:root { --bg: #17171b; --panel: #222228; --panel2: #2c2c34; --text: #f1f1f4; --muted: #a6a6b2; --line: #3a3a44; --si: #7dff9a; --no: #ff7b87; }
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: var(--bg); color: var(--text); font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; overflow: hidden; overscroll-behavior: none; touch-action: manipulation; }
button { font: inherit; color: inherit; background: var(--panel); border: 0; border-radius: 16px; padding: 12px 18px; cursor: pointer; user-select: none; -webkit-user-select: none; }
button:active { filter: brightness(1.25); }
button:disabled { opacity: .35; cursor: default; }
button:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
[hidden] { display: none !important; }

#bar { position: fixed; top: 0; left: 0; right: 0; z-index: 5; height: calc(env(safe-area-inset-top) + 58px); padding: env(safe-area-inset-top) 10px 0; display: flex; align-items: center; gap: 7px; background: var(--bg); }
#bar button { flex: none; height: 44px; min-width: 44px; padding: 0 10px; border-radius: 13px; background: rgba(255, 255, 255, .09); font-size: 20px; }
#bar #back { font-size: 30px; line-height: 1; }
#bar #read { font-size: 14px; font-weight: 700; }
#bar #voice.on { background: #2f6b46; }
.medio { flex: 1; min-width: 0; line-height: 1.15; text-align: center; }
#title { display: block; font-weight: 800; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#hud { color: var(--muted); font-weight: 600; }
body[data-screen="menu"] #bar { justify-content: flex-end; background: none; pointer-events: none; }
body[data-screen="menu"] #bar button { pointer-events: auto; }
body[data-screen="menu"] .medio { display: none; }

#view { position: fixed; inset: 0; padding-top: calc(env(safe-area-inset-top) + 58px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
body[data-screen="game"] #view { overflow: hidden; }
body[data-screen="menu"] #view { padding-top: env(safe-area-inset-top); }

/* Menú */
.menu { max-width: 540px; margin: 0 auto; padding: 22px 16px calc(env(safe-area-inset-bottom) + 28px); text-align: center; }
body[data-screen="menu"] .menu { padding-top: 62px; }
.logo { font-size: clamp(34px, 11vw, 48px); letter-spacing: 3px; font-weight: 900; }
.tag { margin: 4px 0 14px; color: var(--muted); font-size: 15px; }
.total { display: inline-block; padding: 6px 16px; border-radius: 20px; background: var(--panel); color: var(--muted); margin-bottom: 16px; font-size: 15px; }
.total b { color: #ffd24a; }
.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.card { min-height: 162px; padding: 14px; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; text-align: left; border-radius: 22px; color: #fff; text-shadow: 0 1px 6px rgba(0, 0, 0, .4); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.cards .card:last-child:nth-child(odd) { grid-column: span 2; min-height: 132px; }
.cicono { font-size: 34px; line-height: 1; }
.cname { display: block; font-size: 19px; font-weight: 800; line-height: 1.15; }
.cdesc { display: block; font-size: 13px; opacity: .93; margin-top: 4px; line-height: 1.25; }
.cfoot { font-size: 14px; letter-spacing: 2px; }
.card.viaje { width: 100%; min-height: 0; margin-bottom: 12px; background: linear-gradient(140deg, #31314a, #5a3e63); }
.carretera { display: block; position: relative; height: 38px; border-radius: 10px; background: #26262d; overflow: hidden; }
.carretera::before { content: ''; position: absolute; left: 0; right: -60px; top: 50%; border-top: 3px dashed #ffd24a; animation: carril 1.1s linear infinite; }
.carretera i { position: absolute; left: 20%; top: 2px; font-style: normal; font-size: 26px; transform: scaleX(-1); animation: bote .55s ease-in-out infinite; }
@keyframes carril { to { transform: translateX(-36px); } }
@keyframes bote { 50% { margin-top: -2px; } }
.soft { margin-top: 22px; background: none; color: var(--muted); font-size: 14px; }

/* Viaje */
h2.grande { font-size: 27px; line-height: 1.2; margin: 10px 0 16px; }
.largos { display: grid; gap: 11px; margin-bottom: 14px; }
.largos button { display: flex; justify-content: space-between; align-items: center; padding: 19px 18px; font-size: 18px; }
.largos span { color: var(--muted); font-size: 15px; }
.progreso { position: relative; height: 10px; margin: 24px 34px 20px 14px; background: var(--panel2); border-radius: 6px; }
.progreso i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, #4dabf7, #69db7c); }
.progreso span { position: absolute; top: -17px; font-size: 25px; transform: translateX(-50%) scaleX(-1); }
.progreso em { position: absolute; right: -30px; top: -10px; font-style: normal; font-size: 21px; }
.paradas { list-style: none; display: grid; gap: 8px; text-align: left; }
.paradas li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--panel); }
.paradas li.hecha { opacity: .55; }
.paradas li.ahora { background: var(--panel2); box-shadow: 0 0 0 2px #ffd24a; }
.punto { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: #0005; font-weight: 800; }
.ahora .punto { font-size: 24px; }
.paradas small { display: block; color: var(--muted); }
.ruta .acciones { margin-top: 16px; }
.copa { font-size: 74px; line-height: 1.2; }

/* Juego */
.stage { height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; max-width: 540px; margin: 0 auto; padding: 6px 16px calc(env(safe-area-inset-bottom) + 16px); text-align: center; }
.stage > * { flex: none; }
.stage h2 { font-size: 24px; margin: 4px 0 10px; line-height: 1.2; }
.consigna { color: var(--muted); margin: 6px 0 14px; }
.consigna b { color: var(--text); }
.nota { color: var(--muted); font-size: 15px; margin: 12px 0; }
.etiqueta { text-transform: uppercase; letter-spacing: .1em; font-size: 13px; font-weight: 800; color: #ffd24a; margin: 4px 0 6px; }
.pregunta { font-size: 22px; font-weight: 700; line-height: 1.3; margin: 8px 0 12px; }
.relato { text-align: left; font-size: 18px; line-height: 1.55; background: var(--panel); border-radius: 18px; padding: 15px 16px; }
.acciones { display: grid; gap: 10px; margin-top: auto; padding-top: 14px; }
.acciones button, .tapa button { font-weight: 700; }
button.grande { padding: 18px; font-size: 19px; }
button.bien { background: #1f7a4a; }
button.mal { background: #96333f; }
button.suave { background: none; color: var(--muted); font-size: 15px; padding: 9px; }
.dos { display: grid; gap: 4px; margin: 8px 0; }
.dos > span { font-size: 28px; color: var(--muted); }
.palabron { font-size: clamp(30px, 10vw, 46px); font-weight: 900; text-transform: uppercase; padding: 18px 10px; border-radius: 22px; background: linear-gradient(140deg, #3b2d63, #57285a); overflow-wrap: anywhere; line-height: 1.1; animation: entrar .3s ease-out; }
.palabron.solo { background: linear-gradient(140deg, #25503c, #1d4a58); font-size: clamp(28px, 8.5vw, 40px); margin: 8px 0; }
@keyframes entrar { from { transform: scale(.85); opacity: 0; } }
.contador { font-weight: 800; font-size: 19px; margin-top: 8px; }
.pistas { list-style: none; counter-reset: p; display: grid; gap: 9px; text-align: left; margin: 6px 0; }
.pistas li { counter-increment: p; position: relative; background: var(--panel); border-radius: 16px; padding: 13px 14px 13px 52px; font-size: 18px; }
.pistas li::before { content: counter(p); position: absolute; left: 12px; top: 12px; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: #0006; font-size: 14px; font-weight: 800; color: #ffd24a; }
.pistas li:last-child { background: var(--panel2); animation: entrar .3s ease-out; }
.opciones { display: grid; gap: 10px; text-align: left; margin: 6px 0; }
.opciones button { display: flex; align-items: center; gap: 13px; text-align: left; padding: 15px 14px; font-size: 18px; border: 2px solid transparent; }
.opciones b { flex: none; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: #0007; color: #ffd24a; }
.opciones button.puesta { border-color: #ffd24a; background: var(--panel2); }
.opciones button.puesta b { background: #ffd24a; color: #17171b; }
.solucion { list-style: none; counter-reset: s; display: grid; gap: 8px; text-align: left; }
.solucion li { counter-increment: s; position: relative; padding: 10px 14px 10px 52px; border-radius: 14px; background: var(--panel); border-left: 6px solid var(--no); }
.solucion li.si { border-left-color: var(--si); }
.solucion li::before { content: counter(s) "º"; position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-weight: 900; color: #ffd24a; }
.solucion small { display: block; color: var(--muted); }
.letras { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; margin-bottom: 10px; }
.letras span { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 50%; background: var(--panel2); font-size: 14px; font-weight: 800; text-transform: uppercase; }
.letras .bien { background: #1f7a4a; }
.letras .mal { background: #96333f; }
.letras .pasada { background: #8a6a14; }
.letras .actual { box-shadow: 0 0 0 2px #fff; }
.letraza { align-self: center; width: 78px; height: 78px; display: grid; place-items: center; border-radius: 50%; background: linear-gradient(140deg, #12936f, #3bbf6a); font-size: 44px; font-weight: 900; text-transform: uppercase; }
.tapa { margin: auto 0; display: grid; }
.final { margin: auto 0; padding: 10px 0; animation: entrar .35s ease-out; }
.final p { color: #d7d7de; font-size: 18px; line-height: 1.5; }
.bigstars { font-size: 52px; color: #ffd24a; letter-spacing: 6px; }

/* Ventanas */
#modal { position: fixed; inset: 0; z-index: 20; background: rgba(8, 8, 10, .86); display: grid; place-items: center; padding: 18px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); overflow-y: auto; }
#modal .sheet { background: var(--panel); border-radius: 26px; padding: 22px 18px; width: min(380px, 100%); text-align: center; }
#modal h2 { font-size: 24px; margin-bottom: 8px; }
#modal p { margin: 9px 0; color: #d7d7de; }
#modal p b { color: #fff; }
#modal button { display: block; width: 100%; margin-top: 10px; background: var(--panel2); }
#modal button.big { background: #f1f1f4; color: #17171b; font-weight: 800; }
#modal button.enorme { padding: 24px; font-size: 22px; }

@media (max-height: 680px) { .palabron { padding: 10px; } .letraza { width: 58px; height: 58px; font-size: 32px; } .letras span { width: 24px; height: 24px; font-size: 12px; } .pregunta { font-size: 19px; } }
@media (max-width: 360px) { .card { padding: 11px; } .cname { font-size: 17px; } #bar #read { font-size: 12px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; } }
