.juego {
  --fondo: #101c1c;
  --panel: #172b2b;
  --borde: #9ec0a12b;
  --papel: #f4f3dc;
  --suave: #bdcdbd;
  --agua: #9de2cd;
  --sol: #f0cf83;
  background: radial-gradient(ellipse at 50% 10%, #30473b, #132423 70%, #101b1c);
  min-height: 100svh;
}

.juego .barra {
  min-height: 46px;
  padding: 6px 24px;
  border-color: #92b8981a;
  background: #0e1e20bb;
}
.juego .marca { gap: 8px; font-size: 13px; letter-spacing: .03em; }
.juego .charca-marca { width: 28px; height: 28px; border-radius: 50%; background: #a3e6bd19; color: #c1e8a8; }
.juego .barra nav a { font-size: 12px; text-decoration: none; }

.juego .charca[data-juego] {
  --background: #164f61;
  --foreground: #fff6de;
  --blue: #62b5b0;
  --orange: #cdb589;
  --green: #bce179;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  width: min(calc(100% - 36px), calc((100svh - 205px) * 660 / 356));
  max-width: 1320px;
  padding: 0;
  margin: 12px auto 0;
  gap: 10px;
}

.juego .charca-intro {
  grid-area: 1 / 1;
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) auto;
  gap: 12px 24px;
  align-items: center;
  padding: 0 4px;
}
.juego h1 { font: 800 clamp(21px, 2.2vw, 29px)/1.1 system-ui, sans-serif; letter-spacing: -.05em; margin-top: 3px; }
.juego h1 em { font-style: normal; color: var(--papel); }
.juego .sobrelinea { font-size: 9px; letter-spacing: .13em; color: #a8c692; }
.juego .charca-objetivo { max-width: 370px; font-size: 12px; line-height: 1.45; }
.juego .charca-tiempo { gap: 8px; padding: 0; flex-wrap: nowrap; font-size: 11px; }
.juego .charca-tiempo > span:first-child { max-width: 100px; }
.juego .charca-tiempo > .charca-progreso { display: none; }
.juego .charca-segundos { font-size: 21px; font-weight: 800; letter-spacing: -.05em; color: var(--papel); }
.juego .juego-urgente .charca-segundos { color: #ffda86; text-shadow: 0 0 16px #ffc15a66; }

.juego .charca-tablero {
  grid-area: 2 / 1;
  display: flex;
  flex-direction: column;
  border: 1px solid #b7cf9645;
  border-radius: 20px;
  overflow: hidden;
  background: #183332;
  box-shadow: 0 20px 60px #040d1855, 0 2px 0 #91a47c22, 0 0 0 5px #0b1c202e;
}
.juego .charca-mapa { order: 0; aspect-ratio: 660 / 356; background: #536749; isolation: isolate; }
.juego .charca-mapa::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  box-shadow: inset 0 0 55px #132e2736;
}

.juego .charca-marcador, .juego .charca > .charca-puntuacion {
  grid-area: 2 / 1;
  z-index: 2;
  align-self: start;
  margin: 13px;
  pointer-events: none;
}
.juego .charca-marcador { display: flex; justify-content: space-between; gap: 12px; }
.juego .charca-puntuacion {
  width: clamp(145px, 23vw, 215px);
  border: 1px solid #c5d5a33b;
  border-radius: 12px;
  padding: 9px 12px;
  background: linear-gradient(140deg, #153c39ed, #112a32e6);
  box-shadow: 0 4px 12px #061b3033;
  backdrop-filter: blur(12px);
  gap: 6px;
}
.juego .charca-linea { font-size: 12px; }
.juego .charca-linea strong { font-size: 20px; letter-spacing: -.04em; color: #f9f6d9; }
.juego .charca-excedente { color: #c9ddac; font-size: 10px; line-height: 1.2; }
.juego .charca-progreso { height: 4px; background: #dae8ba23; }
.juego .charca-progreso > div { border-radius: inherit; transition: width .22s ease; box-shadow: 0 0 8px var(--rasgo-color); }

.juego .charca-controles, .juego .canales-instruccion {
  order: 1;
  min-height: 58px;
  padding: 8px 14px;
  gap: 7px;
  background: linear-gradient(0deg, #122729, #203b35);
  border-top: 1px solid #c5d5a31f;
}
.juego .charca-controles span { font-size: 11px; }
.juego .charca-boton {
  min-height: 42px;
  border: 1px solid #d2dda336;
  border-radius: 10px;
  color: var(--papel);
  background: linear-gradient(#345248, #233e39);
  box-shadow: 0 2px 0 #071c2455, inset 0 1px 0 #ffffff0d;
  transition: background .15s, transform .15s, box-shadow .15s;
}
.juego .charca-boton:hover:not(:disabled):not([aria-disabled="true"]) { background: #456451; box-shadow: 0 0 0 2px #c4dea21c, 0 3px 8px #071c2444; }
.juego .charca-boton:active:not(:disabled) { transform: translateY(1px); }
.juego .charca-boton[aria-pressed="true"] { background: #bbcf8e20; border-color: var(--rasgo-color, #bde5b0); color: var(--rasgo-color, #d2f3bf); box-shadow: inset 0 0 0 1px var(--rasgo-color, #ccecb4), 0 0 12px #c8ed9c11; }
.juego .charca-jugar { min-width: 80px; background: linear-gradient(#f8dfa2, #dfbd72); color: #273b2c; border-color: #ffebba; font-size: 12px; }
.juego .charca-boton.charca-jugar:hover:not(:disabled):not([aria-disabled="true"]) { background: #ffe8ae; color: #273b2c; }
.juego .juego-icono { width: 36px; min-width: 36px; min-height: 36px; padding: 0; font-size: 18px; font-weight: 500; }
.juego .charca-puesta { min-height: 36px; padding: 4px 12px; border-radius: 20px; background: #183b37ec; border-color: #d4dfac55; font-size: 11px; }
.juego .charca-puesta:active { transform: translate(-50%, -49%); }
.juego .charca-puesta::before { content: '✦'; margin-right: 6px; color: var(--sol); }

.juego .charca-pie { grid-area: 3 / 1; padding: 0 4px; font-size: 11px; line-height: 1.5; min-height: 18px; }
.juego .charca-pie > p[role="status"] { color: #d9eab4; }
.juego .charca > p.charca-pie { grid-area: auto; opacity: .7; }
.juego .charca-semilla { grid-area: 4 / 1; font-size: 10px; border: 0; padding: 0 4px; color: #a4bd9e; }
.juego .charca-semilla::before { content: '↳ '; }
.juego .charca-siguiente:not([hidden]) { grid-area: auto; justify-self: end; min-height: 36px; font-size: 12px; border-radius: 20px; }
.juego .canales-intro, .juego .refugio-intro { font-size: 11px; padding: 0 4px 8px; }
.juego .charca-meta { top: 21%; border: 1px solid #dae8a25c; color: #f5edb3; background: #183c38ed; border-radius: 20px; padding: 5px 12px; font-weight: 700; z-index: 2; }
.juego .canales .charca-meta { top: 43%; }

.juego .canales-instruccion { align-items: center; font-size: 11px; }
.juego #canales-transito { font-size: 12px; font-weight: 750; color: #dfefbd; }
.juego .canales-compuerta {
  width: 48px;
  height: 48px;
  min-height: 48px;
  border-radius: 50%;
  border: 2px solid #c8d0a4;
  color: #f1e8bb;
  background: radial-gradient(circle at 35% 20%, #4b6b55, #213d37);
  box-shadow: 0 3px 0 #172f29, 0 5px 14px #152e3877, inset 0 1px 0 #f7f4c633;
}
.juego .canales-compuerta::after { content: '+'; display: block; font-size: 16px; line-height: 12px; color: #c9e5b5; }
.juego .canales-compuerta span { font-size: 10px; }
.juego .canales-compuerta[aria-pressed="true"] { background: radial-gradient(circle at 30% 20%, #d4e9b8, #97cbb2); color: #153e38; border-color: #f1f3cf; box-shadow: 0 0 0 5px #ccecc629, 0 4px 14px #19363266; }
.juego .canales-compuerta[aria-pressed="true"]::after { content: '−'; color: #1c5b4e; }
.juego .canales-compuerta:active { transform: translate(-50%, -48%); }
.juego .canales-compuerta[data-seco] { background: #645a40; border-color: #aa9a70; color: #f2d9a2; opacity: .7; }
.juego .canales-compuerta[data-seco]::after { content: '×'; color: #d2b688; }
.juego .canales-rotulo, .juego .refugio-rotulos span { background: #153831b8; border: 0; font-size: 11px; letter-spacing: .02em; color: #e2ebca; backdrop-filter: blur(6px); box-shadow: 0 2px 5px #0e272533; }
.juego .canales-rotulo-oeste { color: #aff1d9; }
.juego .canales-rotulo-este { color: #ffe4a3; }
.juego .refugio-rotulos { bottom: 9%; }

.juego-flotante { position: absolute; z-index: 4; left: 50%; top: 50%; transform: translate(-50%, -50%); }
.juego-empezar {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 22px;
  background: linear-gradient(#fae7b5, #e2c986);
  color: #294335;
  border: 1px solid #fff1cb;
  border-radius: 30px;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 5px 0 #1c3a3566, 0 8px 30px #173f4b66;
}
.juego-empezar:hover { background: #ffefbe; }
.juego-pausa { padding: 16px 22px; border-radius: 18px; background: #153b36ee; color: var(--papel); text-align: center; box-shadow: 0 8px 40px #102b3277; }
.juego-pausa p { font-weight: 800; margin-bottom: 8px; }
.juego-panel {
  width: min(340px, calc(100% - 28px));
  max-height: calc(100% - 20px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding: 23px;
  border: 1px solid #cde0ac66;
  border-radius: 21px;
  background: linear-gradient(140deg, #2c4e40f8, #123630fa);
  box-shadow: 0 20px 60px #09232ecc, 0 0 0 5px #152d2844;
  text-align: center;
}
.juego-panel h2 { margin: 4px 0 8px; font-size: 24px; font-weight: 800; letter-spacing: -.04em; }
.juego-panel p { font-size: 13px; color: #d0dec1; }
.juego-panel .charca-boton, .juego-panel a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; margin-top: 14px; padding: 6px 14px; text-decoration: none; }
.juego-panel a { background: #e6ce91; color: #263d31; border-radius: 12px; font-weight: 800; font-size: 13px; }
.juego-panel .juego-repetir { background: transparent; margin-left: 5px; border-color: #cedfa34d; font-size: 12px; }
.juego-panel-ayuda { z-index: 6; text-align: left; }
.juego-panel-ayuda p + p { margin-top: 9px; font-size: 11px; }
.juego-aviso-nuevo { animation: aviso-juego .3s ease-out; }
@keyframes aviso-juego { from { opacity: .5; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }

@media (max-width: 820px) {
  .juego .charca[data-juego] { width: calc(100% - 24px); }
  .juego .charca-intro { grid-template-columns: 1fr auto; gap: 8px; }
  .juego .charca-objetivo { grid-column: 1 / -1; grid-row: 2; max-width: none; font-size: 12px; }
  .juego .charca-tiempo { grid-column: 2; grid-row: 1; }
  .juego .charca-tiempo > span:first-child { display: none; }
  .juego .charca-marcador, .juego .charca > .charca-puntuacion { margin: 9px; }
  .juego .charca-puntuacion { width: 170px; }
  .juego .charca-controles, .juego .canales-instruccion { padding: 8px 10px; }
}

@media (max-width: 540px) {
  .juego .barra { padding: 6px 12px; }
  .juego .charca[data-juego] { width: calc(100% - 16px); margin-top: 12px; gap: 8px; }
  .juego .charca-marcador, .juego .charca > .charca-puntuacion { grid-area: 2 / 1; position: static; margin: 0; align-self: stretch; }
  .juego .charca-marcador { gap: 8px; }
  .juego .charca-puntuacion { width: auto; flex: 1; padding: 6px 10px; border-radius: 10px; }
  .juego .charca-linea { font-size: 11px; }
  .juego .charca-linea strong { font-size: 18px; }
  .juego .charca-tablero { grid-area: 3 / 1; border-radius: 15px; }
  .juego .charca-pie { grid-area: 4 / 1; }
  .juego .charca-semilla { grid-area: 5 / 1; }
  .juego .charca-boton { min-height: 44px; }
  .juego .juego-icono { width: 44px; min-width: 44px; }
  .juego .charca-controles span { margin-left: auto; width: 100%; text-align: left; font-size: 10px; }
  .juego .charca-puesta { min-height: 44px; font-size: 10px; padding: 4px 8px; top: 79%; }
  .juego .refugio-rotulos { font-size: 10px; bottom: 5%; padding: 0 6%; }
  .juego .canales-compuerta { width: 44px; height: 44px; min-height: 44px; }
  .juego .canales-rotulo { font-size: 9px; padding: 1px 4px; }
  .juego .canales-instruccion { gap: 5px; padding: 8px 10px; }
  .juego .canales-instruccion p { font-size: 10px; }
  .juego .juego-panel { padding: 14px; width: min(320px, calc(100% - 20px)); }
  .juego .juego-panel h2 { font-size: 20px; }
  .juego .juego-panel p { font-size: 11px; }
  .juego .juego-panel .charca-boton, .juego .juego-panel a { margin-top: 8px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .juego *, .juego *::after { animation: none !important; transition: none !important; }
}
