/* Interfaz del juego: placas de hierro con remaches de latón sobre la escena 3D. */
:root {
  --iron: #1e2930;
  --iron-2: #2a3841;
  --iron-3: #364853;
  --brass: #d9a441;
  --brass-hi: #f0c869;
  --brass-dark: #a8781d;
  --copper: #c46b33;
  --red: #b5462e;
  --light: #f4ede0;
  --muted: #c3baa9;
  --good: #6fcf7f;
  --bad: #ff8a75;
  --panel: rgba(24, 33, 39, 0.94);
  --font-logo: "Rye", "Zilla Slab", Georgia, serif;
  --font-slab: "Zilla Slab", "Rockwell", Georgia, serif;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, 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: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--iron); color: var(--light); font: 15px/1.45 var(--font-sans); overscroll-behavior: none; }
body { touch-action: none; user-select: none; -webkit-user-select: none; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#ui { position: fixed; inset: 0; pointer-events: none; }
.screen { position: absolute; inset: 0; pointer-events: auto; padding: calc(16px + var(--safe-t)) max(16px, var(--safe-r)) calc(16px + var(--safe-b)) max(16px, var(--safe-l)); }
.screen.center { display: grid; place-items: center; }
.screen.dim { background: rgba(12, 16, 19, 0.45); }
.num { font-variant-numeric: tabular-nums; }
h2, h3 { font-family: var(--font-slab); margin: 0; line-height: 1.15; text-wrap: balance; }
h2 { font-size: 1.6rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }
p { margin: 0; }
a { color: var(--brass-hi); }
:focus-visible { outline: 2px solid var(--brass-hi); outline-offset: 2px; }

/* Logo */
.logo { display: grid; justify-items: center; gap: 4px; text-align: center; filter: drop-shadow(0 3px 0 rgba(0,0,0,0.35)); }
.logo-top { font-family: var(--font-logo); font-size: clamp(2.2rem, 11vw, 3.6rem); color: var(--brass-hi); line-height: 1; letter-spacing: 0.02em; -webkit-text-stroke: 1px #5a3a0c; }
.logo-sub { font-family: var(--font-slab); font-weight: 600; text-transform: uppercase; letter-spacing: 0.24em; font-size: 0.78rem; color: var(--light); background: var(--red); padding: 3px 12px; border-radius: 2px; }
.loading-text { margin-top: 26px; color: var(--light); font-family: var(--font-slab); font-size: 1.05rem; text-shadow: 0 1px 2px rgba(0,0,0,0.6); }
#s-loading { background: radial-gradient(ellipse at 50% 30%, #3a4c57 0%, var(--iron) 70%); align-content: center; gap: 0; }
.start-btn { margin-top: 26px; width: min(320px, 100%); animation: start-pulse 1.6s ease-in-out infinite; }
@keyframes start-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.04); } }

/* Botones */
.btn {
  pointer-events: auto; font: 600 1rem/1 var(--font-slab); letter-spacing: 0.02em; color: var(--light); text-decoration: none; text-align: center;
  background: var(--iron-2); border: 2px solid var(--iron-3); border-radius: 10px; padding: 12px 18px; cursor: pointer;
  box-shadow: 0 3px 0 rgba(0,0,0,0.35); transition: transform 0.06s ease;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,0.35); }
.btn.primary { background: linear-gradient(#e6b551, var(--brass-dark)); border-color: #7d5410; color: #241606; text-shadow: 0 1px 0 rgba(255,255,255,0.3); }
.btn.big { font-size: 1.35rem; padding: 16px 22px; width: 100%; }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--muted); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.icon-btn { pointer-events: auto; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--iron-3); background: var(--panel); color: var(--light); font-size: 1.05rem; cursor: pointer; display: grid; place-items: center; }
.icon-btn.muted { opacity: 0.5; text-decoration: line-through; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); gap: 8px; }

/* Panel tipo placa de hierro */
.panel {
  background: var(--panel); border: 2px solid var(--brass-dark); border-radius: 14px; padding: 22px 20px;
  display: grid; gap: 12px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.45), inset 0 0 0 4px rgba(217,164,65,0.08);
  position: relative; width: 100%;
}
.panel::before, .panel::after { content: ""; position: absolute; top: 10px; width: 7px; height: 7px; border-radius: 50%; background: var(--brass); box-shadow: 0 1px 0 #000; }
.panel::before { left: 10px; } .panel::after { right: 10px; }
.panel.narrow { max-width: 380px; }
.eyebrow { font-family: var(--font-slab); text-transform: uppercase; letter-spacing: 0.18em; font-size: 0.78rem; color: var(--brass-hi); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

/* Inicio */
.home { display: grid; grid-template-rows: auto 1fr auto auto auto auto; justify-items: center; align-items: start; gap: 14px; background: linear-gradient(rgba(14,18,21,0.28), rgba(14,18,21,0) 30%, rgba(14,18,21,0) 58%, rgba(14,18,21,0.55)); }
.home .logo { align-self: start; margin-top: 1vh; }
.topbar { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.topbar-right { display: flex; gap: 8px; }
.icon-btn svg { display: block; }
.btn.small-btn { padding: 8px 10px; font-size: 0.92rem; color: var(--light); text-shadow: 0 1px 2px rgba(0,0,0,0.8); }
.purse { display: inline-flex; align-items: center; gap: 8px; background: var(--panel); border: 2px solid var(--iron-3); border-radius: 999px; padding: 6px 14px 6px 8px; font: 700 1.05rem var(--font-slab); }
.purse.small { padding: 4px 10px 4px 6px; font-size: 0.95rem; }
.coin-ico { width: 20px; height: 20px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffe59a, #d9a441 55%, #8f6316); box-shadow: inset 0 0 0 2px #a8781d; }
.pool-banner {
  pointer-events: auto; cursor: pointer; display: grid; justify-items: center; gap: 2px; width: min(380px, 100%);
  background: linear-gradient(180deg, rgba(181,70,46,0.95), rgba(140,48,30,0.95)); color: var(--light);
  border: 2px solid var(--brass); border-radius: 12px; padding: 10px 16px; box-shadow: 0 6px 18px rgba(0,0,0,0.35); font: inherit;
}
.pool-label { font-family: var(--font-slab); text-transform: uppercase; letter-spacing: 0.16em; font-size: 0.72rem; color: #ffe3b0; }
.pool-amount { font: 700 2rem/1.05 var(--font-slab); color: #fff4d6; }
.pool-meta { font-size: 0.8rem; color: #ffe3b0; }
.home-best { font-family: var(--font-slab); font-size: 1rem; color: var(--light); text-shadow: 0 1px 3px rgba(0,0,0,0.8); min-height: 1.2em; }
.home-actions { width: min(380px, 100%); display: grid; gap: 10px; }
.controls-hint { font-size: 0.8rem; color: var(--light); opacity: 0.85; text-align: center; max-width: 34ch; text-shadow: 0 1px 2px rgba(0,0,0,0.8); }

/* HUD */
.hud { position: absolute; inset: 0; padding: calc(10px + var(--safe-t)) max(12px, var(--safe-r)) 0 max(12px, var(--safe-l)); display: flex; justify-content: space-between; align-items: flex-start; pointer-events: none; }
.hud .icon-btn, .hud .purse { pointer-events: auto; }
.hud-left { display: grid; gap: 8px; justify-items: start; }
.hud-distance { display: flex; align-items: baseline; gap: 4px; font-family: var(--font-slab); text-shadow: 0 2px 0 rgba(0,0,0,0.5); }
.powers { display: grid; gap: 5px; }
.power { display: grid; grid-template-columns: auto 64px; align-items: center; gap: 7px; background: var(--panel); border: 1px solid var(--iron-3); border-radius: 8px; padding: 4px 8px 4px 6px; font: 600 0.78rem var(--font-slab); color: var(--light); }
.power i { width: 18px; height: 18px; display: grid; place-items: center; }
.power svg { width: 18px; height: 18px; display: block; }
.power .bar { height: 5px; border-radius: 3px; background: var(--iron-3); overflow: hidden; }
.power .bar b { display: block; height: 100%; background: linear-gradient(90deg, var(--brass), var(--brass-hi)); border-radius: 3px; }
.power .label { grid-column: 1 / -1; display: none; }
.hud-purse { position: relative; }
.hud-purse.bump { animation: bump 0.22s ease-out; }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.14); } 100% { transform: scale(1); } }
.coin-pop { position: absolute; right: 8px; top: 100%; font: 700 0.95rem var(--font-slab); color: var(--brass-hi); text-shadow: 0 2px 0 rgba(0,0,0,0.5); opacity: 0; pointer-events: none; }
.coin-pop.show { animation: pop 0.6s ease-out; }
@keyframes pop { 0% { opacity: 0; transform: translateY(0); } 20% { opacity: 1; } 100% { opacity: 0; transform: translateY(14px); } }
.hud-dist { font-size: 2.4rem; font-weight: 700; color: #fff; line-height: 1; }
.hud-unit { font-size: 1.1rem; color: var(--brass-hi); font-weight: 700; }
.hud-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.badge { font: 700 0.85rem var(--font-slab); background: var(--brass); color: #241606; border-radius: 6px; padding: 3px 8px; box-shadow: 0 2px 0 rgba(0,0,0,0.35); }
.countdown { position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%); font: 700 5rem var(--font-slab); color: var(--brass-hi); text-shadow: 0 4px 0 rgba(0,0,0,0.45); }

/* Choque */
.ring { position: relative; width: 74px; height: 74px; justify-self: center; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 4; }
.ring-bg { stroke: var(--iron-3); }
.ring-fg { stroke: var(--brass); stroke-linecap: round; stroke-dasharray: 119.4; stroke-dashoffset: 0; transition: stroke-dashoffset 0.25s linear; }
.ring span { position: absolute; inset: 0; display: grid; place-items: center; font: 700 1.5rem var(--font-slab); }

/* Resultado */
.result-dist { font-size: 2.8rem; color: var(--brass-hi); }
.result-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.result-grid div { background: var(--iron-2); border-radius: 8px; padding: 8px 4px; }
.result-grid dt { font-size: 0.72rem; color: var(--muted); }
.result-grid dd { margin: 0; font: 700 1.15rem var(--font-slab); }
.result-note { font-size: 0.92rem; color: var(--light); }
.result-note.good { color: var(--good); }

/* Hojas (ranking, tienda, reglas) */
.screen.sheet { padding: 0; background: rgba(14, 18, 21, 0.97); display: grid; grid-template-rows: auto 1fr; }
.sheet-head { display: flex; align-items: center; gap: 12px; padding: calc(10px + var(--safe-t)) max(14px, var(--safe-r)) 10px max(14px, var(--safe-l)); border-bottom: 2px solid var(--brass-dark); background: var(--iron); }
.sheet-head h2 { flex: 1; font-size: 1.3rem; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px max(16px, var(--safe-r)) calc(24px + var(--safe-b)) max(16px, var(--safe-l)); display: grid; gap: 14px; align-content: start; touch-action: pan-y; user-select: text; max-width: 560px; width: 100%; margin: 0 auto; }
.pool-card { display: flex; justify-content: space-between; align-items: center; gap: 12px; background: linear-gradient(180deg, #b5462e, #8c301e); border: 2px solid var(--brass); border-radius: 12px; padding: 12px 16px; }
.pool-close { text-align: right; font: 700 1.1rem var(--font-slab); }
.me-card { background: var(--iron-2); border: 2px solid var(--brass-dark); border-radius: 10px; padding: 12px 14px; display: grid; gap: 4px; }
.me-card strong { font-family: var(--font-slab); font-size: 1.15rem; }
.join-card { background: var(--iron-2); border-radius: 10px; padding: 14px; display: grid; gap: 10px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 0.92rem; }
.check input { width: 22px; height: 22px; flex: none; accent-color: var(--brass); margin: 0; }
.board { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.board li { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto auto; gap: 10px; align-items: center; background: var(--iron-2); border-radius: 8px; padding: 9px 12px; }
.board li.me { outline: 2px solid var(--brass); }
.board .pos { font: 700 1.05rem var(--font-slab); color: var(--brass-hi); text-align: center; }
.board .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board .dist { font-variant-numeric: tabular-nums; color: var(--muted); }
.board .prize { font: 700 0.95rem var(--font-slab); color: var(--good); font-variant-numeric: tabular-nums; min-width: 64px; text-align: right; }
.board li.empty { grid-template-columns: 1fr; color: var(--muted); text-align: center; }
.board li.top3 .pos { color: #ffe08a; }
.section-title { font-family: var(--font-slab); text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.75rem; color: var(--brass-hi); margin-top: 6px; }
.prize-row { display: flex; justify-content: space-between; gap: 10px; background: var(--iron-2); border-radius: 8px; padding: 9px 12px; font-size: 0.9rem; }
.status-pill { font-size: 0.75rem; font-weight: 700; border-radius: 999px; padding: 2px 8px; background: var(--iron-3); }
.status-pill.paid { background: #1f4a2a; color: var(--good); }
.status-pill.pending, .status-pill.approved { background: #4a3a14; color: var(--brass-hi); }
.status-pill.rejected { background: #4a1f1a; color: var(--bad); }
.wallet-text { font-family: ui-monospace, Menlo, monospace; font-size: 0.78rem; word-break: break-all; color: var(--muted); }
.input { width: 100%; padding: 10px 12px; border-radius: 8px; border: 2px solid var(--iron-3); background: var(--iron); color: var(--light); font: inherit; }

/* Tienda */

/* Reglas */
.rules h3 { margin-top: 10px; }
.rules p, .rules li { color: var(--muted); font-size: 0.92rem; }
.rules ul, .rules ol { padding-left: 1.2em; margin: 6px 0; display: grid; gap: 6px; }

/* Historia */
.story { position: absolute; inset: 0; pointer-events: auto; }
.story-bar { position: absolute; left: 0; right: 0; height: 11vh; background: #0b0907; }
.story-bar.top { top: 0; }
.story-bar.bottom { bottom: 0; display: grid; place-items: center; padding: 0 16px var(--safe-b); }
.story-caption { font: 600 clamp(0.95rem, 3.6vw, 1.15rem)/1.3 var(--font-slab); color: #f4e3c0; text-align: center; max-width: 36ch; text-wrap: balance; }
.story-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.bubble {
  position: absolute; transform: translate(-50%, -100%); background: #fffaf0; color: #20160e; font: 700 clamp(0.95rem, 3.8vw, 1.2rem)/1.2 var(--font-slab);
  padding: 8px 12px; border-radius: 14px; border: 2px solid #20160e; box-shadow: 0 3px 0 rgba(0,0,0,0.3); white-space: nowrap; animation: bubble-in 0.18s ease-out;
}
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -10px; transform: translateX(-50%); border: 8px solid transparent; border-top-color: #20160e; border-bottom: 0; }
@keyframes bubble-in { from { transform: translate(-50%, -80%) scale(0.6); opacity: 0; } to { transform: translate(-50%, -100%) scale(1); opacity: 1; } }
.pow {
  position: absolute; transform: translate(-50%, -50%) rotate(-8deg); font: 400 clamp(2.2rem, 11vw, 3.6rem)/1 var(--font-logo); color: #ffd84a;
  -webkit-text-stroke: 2px #8a1c1c; text-shadow: 0 4px 0 #3a0c0c; animation: pow 0.9s ease-out forwards;
}
@keyframes pow { 0% { transform: translate(-50%, -50%) rotate(-8deg) scale(0.3); } 18% { transform: translate(-50%, -50%) rotate(-8deg) scale(1.25); } 30% { transform: translate(-50%, -50%) rotate(-8deg) scale(1); } 80% { opacity: 1; } 100% { transform: translate(-50%, -70%) rotate(-8deg) scale(1.05); opacity: 0; } }
.story-skip { position: absolute; top: calc(10px + var(--safe-t)); right: max(12px, var(--safe-r)); padding: 8px 14px; font-size: 0.95rem; background: rgba(30,41,48,0.85); }
.story-flash { position: absolute; inset: 0; background: #fff8e8; opacity: 0; pointer-events: none; transition: opacity 0.35s ease; }
.story-flash.on { opacity: 1; }

/* Práctica */
.tut { position: absolute; inset: 0; pointer-events: none; }
.tut-card {
  position: absolute; left: 50%; top: 24%; transform: translateX(-50%); width: min(340px, calc(100% - 32px));
  background: var(--panel); border: 2px solid var(--brass); border-radius: 14px; padding: 14px 16px 12px; text-align: center; display: grid; gap: 6px; justify-items: center;
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.tut-card.in { animation: tut-in 0.25s ease-out; }
@keyframes tut-in { from { transform: translateX(-50%) translateY(-10px); opacity: 0; } to { transform: translateX(-50%); opacity: 1; } }
.tut-step { font: 600 0.72rem var(--font-slab); letter-spacing: 0.16em; text-transform: uppercase; color: var(--brass-hi); }
.tut-text { font: 700 1.12rem/1.25 var(--font-slab); color: var(--light); text-wrap: balance; }
.tut-keys { font-size: 0.75rem; color: var(--muted); }
.tut-gesture { position: relative; width: 120px; height: 64px; }
.tut-gesture .finger { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%; background: rgba(255,255,255,0.92); box-shadow: 0 0 0 6px rgba(255,255,255,0.25); }
.tut-gesture.lr .finger { animation: swipe-lr 1.1s ease-in-out infinite; }
.tut-gesture.up .finger { animation: swipe-up 0.9s ease-in-out infinite; }
.tut-gesture.down .finger { animation: swipe-down 0.9s ease-in-out infinite; }
@keyframes swipe-lr { 0%, 100% { transform: translateX(-40px); } 50% { transform: translateX(40px); } }
@keyframes swipe-up { 0% { transform: translateY(22px); opacity: 0; } 25% { opacity: 1; } 100% { transform: translateY(-22px); opacity: 0; } }
@keyframes swipe-down { 0% { transform: translateY(-22px); opacity: 0; } 25% { opacity: 1; } 100% { transform: translateY(22px); opacity: 0; } }
.tut-praise { position: absolute; left: 50%; top: 30%; transform: translate(-50%, -50%); font: 400 2.4rem var(--font-logo); color: var(--brass-hi); -webkit-text-stroke: 1px #5a3a0c; text-shadow: 0 3px 0 rgba(0,0,0,0.4); animation: praise 0.9s ease-out forwards; }
.tut-praise.retry { color: #ffb3a3; }
@keyframes praise { 0% { transform: translate(-50%, -50%) scale(0.5); opacity: 0; } 20% { transform: translate(-50%, -50%) scale(1.15); opacity: 1; } 75% { opacity: 1; } 100% { transform: translate(-50%, -80%) scale(1); opacity: 0; } }
.tut-praise.wait { font: 700 1.25rem var(--font-slab); -webkit-text-stroke: 0; color: var(--light); background: rgba(30,41,48,0.85); border: 2px solid var(--brass-dark); border-radius: 999px; padding: 6px 16px; white-space: nowrap; }
.tut-skip { position: absolute; left: 50%; bottom: calc(18px + var(--safe-b)); transform: translateX(-50%); pointer-events: auto; padding: 8px 14px; font-size: 0.9rem; background: rgba(30,41,48,0.85); }

/* Botones del día en el inicio: misiones, cofre y cartel */
.daily-rail { position: absolute; left: 50%; transform: translateX(-50%); top: calc(16px + var(--safe-t)); display: flex; gap: 8px; z-index: 2; }
.rail-btn { position: relative; display: grid; justify-items: center; gap: 3px; background: none; border: 0; padding: 0; cursor: pointer; color: var(--light); font: 600 0.72rem var(--font-slab); text-shadow: 0 1px 2px rgba(0,0,0,0.9); }
.rail-ico { width: 44px; height: 44px; border-radius: 12px; background: var(--panel); border: 2px solid var(--brass-dark); display: grid; place-items: center; box-shadow: 0 3px 0 rgba(0,0,0,0.35); }
.rail-ico svg { width: 28px; height: 28px; }
.rail-label { display: none; }
.rail-btn:active .rail-ico { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0,0,0,0.35); }
.rail-btn .dot { position: absolute; top: -3px; right: -3px; width: 14px; height: 14px; border-radius: 50%; background: #e8452c; border: 2px solid #fff4d6; animation: dotpulse 1.4s ease-in-out infinite; }
@keyframes dotpulse { 50% { transform: scale(1.18); } }
/* pantallas altas en vertical: columna a la izquierda, debajo del logo, con nombres */
@media (orientation: portrait) and (min-height: 760px) {
  .daily-rail { left: max(10px, var(--safe-l)); transform: none; top: calc(clamp(150px, 21vh, 190px) + var(--safe-t)); flex-direction: column; gap: 10px; }
  .rail-ico { width: 50px; height: 50px; border-radius: 14px; }
  .rail-ico svg { width: 32px; height: 32px; }
  .rail-label { display: block; }
}

/* Antes de salir */
.prerun { display: grid; gap: 10px; max-height: calc(100dvh - 32px); overflow-y: auto; }
.prerun-items { display: grid; gap: 8px; margin-top: 4px; }
.item-row { display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 10px; align-items: center; background: var(--iron-2); border: 2px solid var(--iron-3); border-radius: 10px; padding: 8px 10px; text-align: left; }
.item-row.on { border-color: var(--brass); background: #3a3420; }
.item-row .ico { width: 42px; height: 42px; border-radius: 10px; background: var(--iron); display: grid; place-items: center; }
.item-row .ico svg { width: 30px; height: 30px; }
.item-row strong { font: 700 0.98rem var(--font-slab); display: block; }
.item-row small { color: var(--muted); font-size: 0.78rem; line-height: 1.25; display: block; }
.item-row .btn { padding: 8px 10px; font-size: 0.85rem; white-space: nowrap; }
.toggle { width: 46px; height: 26px; border-radius: 999px; background: var(--iron-3); position: relative; border: 0; cursor: pointer; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--light); transition: left 0.15s; }
.toggle[aria-pressed="true"] { background: var(--brass); }
.toggle[aria-pressed="true"]::after { left: 23px; }
.x2-box { background: var(--iron-2); border-radius: 10px; padding: 10px; display: grid; gap: 8px; }
.x2-box p { margin: 0; color: var(--muted); }
.small { font-size: 0.85rem; }

/* Sombrero en el HUD y aviso de zona */
.hud-hat { display: inline-flex; align-items: center; gap: 6px; background: rgba(31,74,42,0.92); border: 2px solid #6af08a; border-radius: 999px; padding: 2px 10px 2px 4px; font: 700 0.78rem var(--font-slab); color: #e8ffe8; margin-top: 4px; width: max-content; }
.hud-hat svg { width: 26px; height: 26px; }
.hud-hat.pop { animation: hatpop 0.6s ease-out; }
@keyframes hatpop { 0% { transform: scale(0.4); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
.zone-banner { position: absolute; left: 50%; top: 22%; transform: translateX(-50%); display: grid; justify-items: center; pointer-events: none; animation: zonein 3s ease-out forwards; }
.zone-sub { font: 600 0.8rem var(--font-slab); letter-spacing: 0.22em; text-transform: uppercase; color: var(--light); text-shadow: 0 1px 3px rgba(0,0,0,0.9); }
.zone-name { font: 400 clamp(1.9rem, 9vw, 3rem)/1.05 var(--font-logo); color: var(--brass-hi); -webkit-text-stroke: 1px #5a3a0c; text-shadow: 0 3px 0 rgba(0,0,0,0.45); white-space: nowrap; }
@keyframes zonein { 0% { opacity: 0; transform: translate(-50%, 12px); } 12% { opacity: 1; transform: translate(-50%, 0); } 80% { opacity: 1; } 100% { opacity: 0; } }

/* Choque con y sin sombrero */
.hat-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.hat-btn svg { width: 30px; height: 30px; flex: none; }
#crash-hat { display: grid; gap: 10px; justify-items: center; }
#crash-hat .btn { width: 100%; }
.nohat { display: grid; justify-items: center; gap: 6px; }
.nohat p { margin: 0; color: var(--light); }
.nohat-ico svg { width: 54px; height: 54px; filter: grayscale(1) opacity(0.6); }

/* Resultados: el vaquero baila arriba (vertical) o a la izquierda (horizontal) */
#s-results.screen.center { align-items: end; }
#s-results .panel { padding: 16px 18px; gap: 10px; }
@media (orientation: landscape) { #s-results.screen.center { align-items: center; justify-items: end; } }
.res-daily { display: grid; gap: 6px; text-align: left; }
.res-line { display: flex; align-items: center; gap: 8px; background: var(--iron-2); border-radius: 8px; padding: 7px 10px; font-size: 0.86rem; }
.res-line b { color: var(--brass-hi); font-family: var(--font-slab); }
.res-line.done { outline: 2px solid var(--good); }
.res-line .letter-chip { font: 700 1rem var(--font-slab); background: #ead29c; color: #9c2f22; border: 2px solid #5a3418; border-radius: 4px; padding: 0 6px; }

/* Tienda */
.shop { padding: 0; display: grid; grid-template-rows: auto minmax(150px, 38vh) 1fr; background: linear-gradient(rgba(14,18,21,0.45), rgba(14,18,21,0) 20%); }
.shop .sheet-head { background: rgba(30,41,48,0.92); }
.shop-window { position: relative; pointer-events: none; }
.shop-pick { position: absolute; left: 12px; right: 12px; bottom: 8px; display: flex; align-items: center; gap: 10px; background: var(--panel); border: 2px solid var(--brass-dark); border-radius: 12px; padding: 8px 8px 8px 12px; pointer-events: auto; }
.shop-pick-text { flex: 1; min-width: 0; display: grid; }
.shop-pick-text strong { font: 700 1.02rem var(--font-slab); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.shop-pick-text span { color: var(--muted); }
.shop-pick .btn { padding: 10px 14px; font-size: 0.95rem; white-space: nowrap; }
.shop-panel { background: rgba(14, 18, 21, 0.97); border-top: 2px solid var(--brass-dark); display: grid; grid-template-rows: auto 1fr; min-height: 0; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding: 10px max(12px, var(--safe-r)) 8px max(12px, var(--safe-l)); scrollbar-width: none; touch-action: pan-x; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; font: 600 0.9rem var(--font-slab); color: var(--muted); background: var(--iron-2); border: 2px solid var(--iron-3); border-radius: 999px; padding: 7px 13px; cursor: pointer; }
.tab[aria-selected="true"] { color: #241606; background: linear-gradient(#e6b551, var(--brass-dark)); border-color: #7d5410; }
.shop-body { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 4px max(12px, var(--safe-r)) calc(18px + var(--safe-b)) max(12px, var(--safe-l)); display: grid; gap: 10px; align-content: start; touch-action: pan-y; }
.shop-body > p { margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.card { position: relative; background: var(--iron-2); border: 2px solid var(--iron-3); border-radius: 12px; padding: 8px 6px; display: grid; gap: 4px; justify-items: center; text-align: center; cursor: pointer; color: var(--light); font: inherit; }
.card.sel { border-color: var(--brass-hi); box-shadow: 0 0 0 2px rgba(240,200,105,0.35); }
.card .thumb { width: 64px; height: 64px; display: grid; place-items: center; }
.card .thumb svg { width: 60px; height: 60px; }
.card .nm { font: 600 0.82rem/1.15 var(--font-slab); min-height: 2.3em; display: grid; place-items: center; }
.card .pr { font: 700 0.8rem var(--font-slab); color: var(--brass-hi); display: inline-flex; align-items: center; gap: 4px; }
.card .pr .coin-ico { width: 13px; height: 13px; }
.card .pr.own { color: var(--muted); }
.card .pr.on { color: var(--good); }
.card.locked .thumb { opacity: 0.85; }
.skin-figure { width: 64px; height: 84px; position: relative; transform: scale(0.74); transform-origin: top center; margin-bottom: -20px; }
.skin-figure i { position: absolute; left: 50%; transform: translateX(-50%); border-radius: 3px; }
.rows { display: grid; gap: 8px; }
.up-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 10px; align-items: center; background: var(--iron-2); border: 2px solid var(--iron-3); border-radius: 12px; padding: 10px; }
.up-row .ico { width: 44px; height: 44px; border-radius: 10px; background: var(--iron); display: grid; place-items: center; }
.up-row .ico svg { width: 30px; height: 30px; }
.up-row strong { font: 700 1rem var(--font-slab); }
.up-row small { display: block; color: var(--muted); font-size: 0.8rem; }
.pips { display: flex; gap: 4px; margin: 4px 0 2px; }
.pips i { width: 18px; height: 7px; border-radius: 3px; background: var(--iron-3); }
.pips i.on { background: linear-gradient(90deg, var(--brass), var(--brass-hi)); }
.up-row .btn { padding: 9px 11px; font-size: 0.85rem; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.up-row .btn .coin-ico { width: 14px; height: 14px; }
@media (orientation: landscape) {
  .shop { grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr); grid-template-rows: auto 1fr; }
  .shop .sheet-head { grid-column: 1 / -1; }
  .shop-window { grid-row: 2; grid-column: 1; }
  .shop-panel { grid-row: 2; grid-column: 2; border-top: 0; border-left: 2px solid var(--brass-dark); }
}

/* Misiones */
.missions { display: grid; gap: 10px; }
.mission { background: var(--iron-2); border: 2px solid var(--iron-3); border-radius: 12px; padding: 12px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; align-items: center; }
.mission.done { border-color: var(--good); }
.mission.claimed { opacity: 0.6; }
.mission .tier { font: 600 0.7rem var(--font-slab); letter-spacing: 0.14em; text-transform: uppercase; color: var(--brass-hi); }
.mission .txt { font: 700 1rem/1.2 var(--font-slab); }
.mission .bar { grid-column: 1 / -1; height: 8px; border-radius: 4px; background: var(--iron-3); overflow: hidden; }
.mission .bar b { display: block; height: 100%; background: linear-gradient(90deg, var(--brass), var(--brass-hi)); }
.mission.done .bar b { background: var(--good); }
.mission .prog { font-size: 0.8rem; color: var(--muted); }
.mission .btn { padding: 9px 12px; font-size: 0.88rem; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.mission .btn .coin-ico { width: 14px; height: 14px; }

/* Cofre */
.chest-panel { display: grid; gap: 10px; justify-items: center; text-align: center; }
.chest-panel .btn { width: 100%; }
.chest-art { position: relative; width: 130px; height: 124px; margin: 6px 0 2px; }
.chest-box { position: absolute; left: 10px; right: 10px; bottom: 0; height: 58px; background: linear-gradient(#9a6a3a, #6a4422); border: 3px solid #3a2412; border-radius: 6px; }
.chest-box::before { content: ""; position: absolute; left: 0; right: 0; top: 10px; height: 8px; background: #d9a441; }
.chest-box i { position: absolute; left: 50%; top: 2px; transform: translateX(-50%); width: 20px; height: 24px; background: #f0c869; border: 2px solid #3a2412; border-radius: 3px; }
.chest-lid { position: absolute; left: 7px; right: 7px; bottom: 52px; height: 44px; background: linear-gradient(#b88a4a, #8a5a2a); border: 3px solid #3a2412; border-radius: 40px 40px 6px 6px; transform-origin: 10% 100%; transition: transform 0.45s cubic-bezier(.3,1.6,.5,1); z-index: 2; }
.chest-lid::after { content: ""; position: absolute; left: 0; right: 0; bottom: 6px; height: 8px; background: #d9a441; }
.chest-glow { position: absolute; left: 50%; bottom: 40px; width: 10px; height: 10px; transform: translateX(-50%); border-radius: 50%; box-shadow: 0 0 0 0 rgba(255,220,120,0); transition: box-shadow 0.5s; }
.chest-prize { position: absolute; left: 50%; bottom: 58px; transform: translate(-50%, 24px); font: 700 1.7rem var(--font-slab); color: var(--brass-hi); text-shadow: 0 2px 0 rgba(0,0,0,0.5); opacity: 0; transition: transform 0.6s 0.25s, opacity 0.4s 0.25s; z-index: 3; white-space: nowrap; }
.chest-art.shake { animation: shake 0.45s ease-in-out; }
.chest-art.open .chest-lid { transform: rotate(-38deg) translate(-6px, -8px); }
.chest-art.open .chest-glow { box-shadow: 0 0 40px 34px rgba(255,220,120,0.75); }
.chest-art.open .chest-prize { opacity: 1; transform: translate(-50%, -4px); }
@keyframes shake { 20% { transform: rotate(-5deg); } 40% { transform: rotate(5deg); } 60% { transform: rotate(-4deg); } 80% { transform: rotate(3deg); } }
.streak { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; width: 100%; }
.streak li { background: var(--iron-2); border: 2px solid var(--iron-3); border-radius: 8px; padding: 5px 0; display: grid; gap: 1px; font-size: 0.68rem; color: var(--muted); }
.streak li b { font: 700 0.8rem var(--font-slab); color: var(--light); }
.streak li.got { background: #24402c; border-color: #3d7a4a; }
.streak li.now { border-color: var(--brass-hi); box-shadow: 0 0 0 2px rgba(240,200,105,0.35); }
.streak li.big b { color: var(--brass-hi); }

/* Cartel de Se busca */
.poster { width: min(360px, 100%); background: #ead29c; color: #3a2412; border: 3px solid #5a3418; border-radius: 4px; padding: 18px 18px 14px; display: grid; gap: 8px; justify-items: center; text-align: center; box-shadow: 0 12px 30px rgba(0,0,0,0.5), inset 0 0 40px rgba(150,100,50,0.35); transform: rotate(-1deg); }
.poster p { margin: 0; }
.poster-top { font: 400 2.6rem/1 var(--font-logo); color: #5a3418; letter-spacing: 0.04em; }
.poster-sub { font: 700 0.8rem var(--font-slab); letter-spacing: 0.2em; text-transform: uppercase; color: #9c2f22; }
.poster-word { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; margin: 8px 0; }
.poster-word span { width: 38px; height: 46px; display: grid; place-items: center; font: 700 1.6rem var(--font-slab); border: 2px dashed #8a6a3a; border-radius: 4px; color: transparent; background: rgba(255,255,255,0.15); }
.poster-word span.got { border-style: solid; border-color: #5a3418; color: #9c2f22; background: #f6e6bc; }
.poster-word span.next { border-color: #9c2f22; animation: dotpulse 1.4s ease-in-out infinite; }
.poster-reward { font: 700 1.05rem var(--font-slab); }
.poster-reward strong { color: #9c2f22; }
.poster-note { font-size: 0.85rem; color: #5a4028; }
.poster .btn { width: 100%; }
.poster .btn.ghost { color: #5a4028; }

/* Aviso */
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); background: var(--light); color: var(--iron); font-weight: 600; padding: 10px 16px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,0.4); max-width: calc(100% - 32px); text-align: center; z-index: 50; pointer-events: none; }
.toast.bad { background: #ffd2c8; color: #5a1408; }

/* Anuncio simulado (pruebas) */
.mock-ad { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,0.85); display: grid; place-items: center; padding: 16px; }
.mock-ad-card { background: #f4ede0; color: #20160e; border-radius: 14px; padding: 26px; width: min(340px, 100%); display: grid; gap: 10px; text-align: center; }
.mock-ad-tag { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.16em; color: #8a5f0e; }
.mock-ad-title { font: 700 1.4rem var(--font-slab); }
.mock-ad-count { font: 700 2.2rem var(--font-slab); }
.mock-ad-actions { display: flex; gap: 8px; justify-content: center; }
.mock-ad .btn.ghost { color: #5a4a3a; }

@media (min-width: 900px) {
  .controls-hint::after { content: " En PC usa las flechas o WASD."; }
}
/* Horizontal con poca altura: el menú va a la derecha y el vaquero queda a la izquierda */
@media (orientation: landscape) and (max-height: 560px) {
  .home { grid-template-columns: minmax(0, 1fr) minmax(320px, 50%); grid-template-rows: auto auto auto auto 1fr; justify-items: center; gap: 8px; background: linear-gradient(90deg, rgba(14,18,21,0) 35%, rgba(14,18,21,0.55)); }
  .home .topbar { grid-column: 1 / -1; }
  .home .logo, .home .pool-banner, .home .home-best, .home .home-actions, .home .controls-hint { grid-column: 2; }
  .home .logo { margin-top: 0; }
  .home .logo-top { font-size: 2.1rem; }
  .home .logo-sub { font-size: 0.66rem; }
  .home .pool-banner { padding: 6px 12px; }
  .home .pool-amount { font-size: 1.45rem; }
  .home .home-best { font-size: 0.88rem; min-height: 1.2em; text-align: center; margin: 0; }
  .home .home-actions { gap: 6px; }
  .home .home-actions .btn.big { padding: 10px 16px; font-size: 1.15rem; }
  .home .home-actions .btn { padding: 9px 12px; }
  .home .controls-hint { display: none; }
  .screen.center .panel, .poster { max-height: calc(100dvh - 20px); overflow-y: auto; }
  .screen.center { padding-top: calc(10px + var(--safe-t)); padding-bottom: calc(10px + var(--safe-b)); }
  .chest-panel { gap: 6px; padding: 14px 16px; }
  .chest-art { height: 96px; transform: scale(0.8); margin: -6px 0 -10px; }
  .poster { padding: 12px 16px 10px; gap: 4px; }
  .poster-top { font-size: 2rem; }
}
@media (prefers-reduced-motion: reduce) {
  .hud-purse.bump, .coin-pop.show, .bubble, .pow, .tut-card.in, .tut-praise { animation: none; }
  .tut-gesture .finger { animation-duration: 2.4s; }
  .btn { transition: none; }
}

/* Etiqueta "Dinero real" (premios del ranking) */
.pool-tag {
  display: inline-block; font: 700 0.66rem/1.2 var(--font-slab); letter-spacing: 0.14em; text-transform: uppercase;
  color: #10301a; background: linear-gradient(#a6f09a, #5cc45a); border: 1px solid #2f7a34; border-radius: 999px; padding: 2px 9px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45), 0 1px 3px rgba(0,0,0,0.3);
}
.pool-banner .pool-tag { margin-bottom: 3px; }
.pool-card .pool-label .pool-tag { vertical-align: 1px; margin-right: 4px; }

/* Idioma */
.icon-btn.lang-btn { width: auto; min-width: 44px; padding: 0 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 5px; font: 700 0.82rem var(--font-slab); letter-spacing: 0.04em; }
.lang-menu { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(10, 13, 16, 0.6); pointer-events: auto; }
.lang-card { width: min(320px, 100%); background: var(--panel); border: 2px solid var(--brass-dark); border-radius: 14px; padding: 18px; display: grid; gap: 10px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.lang-list { display: grid; gap: 8px; }
.lang-opt { width: 100%; }

/* Bienvenida */
.welcome { max-width: 400px; }
.welcome h2 { font-family: var(--font-logo); font-weight: 400; font-size: 1.7rem; color: var(--brass-hi); }
.welcome { padding-top: 56px; }
.welcome .welcome-lang { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); height: 34px; }
.welcome-pool { display: grid; justify-items: center; gap: 2px; padding: 10px 14px; border-radius: 12px; border: 2px solid var(--brass); background: linear-gradient(180deg, rgba(181,70,46,0.95), rgba(140,48,30,0.95)); }
.welcome-money { font-size: 1.02rem; line-height: 1.45; }
.welcome-money strong { color: #a6f09a; }
.welcome p { margin: 0; }

/* Método de cobro */
.pay-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; background: var(--iron); border-radius: 10px; padding: 4px; }
.seg-btn { pointer-events: auto; font: 600 0.92rem/1.1 var(--font-slab); color: var(--muted); background: transparent; border: 0; border-radius: 8px; padding: 9px 6px; cursor: pointer; }
.seg-btn[aria-pressed="true"] { background: var(--iron-3); color: var(--light); box-shadow: inset 0 0 0 1px var(--brass-dark); }
#rk-wallet .input { user-select: text; -webkit-user-select: text; }
