/* IS Arena — white & green, sem gradientes. Tema escuro em [data-theme="dark"] (escolhido no browser, ver app.js) */
:root {
  color-scheme: light;
  --bg: #ffffff;
  --bg-2: #fafafa;
  --bg-3: #f4f4f5;
  --surface: #ffffff;   /* cartões, botões, campos e chips */
  --raised: #ffffff;    /* separador ativo (tabs, seg) */
  --glass: rgba(255, 255, 255, .92);   /* barras fixas */
  --glass-2: rgba(255, 255, 255, .95);
  --glass-3: rgba(255, 255, 255, .97);
  --fg: #0a0a0a;
  --fg-2: #27272a;
  --fg-inv: #ffffff;    /* texto sobre fundos var(--fg) */
  --muted: #71717a;
  --muted-2: #a1a1aa;
  --border: #e4e4e7;
  --border-2: #d4d4d8;
  --green: #16a34a;
  --green-h: #15803d;   /* verde para texto */
  --green-btn-h: #15803d;
  --green-d: #14532d;
  --green-50: #f0fdf4;
  --green-100: #dcfce7;
  --green-200: #bbf7d0;
  --green-400: #4ade80;
  --red: #dc2626;
  --red-d: #991b1b;
  --red-50: #fef2f2;
  --red-200: #fecaca;
  --amber: #d97706;
  --amber-50: #fffbeb;
  --amber-200: #fde68a;
  --orange: #ea580c;
  --orange-50: #fff7ed;
  --orange-200: #fed7aa;
  --blue: #2563eb;
  --gold-bg: #fef3c7;
  --gold-fg: #b45309;
  --gold-bd: #fde68a;
  --silver-fg: #52525b;
  --bronze-bg: #ffedd5;
  --bronze-fg: #c2410c;
  --bronze-bd: #fed7aa;
  --tk-tag: #166534;
  --tk-attr: #9333ea;
  --tk-str: #b45309;
  --tk-kw: #1d4ed8;
  --toast-bg: #0a0a0a;
  --toast-fg: #ffffff;
  --toast-bd: transparent;
  --backdrop: rgba(10, 10, 10, .35);
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, .08);
  --shadow-sheet: 0 -10px 40px rgba(0, 0, 0, .12);
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #09090b;
  --bg-2: #141417;
  --bg-3: #1d1d21;
  --surface: #111113;
  --raised: #2c2c31;
  --glass: rgba(9, 9, 11, .86);
  --glass-2: rgba(9, 9, 11, .93);
  --glass-3: rgba(17, 17, 19, .95);
  --fg: #fafafa;
  --fg-2: #d4d4d8;
  --fg-inv: #09090b;
  --muted: #a1a1aa;
  --muted-2: #71717a;
  --border: #27272a;
  --border-2: #3f3f46;
  --green: #16a34a;
  --green-h: #4ade80;
  --green-btn-h: #15803d;
  --green-d: #86efac;
  --green-50: rgba(34, 197, 94, .1);
  --green-100: rgba(34, 197, 94, .2);
  --green-200: rgba(34, 197, 94, .32);
  --green-400: #22c55e;
  --red: #ef4444;
  --red-d: #fca5a5;
  --red-50: rgba(239, 68, 68, .12);
  --red-200: rgba(239, 68, 68, .4);
  --amber: #f59e0b;
  --amber-50: rgba(245, 158, 11, .1);
  --amber-200: rgba(245, 158, 11, .38);
  --orange: #fb923c;
  --orange-50: rgba(249, 115, 22, .12);
  --orange-200: rgba(249, 115, 22, .4);
  --blue: #60a5fa;
  --gold-bg: rgba(245, 158, 11, .16);
  --gold-fg: #fbbf24;
  --gold-bd: rgba(245, 158, 11, .4);
  --silver-fg: #d4d4d8;
  --bronze-bg: rgba(234, 88, 12, .16);
  --bronze-fg: #fb923c;
  --bronze-bd: rgba(234, 88, 12, .4);
  --tk-tag: #4ade80;
  --tk-attr: #c084fc;
  --tk-str: #fbbf24;
  --tk-kw: #60a5fa;
  --toast-bg: #1f1f23;
  --toast-fg: #fafafa;
  --toast-bd: #3f3f46;
  --backdrop: rgba(0, 0, 0, .6);
  --shadow: 0 1px 2px rgba(0, 0, 0, .5);
  --shadow-lg: 0 8px 30px rgba(0, 0, 0, .55);
  --shadow-sheet: 0 -10px 40px rgba(0, 0, 0, .6);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -.02em; margin: 0 0 .5em; font-weight: 600; }
h1 { font-size: 30px; letter-spacing: -.035em; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0 0 1em; }
a { color: inherit; text-decoration: none; }
code, kbd, .mono { font-family: var(--mono); }
code { font-size: .88em; background: var(--bg-3); border: 1px solid var(--border); border-radius: 5px; padding: .05em .35em; white-space: break-spaces; }
kbd { font-size: 11px; border: 1px solid var(--border-2); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: var(--surface); }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
img, svg { max-width: 100%; }
.ic { flex: none; vertical-align: -3px; }
::selection { background: var(--green-200); }
:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

.wrap { width: 100%; max-width: 1140px; margin: 0 auto; padding: 28px 20px 40px; }
.wrap-narrow { max-width: 880px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.right { text-align: right; }
.center { text-align: center; justify-content: center; }
.grow { flex: 1; }
.row { display: flex; align-items: center; }
.g10 { gap: 10px; }
.wrap-row { flex-wrap: wrap; }
.mt { margin-top: 22px; }
.accent { color: var(--green); }
.eyebrow { font-size: 12px; font-family: var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 6px; }
.lead { color: var(--fg-2); font-size: 16px; max-width: 760px; }
.link { color: var(--green-h); font-weight: 500; background: none; border: 0; padding: 0; cursor: pointer; font: inherit; font-size: 13px; }
.link:hover { text-decoration: underline; }
.back { display: inline-block; margin-bottom: 14px; }

/* ---------------------------------------------------------------- topbar */
.topbar { position: sticky; top: 0; z-index: 40; background: var(--glass); backdrop-filter: saturate(180%) blur(8px); -webkit-backdrop-filter: saturate(180%) blur(8px); border-bottom: 1px solid var(--border); }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 0 16px; height: 60px; display: flex; align-items: center; gap: 14px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: -.03em; font-size: 16px; flex: none; }
.brand-lg { font-size: 22px; gap: 12px; }
.mainnav { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a { position: relative; display: flex; align-items: center; gap: 6px; padding: 7px 10px; border-radius: 8px; color: var(--muted); font-size: 14px; font-weight: 500; white-space: nowrap; transition: color .15s, background .15s; }
.mainnav a:hover { color: var(--fg); background: var(--bg-3); }
.mainnav a.on { color: var(--fg); background: var(--bg-3); }
.mainnav a.on .ic { color: var(--green); }
.mainnav .dot, .chip-bell b { min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--green); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; font-style: normal; }
.chip-bell b { position: absolute; }
.userbox { display: flex; align-items: center; gap: 8px; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border: 1px solid var(--border); border-radius: 999px; font-size: 13px; font-weight: 600; font-family: var(--mono); background: var(--surface); color: inherit; position: relative; }
.chip-streak { color: var(--muted); }
.chip-streak.hot { color: var(--orange); border-color: var(--orange-200); background: var(--orange-50); }
.chip-coins .ic { color: var(--amber); }
.chip-bell { padding: 0 8px; color: var(--muted); }
.chip-bell.has { color: var(--fg); }
.chip-bell b { top: -6px; right: -6px; }
.me { display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px; border: 1px solid var(--border); border-radius: 999px; }
.me:hover { border-color: var(--border-2); }
.me-av { width: 34px; height: 34px; border-radius: 50%; overflow: hidden; display: grid; place-items: center; background: var(--bg-3); border: 1px solid var(--border); }
.me-av svg { width: 52px; height: auto; transform: translate(2px, 4px); }
.me-txt { display: flex; flex-direction: column; line-height: 1.1; }
.me-txt strong { font-size: 13px; }
.me-txt small { font-size: 11px; color: var(--muted); font-family: var(--mono); }

@media (max-width: 1080px) {
  .topbar-inner { height: auto; flex-wrap: wrap; padding: 10px 14px 0; row-gap: 6px; }
  .brand { order: 1; }
  .userbox { order: 2; margin-left: auto; }
  .mainnav { order: 3; flex-basis: 100%; padding-bottom: 6px; }
  .me-txt { display: none; }
  .me { padding: 2px; }
}

/* ---------------------------------------------------------------- base components */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 18px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin-bottom: 8px; }
.page-head .lead { margin: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-2 > .card, .grid-3 > .card { margin-bottom: 0; }
.grid-2, .grid-3 { margin-bottom: 18px; }
@media (max-width: 900px) { .grid-3 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } h1 { font-size: 25px; } .wrap { padding: 20px 16px 32px; } }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid transparent; font: inherit; font-size: 14px; font-weight: 550; cursor: pointer; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, transform .05s; user-select: none; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--green); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--green-btn-h); }
.btn-dark { background: var(--fg); color: var(--fg-inv); }
.btn-dark:hover:not(:disabled) { background: var(--fg-2); }
.btn-ghost { background: var(--surface); color: var(--fg); border-color: var(--border); }
.btn-ghost:hover:not(:disabled) { border-color: var(--border-2); background: var(--bg-2); }
.btn-danger { background: var(--surface); color: var(--red); border-color: var(--red-200); }
.btn-danger:hover { background: var(--red-50); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 7px; }
.btn-lg { height: 44px; padding: 0 18px; font-size: 15px; border-radius: 9px; }
.btn-block { width: 100%; }
form { margin: 0; }
.inline-form { display: inline-flex; gap: 6px; margin: 2px 6px 2px 0; }
.inline-form input { height: 30px; padding: 0 8px; border: 1px solid var(--border); border-radius: 7px; font: inherit; font-size: 13px; width: 130px; background: var(--surface); color: var(--fg); }

.pill { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; background: var(--bg-3); color: var(--fg-2); font-size: 12px; font-weight: 600; white-space: nowrap; border: 1px solid var(--border); }
.pill-ok { background: var(--green-50); color: var(--green-h); border-color: var(--green-200); }
.pill-bad { background: var(--red-50); color: var(--red); border-color: var(--red-200); }
.pill-warn { background: var(--amber-50); color: var(--amber); border-color: var(--amber-200); }
.tchip { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--fg-2); background: var(--surface); border: 1px solid var(--border); white-space: nowrap; }
.tchip::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--tc); }
.rchip { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11px; font-weight: 700; color: var(--rc); border: 1px solid currentColor; text-transform: uppercase; letter-spacing: .03em; font-family: var(--mono); background: var(--surface); }
.src-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--fg-inv); background: var(--fg); }
.src-modelo { background: var(--surface); color: var(--fg); border: 1px solid var(--fg); }
.title-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 600; color: var(--green-h); background: var(--green-50); border: 1px solid var(--green-200); }

.alert { padding: 11px 14px; border-radius: 9px; border: 1px solid var(--border); margin-bottom: 16px; font-size: 14px; background: var(--bg-2); }
.alert-err { border-color: var(--red-200); background: var(--red-50); color: var(--red-d); }
.alert-ok { border-color: var(--green-200); background: var(--green-50); color: var(--green-d); }

.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--fg-2); }
.form input, .form select, .tc-actions select { height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px; font: inherit; font-size: 15px; font-weight: 400; background: var(--surface); color: var(--fg); width: 100%; }
.form input:focus, .form select:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-100); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .form-row { grid-template-columns: minmax(0, 1fr); } }
.hint { font-size: 13px; color: var(--muted); margin: 0; }

.bar { height: 8px; background: var(--bg-3); border-radius: 99px; overflow: hidden; border: 1px solid var(--border); flex: 1; min-width: 40px; }
.bar > span { display: block; height: 100%; background: var(--green); border-radius: 99px; transition: width .5s cubic-bezier(.2, .8, .2, 1); }
.bar-lg { height: 12px; }
.bar-warn > span { background: #f59e0b; }
.bar-bad > span { background: var(--red); }
.bar-empty > span { background: transparent; }
.bar-hp > span { background: var(--red); }

.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.kpis-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpis > div, .stat-row > div, .rewards > div, .season-box > div { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; background: var(--bg-2); min-width: 0; }
.k { font-size: 11.5px; color: var(--muted); font-family: var(--mono); text-transform: uppercase; letter-spacing: .04em; }
.v { font-size: 20px; font-weight: 650; letter-spacing: -.02em; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.v.hot { color: var(--orange); }
.g-good { color: var(--green-h); }
.g-ok { color: var(--amber); }
.g-bad { color: var(--red); }
@media (max-width: 640px) { .kpis-5 { grid-template-columns: repeat(2, 1fr); } }

.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); font-family: var(--mono); text-transform: uppercase; letter-spacing: .04em; padding: 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 9px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table a:not(.ulink):not(.btn) { font-weight: 500; }
.table a:not(.ulink):not(.btn):hover { color: var(--green-h); }
.grade { font-family: var(--mono); font-weight: 700; }

.tabs, .seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--bg-3); border: 1px solid var(--border); border-radius: 10px; }
.tabs a, .seg a, .seg button { padding: 6px 12px; border-radius: 7px; font-size: 13.5px; font-weight: 550; color: var(--muted); border: 0; background: none; cursor: pointer; font-family: inherit; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.tabs a.on, .seg a.on, .seg button.on { background: var(--raised); color: var(--fg); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.tabs { display: flex; margin-bottom: 18px; }
.tabs a { flex: 1; text-align: center; justify-content: center; }
.tabbar { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 18px; scrollbar-width: thin; }
.tabbar a { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 13.5px; font-weight: 550; color: var(--muted); white-space: nowrap; background: var(--surface); }
.tabbar a:hover { color: var(--fg); border-color: var(--border-2); }
.tabbar a.on { color: var(--fg-inv); background: var(--fg); border-color: var(--fg); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips a, .chips button { padding: 5px 11px; border: 1px solid var(--border); border-radius: 999px; font-size: 13px; font-weight: 550; color: var(--muted); background: var(--surface); cursor: pointer; font-family: inherit; }
.chips a.on, .chips button.on { background: var(--green-50); border-color: var(--green-200); color: var(--green-h); }

.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 26px 12px; color: var(--muted); border: 1px dashed var(--border-2); border-radius: 10px; }
.empty p { margin: 0; font-size: 14px; }

.ulink { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; vertical-align: middle; }
.ulink:hover .ulink-name { color: var(--green-h); }
.ulink-av { width: 30px; height: 30px; border-radius: 8px; overflow: hidden; display: inline-grid; place-items: center; border: 1px solid var(--border); background: var(--bg-3); flex: none; }
.ulink-av svg { width: 160%; height: auto; transform: translate(1px, 12%); }
.pos { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 6px; font-family: var(--mono); font-size: 12px; font-weight: 700; background: var(--bg-3); color: var(--muted); }
.pos-1 { background: var(--gold-bg); color: var(--gold-fg); }
.pos-2 { background: var(--bg-3); color: var(--silver-fg); border: 1px solid var(--border-2); }
.pos-3 { background: var(--bronze-bg); color: var(--bronze-fg); }
.mini-rank { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.mini-rank li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.mini-rank li .ulink { flex: 1; min-width: 0; }
.mini-rank li .ulink .ulink-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ---------------------------------------------------------------- auth */
body.bare { background: var(--bg-2); }
.auth-wrap { max-width: 1100px; min-height: calc(100vh - 70px); display: flex; align-items: center; }
.auth { display: grid; grid-template-columns: 1.2fr .9fr; gap: 40px; align-items: center; width: 100%; }
.auth-hero h1 { font-size: 46px; letter-spacing: -.045em; margin: 26px 0 14px; }
.auth-stats { list-style: none; padding: 0; margin: 22px 0; display: flex; gap: 26px; flex-wrap: wrap; }
.auth-stats li { display: flex; flex-direction: column; }
.auth-stats strong { font-size: 26px; letter-spacing: -.03em; }
.auth-stats span { font-size: 13px; color: var(--muted); }
.auth-avatars { display: flex; gap: 12px; flex-wrap: wrap; }
.auth-avatars svg { border-radius: 12px; border: 1px solid var(--border); background: var(--surface); }
.auth-card { padding: 26px; }
@media (max-width: 860px) { .auth { grid-template-columns: minmax(0, 1fr); gap: 20px; } .auth-hero h1 { font-size: 34px; } .auth-avatars svg { width: 30%; height: auto; } }

/* ---------------------------------------------------------------- dashboard */
.dash-hero { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; margin-bottom: 18px; }
.dash-hero .card { margin-bottom: 0; }
.hero-card { display: flex; gap: 22px; align-items: center; }
.hero-av svg, .ph-av svg, .sa-av svg, .vs-av svg { border-radius: 12px; border: 1px solid var(--border); display: block; height: auto; }
.hero-av { flex: none; }
.hero-info { flex: 1; min-width: 0; }
.hero-title { font-size: 34px; margin: 2px 0 8px; }
.lvl-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin-bottom: 16px; }
.stat-row .v { font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.dash-side { display: grid; gap: 10px; }
.tile { display: flex; align-items: center; gap: 12px; padding: 13px 14px; margin: 0; transition: border-color .15s, background .15s; }
.tile:hover { border-color: var(--border-2); background: var(--bg-2); }
.tile-accent { border-color: var(--green-200); background: var(--green-50); }
.tile-accent:hover { background: var(--green-100); border-color: var(--green-400); }
.tile-done { opacity: .75; }
.tile-ic { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); flex: none; color: var(--green); }
.tile-body { flex: 1; min-width: 0; display: grid; gap: 2px; }
.tile-body strong { font-size: 14px; }
.tile-body small { font-size: 12.5px; color: var(--muted); }
.tile-body .bar { margin-top: 4px; height: 6px; }
@media (max-width: 980px) { .dash-hero { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .hero-card { flex-direction: column; align-items: stretch; } .hero-av svg { width: 100%; } .stat-row { grid-template-columns: repeat(2, 1fr); } }

.missions { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.mission { border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; display: grid; gap: 7px; }
.mission.ready { border-color: var(--green-400); background: var(--green-50); }
.mission.claimed { opacity: .6; }
.m-top, .m-bottom { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; }
.m-bottom { min-height: 24px; }

.spark { display: flex; align-items: flex-end; gap: 6px; height: 90px; padding: 8px 0 4px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.spark-lg { height: 120px; }
.spark-bar { flex: 1; max-width: 34px; border-radius: 4px 4px 0 0; background: var(--green); }
.spark-bar.g-ok { background: #f59e0b; }
.spark-bar.g-bad { background: var(--red); }

.topic-bars { list-style: none; padding: 0; margin: 0; display: grid; gap: 11px; }
.topic-bars li > a, .tb-label { display: flex; justify-content: space-between; font-size: 13.5px; font-weight: 550; margin-bottom: 4px; }
.topic-bars li > a:hover { color: var(--green-h); }
.topic-bars .bar { height: 7px; }
.topic-bars-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 22px; }
@media (max-width: 640px) { .topic-bars-2 { grid-template-columns: minmax(0, 1fr); } }

/* ---------------------------------------------------------------- start / practice */
.start-grid .card { margin-bottom: 0; }
.choice-cards { display: grid; gap: 10px; margin: 14px 0 16px; }
.choice-card { display: flex; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; align-items: flex-start; }
.choice-card:has(input:checked) { border-color: var(--green); background: var(--green-50); box-shadow: 0 0 0 3px var(--green-100); }
.choice-card input { margin-top: 4px; accent-color: var(--green); }
.choice-card span { display: grid; gap: 3px; }
.choice-card strong { display: flex; align-items: center; gap: 6px; font-size: 14.5px; }
.choice-card small { color: var(--muted); font-size: 13px; }
.checklist { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 8px; font-size: 14px; }
.checklist li { display: flex; gap: 8px; align-items: flex-start; }
.checklist .ic { color: var(--green); margin-top: 3px; }

.review-card { display: flex; gap: 16px; align-items: center; border-color: var(--green-200); background: var(--green-50); }
.review-card.is-empty { background: var(--surface); border-color: var(--border); }
.rc-ic { width: 46px; height: 46px; border-radius: 11px; background: var(--surface); border: 1px solid var(--green-200); display: grid; place-items: center; color: var(--green); flex: none; }
.rc-body { flex: 1; }
.rc-body h2 { margin-bottom: 4px; }
.rc-body p { margin: 0; }
@media (max-width: 640px) { .review-card { flex-direction: column; align-items: flex-start; } }
.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.topic-card { margin: 0; display: flex; flex-direction: column; gap: 8px; border-top: 3px solid var(--tc); }
.topic-card.is-focus { box-shadow: 0 0 0 3px var(--green-100); border-color: var(--green); border-top-color: var(--tc); }
.topic-card h3 { font-size: 17px; margin: 2px 0 0; }
.topic-card p { margin: 0; flex: 1; }
.tc-top { display: flex; justify-content: space-between; align-items: center; }
.tc-tag { font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 5px; color: #fff; background: var(--tc); }
.tc-stats { display: flex; justify-content: space-between; color: var(--muted); }
.tc-actions { display: flex; gap: 8px; margin-top: 6px; }
.tc-actions select { height: 30px; font-size: 13px; padding: 0 8px; }

/* ---------------------------------------------------------------- quiz */
.quiz-top { position: sticky; top: 61px; z-index: 5; background: var(--glass-2); padding: 10px 0 12px; margin: -10px 0 14px; }
@media (max-width: 1080px) { .quiz-top { top: 96px; } }
.quiz-title { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.quiz-title .eyebrow { margin: 0; }
.quiz-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.quiz-meta > span { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; font-family: var(--mono); font-size: 13px; font-weight: 600; background: var(--surface); }
.qm-pos { color: var(--fg); }
.qm-timer.low { color: var(--red); border-color: var(--red-200); background: var(--red-50); }
.qm-lives { color: var(--red); letter-spacing: 1px; }
.quiz-nav { display: grid; grid-template-columns: repeat(auto-fill, minmax(26px, 1fr)); gap: 4px; margin-bottom: 4px; }
/* cada pergunta é um botão: as já respondidas abrem-se para rever (área de toque maior que a barra) */
.quiz-nav button { all: unset; box-sizing: border-box; display: block; position: relative; height: 16px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.quiz-nav button::before { content: ""; position: absolute; left: 0; right: 0; top: 4px; height: 8px; box-sizing: border-box; border-radius: 3px; background: var(--bg-3); border: 1px solid var(--border); transition: transform .12s; }
.quiz-nav button.cur::before { background: var(--fg); border-color: var(--fg); }
.quiz-nav button.ok::before { background: var(--green); border-color: var(--green); }
.quiz-nav button.bad::before { background: var(--red); border-color: var(--red); }
.quiz-nav button.part::before { background: #f59e0b; border-color: #f59e0b; }
.quiz-nav button.done::before { background: var(--muted-2); border-color: var(--muted-2); }
.quiz-nav button.skip::before { background: transparent; border: 1.5px dashed var(--muted-2); }
.quiz-nav button.view::before { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3.5px var(--fg); }
.quiz-nav button:disabled { cursor: default; }
.quiz-nav button:not(:disabled):hover::before { transform: scaleY(1.4); }
.quiz-nav button:focus-visible::before { outline: 2px solid var(--green); outline-offset: 2px; }
.past-banner { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; margin: -4px 0 14px; padding: 8px 12px; border-radius: 9px; background: var(--bg-3); border: 1px solid var(--border); font-size: 13.5px; color: var(--fg-2); }
.past-banner .link { margin-left: auto; font-size: 13.5px; font-weight: 600; }
.gap.ro { cursor: default; }
.quiz-progress { height: 3px; background: var(--bg-3); border-radius: 2px; overflow: hidden; }
.quiz-progress span { display: block; height: 100%; width: 0; background: var(--green); transition: width .4s; }
.qcard { padding: 24px; min-height: 280px; }
.q-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.q-num { font-family: var(--mono); font-size: 13px; color: var(--muted); font-weight: 600; margin-right: 4px; }
.q-text { font-size: 17px; line-height: 1.6; margin-bottom: 16px; color: var(--fg); }
.q-text code { font-size: .86em; }
.codes { display: grid; gap: 10px; margin: 0 0 18px; }
.codes-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 760px) { .codes-2 { grid-template-columns: minmax(0, 1fr); } }
.code { margin: 0; border: 1px solid var(--border); border-radius: 9px; overflow: hidden; background: var(--bg-2); min-width: 0; }
.code figcaption { font-family: var(--mono); font-size: 11.5px; color: var(--muted); padding: 6px 12px; border-bottom: 1px solid var(--border); background: var(--surface); text-transform: uppercase; letter-spacing: .04em; }
.code pre { margin: 0; padding: 12px 14px; overflow-x: auto; font-size: 12.5px; line-height: 1.6; }
.code pre code { background: none; border: 0; padding: 0; font-size: inherit; white-space: pre; }
.tk-tag { color: var(--tk-tag); }
.tk-attr { color: var(--tk-attr); }
.tk-str { color: var(--tk-str); }
.tk-kw { color: var(--tk-kw); }
.tk-com { color: var(--muted-2); }

.opts { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.opt { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 13px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); cursor: pointer; font: inherit; font-size: 15px; color: var(--fg); transition: border-color .12s, background .12s, box-shadow .12s; }
.opt:hover:not(:disabled) { border-color: var(--border-2); background: var(--bg-2); }
.opt.sel { border-color: var(--fg); box-shadow: 0 0 0 1px var(--fg); }
.opt:disabled { cursor: default; }
.opt-letter { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; font-family: var(--mono); font-size: 13px; font-weight: 700; border: 1px solid var(--border-2); color: var(--muted); flex: none; background: var(--surface); }
.opt.sel .opt-letter { background: var(--fg); color: var(--fg-inv); border-color: var(--fg); }
.opt-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.opt.correct { border-color: var(--green); background: var(--green-50); box-shadow: 0 0 0 1px var(--green); }
.opt.correct .opt-letter { background: var(--green); color: #fff; border-color: var(--green); }
.opt.wrong { border-color: var(--red); background: var(--red-50); box-shadow: 0 0 0 1px var(--red); }
.opt.wrong .opt-letter { background: var(--red); color: #fff; border-color: var(--red); }
.opt.dim { opacity: .55; }
.tf { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tf .opt { justify-content: center; font-weight: 600; padding: 18px; }
.tf .opt .opt-text { flex: none; text-align: center; }
.opts-review li { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 9px; font-size: 14.5px; }
.opts-review li .ic { margin-left: auto; }
.opts-review li.is-correct { border-color: var(--green); background: var(--green-50); }
.opts-review li.is-correct .ic { color: var(--green); }
.opts-review li.is-chosen:not(.is-correct) { border-color: var(--red); background: var(--red-50); }
.opts-review li.is-chosen:not(.is-correct) .ic { color: var(--red); }
.opts-review li.is-chosen .opt-letter, .opts-review li.is-chosen::before { font-weight: 700; }
.opts-tf { grid-template-columns: 1fr 1fr; }

/* drag & drop */
.dnd-text { font-size: 16px; line-height: 2.3; margin-bottom: 18px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-2); }
.gap { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; min-width: 120px; min-height: 34px; padding: 3px 10px; margin: 2px 2px; border: 1.5px dashed var(--border-2); border-radius: 8px; background: var(--surface); line-height: 1.3; font-size: 14px; cursor: pointer; transition: border-color .12s, background .12s, box-shadow .12s; max-width: 100%; overflow-wrap: anywhere; }
.gap.over, .gap.target { border-color: var(--green); background: var(--green-50); box-shadow: 0 0 0 3px var(--green-100); }
.gap.filled { border-style: solid; border-color: var(--fg); font-weight: 600; touch-action: none; }
.gap.gap-ok { border: 1.5px solid var(--green); background: var(--green-50); color: var(--green-d); font-weight: 600; cursor: default; }
.gap.gap-bad { border: 1.5px solid var(--red); background: var(--red-50); color: var(--red); font-weight: 600; cursor: default; }
.gap.gap-fix { border: 1.5px solid var(--green); background: var(--surface); color: var(--green-d); font-weight: 600; cursor: default; }
.gap.gap-fix::before { content: "→ "; color: var(--muted); font-weight: 400; }
.gap i { font-weight: 400; color: var(--muted); }
.pool { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; min-height: 58px; }
.pool-label { font-size: 12px; font-family: var(--mono); color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 0 0 6px; }
.token { display: inline-flex; align-items: center; padding: 7px 12px; border: 1px solid var(--border-2); border-bottom-width: 2px; border-radius: 8px; background: var(--surface); color: var(--fg); font: inherit; font-size: 14px; font-weight: 550; cursor: grab; touch-action: none; user-select: none; max-width: 100%; overflow-wrap: anywhere; text-align: left; }
.token:hover { border-color: var(--fg); }
.token.picked { border-color: var(--green); background: var(--green-50); box-shadow: 0 0 0 3px var(--green-100); }
.token.used { opacity: .3; pointer-events: none; }
.token.g2 { border-left: 4px solid #2563eb; }
.token.g3 { border-left: 4px solid #d97706; }
.token.g4 { border-left: 4px solid #7c3aed; }
.gap[data-g="2"] { border-color: #93c5fd; }
.gap[data-g="3"] { border-color: #fcd34d; }
.gap[data-g="4"] { border-color: #c4b5fd; }
.drag-ghost { position: fixed; z-index: 100; pointer-events: none; transform: translate(-50%, -50%) rotate(-2deg); box-shadow: var(--shadow-lg); cursor: grabbing; }
body.dragging, body.dragging * { cursor: grabbing !important; }

.feedback { margin-top: 18px; border-radius: 10px; padding: 14px 16px; border: 1px solid; animation: pop .25s ease; }
.feedback.ok { border-color: var(--green-200); background: var(--green-50); }
.feedback.bad { border-color: var(--red-200); background: var(--red-50); }
.feedback.part { border-color: var(--amber-200); background: var(--amber-50); }
.feedback.neutral { border-color: var(--border); background: var(--bg-2); }
.fb-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.feedback.ok .fb-title { color: var(--green-h); }
.feedback.bad .fb-title { color: var(--red); }
.feedback.part .fb-title { color: var(--amber); }
.fb-body { font-size: 14.5px; color: var(--fg-2); }
.fb-body p:last-child { margin: 0; }
.fb-dmg { margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--red); font-weight: 600; }
.exp-variant { padding: 8px 10px; border-radius: 8px; background: var(--surface); border: 1px dashed var(--amber-200); font-size: 13.5px; }
.fb-toggle { margin-top: 4px; }
.feedback { scroll-margin: 72px 0 96px; }
/* explicação aprofundada: parágrafos, listas e caixa de exemplo */
.fb-body p, .exp-body p { margin: 0 0 .65em; }
.fb-body > :last-child, .exp-body > :last-child { margin-bottom: 0; }
.exp-list { margin: 0 0 .65em; padding-left: 1.25em; }
.exp-list li { margin: .2em 0; }
.exp-list li::marker { color: var(--muted-2); }
.exp-ex { margin-top: 12px; padding: 10px 12px 12px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border); }
.exp-ex-h { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--green-h); }
.exp-ex .code { margin: 8px 0; }
.exp-ex > :last-child, .exp-ex p:last-child { margin-bottom: 0; }
.fb-body .code, .exp-body .code { margin: 8px 0; }
.fb-body .code pre, .exp-body .code pre { font-size: 12px; }
@media (max-width: 640px) {
  /* no telemóvel, menos caixas dentro de caixas: mais largura para o código do exemplo */
  .exp-ex { padding: 8px 8px 10px; margin-left: -4px; margin-right: -4px; }
  .fb-body .code pre, .exp-body .code pre { font-size: 11px; padding: 9px 10px; }
}
@media (max-width: 640px) { .prev-txt { display: none; } [data-prev] { padding: 0 12px; } }
/* "Deixar em branco" (só no teste): texto curto em ecrãs estreitos */
.skip-s { display: none; }
@media (max-width: 640px) { .skip-l { display: none; } .skip-s { display: inline; } [data-skip] { padding: 0 12px; } }
.rq { scroll-margin-top: 96px; }
/* botão escondido sem a barra mudar de altura (treino: a resposta conta ao escolher) */
.btn.is-ghost { visibility: hidden; }
@keyframes pop { from { transform: translateY(4px); opacity: 0; } to { transform: none; opacity: 1; } }

.quiz-actions { display: flex; align-items: center; gap: 10px; position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: var(--glass-2); border-top: 1px solid var(--border); z-index: 5; }
.kbd-hint { font-size: 12px; color: var(--muted); }
@media (max-width: 640px) { .kbd-hint { display: none; } .qcard { padding: 18px 16px; } .q-text { font-size: 16px; } .tf { grid-template-columns: 1fr 1fr; } .gap { min-width: 90px; } }
.q-skeleton { display: grid; gap: 12px; }
.q-skeleton div { height: 18px; border-radius: 6px; background: var(--bg-3); animation: pulse 1.2s infinite; }
.q-skeleton div:nth-child(2) { width: 80%; }
.q-skeleton div:nth-child(3) { width: 60%; }
@keyframes pulse { 50% { opacity: .5; } }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

/* ---------------------------------------------------------------- results */
.result-hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 24px; align-items: start; }
.big-grade { font-size: 64px; font-weight: 700; letter-spacing: -.05em; line-height: 1; margin: 8px 0 10px; font-family: var(--font); }
.big-grade small { font-size: 22px; color: var(--muted); font-weight: 500; letter-spacing: -.01em; }
.rewards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.rewards .v { color: var(--green-h); }
.notes { margin: 0 0 12px; padding-left: 18px; font-size: 13px; color: var(--muted); }
@media (max-width: 760px) { .result-hero { grid-template-columns: minmax(0, 1fr); } .big-grade { font-size: 52px; } }
.review-head { display: flex; justify-content: space-between; align-items: center; margin: 26px 0 14px; gap: 10px; flex-wrap: wrap; }
.review-head h2 { margin: 0; }
.rq { border-left: 3px solid var(--border-2); }
.rq-ok { border-left-color: var(--green); }
.rq-bad { border-left-color: var(--red); }
.rq-part { border-left-color: #f59e0b; }
.rq-skip { border-left-color: var(--muted-2); border-left-style: dashed; }
.rq-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.rq-n { font-family: var(--mono); font-weight: 700; font-size: 13px; width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; background: var(--bg-3); }
.rq-res { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; }
.rq-ok .rq-res { color: var(--green-h); }
.rq-bad .rq-res { color: var(--red); }
.rq-skip .rq-res { color: var(--muted); }
.rq .q-text { font-size: 15.5px; }
.exp { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 10px; }
.exp summary { cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--muted); list-style: none; }
.exp summary::-webkit-details-marker { display: none; }
.exp[open] summary { color: var(--fg); margin-bottom: 6px; }
.exp-body { font-size: 14.5px; color: var(--fg-2); }
.exp-body p:last-child { margin: 0; }
.dnd-review { line-height: 2.4; }
.review.only-wrong .rq[data-ok="1"], .review.only-wrong .rq[data-skip] { display: none; }
.review.only-skip .rq:not([data-skip]) { display: none; }
/* resumo da cotação do teste: certas · parciais · erradas (desconto) · em branco */
.score-split { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 2px 0 10px; font-size: 13.5px; color: var(--fg-2); }
.score-split .ss { display: inline-flex; align-items: center; gap: 5px; }
.score-split .ss::before { content: ""; width: 9px; height: 9px; border-radius: 3px; flex: none; }
.score-split b { font-family: var(--mono); color: var(--fg); }
.score-split small { color: var(--red); font-family: var(--mono); font-size: 12.5px; }
.ss-ok::before { background: var(--green); }
.ss-part::before { background: #f59e0b; }
.ss-bad::before { background: var(--red); }
.ss-skip::before { border: 1.5px dashed var(--muted-2); box-sizing: border-box; }

/* ---------------------------------------------------------------- games */
.claim-banner { display: flex; align-items: center; gap: 14px; border-color: var(--green-400); background: var(--green-50); flex-wrap: wrap; }
.raid { display: grid; grid-template-columns: auto 1fr minmax(200px, 260px); gap: 24px; align-items: start; }
.raid-art { width: 184px; height: 184px; border-radius: 14px; display: grid; place-items: center; background: var(--bg-2); border: 1px solid var(--border); }
.raid-art svg { animation: bob 2.4s ease-in-out infinite; }
.raid-art.dead svg { animation: none; transform: rotate(90deg) translateX(14px); opacity: .7; }
@keyframes bob { 50% { transform: translateY(-5px); } }
.raid-name { font-size: 24px; margin: 0 0 6px; }
.hp { margin: 12px 0; }
.hp-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; font-size: 13px; }
.raid-rank h3 { margin-bottom: 10px; }
@media (max-width: 920px) { .raid { grid-template-columns: minmax(0, 1fr); } .raid-art { width: 100%; } }
.games-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.games-grid .card { margin: 0; }
.game { display: flex; flex-direction: column; gap: 12px; }
.game-head { display: flex; gap: 12px; align-items: flex-start; }
.game-head h2 { margin-bottom: 4px; }
.game-head p { margin: 0; }
.game-ic { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; background: var(--green-50); color: var(--green); border: 1px solid var(--green-200); flex: none; }
.game-mine { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; padding: 9px 12px; border-radius: 9px; background: var(--bg-2); border: 1px solid var(--border); }
.sub { font-size: 12px; font-family: var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 6px 0 0; font-weight: 600; }

/* ---------------------------------------------------------------- duels */
.record { display: flex; gap: 8px; }
.record span { display: flex; flex-direction: column; align-items: center; padding: 8px 12px; border: 1px solid var(--border); border-radius: 9px; font-size: 11px; color: var(--muted); font-family: var(--mono); min-width: 58px; }
.record b { font-size: 20px; color: var(--fg); font-family: var(--font); }
.duel-grid .card { margin: 0; }
.duel-row { display: flex; align-items: center; gap: 12px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; transition: border-color .15s, background .15s; }
.duel-row:hover { border-color: var(--border-2); background: var(--bg-2); }
.duel-row .ulink-av { width: 38px; height: 38px; }
.dr-main { flex: 1; min-width: 0; display: grid; }
.dr-main small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.duel-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); column-gap: 10px; }
.players { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.player { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 8px; border: 1px solid var(--border); border-radius: 10px; text-align: center; transition: border-color .15s; }
.player:hover { border-color: var(--green); }
.player svg { border-radius: 8px; border: 1px solid var(--border); }
.player strong { font-size: 13.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.online { position: absolute; top: 9px; right: 9px; width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px var(--green-100); }
.online-txt { color: var(--green-h); }
.duel-detail { text-align: center; }
.versus { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; margin: 18px 0; }
.vs-side { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; }
.vs-side.winner { border-color: var(--green); background: var(--green-50); box-shadow: 0 0 0 3px var(--green-100); }
.vs-av svg { width: 100%; max-width: 200px; }
.vs-mid { font-family: var(--mono); font-weight: 800; font-size: 22px; color: var(--muted-2); }
.vs-score { min-height: 40px; display: flex; align-items: baseline; gap: 4px; }
.vs-score .big { font-size: 30px; font-weight: 700; }
.duel-status { font-size: 17px; margin-bottom: 14px; }
.okc { color: var(--green); }
.badc { color: var(--red); }
.cmp td:nth-child(2) { max-width: 420px; }
@media (max-width: 560px) { .versus { grid-template-columns: 1fr 1fr; } .vs-mid { display: none; } }

/* ---------------------------------------------------------------- ranking */
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; max-width: 640px; margin: 0 auto 18px; }
.podium-step { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.podium-av svg { border-radius: 10px; border: 1px solid var(--border); background: var(--surface); height: auto; max-width: 100%; }
.podium-val { font-family: var(--mono); font-weight: 700; }
.podium-block { width: 100%; border: 1px solid var(--border); border-bottom: 0; border-radius: 10px 10px 0 0; display: grid; place-items: center; font-size: 26px; font-weight: 800; color: var(--muted); background: var(--bg-2); margin-top: 6px; }
.p1 .podium-block { height: 92px; background: var(--gold-bg); color: var(--gold-fg); border-color: var(--gold-bd); }
.p2 .podium-block { height: 66px; }
.p3 .podium-block { height: 48px; background: var(--bronze-bg); color: var(--bronze-fg); border-color: var(--bronze-bd); }
.rank-table .me-row td { background: var(--green-50); }
.w-pos { width: 48px; }

/* ---------------------------------------------------------------- pass */
.season-box { display: grid; grid-template-columns: repeat(4, auto); gap: 8px; }
@media (max-width: 640px) { .season-box { grid-template-columns: repeat(2, 1fr); width: 100%; } }
.pass-track { display: flex; gap: 10px; overflow-x: auto; padding: 16px 2px 8px; scroll-snap-type: x proximity; }
.tier { flex: 0 0 150px; scroll-snap-align: start; border: 1px solid var(--border); border-radius: 11px; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; background: var(--surface); }
.tier.locked { background: var(--bg-2); }
.tier.locked .tier-art { opacity: .45; filter: grayscale(.6); }
.tier.unlocked { border-color: var(--green-200); }
.tier.unlocked:not(.claimed) { box-shadow: 0 0 0 3px var(--green-100); border-color: var(--green); }
.tier.special { border-width: 1.5px; }
.tier.special.r-lendario { border-color: #f59e0b; }
.tier.special.r-epico { border-color: #8b5cf6; }
.tier-n { font-family: var(--mono); font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.tier-art { height: 68px; display: grid; place-items: center; }
.tier-coins { color: var(--amber); }
.tier-name { font-size: 13px; font-weight: 600; line-height: 1.25; min-height: 32px; display: grid; place-items: center; }
.tier-act { min-height: 30px; display: grid; place-items: center; }

/* ---------------------------------------------------------------- shop */
.shop { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 18px; align-items: start; }
.shop-avatar { position: sticky; top: 76px; }
.sa-av svg { width: 100%; }
.sa-name { display: flex; align-items: center; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.eq-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.eq-list li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.eq-list li:last-child { border: 0; }
.shop-filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.item { margin: 0; padding: 14px; display: flex; flex-direction: column; gap: 10px; border-top: 3px solid var(--border-2); }
.item.r-raro { border-top-color: #2563eb; }
.item.r-epico { border-top-color: #7c3aed; }
.item.r-lendario { border-top-color: #d97706; }
.item.equipped { box-shadow: 0 0 0 2px var(--green); }
.item-art { height: 104px; display: grid; place-items: center; background: var(--bg-2); border-radius: 9px; border: 1px solid var(--border); }
.title-big { font-weight: 700; letter-spacing: -.02em; padding: 6px 12px; border-radius: 8px; border: 1px solid var(--green-200); background: var(--green-50); color: var(--green-h); text-align: center; }
.item-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; }
.item-top strong { font-size: 14.5px; line-height: 1.3; }
.item-body p { margin: 4px 0 0; }
.item-act { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; min-height: 30px; }
.price { display: inline-flex; align-items: center; gap: 5px; font-family: var(--mono); font-weight: 700; }
.price .ic { color: var(--amber); }
@media (max-width: 880px) { .shop { grid-template-columns: minmax(0, 1fr); } .shop-avatar { position: static; } .sa-av svg { max-width: 360px; display: block; margin: 0 auto; } }

/* ---------------------------------------------------------------- profile */
.profile-hero { display: flex; gap: 26px; align-items: center; }
.ph-av { flex: none; }
.ph-info { flex: 1; min-width: 0; }
.ph-info h1 { margin: 2px 0 6px; font-size: 34px; }
.ph-info .title-tag { margin-bottom: 12px; }
@media (max-width: 760px) { .profile-hero { flex-direction: column; align-items: stretch; } .ph-av svg { width: 100%; } }
.achs { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.ach { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border: 1px solid var(--border); border-radius: 9px; opacity: .55; }
.ach span:last-child { display: grid; font-size: 13.5px; }
.ach small { font-size: 12px; }
.ach.got { opacity: 1; border-color: var(--green-200); background: var(--green-50); }
.ach-ic { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); flex: none; color: var(--muted); }
.ach.got .ach-ic { color: var(--amber); border-color: var(--amber-200); }
.narrow-card { max-width: 560px; }

/* ---------------------------------------------------------------- study */
.study { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 18px; align-items: start; }
.study-nav { position: sticky; top: 76px; padding: 10px; display: grid; gap: 2px; }
.study-nav a { display: grid; grid-template-columns: auto 1fr; column-gap: 9px; align-items: center; padding: 8px 10px; border-radius: 8px; font-size: 14px; font-weight: 550; }
.study-nav a small { grid-column: 2; font-size: 12px; }
.study-nav a:hover { background: var(--bg-3); }
.dotc { width: 9px; height: 9px; border-radius: 3px; background: var(--tc); grid-row: span 2; }
.study-topic { border-top: 3px solid var(--tc); scroll-margin-top: 80px; }
.st-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.st-head h2 { font-size: 22px; margin: 8px 0 0; }
.study-topic h3 { margin: 20px 0 8px; font-size: 13px; font-family: var(--mono); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.bullets { margin: 0; padding-left: 20px; display: grid; gap: 7px; font-size: 15px; }
.bullets li::marker { color: var(--green); }
.bullets li.trap { background: var(--amber-50); border: 1px solid var(--amber-200); border-radius: 8px; padding: 6px 10px; list-style: none; margin-left: -20px; }
@media (max-width: 860px) { .study { grid-template-columns: minmax(0, 1fr); } .study-nav { position: static; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); } }

.flash { max-width: 680px; margin: 0 auto; }
.flash-filters { justify-content: center; margin-bottom: 14px; }
.flash-stats { display: flex; justify-content: center; gap: 16px; font-size: 13px; color: var(--muted); margin-bottom: 14px; font-family: var(--mono); }
.flash-card { perspective: 1200px; height: 300px; cursor: pointer; margin-bottom: 16px; outline: none; }
.fc-inner { position: relative; width: 100%; height: 100%; transition: transform .45s cubic-bezier(.2, .8, .2, 1); transform-style: preserve-3d; }
.flash-card.flipped .fc-inner { transform: rotateY(180deg); }
.fc-front, .fc-back { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; border: 1px solid var(--border); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px; text-align: center; gap: 10px; }
.fc-back { transform: rotateY(180deg); background: var(--green-50); border-color: var(--green-200); }
.fc-text { font-size: 22px; font-weight: 600; letter-spacing: -.02em; line-height: 1.35; }
.fc-back .fc-text { font-size: 17px; font-weight: 500; letter-spacing: 0; }
.fc-topic { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.fc-hint { font-size: 12px; color: var(--muted-2); position: absolute; bottom: 14px; }
.flash-card:focus-visible .fc-front { box-shadow: 0 0 0 3px var(--green-100); }
.flash-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.flash-done { text-align: center; padding: 30px; }

/* ---------------------------------------------------------------- misc */
.notifs { list-style: none; padding: 0; margin: 0; }
.notifs li { display: flex; justify-content: space-between; gap: 12px; padding: 11px 4px; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.notifs li:last-child { border: 0; }
.notifs li.unread { font-weight: 600; }
.notifs li.unread::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-top: 8px; flex: none; }
.notifs li > :first-child { flex: 1; }
.notifs a:hover { color: var(--green-h); }
.hard-list { padding-left: 20px; display: grid; gap: 8px; font-size: 14px; }
.clamp-1 { display: inline; }

.foot { border-top: 1px solid var(--border); background: var(--bg-2); }
.foot-inner { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 18px; padding-bottom: 18px; font-size: 13px; flex-wrap: wrap; }
.foot-inner span { display: inline-flex; align-items: center; gap: 8px; }
body.bare .foot { display: none; }
body.page-jogar .foot { display: none; }

#toasts { position: fixed; right: 16px; bottom: 16px; z-index: 200; display: grid; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border-radius: 10px; background: var(--toast-bg); color: var(--toast-fg); border: 1px solid var(--toast-bd); font-size: 14px; box-shadow: var(--shadow-lg); animation: toastIn .25s ease; }
.toast.ok .ic { color: var(--green-400); }
.toast.err { background: #7f1d1d; }
.toast.hide { opacity: 0; transform: translateY(6px); transition: .25s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ================================================================ v2 · owner + telemóvel */
.owner-tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px 0 6px; border-radius: 6px; background: #0a0a0a; color: #4ade80; font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; vertical-align: middle; line-height: 1; flex: none; }
.owner-tag .ic { color: #facc15; vertical-align: 0; }
.owner-sm { height: 18px; padding: 0 6px 0 5px; font-size: 9.5px; gap: 3px; }
.owner-sm .ic { width: 10px; height: 10px; }
.owner-lg { height: 26px; font-size: 12px; padding: 0 10px 0 8px; }
.hero-hello { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.me-txt strong .ic { color: var(--amber); vertical-align: -1px; }
.ph-name { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.podium-step .owner-tag { margin-top: -2px; }

/* login: áreas da grelha */
.auth { grid-template-areas: "top card" "more card"; row-gap: 0; }
.auth-top { grid-area: top; align-self: end; }
.auth-more { grid-area: more; align-self: start; }
.auth-card { grid-area: card; }
.auth-top h1 { font-size: 46px; letter-spacing: -.045em; margin: 26px 0 14px; }

/* navegação de telemóvel (escondida no desktop) */
.mtab, .sheet { display: none; }

@media (max-width: 860px) {
  .mainnav { display: none; }
  .topbar-inner { height: 56px; flex-wrap: nowrap; padding: 0 12px; row-gap: 0; }
  .userbox { margin-left: auto; gap: 6px; }
  .chip { height: 32px; padding: 0 10px; }
  body.has-mtab { padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
  .mtab { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--glass-3); -webkit-backdrop-filter: saturate(180%) blur(10px); backdrop-filter: saturate(180%) blur(10px); border-top: 1px solid var(--border); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  body.page-jogar .mtab { display: none; }
  .mtab a, .mtab button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; height: 52px; border: 0; background: none; border-radius: 12px; color: var(--muted); font: inherit; font-size: 11px; font-weight: 600; cursor: pointer; -webkit-tap-highlight-color: transparent; }
  .mtab .on { color: var(--fg); }
  .mtab .on .ic { color: var(--green); }
  .mtab a:active, .mtab button:active { background: var(--bg-3); }
  .mtab .dot, .sheet-grid .dot { position: absolute; top: 3px; left: calc(50% + 7px); min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--green); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; font-style: normal; border: 2px solid var(--surface); box-sizing: content-box; }
  .sheet:not([hidden]) { display: block; position: fixed; inset: 0; z-index: 70; }
  .sheet-backdrop { position: absolute; inset: 0; background: var(--backdrop); animation: fadeIn .15s ease; }
  .sheet-panel { position: absolute; left: 0; right: 0; bottom: 0; background: var(--surface); border-radius: 18px 18px 0 0; padding: 8px 16px calc(16px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-sheet); animation: sheetUp .22s cubic-bezier(.2, .8, .2, 1); max-height: 85vh; overflow-y: auto; }
  .sheet-grip { width: 40px; height: 4px; border-radius: 2px; background: var(--border-2); margin: 4px auto 12px; }
  .sheet-me { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 14px; margin-bottom: 12px; }
  .sheet-me .ulink-av { width: 44px; height: 44px; border-radius: 12px; }
  .sheet-me-txt { flex: 1; min-width: 0; display: grid; gap: 2px; }
  .sheet-me-txt strong { display: flex; align-items: center; gap: 6px; }
  .sheet-me-txt small { font-size: 12.5px; }
  .sheet-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
  .sheet-grid a { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 4px 12px; border: 1px solid var(--border); border-radius: 14px; font-size: 12px; font-weight: 600; color: var(--fg-2); }
  .sheet-grid a .ic { color: var(--green); }
  .sheet-grid a.on { border-color: var(--green); background: var(--green-50); }
  .sheet-grid .dot { top: 6px; left: calc(50% + 8px); }
  body.sheet-open { overflow: hidden; }
  .foot { display: none; }
  #toasts { left: 12px; right: 12px; bottom: calc(80px + env(safe-area-inset-bottom)); max-width: none; }
  body.page-jogar #toasts { bottom: calc(86px + env(safe-area-inset-bottom)); }
  .quiz-top { top: 56px; }
  .form input, .form select, .tc-actions select, .inline-form input { font-size: 16px; }
  .auth { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "card" "more"; gap: 18px; }
  .auth-top h1 { font-size: 32px; margin: 18px 0 0; }
  .auth-wrap { min-height: 0; align-items: flex-start; }
  .auth-stats { margin: 14px 0; gap: 18px; }
}
@keyframes sheetUp { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

@media (max-width: 880px) {
  .shop-avatar { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 12px 14px; align-items: center; }
  .sa-av svg { width: 132px; max-width: none; margin: 0; }
  .sa-info .sa-name { margin: 0 0 8px; }
  .sa-info .kpis { margin-bottom: 0; gap: 6px; }
  .sa-info .kpis > div { padding: 7px 8px; }
  .sa-info .v { font-size: 16px; }
  .eq-list { grid-column: 1 / -1; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 16px; }
}

@media (max-width: 640px) {
  .wrap { padding: 16px 14px 28px; }
  .card { padding: 16px; border-radius: 12px; margin-bottom: 14px; }
  .grid-2, .grid-3 { gap: 14px; margin-bottom: 14px; }
  h1 { font-size: 24px; }
  .page-head { margin-bottom: 16px; gap: 12px; }
  .lead { font-size: 15px; }
  .btn { height: 40px; }
  .btn-sm { height: 34px; }
  .btn-lg { height: 48px; }
  /* início */
  .hero-card { gap: 14px; }
  .hero-av { align-self: center; }
  .hero-av svg { width: 220px; max-width: 100%; }
  .hero-title { font-size: 28px; }
  .hero-actions { flex-direction: column; }
  .hero-actions > *, .hero-actions form .btn { width: 100%; }
  .stat-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile { padding: 12px; }
  /* quiz */
  .quiz-top { padding: 8px 0 10px; margin: -6px 0 12px; }
  .quiz-title { margin-bottom: 8px; gap: 6px; }
  .quiz-title .eyebrow { width: 100%; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .quiz-meta { gap: 6px; }
  .quiz-meta > span { height: 28px; padding: 0 8px; font-size: 12.5px; }
  .quiz-nav { gap: 3px; }
  .quiz-nav span { height: 6px; }
  .qcard { padding: 16px 14px; min-height: 0; }
  .q-head { margin-bottom: 10px; }
  .q-text { font-size: 16px; line-height: 1.55; }
  .opts { gap: 8px; }
  .opt { padding: 12px; gap: 10px; font-size: 15px; border-radius: 12px; min-height: 52px; }
  .opt-letter { width: 28px; height: 28px; }
  .tf .opt { padding: 16px 8px; min-height: 60px; }
  .code pre { font-size: 11.5px; padding: 10px 12px; }
  .codes { margin-bottom: 14px; }
  .dnd-text { padding: 12px; font-size: 15px; line-height: 2.25; }
  .gap { min-width: 96px; min-height: 38px; font-size: 13.5px; }
  .pool { gap: 8px; padding: 10px; }
  .token { padding: 9px 12px; font-size: 14px; min-height: 40px; }
  .feedback { padding: 12px 14px; }
  .quiz-actions { gap: 8px; padding-top: 10px; }
  .quiz-actions .grow { display: none; }
  .quiz-actions [data-submit] { flex: 1; }
  /* resultados */
  .result-hero .row .btn, .result-hero .row form, .result-hero .row form .btn { width: 100%; }
  .rewards .v { font-size: 17px; }
  .rq { padding: 14px; }
  .opts-review li { font-size: 14px; padding: 9px 10px; }
  /* loja */
  .items { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .item { padding: 10px; gap: 8px; border-radius: 12px; }
  .item-art { height: 86px; }
  .item-art svg { width: 66px; height: auto; }
  .title-big { font-size: 12px; padding: 5px 8px; }
  .item-top { flex-direction: column; gap: 4px; }
  .item-top strong { font-size: 13px; }
  .item-body p { font-size: 11.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .item-act { flex-wrap: wrap; gap: 6px; }
  .item-act .btn { width: 100%; }
  .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chips a, .chips button { flex: none; }
  .flash-filters { justify-content: flex-start; }
  /* ranking */
  .podium { gap: 8px; }
  .podium-step strong { font-size: 13px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rank-table th:nth-child(n+4), .rank-table td:nth-child(n+4) { display: none; }
  .rank-table td { padding: 8px 6px; }
  .tabbar a { padding: 7px 10px; font-size: 13px; }
  /* passe */
  .tier { flex-basis: 128px; }
  .season-box .v { font-size: 17px; }
  /* duelos */
  .record { width: 100%; }
  .record span { flex: 1; min-width: 0; }
  .duel-row { gap: 10px; padding: 9px; }
  .duel-row .pill { font-size: 11px; }
  .players { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .player { padding: 10px 4px; }
  .player svg { width: 56px; height: auto; }
  .vs-side { padding: 10px 6px; }
  .vs-score .big { font-size: 24px; }
  /* perfil */
  .ph-av { align-self: center; }
  .ph-av svg { width: 240px; max-width: 100%; }
  .ph-info h1 { font-size: 28px; }
  .achs { grid-template-columns: minmax(0, 1fr); }
  /* estudar */
  .study-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .bullets { font-size: 14.5px; padding-left: 18px; }
  .flash-card { height: 260px; }
  .fc-text { font-size: 19px; }
  .fc-back .fc-text { font-size: 15.5px; }
  .topic-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .raid-art { height: 150px; }
  .raid-art svg { width: 130px; height: 130px; }
}

@media (max-width: 380px) {
  .brand span { display: none; }
  .chip-streak { display: none; }
  .players { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* textos com código longo (sem espaços) nunca podem alargar a página */
.bullets > li, .q-text, .exp-body, .fb-body, .opt-text, .lead, .tile-body small, .notifs li { min-width: 0; overflow-wrap: anywhere; }
.bullets { grid-template-columns: minmax(0, 1fr); }

/* ================================================================ tema claro / escuro */
/* botão da barra de topo (desktop) e do ecrã de entrada: lua no claro, sol no escuro */
.chip-theme { padding: 0 8px; color: var(--muted); cursor: pointer; -webkit-appearance: none; appearance: none; -webkit-tap-highlight-color: transparent; }
.chip-theme:hover { color: var(--fg); border-color: var(--border-2); }
.chip-theme .ti-moon { display: inline-flex; }
.chip-theme .ti-sun { display: none; }
[data-theme="dark"] .chip-theme .ti-moon { display: none; }
[data-theme="dark"] .chip-theme .ti-sun { display: inline-flex; }
.theme-fab { position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 14px; z-index: 5; height: 34px; padding: 0 9px; }
/* seletor Claro / Escuro / Auto (menu "Mais" e perfil) */
.theme-switch button .ic { width: 15px; height: 15px; }
.theme-card p { margin: 0 0 12px; }
.sheet-theme { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; padding: 8px 8px 8px 12px; border: 1px solid var(--border); border-radius: 14px; margin-bottom: 12px; }
.sheet-theme-label { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--fg-2); }
.sheet-theme-label .ic { color: var(--green); }
.sheet-theme .seg button { padding: 7px 10px; font-size: 13px; gap: 5px; }
@media (max-width: 860px) { .topbar .chip-theme { display: none; } }
/* barra de topo: espaço para o botão do tema sem cortar a navegação (a "Loja" ficava escondida) */
.topbar-inner { max-width: 1320px; }
@media (min-width: 1081px) and (max-width: 1320px) {
  .topbar-inner { gap: 10px; }
  .mainnav a { padding: 7px 8px; }
  .userbox { gap: 6px; }
}
@media (min-width: 1081px) and (max-width: 1239px) { .me-txt { display: none; } .me { padding: 2px; } }
@media (min-width: 1081px) and (max-width: 1141px) { .mainnav a .ic { display: none; } }

/* ajustes que as variáveis sozinhas não resolvem */
.tc-all .tc-tag { color: var(--fg-inv); }
[data-theme="dark"] body.bare { background: var(--bg); }
[data-theme="dark"] .logo-mark > rect:first-child { fill: #1c1c20; }
[data-theme="dark"] .owner-tag { box-shadow: inset 0 0 0 1px #3f3f46; }
[data-theme="dark"] .rchip { color: color-mix(in srgb, var(--rc) 66%, #fff); }
[data-theme="dark"] .tabs a.on, [data-theme="dark"] .seg a.on, [data-theme="dark"] .seg button.on { box-shadow: 0 1px 2px rgba(0, 0, 0, .45); }
[data-theme="dark"] .sheet-panel { border-top: 1px solid var(--border); }
/* avatares: os fundos claros ("Fundo Limpo", "Pontos" e "Grelha") escurecem com o tema */
[data-theme="dark"] .avbg-w { fill: #27272a; }
[data-theme="dark"] .avbg-p { fill: #232327; }
[data-theme="dark"] .avbg-pd { fill: #4b4b53; }
[data-theme="dark"] .avbg-g { fill: #0b2414; }
[data-theme="dark"] .avbg-gl { fill: #166534; }
/* miniaturas da loja: manequim e etiqueta de título */
[data-theme="dark"] .item-ghost rect { fill: #2e2e33; }
[data-theme="dark"] .item-ghost rect[fill="#d4d4d8"] { fill: #4b4b53; }
[data-theme="dark"] .ttl-bg { fill: #27272a; stroke: #52525b; }
[data-theme="dark"] .ttl-tx { fill: #e4e4e7; }
/* ao trocar de tema, tudo muda de uma vez (sem transições a meio) */
.theme-swap *, .theme-swap *::before, .theme-swap *::after { transition: none !important; }

/* telemóveis estreitos (≤380px): a barra do quiz com "Em branco" tem de caber numa linha */
@media (max-width: 380px) { .quiz-actions { gap: 6px; } .quiz-actions .btn-sm { padding: 0 8px; } .quiz-actions .btn-lg { padding: 0 12px; } .quiz-actions [data-skip] { padding: 0 10px; } }
