/* Panal: estilos (2D, DOM + SVG). Tema claro y oscuro con variables. */
:root, :root[data-theme="light"] {
  --bg: #fff6df; --bg2: #ffe9b8; --panel: #ffffff; --panel2: #fffaf0; --text: #2b2118; --muted: #7a6a58; --line: rgba(90,62,20,.14); --line2: rgba(90,62,20,.28);
  --hex: #efe6d2; --hex-hover: #e6dac0; --hex-text: #2b2118; --center: #ffc533; --center-text: #3a2600; --accent: #f5a300; --accent-dark: #c27c00;
  --good: #2e9e62; --bad: #d9473b; --shadow: 0 10px 28px rgba(110,70,0,.14); --pattern: rgba(245,163,0,.10);
  --accent-text: #3a2600;
  --font: 'Fredoka', 'Baloo 2', ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px); --safe-l: env(safe-area-inset-left, 0px); --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #16131f; --bg2: #221a33; --panel: #231e30; --panel2: #2b2540; --text: #f7f1ff; --muted: #b0a5c6; --line: rgba(255,255,255,.12); --line2: rgba(255,255,255,.24);
  --hex: #332c46; --hex-hover: #3d3554; --hex-text: #f7f1ff; --center: #ffc533; --center-text: #3a2600; --accent: #ffbf2e; --accent-dark: #ffd36b;
  --good: #57d68f; --bad: #ff7a6e; --shadow: 0 10px 28px rgba(0,0,0,.4); --pattern: rgba(255,197,51,.06);
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); overscroll-behavior: none; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; overflow: hidden; }
#app { position: fixed; inset: 0; overflow: hidden; background: radial-gradient(120% 70% at 50% 0%, var(--bg2), var(--bg) 70%); touch-action: manipulation; transition: background .4s; }
#app::before { content: ''; position: absolute; inset: 0; pointer-events: none; opacity: 1;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='97' viewBox='0 0 56 97'%3E%3Cpath d='M28 0l28 16v32L28 64 0 48V16zM28 64v33M0 16L-28 0M56 16l28-16' fill='none' stroke='%23f5a300' stroke-opacity='.13' stroke-width='1.5'/%3E%3C/svg%3E"); background-size: 56px 97px; mask-image: linear-gradient(180deg, #000, transparent 55%); -webkit-mask-image: linear-gradient(180deg, #000, transparent 55%); }
.hidden { display: none !important; }
button { font-family: inherit; color: inherit; border: 0; background: none; cursor: pointer; touch-action: manipulation; }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
a { color: var(--accent-dark); }
.howto-src { display: none; }

/* ---------- botones ---------- */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: .55em; min-height: 52px; padding: .45em 1.3em; border-radius: 18px; font-size: 1.1rem; font-weight: 700; color: var(--accent-text); text-decoration: none;
  background: linear-gradient(180deg, #ffe58a, var(--center) 55%, #f2a922); box-shadow: 0 5px 0 #c07d10, 0 10px 22px rgba(120,70,0,.22), inset 0 2px 0 rgba(255,255,255,.6); transition: transform .08s, box-shadow .08s, filter .15s; }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 #c07d10, inset 0 2px 0 rgba(255,255,255,.6); }
.btn svg { width: 1.3em; height: 1.3em; flex: none; }
.btn span { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.1; text-align: left; }
.btn small { font-size: .66em; font-weight: 600; opacity: .8; margin-top: .2em; }
.btn.mint { color: #06301a; background: linear-gradient(180deg, #b9ffd2, #4fd384 55%, #23a85a); box-shadow: 0 5px 0 #157a3f, 0 10px 22px rgba(0,60,20,.2), inset 0 2px 0 rgba(255,255,255,.6); }
.btn.mint:active { box-shadow: 0 1px 0 #157a3f; }
.btn.ghost { color: var(--text); background: var(--panel); box-shadow: inset 0 0 0 2px var(--line2), 0 4px 12px rgba(0,0,0,.06); }
.btn.ghost:active { transform: translateY(2px); }
.btn.big { min-height: 64px; font-size: 1.35rem; padding: .4em 1.4em; border-radius: 22px; }
.btn.small { min-height: 40px; font-size: .92rem; padding: .3em .9em; border-radius: 13px; }
.btn[disabled] { filter: grayscale(.7) brightness(.9); pointer-events: none; }
.icon-btn { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; color: var(--text); background: var(--panel); box-shadow: inset 0 0 0 2px var(--line), 0 3px 10px rgba(0,0,0,.06); flex: none; }
.icon-btn svg { width: 24px; height: 24px; }
.icon-btn:active { transform: scale(.93); }
.row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.col { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }

/* ---------- pantallas ---------- */
#screens { position: absolute; inset: 0; z-index: 10; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; animation: in .25s ease-out both; padding: calc(10px + var(--safe-t)) calc(12px + var(--safe-r)) calc(12px + var(--safe-b)) calc(12px + var(--safe-l)); }
.screen.out { animation: out .2s ease-in both; pointer-events: none; }
@keyframes in { from { opacity: 0; transform: translateY(8px) scale(.99); } }
@keyframes out { to { opacity: 0; transform: scale(.985); } }
.overlay { justify-content: center; background: rgba(30,18,0,.38); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: 20; }
:root[data-theme="dark"] .overlay { background: rgba(5,3,12,.6); }
.card { width: min(440px, 100%); max-height: 100%; overflow: auto; padding: 22px 20px; border-radius: 26px; background: var(--panel); box-shadow: inset 0 0 0 2px var(--line), var(--shadow); text-align: center; display: flex; flex-direction: column; gap: 14px; animation: pop .28s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes pop { from { transform: scale(.92); opacity: 0; } }
.card h2 { margin: 0; font-size: 1.7rem; line-height: 1.1; }
.card .sub { margin: 0; color: var(--muted); font-size: 1rem; line-height: 1.35; }
.card .note { margin: 0; color: var(--muted); font-size: .85rem; line-height: 1.35; }
.card.scroll { max-height: min(88vh, 760px); }

/* portada */
.title-screen { justify-content: space-between; }
.title-top { width: 100%; display: flex; align-items: center; gap: 10px; }
.title-top .sp { flex: 1; }
.portal-link { display: flex; align-items: center; gap: 6px; padding: 6px 12px 6px 6px; border-radius: 99px; background: var(--panel); box-shadow: inset 0 0 0 2px var(--line); color: var(--text); text-decoration: none; font-weight: 600; font-size: .9rem; }
.portal-link svg { width: 28px; height: 28px; }
.logo { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.logo .logo-hive { filter: drop-shadow(0 8px 14px rgba(180,110,0,.25)); animation: float 4s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px) rotate(3deg); } }
.logo-hive .lc { fill: var(--center); stroke: #e09b00; stroke-width: 1.2; }
.logo-hive .lo { fill: var(--hex); stroke: var(--line2); stroke-width: 1; }
.logo .h1 { font-size: clamp(3.6rem, 17vw, 5.6rem); font-weight: 700; line-height: .95; color: var(--center); -webkit-text-stroke: 3px #8a5600; paint-order: stroke fill; text-shadow: 0 6px 0 #8a5600, 0 12px 22px rgba(120,70,0,.25); letter-spacing: .01em; margin-top: 4px; }
.logo .sub { font-size: 1.25rem; font-weight: 700; color: var(--accent-dark); margin-top: 8px; }
.logo p { margin: 10px auto 0; max-width: 340px; color: var(--muted); font-weight: 500; font-size: 1.02rem; line-height: 1.3; }
.title-bottom { display: flex; flex-direction: column; gap: 14px; align-items: stretch; width: min(380px, 100%); margin-bottom: 1vh; }
.title-bottom .btn.big { justify-content: flex-start; }
.title-bottom .row.two { flex-wrap: nowrap; } .title-bottom .row.two .btn { flex: 1; padding: .4em .7em; font-size: 1rem; }
.title-bottom .row.two .btn span { align-items: center; text-align: center; }
.loading-screen { justify-content: center; gap: 18px; color: var(--muted); font-weight: 600; text-align: center; }
.spin-hive .logo-hive { animation: spin 1.4s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- pantalla de juego ---------- */
.game-screen { padding-top: calc(8px + var(--safe-t)); padding-bottom: calc(10px + var(--safe-b)); }
.gbar { width: 100%; max-width: 1100px; display: flex; align-items: center; gap: 8px; flex: none; }
.gtitle { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.gtitle b { font-size: 1.15rem; } .gtitle small { color: var(--muted); font-weight: 500; font-size: .85rem; }
.gtitle b, .gtitle small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.gmain { flex: 1; min-height: 0; width: 100%; max-width: 560px; display: grid; gap: 8px; margin-top: 8px;
  grid-template-columns: 100%; grid-template-rows: auto auto auto minmax(0, 1fr) auto auto; grid-template-areas: "rank" "found" "entry" "hive" "ctrls" "ctrls2"; }
.side, .play { display: contents; }
.rank { grid-area: rank; } .found { grid-area: found; } .entry-wrap { grid-area: entry; } .hive-wrap { grid-area: hive; } .ctrls { grid-area: ctrls; } .ctrls2 { grid-area: ctrls2; }

/* rango */
.rank { padding: 0 6px; }
.rk-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.rk { font-size: 1.15rem; } .rk-next { color: var(--muted); font-size: .85rem; font-weight: 500; text-align: right; }
.track { position: relative; height: 30px; margin: 0 14px; }
.track::before { content: ''; position: absolute; left: 0; right: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; background: var(--line2); }
.track .fill { position: absolute; left: 0; top: 50%; height: 4px; margin-top: -2px; border-radius: 2px; background: var(--accent); transition: width .5s cubic-bezier(.3,1.3,.5,1); }
.track i { position: absolute; top: 50%; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; background: var(--panel); box-shadow: inset 0 0 0 2px var(--line2); transition: .3s; }
.track i.on { background: var(--accent); box-shadow: none; }
.track .sc { position: absolute; top: 50%; transform: translate(-50%, -50%); min-width: 30px; height: 30px; padding: 0 6px; border-radius: 15px; display: grid; place-items: center; font-weight: 700; font-size: .92rem; background: var(--center); color: var(--center-text); box-shadow: 0 2px 6px rgba(150,90,0,.3); transition: left .5s cubic-bezier(.3,1.3,.5,1); }
.rank.bump .rk, .rank.bump .sc { animation: bump .5s; }
@keyframes bump { 40% { transform: translate(-50%, -50%) scale(1.25); } }
.rank.bump .rk { animation: bumpk .5s; } @keyframes bumpk { 40% { transform: scale(1.15); color: var(--accent-dark); } }

/* palabras encontradas */
.found { position: relative; z-index: 4; }
.found-head { width: 100%; min-height: 46px; display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 16px; border-radius: 16px; background: var(--panel); box-shadow: inset 0 0 0 2px var(--line); font-weight: 600; font-size: .98rem; text-align: left; }
.found-head > svg { width: 22px; height: 22px; flex: none; color: var(--muted); transition: transform .25s; }
.found.open .found-head > svg { transform: rotate(180deg); }
.fh-t { flex: none; }
.chips { flex: 1; min-width: 0; display: flex; gap: 6px; overflow: hidden; white-space: nowrap; color: var(--muted); font-weight: 500; mask-image: linear-gradient(90deg, #000 75%, transparent); -webkit-mask-image: linear-gradient(90deg, #000 75%, transparent); }
.chips span.tuti { color: var(--accent-dark); font-weight: 700; }
.found-head.bump { animation: hb .35s; } @keyframes hb { 40% { transform: scale(1.04); box-shadow: inset 0 0 0 2px var(--accent); } }
.found-list { display: none; }
.found.open .found-list { display: block; position: absolute; left: 0; right: 0; top: calc(100% + 6px); max-height: min(62vh, 520px); overflow: auto; padding: 12px 16px; border-radius: 18px; background: var(--panel); box-shadow: inset 0 0 0 2px var(--line), var(--shadow); animation: in .2s both; }
.found-list ul { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 18px; }
.found-list li { padding: 5px 0; border-bottom: 1px solid var(--line); break-inside: avoid; font-weight: 500; text-transform: capitalize; }
.found-list li.tuti { font-weight: 700; color: var(--accent-dark); }
.found-list li.new { animation: newin .8s; } @keyframes newin { from { background: rgba(255,197,51,.45); } }
.found-list .empty { margin: 4px 0; color: var(--muted); }
.found-list .rev-t { margin: 14px 0 4px; font-weight: 700; color: var(--muted); font-size: .9rem; }
.rev { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.rev li { padding: 4px 10px; border-radius: 10px; background: var(--hex); font-weight: 700; letter-spacing: .12em; border: 0 !important; }
.rev.big { justify-content: center; } .rev.big li { font-size: 1.25rem; padding: 6px 14px; }

/* palabra que se escribe */
.entry-wrap { position: relative; display: flex; justify-content: center; align-items: center; min-height: 52px; }
.entry { display: flex; align-items: center; justify-content: center; min-height: 48px; max-width: 100%; font-size: clamp(1.7rem, 7vw, 2.3rem); font-weight: 700; letter-spacing: .06em; }
.entry .letters { display: flex; flex-wrap: nowrap; overflow: hidden; }
.entry .letters span { animation: lt .12s ease-out; } @keyframes lt { from { transform: translateY(6px) scale(.7); opacity: 0; } }
.entry .letters span.c { color: var(--accent); }
:root[data-theme="light"] .entry .letters span.c { color: #e19400; }
.entry .letters span.x { color: var(--muted); opacity: .55; }
.caret { width: 3px; height: 1.15em; margin-left: 3px; border-radius: 2px; background: var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.entry.shake { animation: shake .38s; } @keyframes shake { 15%, 55% { transform: translateX(-9px); } 35%, 75% { transform: translateX(9px); } }
.msg { position: absolute; left: 50%; top: -6px; transform: translate(-50%, -60%) scale(.8); padding: 6px 14px; border-radius: 12px; font-weight: 700; font-size: .95rem; background: var(--text); color: var(--bg); opacity: 0; pointer-events: none; white-space: nowrap; transition: opacity .2s, transform .2s; z-index: 3; }
.msg.show { opacity: 1; transform: translate(-50%, -60%) scale(1); }
.msg.good { background: var(--good); color: #fff; }
.msg.bad { background: var(--text); color: var(--bg); }

/* panal */
.hive-wrap { position: relative; width: 100%; min-height: 150px; }
.hive { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; touch-action: manipulation; }
.cell { cursor: pointer; }
.cell .in { transform-box: fill-box; transform-origin: center; transition: transform .14s cubic-bezier(.3,1.6,.5,1); }
.cell polygon { fill: var(--hex); stroke: none; transition: fill .15s; }
.cell.center polygon { fill: var(--center); }
.cell text { font-size: .9px; font-weight: 700; fill: var(--hex-text); pointer-events: none; font-family: var(--font); }
.cell.center text { fill: var(--center-text); }
@media (hover: hover) { .cell:hover polygon { fill: var(--hex-hover); } .cell.center:hover polygon { fill: #ffd25e; } }
.cell.hit .in { transform: scale(.86); transition-duration: .06s; }
.cell.hit polygon { fill: var(--hex-hover); } .cell.center.hit polygon { fill: #ffb400; }
.cell.mix .in { animation: mix .42s ease-in-out; } @keyframes mix { 40% { transform: scale(.55) rotate(-25deg); opacity: .2; } }

/* botones del juego */
.ctrls, .ctrls2 { display: flex; justify-content: center; align-items: center; gap: 12px; }
.pbtn { min-height: 52px; min-width: 100px; padding: 0 18px; border-radius: 99px; background: var(--panel); box-shadow: inset 0 0 0 2px var(--line2), 0 3px 8px rgba(0,0,0,.05); font-weight: 600; font-size: 1.05rem; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: transform .08s; position: relative; }
.pbtn.round { min-width: 52px; width: 52px; padding: 0; }
.pbtn svg { width: 24px; height: 24px; }
.pbtn.down, .pbtn:active { transform: scale(.94); background: var(--hex); }
.pbtn.small { min-height: 42px; min-width: 0; font-size: .95rem; padding: 0 14px; }
.pbtn.small svg { width: 20px; height: 20px; }
.pbtn .badge { font-style: normal; font-size: .72rem; font-weight: 700; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; display: grid; place-items: center; background: var(--center); color: var(--center-text); }
.pbtn .badge:empty { display: none; }
.pbtn .badge.ad { background: #4fd384; color: #06301a; }
.pbtn.off { opacity: .5; }

/* efectos */
#confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; }
#fx { position: absolute; inset: 0; pointer-events: none; z-index: 35; }
.fly { position: absolute; z-index: 36; padding: 4px 12px; border-radius: 12px; background: var(--center); color: var(--center-text); font-weight: 700; font-size: 1.4rem; letter-spacing: .05em; pointer-events: none; white-space: nowrap; box-shadow: 0 6px 16px rgba(150,90,0,.3); }
.fly.tuti { background: linear-gradient(90deg, #ffb000, #ff6fa8, #4fb3ff); color: #fff; }
.pop { position: absolute; font-weight: 700; font-size: 1.3rem; color: var(--good); animation: popup 1s ease-out forwards; white-space: nowrap; }
.pop.gold { color: var(--accent-dark); font-size: 1.6rem; }
@keyframes popup { from { transform: translateY(0) scale(.7); opacity: 0; } 20% { transform: translateY(-10px) scale(1.1); opacity: 1; } to { transform: translateY(-46px); opacity: 0; } }
.banner { position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; text-align: center; animation: banner 2s ease-out forwards; }
.banner b { font-size: clamp(2.8rem, 13vw, 4.6rem); line-height: 1; color: var(--center); -webkit-text-stroke: 3px #8a5600; paint-order: stroke fill; text-shadow: 0 5px 0 #8a5600, 0 10px 30px rgba(0,0,0,.25); }
.banner small { margin-top: 8px; padding: 4px 12px; border-radius: 99px; background: var(--panel); color: var(--text); font-weight: 600; font-size: 1rem; box-shadow: var(--shadow); }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.4); } 12% { opacity: 1; transform: translate(-50%, -50%) scale(1.12); } 22% { transform: translate(-50%, -50%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -60%) scale(1); } }
#toasts { position: absolute; left: 0; right: 0; bottom: calc(130px + var(--safe-b)); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; z-index: 30; }
.toast { padding: 9px 16px; border-radius: 14px; background: var(--text); color: var(--bg); font-weight: 600; animation: in .25s both; max-width: 90vw; text-align: center; box-shadow: var(--shadow); }
.toast.gold { background: var(--center); color: var(--center-text); }
.toast.out { animation: out .3s both; }

/* paneles */
.over-score { display: flex; flex-direction: column; align-items: center; }
.over-score b { font-size: 3rem; line-height: 1; color: var(--accent-dark); }
.over-score span { color: var(--muted); font-weight: 600; }
.done-hive .logo-hive { animation: float 2.5s ease-in-out infinite; }
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stat { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 4px; border-radius: 14px; background: var(--panel2); box-shadow: inset 0 0 0 1.5px var(--line); }
.stat b { font-size: 1.6rem; line-height: 1; } .stat span { font-size: .75rem; color: var(--muted); font-weight: 600; line-height: 1.15; }
.tbl-wrap { overflow-x: auto; }
.htable { border-collapse: collapse; margin: 0 auto; font-variant-numeric: tabular-nums; }
.htable th, .htable td { padding: 4px 7px; text-align: center; font-size: .95rem; }
.htable thead th { color: var(--muted); font-size: .85rem; }
.htable tbody th { text-transform: uppercase; color: var(--accent-dark); }
.htable td i { color: var(--muted); font-style: normal; opacity: .5; }
.htable .tot, .htable tr.tot td, .htable tr.tot th { font-weight: 700; color: var(--muted); }
.htable tr.tot { border-top: 2px solid var(--line2); }
.twos { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.twos span { padding: 3px 9px; border-radius: 9px; background: var(--panel2); box-shadow: inset 0 0 0 1.5px var(--line); font-weight: 600; font-size: .92rem; }
.ylist { list-style: none; margin: 0; padding: 0; columns: 2; column-gap: 16px; text-align: left; }
.ylist li { padding: 3px 0; break-inside: avoid; color: var(--muted); text-transform: capitalize; }
.ylist li.got { color: var(--good); font-weight: 600; }
.ylist li.tuti { font-weight: 700; }
.credits { margin: 0; text-align: left; line-height: 1.45; color: var(--muted); font-size: .95rem; }
.settings { display: flex; flex-direction: column; gap: 8px; text-align: left; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 12px; border-radius: 14px; background: var(--panel2); box-shadow: inset 0 0 0 1.5px var(--line); font-weight: 600; }
.setting select { font-family: inherit; font-size: 1rem; font-weight: 600; padding: 7px 10px; border-radius: 10px; border: 0; background: var(--panel); color: var(--text); box-shadow: inset 0 0 0 2px var(--line2); max-width: 58%; }
.tog { display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 99px; background: var(--hex); font-weight: 700; min-width: 74px; }
.tog i { width: 26px; height: 26px; border-radius: 50%; background: #a99b85; transition: .2s; }
.tog.on i { background: #4fd384; transform: translateX(2px); }
.settings .links { margin-top: 6px; }
.howto-body { text-align: left; }
.howto-body h2 { font-size: 1.15rem; margin: 1em 0 .3em; color: var(--accent-dark); }
.howto-body ul { padding-left: 1.2em; margin: .3em 0; }
.howto-body li { margin: .3em 0; line-height: 1.38; }
.howto-body p { line-height: 1.42; margin: .4em 0; }

/* anuncio simulado */
.dev-ad { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(0,0,0,.75); }
.dev-ad-box { width: min(340px, 90%); padding: 20px; border-radius: 20px; background: #111; color: #fff; text-align: center; display: flex; flex-direction: column; gap: 12px; align-items: center; }
.dev-ad-tag { font-size: .8rem; color: #aaa; }
.dev-ad-art { width: 100%; aspect-ratio: 16/9; border-radius: 12px; display: grid; place-items: center; background: repeating-linear-gradient(45deg, #333 0 12px, #2a2a2a 12px 24px); font-size: 2rem; font-weight: 700; }
.dev-ad .btn.ghost { background: #222; color: #fff; }

#loader { position: absolute; inset: 0; display: grid; place-items: center; z-index: 60; background: var(--bg); transition: opacity .4s; }
#loader.out { opacity: 0; pointer-events: none; }
.loader-hive { width: 58px; height: 58px; border-radius: 50%; border: 8px solid rgba(245,163,0,.25); border-top-color: var(--accent); animation: spin .9s linear infinite; }
.noscript { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; text-align: center; }

/* ---------- horizontal y escritorio: panal a la izquierda, lista a la derecha ---------- */
@media (orientation: landscape) and (min-width: 620px) {
  .gmain { max-width: 1100px; column-gap: 28px; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; grid-template-areas: "entry rank" "hive found" "ctrls ctrls2"; }
  .found { display: flex; flex-direction: column; min-height: 0; border-radius: 18px; background: var(--panel); box-shadow: inset 0 0 0 2px var(--line); }
  .found-head { pointer-events: none; background: none; box-shadow: none; border-bottom: 2px solid var(--line); border-radius: 18px 18px 0 0; }
  .found-head > svg, .chips { display: none; }
  .found-list, .found.open .found-list { display: block; position: static; flex: 1; min-height: 0; max-height: none; overflow: auto; padding: 8px 16px 12px; box-shadow: none; background: none; animation: none; }
  .found-list ul { columns: 3; }
  .ctrls2 { justify-content: flex-start; }
  .rank { align-self: center; }
  .title-screen { display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto 1fr; align-items: center; justify-items: center; column-gap: 24px; }
  .title-top { grid-column: 1 / -1; }
  .title-bottom { margin-bottom: 0; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .gbar .icon-btn { width: 40px; height: 40px; } .gbar { gap: 6px; }
  .gtitle small { display: none; }
  .gmain { margin-top: 4px; gap: 4px; column-gap: 20px; }
  .found-list ul { columns: 2; }
  .entry { font-size: 1.6rem; min-height: 40px; } .entry-wrap { min-height: 42px; }
  .pbtn { min-height: 46px; } .pbtn.round { width: 46px; min-width: 46px; } .pbtn.small { min-height: 40px; }
  .track { height: 26px; }
  .logo .logo-hive { width: 72px; height: 72px; } .logo .h1 { font-size: 3.6rem; } .logo p { font-size: .92rem; margin-top: 6px; }
  .btn.big { min-height: 54px; font-size: 1.15rem; }
  .title-bottom { gap: 10px; }
  #toasts { bottom: calc(70px + var(--safe-b)); }
  .card { padding: 16px; gap: 10px; max-height: calc(100vh - 20px); }
  .stats-grid { grid-template-columns: repeat(8, 1fr); }
}
@media (max-height: 700px) and (orientation: portrait) {
  .logo .logo-hive { width: 84px; height: 84px; } .logo .h1 { font-size: 3.8rem; }
  .gmain { gap: 6px; }
  .pbtn { min-height: 48px; } .pbtn.round { width: 48px; min-width: 48px; } .pbtn.small { min-height: 38px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
@media (orientation: landscape) and (max-height: 520px) {
  .done-hive { display: none; } .over-score b { font-size: 2.2rem; }
  .card h2 { font-size: 1.4rem; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .settings-p .card { width: min(680px, 100%); }
  .settings { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; } .setting { padding: 5px 10px; } .settings .links { grid-column: 1 / -1; margin-top: 0; }
}

/* fichas.py: ficha del juego bajo la pantalla de juego (visible al desplazarse; al jugar la página vuelve arriba y no se mueve) */
html, body { height: auto !important; min-height: 100%; overflow-x: hidden !important; overflow-y: auto !important; }
html:has(body.playing), body.playing { overflow: hidden !important; }
body:not(.playing) { touch-action: pan-y; }
body:not(.playing) #wrap, body:not(.playing) #app, body:not(.playing) #app canvas, body:not(.playing) #app .screen { touch-action: pan-y !important; }   /* fuera de la partida se puede bajar a la ficha deslizando sobre el juego */
#wrap, #app { position: relative !important; inset: auto !important; width: 100% !important; height: 100vh !important; height: 100dvh !important; }
.game-info { max-width: 860px; margin: 0 auto; padding: 26px 18px 40px; font-family: Fredoka, ui-rounded, system-ui, -apple-system, 'Segoe UI', sans-serif; color: #f4f0ff; line-height: 1.55; user-select: text; -webkit-user-select: text; }
.game-info .crumbs { font-size: .92rem; color: #b9b0d8; margin-bottom: 10px; } .game-info .crumbs a { color: #b9b0d8; } .game-info .crumbs span { margin: 0 6px; opacity: .6; }
.game-info .howto-src { display: block; } .game-info .howto { background: none; color: inherit; padding: 0; border-radius: 0; box-shadow: none; border: 0; }
.game-info h1 { font-size: clamp(1.6rem, 4.5vw, 2.2rem); line-height: 1.15; margin: 0 0 10px; color: #fff; }
.game-info h2 { font-size: 1.3rem; margin: 26px 0 8px; color: #ffd23f; }
.game-info p, .game-info li { color: #e8e2fa; } .game-info ul { padding-left: 1.2em; } .game-info a { color: #ffd23f; }
.game-info details { margin: 8px 0; padding: 12px 16px; border-radius: 14px; background: rgba(255,255,255,.06); box-shadow: inset 0 0 0 1.5px rgba(190,160,255,.22); }
.game-info summary { cursor: pointer; font-weight: 600; } .game-info details p { margin: 6px 0 0; }
.game-info .more { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; padding: 0; list-style: none; }
.game-info .more a { display: block; border-radius: 16px; overflow: hidden; background: rgba(255,255,255,.06); box-shadow: inset 0 0 0 1.5px rgba(190,160,255,.22); text-decoration: none; color: #fff; }
.game-info .more img { display: block; width: 100%; height: auto; aspect-ratio: 40 / 21; object-fit: cover; } .game-info .more b { display: block; padding: 8px 10px 0; } .game-info .more span { display: block; padding: 0 10px 10px; font-size: .88rem; color: #c9c0e6; }
.game-info .foot { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 34px; padding-top: 16px; border-top: 1px solid rgba(190,160,255,.22); font-size: .92rem; } .game-info .foot a { color: #b9b0d8; }
.howto .t1 { font-size: 1.25rem; font-weight: 700; margin: .67em 0; }
