/* Tablero a pantalla completa, columna móvil: barra rival, charca y orilla rival, río, tu orilla y charca, tu barra y la mano */
:root {
  --hierba: #a9cf7c; --hierba-osc: #86b35c; --agua: #8fd3dc; --agua-osc: #5fb4c4; --rio: #6bb8d6;
  --papel: #fff8ec; --tinta: #3a2a1c; --suave: #7a5f45; --borde: #c99a5b; --naranja: #ef8f1f;
  --zen: #1d9e75; --pes: #d85a30; --estres: #e24b4a; --sel: #f2c230;
  --font: "Fredoka", system-ui, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--hierba); color: var(--tinta); font-family: var(--font); -webkit-tap-highlight-color: transparent; overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible { outline: 3px solid var(--sel); outline-offset: 2px; }
#app { height: 100%; max-width: 520px; margin: 0 auto; position: relative; }

/* Inicio */
.inicio { height: 100%; overflow-y: auto; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); text-align: center; }
.inicio h1 { font-size: 40px; font-weight: 600; margin: 8px 0 0; letter-spacing: .5px; }
.lema { margin: 4px 0 18px; color: var(--suave); }
.elige { font-weight: 500; margin: 0 0 10px; }
.mazos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.mazo { background: var(--papel); border: 2px solid var(--borde); border-radius: 16px; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.mazo:active { transform: scale(.97); }
.mazo-arte { width: 84px; height: 84px; display: block; }
.mazo-arte svg { width: 100%; height: 100%; }
.mazo b { font-size: 18px; font-weight: 500; }
.mazo small { font-size: 12px; color: var(--suave); line-height: 1.3; }

/* Menú y pantallas sueltas */
.pantalla { height: 100%; overflow-y: auto; padding: 16px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); }
.pantalla h2 { font-size: 24px; font-weight: 500; margin: 8px 0 10px; text-align: center; }
.pantalla h3 { font-size: 17px; font-weight: 500; margin: 16px 0 6px; }
.menu { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 4px; }
.menu-arte { width: 140px; height: 140px; display: block; }
.menu-arte svg { width: 100%; height: 100%; }
.menu h1 { font-size: 44px; font-weight: 600; margin: 0; }
.menu-opciones { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 280px; margin: 14px 0 10px; }
.menu-opciones button, .volver, .pestanas button, .opciones button { border: 2px solid var(--borde); background: var(--papel); border-radius: 14px; padding: 12px; font-size: 18px; }
.menu-opciones .principal { background: var(--naranja); border-color: #c76f12; color: #fff; font-weight: 500; font-size: 20px; }
.volver { padding: 6px 12px; font-size: 14px; }
.texto { line-height: 1.5; }
.texto p, .texto li { max-width: 60ch; }
.texto ol { padding-left: 20px; margin: 0; display: grid; gap: 6px; }
.texto .n-zen, .texto .n-pes, .texto .n-ag { font-size: 11px; }
.pestanas, .opciones { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pestanas button, .opciones button { font-size: 14px; padding: 6px 12px; }
.pestanas .activa, .opciones .activa { background: var(--naranja); border-color: #c76f12; color: #fff; }
.coleccion .nota { text-align: center; }
.rejilla { display: grid; grid-template-columns: repeat(auto-fill, minmax(82px, 1fr)); gap: 12px 6px; justify-items: center; padding-top: 6px; }
.menu-btn + .quien { width: auto; flex: 1 1 auto; }
.menu-btn { border: 0; background: none; font-size: 18px; padding: 0 6px 0 0; line-height: 1; }

/* Juego */
.juego { height: 100%; display: grid; grid-template-rows: auto 1fr 1fr auto 1fr 1fr auto auto; padding: 4px max(8px, env(safe-area-inset-right, 0px)) 4px max(8px, env(safe-area-inset-left, 0px)); gap: 3px; }
.barra { background: var(--papel); border-radius: 12px; padding: 4px 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12px; }
.contadores { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; flex: 1; min-width: 0; }
.quien { font-weight: 500; width: 100%; }
.turno { font-style: normal; background: var(--sel); border-radius: 6px; padding: 0 5px; font-size: 11px; }
.zen { display: inline-flex; align-items: center; gap: 4px; }
.zen-barra { width: 64px; height: 8px; background: #e8dcc8; border-radius: 4px; overflow: hidden; }
.zen-barra span { display: block; height: 100%; background: var(--zen); transition: width .6s; }
.zen b, .mand b { font-size: 15px; font-weight: 600; }
.mini { color: var(--suave); }
.fase { display: flex; gap: 6px; }
.fase button, .botones button { border: 2px solid var(--borde); background: var(--papel); border-radius: 10px; padding: 6px 10px; font-size: 14px; }
.fase button.principal, .botones .principal { background: var(--naranja); border-color: #c76f12; color: #fff; font-weight: 500; }

.zona { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 14px 6px 4px; border-radius: 14px; min-height: 0; }
.etiqueta { position: absolute; top: 1px; left: 10px; font-size: 10px; color: var(--suave); letter-spacing: .5px; text-transform: uppercase; }
.orilla { background: #d9c48f; box-shadow: inset 0 0 0 2px #cdb57a; }
.charca { background: radial-gradient(ellipse at 30% 30%, #b5e6ec 0 18%, transparent 19%), radial-gradient(ellipse at 75% 70%, #a9dfe6 0 14%, transparent 15%), var(--agua); box-shadow: inset 0 0 0 3px #9aa49b; overflow: hidden; }
.charca .etiqueta { color: #2e6f7c; }
.charca::before, .charca::after { content: ""; position: absolute; width: 40px; height: 40px; border-radius: 50%; background: radial-gradient(circle, #ffffffaa, transparent 70%); bottom: 0; left: 20%; animation: vapor 4s infinite ease-out; pointer-events: none; }
.charca::after { left: 65%; animation-delay: 2s; }
@keyframes vapor { 0% { transform: translateY(10px) scale(.6); opacity: 0; } 30% { opacity: .8; } 100% { transform: translateY(-70px) scale(1.6); opacity: 0; } }
.rio { background: linear-gradient(90deg, var(--rio), #8ccbe3, var(--rio)); background-size: 200% 100%; animation: rio 8s linear infinite; border-radius: 10px; min-height: 30px; display: flex; align-items: center; justify-content: center; padding: 2px 10px; }
@keyframes rio { to { background-position: 200% 0; } }
#aviso { background: #ffffffdd; border-radius: 8px; padding: 2px 10px; font-size: 13px; text-align: center; }

.hueco { border: 2px dashed #00000018; border-radius: 12px; }
.ficha { position: relative; border: 2px solid #00000022; background: #fff8ecee; border-radius: 12px; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; min-height: 0; overflow: hidden; }
.charca .ficha { background: #e9f8fbdd; }
.ficha.sel { border-color: var(--sel); box-shadow: 0 0 0 3px var(--sel); animation: latido 1s infinite; }
.ficha.elegida { border-color: var(--naranja); box-shadow: 0 0 0 3px var(--naranja); }
@keyframes latido { 50% { box-shadow: 0 0 0 5px #f2c23088; } }
.retrato { position: absolute; inset: 2px 2px 26px; }
.retrato svg { width: 100%; height: 100%; }
.charca .retrato { clip-path: inset(0 0 22% 0); }
.estados { position: absolute; top: 2px; right: 3px; font-size: 13px; }
.amigos { position: absolute; top: 2px; left: 3px; font-size: 15px; line-height: 1; }
.nums { position: absolute; bottom: 22px; left: 2px; right: 2px; display: flex; justify-content: space-between; }
.n-zen, .n-pes, .n-ag { display: inline-grid; place-items: center; min-width: 20px; height: 20px; border-radius: 10px; color: #fff; font-size: 12px; font-weight: 600; padding: 0 4px; }
.n-zen { background: var(--zen); } .n-pes { background: var(--pes); } .n-ag { background: #8a6a4a; }
.aguante { position: relative; display: flex; gap: 2px; margin-bottom: 11px; }
.aguante i { width: 9px; height: 6px; border-radius: 3px; background: #8a6a4a55; }
.aguante i.lleno { background: var(--estres); }
.ficha .nombre { position: absolute; bottom: 1px; left: 2px; right: 2px; font-size: 9px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--suave); }
.tiembla { animation: tiembla .5s; }
@keyframes tiembla { 20%, 60% { transform: translateX(-5px) rotate(-3deg); } 40%, 80% { transform: translateX(5px) rotate(3deg); } }

/* Cartas */
.mano { display: flex; gap: 6px; overflow-x: auto; padding: 4px 2px 6px; min-height: 120px; scrollbar-width: none; }
.en-mano { border: 0; background: none; padding: 0; flex: 0 0 auto; transition: transform .15s; }
.en-mano.elegida { transform: translateY(-8px); }
.en-mano.cara .carta { filter: saturate(.4) brightness(.92); }
.vacia { color: var(--suave); font-size: 13px; align-self: center; }
.carta { position: relative; display: flex; flex-direction: column; align-items: center; width: 78px; height: 110px; background: var(--papel); border: 2px solid var(--borde); border-radius: 10px; padding: 4px 3px; }
.carta.t-amigo { background: #eef6e4; border-color: #8db86b; }
.carta.t-suceso { background: #f6ecf6; border-color: #b98ac0; }
.coste { position: absolute; top: -6px; left: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--naranja); color: #fff; font-weight: 600; font-size: 13px; display: grid; place-items: center; border: 2px solid #fff; }
.c-arte { width: 58px; height: 52px; display: grid; place-items: center; }
.c-arte svg { width: 100%; height: 100%; }
.emoji { font-size: 34px; line-height: 1; }
.c-nombre { font-size: 10.5px; line-height: 1.15; text-align: center; height: 25px; overflow: hidden; }
.c-nums { display: flex; gap: 2px; margin-top: auto; }
.c-nums span { min-width: 18px; height: 18px; font-size: 11px; }
.c-tipo { margin-top: auto; font-size: 10px; color: var(--suave); }
.carta.grande { width: 120px; height: 168px; flex: 0 0 auto; }
.carta.grande .c-arte { width: 96px; height: 90px; }
.carta.grande .emoji { font-size: 60px; }
.carta.grande .c-nombre { font-size: 13px; height: 32px; }

/* Hoja inferior (detalle, decisiones) */
.hoja { position: absolute; inset: 0; background: #2a1c1055; display: flex; align-items: flex-end; z-index: 20; }
.hoja-caja { background: var(--papel); width: 100%; border-radius: 20px 20px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px)); max-height: 85%; overflow-y: auto; animation: sube .25s ease-out; }
@keyframes sube { from { transform: translateY(40%); opacity: 0; } }
.hoja h2 { margin: 0 0 6px; font-size: 20px; font-weight: 500; }
.hoja p { margin: 6px 0; line-height: 1.4; }
.detalle { display: flex; gap: 14px; align-items: flex-start; }
.detalle > div { min-width: 0; }
.tipo, .nota { color: var(--suave); font-size: 13px; }
.stats { list-style: none; padding: 0; margin: 6px 0; display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 14px; }
.botones { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.fila-cartas { display: flex; gap: 8px; overflow-x: auto; padding: 8px 2px; }

/* Efectos */
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 30; }
.flota { position: fixed; transform: translate(-50%, -50%); background: #fff; border-radius: 10px; padding: 2px 8px; font-weight: 600; font-size: 14px; white-space: nowrap; box-shadow: 0 2px 6px #0002; animation: flota 1.3s ease-out forwards; }
.f-zen { color: var(--zen); } .f-estres { color: var(--estres); } .f-mand { color: #c76f12; }
@keyframes flota { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); } 100% { opacity: 0; transform: translate(-50%, -160%); } }
.gota { position: fixed; width: 8px; height: 8px; border-radius: 50%; background: #5fb4e6; animation: gota .6s ease-out forwards; }
@keyframes gota { to { transform: translate(var(--dx), var(--dy)); opacity: 0; } }
.suceso-volando { position: fixed; left: 50%; top: 42%; transform: translate(-50%, -50%); animation: suceso 1.4s ease-in-out forwards; }
@keyframes suceso { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.3) rotate(-10deg); } 20%, 75% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); } 100% { opacity: 0; transform: translate(-50%, -80%) scale(.8); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; } }

/* Efectos nuevos */
.sprite { position: fixed; transform: translate(-50%, -50%); pointer-events: none; }
.sprite svg { width: 100%; height: 100%; display: block; }
.cae { width: 44px; height: 44px; animation: cae .6s cubic-bezier(.3, 1.6, .5, 1) forwards; }
@keyframes cae { 0% { transform: translate(-50%, -260%) scale(.6); opacity: 0; } 60% { opacity: 1; } 85% { transform: translate(-50%, -50%) scale(1.15); } 100% { transform: translate(-50%, -50%) scale(.4); opacity: 0; } }
.mandarina { font-size: 18px; animation: mandarina .8s ease-in forwards; }
@keyframes mandarina { 0% { transform: translate(-50%, calc(-50% - var(--alto))) rotate(0); opacity: 0; } 20% { opacity: 1; } 75% { transform: translate(-50%, -50%) rotate(200deg); } 88% { transform: translate(-50%, calc(-50% - 8px)); } 100% { transform: translate(-50%, -50%); opacity: 0; } }
.cartel { position: fixed; left: 50%; top: 46%; transform: translate(-50%, -50%); padding: 10px 26px; border-radius: 16px; font-size: 26px; font-weight: 600; color: #fff; white-space: nowrap; animation: cartel 1.1s ease-in-out forwards; box-shadow: 0 6px 18px #0003; }
.cartel.mio { background: var(--zen); } .cartel.suyo { background: var(--pes); }
@keyframes cartel { 0% { transform: translate(-160%, -50%) skewX(-12deg); opacity: 0; } 25%, 70% { transform: translate(-50%, -50%) skewX(0); opacity: 1; } 100% { transform: translate(60%, -50%) skewX(12deg); opacity: 0; } }
.confeti { width: 8px; height: 12px; background: var(--c); border-radius: 2px; animation: confeti var(--t) ease-in forwards; }
@keyframes confeti { to { transform: translate(var(--x), 105vh) rotate(var(--r)); } }
.mini { display: inline-block; width: 20px; height: 20px; }
.mini svg { width: 100%; height: 100%; }
.amigos { display: flex; gap: 1px; }

/* Fondos por mazo */
.c-arte { border-radius: 8px; }
.carta.m-remojo .c-arte, .ficha.m-remojo .retrato { background: radial-gradient(circle at 50% 80%, #cfeef3, transparent 70%); }
.carta.m-pesadas .c-arte, .ficha.m-pesadas .retrato { background: radial-gradient(circle at 50% 80%, #f3d9c4, transparent 70%); }
.carta.m-zoo .c-arte, .ficha.m-zoo .retrato { background: radial-gradient(circle at 50% 80%, #d6ecc4, transparent 70%); }
.carta.m-huerto .c-arte, .ficha.m-huerto .retrato { background: radial-gradient(circle at 50% 80%, #fbe1bf, transparent 70%); }
.carta.m-remojo { border-color: #6fb6c4; } .carta.m-pesadas { border-color: #d0835a; } .carta.m-zoo { border-color: #7fae4a; } .carta.m-huerto { border-color: #e8962e; }

/* Arrastrar */
.en-mano { touch-action: pan-x; }
#orilla0 .ficha, #charca0 .ficha { touch-action: none; }
.fantasma { position: fixed; z-index: 40; pointer-events: none; opacity: .92; transform: rotate(-4deg) scale(1.08); box-shadow: 0 10px 24px #0004; border-radius: 12px; }
.levantada { opacity: .35; }
.zona.destino { box-shadow: inset 0 0 0 3px var(--sel); }
.ficha.destino { border-color: var(--sel); box-shadow: 0 0 0 3px var(--sel); animation: latido 1s infinite; }

/* Ayudas */
.en-mano.jugable .carta { box-shadow: 0 0 0 2px var(--sel), 0 0 12px #f2c23099; }
.ficha.puede::after { content: "💧"; position: absolute; top: 2px; left: 50%; transform: translateX(-50%); font-size: 12px; animation: gotita 1.6s ease-in-out infinite; }
@keyframes gotita { 50% { transform: translate(-50%, 3px); } }
.fase .avisa { border-color: var(--sel); animation: latido 1.2s infinite; }
.registro { max-height: 55vh; overflow-y: auto; font-size: 14px; }
.registro p { margin: 2px 0; }
.registro .r-turno { font-weight: 600; margin-top: 10px; color: var(--suave); border-top: 1px solid #00000014; padding-top: 6px; }
button.marcada { background: var(--naranja); border-color: #c76f12; color: #fff; }
.en-mano.marcada .carta { outline: 3px solid var(--naranja); outline-offset: 2px; filter: grayscale(.4); }
.coach { position: absolute; left: 10px; right: 10px; top: 46px; z-index: 15; background: #fffdf6; border: 2px solid var(--naranja); border-radius: 14px; padding: 10px 12px; box-shadow: 0 6px 18px #0003; display: flex; gap: 10px; align-items: flex-end; font-size: 14px; line-height: 1.35; animation: sube .25s ease-out; }
.coach p { margin: 0; flex: 1; min-width: 0; }
.coach button { border: 2px solid #c76f12; background: var(--naranja); color: #fff; border-radius: 10px; padding: 6px 12px; font-weight: 500; flex: 0 0 auto; }
