/* Estil "acadèmia": blau marí institucional + vermell bomber */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #eef1f5;
  --text: #14213a;
  --muted: #5d6b82;
  --border: #dde3eb;
  --navy: #0f2742;
  --navy-2: #173a5e;
  --navy-ink: #ffffff;
  --accent: #c4161c;
  --accent-ink: #ffffff;
  --accent-soft: #fbe9e9;
  --brand: #173a5e;
  --brand-soft: #e6eef7;
  --ok: #1d7a46;
  --ok-soft: #e3f4ea;
  --ko: #c4161c;
  --ko-soft: #fbe9e9;
  --warn: #9a6200;
  --warn-soft: #fdf2dc;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15,39,66,.06), 0 6px 18px rgba(15,39,66,.06);
  --font: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-head: "Archivo", "Public Sans", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1420; --surface: #152033; --surface-2: #1c2a40; --text: #e8edf5; --muted: #9aa8bd; --border: #26364f;
    --navy: #0a1626; --navy-2: #13253d; --accent: #ef4d50; --accent-soft: #3a1a1d; --brand: #8fb7e6; --brand-soft: #1b2e48;
    --ok: #5fcb8b; --ok-soft: #173325; --ko: #ef6b6d; --ko-soft: #3a1a1d; --warn: #e8b54a; --warn-soft: #3a2f17;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1420; --surface: #152033; --surface-2: #1c2a40; --text: #e8edf5; --muted: #9aa8bd; --border: #26364f;
  --navy: #0a1626; --navy-2: #13253d; --accent: #ef4d50; --accent-soft: #3a1a1d; --brand: #8fb7e6; --brand-soft: #1b2e48;
  --ok: #5fcb8b; --ok-soft: #173325; --ko: #ef6b6d; --ko-soft: #3a1a1d; --warn: #e8b54a; --warn-soft: #3a2f17;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 16px/1.55 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--brand); }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.015em; }
h1 { font-size: 1.65rem; font-weight: 800; } h2 { font-size: 1.15rem; font-weight: 700; } h3 { font-size: 1rem; font-weight: 700; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }
.eyebrow { font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--accent); }

/* ---------- logo */
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.logo-mark { width: 38px; height: 38px; flex: none; }
.logo-txt { display: grid; line-height: 1.1; white-space: nowrap; }
.logo-txt b { font-family: var(--font-head); font-weight: 800; font-size: 1.02rem; letter-spacing: -.01em; }
.logo-txt span { font-size: .72rem; opacity: .75; letter-spacing: .04em; text-transform: uppercase; }

/* ---------- layout */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--navy); color: var(--navy-ink); box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.topbar::after { content: ""; display: block; height: 3px; background: var(--accent); }
.topbar-in { max-width: 1100px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 20px; }
.nav { display: flex; gap: 2px; flex: 1; justify-content: center; }
.nav a { text-decoration: none; color: rgba(255,255,255,.75); padding: 8px 14px; border-radius: 9px; font-size: .94rem; font-weight: 500; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.nav a:hover { color: #fff; background: rgba(255,255,255,.07); }
.nav a.on { color: #fff; background: rgba(255,255,255,.13); }
.nav a .badge { background: var(--accent); color: #fff; }
.user-btn { display: flex; align-items: center; gap: 8px; background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.18); border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; font-size: .9rem; white-space: nowrap; }
.user-btn:hover { background: rgba(255,255,255,.14); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: .8rem; }
main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 100px; }
.bottomnav { display: none; }
.foot { text-align: center; color: var(--muted); font-size: .78rem; padding: 0 16px 90px; }

@media (max-width: 760px) {
  .nav { display: none; }
  .topbar-in { justify-content: space-between; }
  .user-btn .un { display: none; }
  .user-btn { padding: 4px; }
  .bottomnav {
    display: flex; position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
    background: var(--surface); border-top: 1px solid var(--border); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 14px rgba(15,39,66,.06);
  }
  .bottomnav a { flex: 1; text-align: center; text-decoration: none; color: var(--muted); font-size: .7rem; font-weight: 600; padding: 4px 0; position: relative; }
  .bottomnav a svg { display: block; margin: 0 auto 2px; width: 22px; height: 22px; }
  .bottomnav a.on { color: var(--accent); }
  .bottomnav .badge { position: absolute; top: 0; left: calc(50% + 6px); background: var(--accent); color: #fff; font-size: .65rem; min-width: 16px; }
}
.ico { width: 18px; height: 18px; flex: none; }

/* ---------- hero */
.hero { background: linear-gradient(120deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; border-radius: var(--radius); padding: 24px; margin-bottom: 18px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px; border-radius: 50%; background: radial-gradient(circle, rgba(196,22,28,.35), transparent 70%); }
.hero h1 { color: #fff; margin-bottom: 4px; }
.hero p { margin: 0; color: rgba(255,255,255,.78); }
.hero .btn-row { margin-top: 16px; position: relative; z-index: 1; }
.hero .btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.35); }
.hero .btn.ghost:hover { background: rgba(255,255,255,.08); }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin: 2px 0 0; }

/* ---------- components */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.grid { display: grid; gap: 12px; }
.tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; }
@media (max-width: 760px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); border-top: 3px solid var(--brand); }
.tile.red { border-top-color: var(--accent); }
.tile .lbl { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.tile .val { font-family: var(--font-head); font-size: 1.85rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin: 2px 0; }
.tile .sub { font-size: .8rem; color: var(--muted); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 9px 16px; cursor: pointer; font-weight: 600; text-decoration: none; color: var(--text); min-height: 42px; font-size: .94rem; transition: background .15s, filter .15s; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.navy { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.danger { color: var(--ko); }
.btn.small { padding: 5px 12px; min-height: 34px; font-size: .85rem; }
.btn.big { min-height: 50px; padding: 12px 22px; font-size: 1rem; }
.btn:disabled { opacity: .45; cursor: default; filter: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.field { display: grid; gap: 5px; margin-bottom: 14px; }
.field label { font-size: .85rem; font-weight: 600; }
.input { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); min-height: 46px; }
.input:focus, .btn:focus-visible, .opt:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
.err { background: var(--ko-soft); color: var(--ko); padding: 10px 12px; border-radius: 10px; font-size: .9rem; margin-bottom: 14px; }
.note { background: var(--brand-soft); padding: 12px 14px; border-radius: 10px; font-size: .92rem; border-left: 3px solid var(--brand); }

.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; font-size: .72rem; font-weight: 700; text-align: center; background: var(--ko-soft); color: var(--ko); line-height: 1.6; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .75rem; font-weight: 600; background: var(--surface-2); color: var(--muted); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.ko { background: var(--ko-soft); color: var(--ko); }
.pill.navy { background: var(--brand-soft); color: var(--brand); }

.bar { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; display: flex; }
.bar > span { display: block; height: 100%; }
.bar .b-ok { background: var(--ok); }
.bar .b-ko { background: var(--ko); }
.bar .b-acc { background: var(--brand); }

/* ---------- auth */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-side { background: linear-gradient(150deg, var(--navy) 0%, var(--navy-2) 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-side::after { content: ""; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; background: radial-gradient(circle, rgba(196,22,28,.35), transparent 70%); }
.auth-side h1 { color: #fff; font-size: 2.2rem; margin: 40px 0 12px; max-width: 14ch; }
.auth-side p { color: rgba(255,255,255,.78); max-width: 46ch; }
.auth-feats { list-style: none; padding: 0; margin: 28px 0 0; display: grid; gap: 14px; position: relative; z-index: 1; }
.auth-feats li { display: flex; gap: 12px; align-items: flex-start; color: rgba(255,255,255,.9); }
.auth-feats .fi { flex: none; width: 34px; height: 34px; border-radius: 9px; background: rgba(255,255,255,.1); display: grid; place-items: center; }
.auth-feats b { display: block; color: #fff; }
.auth-feats span { font-size: .88rem; color: rgba(255,255,255,.7); }
.auth-main { display: grid; place-items: center; padding: 32px 16px; }
.auth-box { width: 100%; max-width: 400px; }
.auth-box h2 { font-size: 1.5rem; margin-bottom: 4px; }
.auth-mobile-logo { display: none; }
@media (max-width: 860px) {
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-mobile-logo { display: flex; justify-content: center; background: var(--navy); color: #fff; padding: 14px; margin: -32px -16px 24px; border-bottom: 3px solid var(--accent); }
  .auth-main { place-items: start center; }
}
.tabs { display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; margin: 18px 0; }
.tabs button { flex: 1; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: .9rem; white-space: nowrap; }
.tabs button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* ---------- topics */
.topic { display: grid; grid-template-columns: 44px 1fr 170px auto; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.topic:first-of-type { border-top: 0; }
.tnum { width: 44px; height: 44px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-family: var(--font-head); font-weight: 800; font-size: .9rem; }
.topic .name { font-weight: 600; line-height: 1.3; }
.topic .meta { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.topic .pc { font-size: .75rem; color: var(--muted); text-align: right; margin-top: 3px; }
@media (max-width: 760px) { .topic { grid-template-columns: 40px 1fr auto; } .topic .bars { grid-column: 2 / -1; grid-row: 2; } .tnum { width: 40px; height: 40px; } }
.group-title { display: flex; align-items: center; gap: 10px; margin: 22px 0 6px; }
.group-title:first-child { margin-top: 4px; }
.group-title h3 { margin: 0; }

/* ---------- chart */
.chart { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 11px; }
.chart .gridl { stroke: var(--border); }
.chart .pass { stroke: var(--ok); stroke-dasharray: 4 4; opacity: .6; }
.chart .line { stroke: var(--brand); fill: none; stroke-width: 2.5; }
.chart .dot { fill: var(--surface); stroke: var(--brand); stroke-width: 2; }
.chart .area { fill: var(--brand); opacity: .07; }

/* ---------- builder */
.checks { display: grid; gap: 6px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 760px) { .checks { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; background: var(--surface); }
.check:hover { background: var(--surface-2); }
.check:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.check input { width: 18px; height: 18px; accent-color: var(--brand); flex: none; }
.check .t { flex: 1; font-size: .92rem; line-height: 1.3; }
.check .c { font-size: .75rem; color: var(--muted); white-space: nowrap; }
.seg { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.seg.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.seg.five { grid-template-columns: repeat(5, minmax(0,1fr)); }
@media (max-width: 560px) { .seg { grid-template-columns: 1fr; } .seg.five { grid-template-columns: repeat(5, minmax(0,1fr)); } }
.seg label { border: 1px solid var(--border); border-radius: 10px; padding: 11px 13px; cursor: pointer; background: var(--surface); position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--brand); }
.seg b { display: block; font-size: .95rem; }
.seg span { font-size: .8rem; color: var(--muted); }
.seg.five label { text-align: center; padding: 12px 4px; }
.seg.five b { font-family: var(--font-head); font-size: 1.25rem; font-weight: 800; }
.section-label { font-size: .75rem; letter-spacing: .07em; text-transform: uppercase; font-weight: 700; color: var(--muted); margin: 22px 0 8px; }
.section-label:first-child { margin-top: 0; }
.sticky-go { position: sticky; bottom: 12px; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; background: var(--navy); color: #fff; border-radius: var(--radius); padding: 14px 18px; box-shadow: 0 8px 24px rgba(15,39,66,.25); }
.sticky-go .muted { color: rgba(255,255,255,.7); }
@media (max-width: 760px) { .sticky-go { bottom: 76px; } }

/* ---------- test runner */
.runner-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.progress { height: 6px; border-radius: 999px; background: var(--border); overflow: hidden; margin-bottom: 16px; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.runner { display: grid; grid-template-columns: 1fr 280px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .runner { grid-template-columns: 1fr; } }
.qcard { padding: 24px; }
.qnum { display: flex; align-items: center; gap: 10px; font-size: .82rem; color: var(--muted); }
.qnum .n { background: var(--navy); color: #fff; font-family: var(--font-head); font-weight: 800; border-radius: 8px; padding: 3px 10px; font-size: .9rem; }
.qtext { font-size: 1.15rem; font-weight: 600; margin: 14px 0 18px; line-height: 1.45; }
.opts { display: grid; gap: 10px; }
.opt { display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; border: 1.5px solid var(--border); background: var(--surface); border-radius: 12px; padding: 12px 14px; cursor: pointer; min-height: 54px; font-size: 1rem; transition: border-color .12s, background .12s; }
.opt:hover:not(:disabled) { border-color: var(--brand); }
.opt .l { flex: none; width: 32px; height: 32px; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; font-weight: 800; font-family: var(--font-head); font-size: .95rem; color: var(--brand); }
.opt.sel { border-color: var(--brand); background: var(--brand-soft); }
.opt.sel .l { background: var(--brand); color: #fff; }
.opt.good { border-color: var(--ok); background: var(--ok-soft); }
.opt.good .l { background: var(--ok); color: #fff; }
.opt.bad { border-color: var(--ko); background: var(--ko-soft); }
.opt.bad .l { background: var(--ko); color: #fff; }
.opt:disabled { cursor: default; color: var(--text); }
.expl { margin-top: 16px; padding: 14px 16px; border-radius: 12px; background: var(--surface-2); font-size: .95rem; border-left: 4px solid var(--brand); }
.expl.ok { border-left-color: var(--ok); }
.expl.ko { border-left-color: var(--ko); }
.expl b { display: block; margin-bottom: 3px; }
.qnav { display: flex; justify-content: space-between; gap: 8px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.side h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.qgrid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
@media (max-width: 900px) { .qgrid { grid-template-columns: repeat(10, minmax(0, 1fr)); } }
@media (max-width: 520px) { .qgrid { grid-template-columns: repeat(7, minmax(0, 1fr)); } }
.qgrid button { aspect-ratio: 1; border: 1px solid var(--border); border-radius: 7px; background: var(--surface); cursor: pointer; font-size: .78rem; font-weight: 600; padding: 0; font-variant-numeric: tabular-nums; }
.qgrid button.ans { background: var(--brand); border-color: var(--brand); color: #fff; }
.qgrid button.good { background: var(--ok); border-color: var(--ok); color: #fff; }
.qgrid button.bad { background: var(--ko); border-color: var(--ko); color: #fff; }
.qgrid button.cur { outline: 2px solid var(--accent); outline-offset: 1px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: .75rem; color: var(--muted); margin-top: 10px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 600; display: inline-flex; gap: 6px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 5px 12px; font-size: .9rem; }

/* ---------- images */
.qimg { margin: 4px 0 16px; }
.qimg img { max-width: 100%; max-height: 380px; height: auto; border-radius: 10px; border: 1px solid var(--border); cursor: zoom-in; background: #fff; display: block; }
.modal:has(img) { max-width: 960px; }

/* ---------- result */
.result-hero { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; }
@media (max-width: 600px) { .result-hero { grid-template-columns: 1fr; text-align: center; } .result-hero .btn-row { justify-content: center; } }
.ring { width: 140px; height: 140px; position: relative; margin: 0 auto; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .v { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .v b { font-family: var(--font-head); font-size: 2.2rem; font-weight: 800; line-height: 1; display: block; }
.ring .v span { font-size: .75rem; color: var(--muted); }
.verdict { font-family: var(--font-head); font-weight: 800; font-size: 1.4rem; margin-bottom: 2px; }
.stats3 { display: flex; gap: 18px; margin: 10px 0 4px; flex-wrap: wrap; }
.stats3 div { font-size: .85rem; color: var(--muted); }
.stats3 b { display: block; font-family: var(--font-head); font-size: 1.3rem; color: var(--text); }
@media (max-width: 600px) { .stats3 { justify-content: center; } }
.review { border-top: 1px solid var(--border); padding: 16px 0; }
.review:first-child { border-top: 0; }
.review .q { font-weight: 600; margin-bottom: 8px; display: flex; gap: 10px; align-items: flex-start; }
.review .a { font-size: .92rem; display: flex; gap: 6px; align-items: baseline; margin-left: 2px; }

/* ---------- tables */
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tbl th, .tbl td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl th { font-weight: 700; color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.scroll-x { overflow-x: auto; }
.list-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 4px; border-top: 1px solid var(--border); cursor: pointer; }
.list-item:first-child { border-top: 0; }
.list-item:hover .t { color: var(--brand); }
.list-item .t { font-weight: 600; }
.score-chip { font-family: var(--font-head); font-weight: 800; font-size: 1rem; padding: 6px 12px; border-radius: 10px; min-width: 64px; text-align: center; }
.score-chip.ok { background: var(--ok-soft); color: var(--ok); }
.score-chip.ko { background: var(--ko-soft); color: var(--ko); }

/* ---------- modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(10,22,38,.55); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { background: var(--surface); border-radius: var(--radius); padding: 22px; max-width: 440px; width: 100%; max-height: 92vh; overflow: auto; }
.toast { position: fixed; left: 50%; bottom: 88px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 60; font-size: .9rem; box-shadow: var(--shadow); }
.sim-banner { background: var(--warn-soft); color: var(--warn); text-align: center; font-size: .8rem; padding: 5px 8px; font-weight: 500; }
.empty { text-align: center; padding: 36px 10px; color: var(--muted); }
@media (max-width: 760px) {
  .sticky-go { padding: 10px 12px; }
  .sticky-go .go-det { display: none; }
  .sticky-go .btn.big { min-height: 44px; padding: 8px 16px; }
  .runner-top .eyebrow { display: none; }
}
/* ---------- ajuda / mapa / més */
.help { display: grid; gap: 22px; }
.step { display: grid; grid-template-columns: 40px 1fr; gap: 16px; }
.step-n { width: 40px; height: 40px; border-radius: 10px; background: var(--navy); color: #fff; display: grid; place-items: center; font-family: var(--font-head); font-weight: 800; }
.step-b { min-width: 0; }
.step-b h3 { font-size: 1.05rem; margin: 8px 0 6px; }
.step-b p, .step-b ul { margin: 0 0 8px; max-width: 70ch; }
.step-b ul, .tips { padding-left: 1.1em; }
.step-b li, .tips li { margin-bottom: 4px; }
kbd { font: 600 .8rem var(--font); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; padding: 0 6px; background: var(--surface-2); }
.formula { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
@media (max-width: 600px) { .formula { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.formula div { background: var(--surface-2); border-radius: 10px; padding: 10px; font-size: .85rem; text-align: center; }
.formula b { font-family: var(--font-head); font-size: 1.2rem; display: block; }
.formula span { display: block; color: var(--muted); font-size: .78rem; font-variant-numeric: tabular-nums; }
.soon-ico { width: 72px; height: 72px; border-radius: 18px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; margin: 0 auto; }
.ico-lg { width: 36px; height: 36px; }
.more-list { display: grid; gap: 6px; }
.more-list a { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--border); border-radius: 10px; text-decoration: none; color: var(--text); font-weight: 600; }
.more-list a:hover { background: var(--surface-2); }
@media (max-width: 1600px) and (min-width: 761px) { .nav a .ico { display: none; } .logo-txt span { display: none; } .nav a { padding: 8px 10px; font-size: .9rem; } .user-btn .un { display: none; } .user-btn { padding: 4px; } }
@media (max-width: 430px) { .logo-txt span { font-size: .6rem; letter-spacing: .02em; white-space: nowrap; } }
/* ---------- menú hamburguesa (mòbil) */
.burger { display: none; background: transparent; border: 1px solid rgba(255,255,255,.22); color: #fff; width: 42px; height: 42px; border-radius: 10px; cursor: pointer; place-items: center; position: relative; flex: none; }
.burger .ico { width: 22px; height: 22px; }
.burger .dot { position: absolute; top: 7px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); border: 2px solid var(--navy); }
.bottomnav { display: none !important; }
@media (max-width: 760px) {
  .burger { display: grid; }
  .topbar-in { gap: 10px; }
  .topbar-in .logo { flex: 1; min-width: 0; }
  .user-btn { order: 2; }
  .burger { order: 3; }
  main { padding-bottom: 40px; }
  .foot { padding-bottom: 30px; }
  .sticky-go { bottom: 12px; }
}
.drawer-bg { position: fixed; inset: 0; z-index: 55; background: rgba(10,22,38,0); transition: background .2s; }
.drawer-bg.open { background: rgba(10,22,38,.55); }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(300px, 86vw); background: var(--surface); padding: calc(12px + env(safe-area-inset-top, 0px)) 12px 20px; display: flex; flex-direction: column; gap: 4px; transform: translateX(100%); transition: transform .2s ease; overflow-y: auto; box-shadow: -8px 0 30px rgba(0,0,0,.2); }
.drawer-bg.open .drawer { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 12px; margin: -12px -12px 8px; padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px; background: var(--navy); color: #fff; border-bottom: 3px solid var(--accent); }
.drawer-head .burger { display: grid; }
.drawer a { display: flex; align-items: center; gap: 12px; padding: 12px 12px; border-radius: 10px; text-decoration: none; color: var(--text); font-weight: 600; }
.drawer a:hover { background: var(--surface-2); }
.drawer a.on { background: var(--brand-soft); color: var(--brand); }
.drawer a .badge { margin-left: auto; background: var(--accent); color: #fff; }
.drawer-sep { height: 1px; background: var(--border); margin: 8px 4px; }
@media (prefers-reduced-motion: reduce) { .drawer, .drawer-bg { transition: none; } }

/* Temari descarregable */
.doc-row { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.group-title + .doc-row { border-top: 0; }
.doc-info { min-width: 0; }
.doc-row .name { font-weight: 600; line-height: 1.3; }
.doc-row .meta { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.doc-act { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.doc-act .btn { gap: 6px; }
.doc-act .btn .ico { width: 16px; height: 16px; }
@media (max-width: 760px) {
  .doc-row { grid-template-columns: 40px 1fr; }
  .doc-act { grid-column: 1 / -1; justify-content: flex-start; }
}
@media (max-width: 340px) { .hide-sm { display: none; } }

/* ---------- Mapa de carreteres ---------- */
:root { --m-sea: #dfeaf3; --m-land: #f7f4ec; --m-coast: #b9c4cf; --m-off: #cfd5dd; --m-road: #7d889a; --m-pri: #556178; --m-ok: #1d8a4e; --m-bad: #d0262c; --m-sel: #e08a00; --m-town: #3d4a5e; --m-halo: #ffffff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --m-sea: #0f1b2b; --m-land: #1e2a3c; --m-coast: #3a4b63; --m-off: #34445b; --m-road: #8795ab; --m-pri: #b3c0d3; --m-ok: #5fcb8b; --m-bad: #ef6b6d; --m-sel: #f2b04a; --m-town: #c9d3e1; --m-halo: #152033; } }
:root[data-theme="dark"] { --m-sea: #0f1b2b; --m-land: #1e2a3c; --m-coast: #3a4b63; --m-off: #34445b; --m-road: #8795ab; --m-pri: #b3c0d3; --m-ok: #5fcb8b; --m-bad: #ef6b6d; --m-sel: #f2b04a; --m-town: #c9d3e1; --m-halo: #152033; }
.m-card { padding: 14px; }
.m-hud { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.m-hud-r { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.m-hearts { font-size: 1.35rem; letter-spacing: 2px; color: var(--accent); line-height: 1; }
.m-heart.lost { color: var(--border); }
.m-wrap { position: relative; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: var(--m-sea); }
.m-svg { display: block; width: 100%; height: min(72vh, 680px); min-height: 340px; touch-action: none; user-select: none; cursor: grab; }
.m-svg.dragging { cursor: grabbing; }
.m-sea { fill: var(--m-sea); }
.m-land { fill: var(--m-land); stroke: var(--m-coast); stroke-width: 1; vector-effect: non-scaling-stroke; }
.m-off { fill: none; stroke: var(--m-off); stroke-width: 1; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.m-road .m-line { fill: none; stroke: var(--m-road); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; transition: stroke .15s; }
.m-road.pri .m-line { stroke: var(--m-pri); stroke-width: 3.4; }
.m-road .m-hit { fill: none; stroke: transparent; stroke-width: 16; vector-effect: non-scaling-stroke; stroke-linecap: round; cursor: pointer; pointer-events: stroke; }
@media (hover: hover) { .m-road:not(.ok):hover .m-line { stroke: var(--m-sel); stroke-width: 4; } }
.m-road.sel .m-line { stroke: var(--m-sel); stroke-width: 4.5; }
.m-road.ok .m-line { stroke: var(--m-ok); stroke-width: 3.6; }
.m-road.ok .m-hit { cursor: default; }
.m-road.bad .m-line { stroke: var(--m-bad); stroke-width: 5; }
.m-lab { fill: var(--m-ok); font-weight: 800; paint-order: stroke; stroke: var(--m-halo); stroke-width: 3.5px; vector-effect: non-scaling-stroke; pointer-events: none; font-family: var(--font-head); }
.m-town { fill: var(--m-town); paint-order: stroke; stroke: var(--m-halo); stroke-width: 3px; pointer-events: none; font-weight: 600; }
.m-dot { fill: var(--m-town); pointer-events: none; }
.m-tw:not(.big) { display: none; }
.m-svg.z2 .m-tw:not(.big) { display: inline; }
.m-zoom { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; }
.m-zoom .btn { width: 38px; height: 38px; padding: 0; font-size: 1.15rem; justify-content: center; background: var(--surface); }
.m-tip { margin: 10px 2px 0; }
.m-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.m-opt { justify-content: center; font-weight: 700; font-size: 1.05rem; padding: 14px; }
.m-pista { font-family: var(--font-head); letter-spacing: .12em; color: var(--text); }
.m-lvls { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 16px; }
.m-lvl { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.m-lvl .btn { margin-top: auto; align-self: flex-start; }
.m-lvl-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 1.1rem; }
@media (max-width: 640px) { .m-svg { height: 62vh; } .m-card { padding: 10px; } }
/* Mapa: aprèn més */
.m-tabs { max-width: 360px; margin: 6px 0 16px; }
.m-ap { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.m-ap-map { position: sticky; top: 12px; }
.m-svg-ap { height: min(70vh, 620px); }
.m-ap-list { min-width: 0; }
.m-fil { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.m-fil #m-q { grid-column: 1 / -1; }
.m-fil2 { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 2px 4px; }
.m-chk { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; cursor: pointer; font-weight: 600; }
.m-llista { max-height: min(64vh, 560px); overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.m-gh { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 16px 2px 6px; position: sticky; top: 0; background: var(--surface); padding: 6px 0; z-index: 1; }
.m-gh .muted { font-weight: 500; }
.m-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.m-it { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
.m-it.on { border-color: var(--m-sel); box-shadow: inset 0 0 0 1px var(--m-sel); }
.m-it-b { display: grid; grid-template-columns: 5.6em minmax(0, 1fr) auto; align-items: baseline; gap: 10px; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; cursor: pointer; color: var(--text); font: inherit; }
.m-it-r { font-family: var(--font-head); font-weight: 800; }
.m-it-t { min-width: 0; font-size: .92rem; }
.m-ruta { display: inline; }
.m-fl { color: var(--muted); margin: 0 .35em; }
.m-it-k { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.m-amaga { color: var(--muted); font-style: italic; }
.m-det { padding: 0 12px 10px calc(5.6em + 22px); font-size: .9rem; }
.m-det p { margin: 0 0 6px; }
.m-lab-sel { fill: var(--m-sel); }
@media (max-width: 860px) {
  .m-ap { grid-template-columns: 1fr; }
  .m-ap-map { position: static; }
  .m-svg-ap { height: 42vh; min-height: 260px; }
  .m-llista { max-height: none; overflow: visible; }
}
@media (max-width: 560px) {
  .m-it-b { grid-template-columns: 4.8em minmax(0, 1fr); }
  .m-it-k { display: none; }
  .m-det { padding-left: 12px; }
}
.m-veure { display: none; }
@media (max-width: 860px) { .m-veure { display: inline-flex; margin-top: 4px; } .m-ap-map { scroll-margin-top: 80px; } }
