:root {
  --bg: #f6f6fb; --card: #fff; --ink: #17172b; --muted: #5d5d78; --line: #e4e4ef;
  --brand: #5b4bff; --brand-ink: #fff; --brand-soft: #ecebff; --accent: #ff5c8a;
  --ok: #16a34a; --ok-soft: #dcfce7; --warn: #f59e0b; --bad: #e5484d;
  --r: 16px; --shadow: 0 1px 2px rgba(20, 20, 50, .06), 0 8px 24px rgba(20, 20, 50, .06);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0e0f1c; --card: #181a2e; --ink: #ececf7; --muted: #a4a5c3; --line: #2a2c47; --brand: #7c70ff; --brand-soft: #2c2866; --ok-soft: #12351f; --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25) }
}
*, *::before, *::after { box-sizing: border-box }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth }
body { margin: 0; background: var(--bg); color: var(--ink); font: 17px/1.6 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; overflow-x: hidden }
img { max-width: 100%; height: auto }
a { color: var(--brand) }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.01em; margin: 1.6em 0 .5em }
h1 { font-size: clamp(1.7rem, 5vw, 2.5rem); margin-top: .6em }
h2 { font-size: 1.35rem }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px }
main.wrap { min-height: 60vh; padding-bottom: 40px }

/* cabecera */
.top { background: var(--card); border-bottom: 1px solid var(--line) }
.top .wrap { display: flex; align-items: center; gap: 12px; min-height: 60px; flex-wrap: wrap }
.logo { display: inline-flex; align-items: center; gap: 8px; font-size: 1.2rem; color: var(--ink); text-decoration: none; margin: 0 }
.logo span { font-weight: 800; letter-spacing: -.01em }
.logo b { color: var(--brand) }
.top nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto }
.top nav a, .lang { padding: 8px 12px; border-radius: 999px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: .95rem; white-space: nowrap }
.top nav a:hover, .top nav a[aria-current] { background: var(--brand-soft); color: var(--brand) }
.lang { border: 1.5px solid var(--line); font-size: .85rem }
@media (max-width: 600px) {
  .top .wrap { gap: 0 8px; padding-bottom: 6px }
  .top nav { order: 3; width: 100%; margin: 0 -8px }
  .lang { margin-left: auto }
}

/* botones */
.btn, .btn-ghost { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 10px 20px; border-radius: 12px; border: 0; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; transition: transform .08s, filter .15s }
.btn { background: var(--brand); color: var(--brand-ink) }
.btn:hover { filter: brightness(1.08) }
.btn:active, .btn-ghost:active { transform: scale(.97) }
.btn-ghost { background: var(--brand-soft); color: var(--brand) }
.btn-lg { font-size: 1.1rem; padding: 14px 28px }
.btn-wa { background: #25d366; color: #fff }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px }
.icon-btn { background: none; border: 0; font-size: 1.4rem; cursor: pointer; min-width: 44px; min-height: 44px; border-radius: 10px }
.pill { display: inline-block; background: var(--brand-soft); color: var(--brand); font-weight: 700; padding: 4px 12px; border-radius: 999px; font-size: .9rem }

/* portada */
.hero { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 24px; margin: 24px 0; padding: 32px; border-radius: 24px; color: #fff; background: radial-gradient(circle at 85% 20%, #ff5c8a 0, transparent 45%), linear-gradient(135deg, #5b4bff, #3b2fc9) }
.hero h1 { margin: .2em 0 .4em }
.hero p { max-width: 36em; opacity: .95 }
.hero .btn { background: #fff; color: #3b2fc9; margin-top: 8px }
.kicker { text-transform: uppercase; letter-spacing: .08em; font-size: .78rem; font-weight: 800; opacity: .85; margin: 0 }
.hero-sil { position: relative; width: 200px; aspect-ratio: 1; display: grid; place-items: center; background: rgba(255, 255, 255, .14); border-radius: 50% }
.hero-sil img { width: 70%; filter: brightness(0) invert(1); opacity: .9 }
.hero-sil span { position: absolute; font-size: 4rem; font-weight: 900; color: #ffd84d; text-shadow: 0 4px 16px rgba(0, 0, 0, .3) }
@media (max-width: 700px) { .hero { grid-template-columns: 1fr; padding: 24px 20px } .hero-sil { display: none } }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px }
.sec-h a { font-weight: 700; text-decoration: none; white-space: nowrap }

/* tarjetas */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 12px }
.card { display: flex; flex-direction: column; gap: 4px; padding: 18px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); color: var(--ink); text-decoration: none; box-shadow: var(--shadow); transition: transform .12s, border-color .12s }
.card:hover { transform: translateY(-2px); border-color: var(--brand) }
.card .ic { font-size: 1.8rem; line-height: 1 }
.card b { font-size: 1.05rem; line-height: 1.3; margin-top: 6px }
.card small { color: var(--muted); font-size: .9rem; line-height: 1.4 }
.more { margin-top: 48px }

/* páginas */
.page-h { margin: 12px 0 20px }
.page-h h1 { margin-bottom: .2em }
.page-h p { color: var(--muted); margin: 0 }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 20px; box-shadow: var(--shadow); max-width: 680px; margin: 0 auto }
.prose { max-width: 720px; margin: 0 auto }
.prose li { margin: .35em 0 }
.prose table { border-collapse: collapse; width: 100%; font-size: .95rem }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 10px; text-align: left }
details { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; margin: 8px 0 }
summary { cursor: pointer; font-weight: 700; padding: 14px 0; list-style-position: outside }
details p { margin-top: 0 }
.pick { text-align: center; padding-top: 18vh }
.pick .logo { font-size: 2rem; justify-content: center }

/* anuncios: separados de botones para evitar clics accidentales */
.ad { margin: 40px auto; min-height: 280px; max-width: 728px; text-align: center }
.ad::before { content: "Advertisement"; display: block; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px }
html[lang=es] .ad::before { content: "Publicidad" }

/* formularios */
label { display: block; font-weight: 600; margin: 12px 0 4px }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--bg); border: 1.5px solid var(--line); border-radius: 12px; padding: 12px 14px; min-height: 48px }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none }
input[type=checkbox], input[type=radio] { width: 22px; min-height: 22px; height: 22px; accent-color: var(--brand); vertical-align: middle; margin: 0 8px 0 0 }
input[type=range] { padding: 0; accent-color: var(--brand); border: 0; background: none }
.check { display: flex; align-items: center; font-weight: 500; margin: 8px 0 }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px }
@media (max-width: 480px) { .row3 { grid-template-columns: 1fr 1fr } }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px }
.out { margin-top: 20px; padding: 16px; border-radius: 14px; background: var(--brand-soft) }
.out:empty { display: none }
.big { font-size: clamp(1.6rem, 6vw, 2.4rem); font-weight: 800; line-height: 1.15; color: var(--brand); margin: 0 }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; margin-top: 12px }
.kv div { background: var(--card); border-radius: 10px; padding: 10px 12px }
.kv b { display: block; font-size: 1.15rem }
.kv small { color: var(--muted) }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 }
.chips button { border: 1.5px solid var(--line); background: var(--card); color: var(--ink); border-radius: 999px; padding: 8px 14px; font: inherit; font-weight: 600; cursor: pointer; min-height: 40px }
.chips button[aria-pressed=true] { background: var(--brand); color: #fff; border-color: var(--brand) }

/* juego */
.g-top { display: flex; align-items: center; justify-content: space-between }
.sil { height: min(62vw, 300px); margin: 8px 0 16px }
.sil img { display: block; width: 100%; height: 100%; object-fit: contain }
@media (prefers-color-scheme: dark) { .sil img { filter: brightness(1.35) } }
.rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px }
.rows li { display: grid; grid-template-columns: 1fr auto 2.2em 3.4em; gap: 8px; align-items: center; min-height: 44px; padding: 6px 12px; border-radius: 10px; font-size: .95rem; background: linear-gradient(90deg, var(--brand-soft) var(--p), var(--bg) var(--p)); animation: pop .25s }
.rows li b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.rows li span { text-align: right; font-variant-numeric: tabular-nums }
.rows li.hit { background: var(--ok-soft); color: var(--ok) }
.rows li.empty { background: var(--bg); border: 1.5px dashed var(--line); animation: none }
@keyframes pop { from { transform: scale(.96); opacity: 0 } }
.g-form { display: flex; gap: 8px; margin-top: 14px }
.g-form input { flex: 1 }
.g-msg { min-height: 1.6em; margin: 8px 0; text-align: center; font-weight: 600 }
.game > .btn-ghost { width: 100% }
#g-end { text-align: center }
.end-t { font-size: 1.35rem; font-weight: 800; margin: 8px 0 }
.ans { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 1.4rem }
.ans img { border-radius: 6px; box-shadow: var(--shadow) }
.share-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 16px 0 }
.cd b { font-variant-numeric: tabular-nums; font-size: 1.2rem }
.end-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px }
.arch { display: flex; flex-wrap: wrap; gap: 8px }
.arch a { padding: 6px 12px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); font-size: .92rem }
.arch a[aria-current] { border-color: var(--brand) }
.arch small { color: var(--muted) }
dialog { border: 0; border-radius: 20px; padding: 24px; width: min(92vw, 420px); background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .35); text-align: center }
dialog::backdrop { background: rgba(10, 10, 30, .55) }
dialog h2 { margin-top: 0 }
.stat4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px }
.stat4 b { display: block; font-size: 1.8rem }
.stat4 small { color: var(--muted); font-size: .75rem; line-height: 1.2; display: block }
.bars { text-align: left; margin-bottom: 20px }
.bars div { display: flex; gap: 8px; align-items: center; margin: 4px 0 }
.bars i { font-style: normal; background: var(--muted); color: #fff; text-align: right; padding: 0 8px; border-radius: 4px; font-weight: 700; font-size: .9rem }
.bars i.me { background: var(--ok) }

/* tests */
.q-prog { height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; margin: 4px 0 16px }
.q-prog i { display: block; height: 100%; background: var(--brand); transition: width .3s }
.q-n { color: var(--muted); font-weight: 700; font-size: .9rem }
.q-t { font-size: 1.25rem; margin: .2em 0 .8em }
.opts { display: grid; gap: 10px }
.opts button { text-align: left; min-height: 54px; padding: 12px 16px; border-radius: 14px; border: 2px solid var(--line); background: var(--bg); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; transition: border-color .12s, background .12s }
.opts button:hover { border-color: var(--brand) }
.opts button.right { border-color: var(--ok); background: var(--ok-soft) }
.opts button.wrong { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent) }
.opts button:disabled { cursor: default }
.q-x { margin: 14px 0 0; padding: 12px 14px; border-radius: 12px; background: var(--brand-soft) }
.res { text-align: center }
.res .emo { font-size: 4rem; line-height: 1; margin: 8px 0 }
.res h2 { margin: .2em 0 .4em; font-size: 1.6rem }
.friend { background: #fff4d6; color: #5a4200; padding: 12px 16px; border-radius: 12px; margin: 0 auto 16px; max-width: 680px; font-weight: 600 }

/* herramientas */
.wheel-box { position: relative; max-width: 380px; margin: 0 auto }
.wheel-box canvas { width: 100%; height: auto; display: block }
.wheel-box::after { content: ""; position: absolute; top: -4px; left: 50%; transform: translateX(-50%); border: 14px solid transparent; border-top: 24px solid var(--accent) }
.coin { width: 140px; height: 140px; margin: 12px auto; border-radius: 50%; display: grid; place-items: center; font-size: 1.1rem; font-weight: 800; background: radial-gradient(circle at 35% 30%, #ffe89a, #e0a800); color: #6b4a00; box-shadow: inset 0 -6px 0 rgba(0, 0, 0, .15), var(--shadow) }
.coin.spin { animation: flip .6s }
@keyframes flip { 50% { transform: rotateY(90deg) scale(1.15) } }
.dice { font-size: 4rem; line-height: 1; letter-spacing: .1em; text-align: center; min-height: 1.2em }
.pw { font-family: ui-monospace, Consolas, monospace; font-size: 1.2rem; word-break: break-all; background: var(--card); padding: 14px; border-radius: 12px; margin: 0 }
.meter { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 10px }
.meter i { display: block; height: 100%; transition: width .2s }
.names { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin-top: 12px }
.names button { padding: 12px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-weight: 700; cursor: pointer; word-break: break-all }
.names button:hover { border-color: var(--brand) }
.nums { font-size: 1.6rem; font-weight: 800; color: var(--brand); word-break: break-word }

/* pie */
.foot { background: var(--card); border-top: 1px solid var(--line); margin-top: 40px; padding: 28px 0 40px; color: var(--muted); font-size: .92rem }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 12px 0 }
.foot nav a { color: var(--ink); text-decoration: none; padding: 6px 0 }
.foot nav a:hover { color: var(--brand) }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 150%); background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 12px; font-weight: 600; transition: transform .25s; z-index: 10; max-width: 90vw }
.toast.on { transform: translate(-50%, 0) }
[hidden] { display: none !important }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap }
.pc h3 { margin: 18px 0 0; font-size: 1.05rem }
.pc-r { font-size: 1.3rem; font-weight: 800; color: var(--brand); margin: 0 0 10px; min-height: 1.4em; overflow-wrap: anywhere }
