/* Styling inspired by the AWS console (Cloudscape Design System): palette, Open Sans, pill buttons. */

@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(../fonts/open-sans-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Open Sans";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(../fonts/open-sans-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Nunito - rounded font for the "cute" theme */
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(../fonts/nunito-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Nunito";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(../fonts/nunito-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------------------------------------------------------------- tokens: light */
:root {
  color-scheme: light;
  --font: "Open Sans", "Helvetica Neue", Roboto, Arial, sans-serif;

  --bg: #f4f4f4;
  --surface: #ffffff;
  --surface-2: #f4f4f4;
  --surface-hover: #f2f8fd;
  --divider: #e9ebed;
  --border-input: #7d8998;
  --text: #000716;
  --text-heading: #000716;
  --text-2: #414d5c;
  --muted: #5f6b7a;

  --accent: #0972d3;
  --accent-hover: #033160;
  --accent-ink: #ffffff;
  --accent-soft: #f2f8fd;

  /* Primary buttons - orange like in the AWS console (same in light and dark) */
  --cta: #ff9900;
  --cta-hover: #ec7211;
  --cta-ink: #000716;

  /* Password strength meter: red -> yellow -> green */
  --meter-weak: #d91515;
  --meter-medium: #f2b200;
  --meter-strong: #037f0c;

  --good: #037f0c;
  --good-soft: #f2fcf3;
  --bad: #d91515;
  --bad-soft: #fff7f7;
  --warn: #8d6605;
  --warn-soft: #fffce9;
  --info-soft: #f2f8fd;

  --nav-bg: #0f1b2a;
  --nav-text: #d1d5db;
  --nav-text-hover: #ffffff;
  --nav-active: #ff9900;
  --brand: #ff9900;

  --badge-grey: #414d5c;
  --track: #e9ebed;
  --grid: #e9ebed;
  --series: #0972d3;

  --tooltip-bg: #0f1b2a;
  --tooltip-text: #ffffff;
  --shadow: 0 1px 1px 0 rgba(0, 28, 36, 0.3), 1px 1px 1px 0 rgba(0, 28, 36, 0.15), -1px 1px 1px 0 rgba(0, 28, 36, 0.15);
  --card-border: transparent;
  --radius: 16px;
  --page-bg: var(--bg);
  --notice-bg: #fffce9;
  --notice-border: #8d6605;
}

/* ---------------------------------------------------------------- tokens: dark (system preference) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="cute"]) {
    color-scheme: dark;
    --bg: #0f1b2a;
    --surface: #192534;
    --surface-2: #0f1b2a;
    --surface-hover: #232f3e;
    --divider: #414d5c;
    --border-input: #5f6b7a;
    --text: #d1d5db;
    --text-heading: #e9ebed;
    --text-2: #b6bec9;
    --muted: #8d99a8;
    --accent: #539fe5;
    --accent-hover: #89bdee;
    --accent-ink: #000716;
    --accent-soft: #0a2440;
    --good: #29ad32;
    --good-soft: #0b2a12;
    --bad: #eb6f6f;
    --bad-soft: #2f1418;
    --warn: #f2cd54;
    --warn-soft: #2b2510;
    --info-soft: #0a2440;
    --nav-bg: #0b1420;
    --badge-grey: #5f6b7a;
    --track: #2a3a4d;
    --grid: #2a3a4d;
    --series: #539fe5;
    --tooltip-bg: #e9ebed;
    --tooltip-text: #000716;
    --shadow: none;
    --card-border: #414d5c;
    --notice-bg: #2b2510;
    --notice-border: #f2cd54;
    --meter-weak: #eb6f6f;
    --meter-medium: #f2cd54;
    --meter-strong: #29ad32;
  }
}

/* ---------------------------------------------------------------- tokens: dark (chosen manually) */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1b2a;
  --surface: #192534;
  --surface-2: #0f1b2a;
  --surface-hover: #232f3e;
  --divider: #414d5c;
  --border-input: #5f6b7a;
  --text: #d1d5db;
  --text-heading: #e9ebed;
  --text-2: #b6bec9;
  --muted: #8d99a8;
  --accent: #539fe5;
  --accent-hover: #89bdee;
  --accent-ink: #000716;
  --accent-soft: #0a2440;
  --good: #29ad32;
  --good-soft: #0b2a12;
  --bad: #eb6f6f;
  --bad-soft: #2f1418;
  --warn: #f2cd54;
  --warn-soft: #2b2510;
  --info-soft: #0a2440;
  --nav-bg: #0b1420;
  --badge-grey: #5f6b7a;
  --track: #2a3a4d;
  --grid: #2a3a4d;
  --series: #539fe5;
  --tooltip-bg: #e9ebed;
  --tooltip-text: #000716;
  --shadow: none;
  --card-border: #414d5c;
  --notice-bg: #2b2510;
  --notice-border: #f2cd54;
  --meter-weak: #eb6f6f;
  --meter-medium: #f2cd54;
  --meter-strong: #29ad32;
}

/* ---------------------------------------------------------------- tokens: cute (lavender + pastel pink) */
:root[data-theme="cute"] {
  color-scheme: light;
  --font: "Nunito", "Open Sans", "Helvetica Neue", Arial, sans-serif;

  --bg: #fff5fa;
  --page-bg: radial-gradient(circle at 8% 0%, #ffe0ef 0, transparent 38%),
             radial-gradient(circle at 95% 12%, #e8ddff 0, transparent 40%),
             radial-gradient(circle at 50% 100%, #fde7f3 0, transparent 45%), #fff7fb;
  --surface: #ffffff;
  --surface-2: #fbf3fd;
  --surface-hover: #f5edff;
  --divider: #f1dff0;
  --border-input: #c7aedb;
  --text: #4b3a5c;
  --text-heading: #3b2950;
  --text-2: #75628a;
  --muted: #9a87ad;

  --accent: #7b5cc8;
  --accent-hover: #5e3fae;
  --accent-ink: #ffffff;
  --accent-soft: #f1eaff;

  --cta: #ffa8cb;
  --cta-hover: #ff8ab8;
  --cta-ink: #4b2340;

  --good: #2e8f63;
  --good-soft: #eaf8f0;
  --bad: #d14b7c;
  --bad-soft: #fff0f5;
  --warn: #9a6a12;
  --warn-soft: #fff7e6;
  --info-soft: #f3edff;

  --nav-bg: linear-gradient(90deg, #8c6bd1 0%, #b571c4 55%, #d873a6 100%);
  --nav-text: #fdf4ff;
  --nav-text-hover: #ffffff;
  --nav-active: #ffe1ef;
  --brand: #ffe1ef;

  --badge-grey: #8f74b3;
  --track: #f3e6f7;
  --grid: #f3e6f7;
  --series: #9b7ad8;

  --tooltip-bg: #4b3a5c;
  --tooltip-text: #ffffff;
  --shadow: 0 4px 18px rgba(170, 110, 190, 0.14);
  --card-border: #f6e3f3;
  --radius: 22px;
  --notice-bg: #fff0f7;
  --notice-border: #e58bb5;
  --meter-weak: #d14b7c;
  --meter-medium: #f5b942;
  --meter-strong: #2e8f63;
}
:root[data-theme="cute"] .brand::after { content: " ♡"; color: var(--brand); }
:root[data-theme="cute"] .brand.big::after { color: #ff8ab8; }
:root[data-theme="cute"] .topbar .btn.ghost { border-color: rgba(255, 255, 255, 0.6); color: #ffffff; }
:root[data-theme="cute"] .llm-pill { background: rgba(255, 255, 255, 0.22); color: #ffffff; }
:root[data-theme="cute"] .llm-pill.on::before { color: #c9ffd9; }
:root[data-theme="cute"] .option { border-radius: 16px; }
:root[data-theme="cute"] .chip, :root[data-theme="cute"] .tag { border-radius: 999px; padding: 0 10px; }

/* ---------------------------------------------------------------- base */
* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--page-bg);
  background-attachment: fixed;
  color: var(--text);
  font: 14px/20px var(--font);
  -webkit-font-smoothing: antialiased;
}

h1 { font-size: 24px; line-height: 30px; font-weight: 700; color: var(--text-heading); margin: 0 0 16px; }
h2 { font-size: 20px; line-height: 24px; font-weight: 700; color: var(--text-heading); margin: 0 0 8px; }
h3 { font-size: 18px; line-height: 22px; font-weight: 700; color: var(--text-heading); margin: 0 0 16px; }
h4 { font-size: 14px; font-weight: 700; margin: 0 0 10px; color: var(--text-2); }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: 13px; border: 1px solid var(--divider); }
a { color: var(--accent); }
.muted { color: var(--text-2); }
.small { font-size: 12px; line-height: 16px; }

/* ---------------------------------------------------------------- top bar (always dark, like the console) */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 0 20px; min-height: 48px;
  background: var(--nav-bg);
  color: var(--nav-text);
}
.brand { font-weight: 800; font-size: 18px; letter-spacing: -.01em; color: #ffffff; }
.brand span { color: var(--brand); }
.brand.big { font-size: 28px; line-height: 36px; color: var(--text-heading); }
.nav { display: flex; gap: 2px; align-self: stretch; }
.nav a {
  color: var(--nav-text); text-decoration: none; padding: 0 14px; font-weight: 700;
  display: flex; align-items: center; border-bottom: 3px solid transparent; border-top: 3px solid transparent;
}
.nav a:hover { color: var(--nav-text-hover); }
.nav a.active { color: var(--nav-text-hover); border-bottom-color: var(--nav-active); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.user-name { font-weight: 700; color: #ffffff; }
.topbar .btn.ghost { color: var(--nav-text); border-color: #5f6b7a; }
.topbar .btn.ghost:hover { color: #ffffff; border-color: #ffffff; background: transparent; }
.theme-btn { min-width: 0; padding: 2px 12px !important; }

main { max-width: 1180px; margin: 0 auto; padding: 24px 20px 64px; }

.site-footer {
  max-width: 1180px; margin: 0 auto; padding: 16px 20px 28px;
  border-top: 1px solid var(--divider); text-align: center; color: var(--muted); font-size: 13px;
}
.site-footer strong { color: var(--text-2); }

/* Notice bar under the header (quotas, AI unavailable) */
.notice-bar {
  background: var(--notice-bg); border-bottom: 2px solid var(--notice-border); color: var(--text);
  padding: 10px 20px; text-align: center; line-height: 20px;
}

/* Waiting-for-AI status: queued / generating */
.wait-status {
  margin: 12px 0 0; padding: 8px 14px; border-radius: 12px; background: var(--info-soft);
  border: 1px dashed var(--accent); color: var(--text-2);
}
.loading #loading-text, .loading #insight-wait { max-width: 520px; margin: 0 auto; }

.limit-row { margin-bottom: 16px; }
.limit-row .hbar-track { margin: 6px 0 4px; }

/* ---------------------------------------------------------------- containers */
.card {
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.grid-2.inner { margin: 0; gap: 24px; }
.stats-view > div > .card, .stats-view .attention { margin-bottom: 20px; }
@media (max-width: 820px) { .grid-2 { grid-template-columns: 1fr; } }

/* ---------------------------------------------------------------- buttons and inputs */
.btn {
  border: 2px solid var(--accent); border-radius: 20px; padding: 4px 20px; min-height: 32px;
  font: 700 14px/20px var(--font); letter-spacing: .01em;
  cursor: pointer; background: var(--surface); color: var(--accent);
  transition: background .1s, color .1s, border-color .1s;
}
.btn:hover { background: var(--surface-hover); border-color: var(--accent-hover); color: var(--accent-hover); }
.btn:disabled { cursor: not-allowed; background: var(--surface); border-color: var(--divider); color: var(--muted); }
.btn.primary { background: var(--cta); border-color: var(--cta); color: var(--cta-ink); }
.btn.primary:hover { background: var(--cta-hover); border-color: var(--cta-hover); color: var(--cta-ink); }
.btn.primary:disabled { background: var(--divider); border-color: var(--divider); color: var(--muted); }
.btn.ghost { border-color: var(--border-input); color: var(--text-2); background: transparent; }
.btn.ghost:hover { border-color: var(--accent-hover); color: var(--accent-hover); }
.btn.link { border: 0; background: transparent; color: var(--accent); padding: 4px 4px; min-height: 0; }
.btn.link:hover { text-decoration: underline; color: var(--accent-hover); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover { filter: brightness(0.9); color: #fff; }
.btn.small { padding: 2px 14px; min-height: 28px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn:focus-visible, .option:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input, select, textarea {
  font: 14px/20px var(--font); color: var(--text); background: var(--surface);
  border: 2px solid var(--border-input); border-radius: 8px; padding: 6px 12px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
input:disabled, textarea:disabled { background: var(--surface-2); color: var(--muted); border-color: var(--divider); }
label { display: block; font-weight: 700; margin-bottom: 14px; }
label input { margin-top: 4px; }

.segmented { display: flex; border: 2px solid var(--border-input); border-radius: 20px; padding: 2px; gap: 2px; }
.segmented button {
  flex: 1; border: 0; background: transparent; color: var(--text-2); padding: 4px 6px; border-radius: 16px;
  font: 700 13px/20px var(--font); cursor: pointer;
}
.segmented button:hover { color: var(--accent-hover); background: var(--surface-hover); }
.segmented button.active { background: var(--cta); color: var(--cta-ink); }

.check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 12px 0 0; cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.check.disabled { opacity: .5; cursor: not-allowed; }

.radio-list { display: grid; gap: 8px; margin-bottom: 12px; }
.radio-list label { display: flex; gap: 8px; align-items: center; font-weight: 400; margin: 0; cursor: pointer; }
.radio-list input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }

.control { margin-bottom: 20px; }
.control-label { font-size: 14px; font-weight: 700; color: var(--text-heading); margin-bottom: 6px; display: block; }
.hint-text { font-size: 12px; line-height: 16px; color: var(--text-2); margin: 8px 0 0; }

.error { color: var(--bad); margin: 0 0 12px; font-weight: 700; }
.warning { background: var(--warn-soft); border: 2px solid var(--warn); color: var(--text); border-radius: 12px; padding: 8px 14px; }

.llm-pill {
  font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 4px;
  background: #232f3e; color: var(--nav-text);
}
.llm-pill::before { content: "●"; margin-right: 6px; }
.llm-pill.on::before { color: #29ad32; }
.llm-pill.off::before { color: #eb6f6f; }

/* ---------------------------------------------------------------- login */
.auth-view { display: grid; place-items: center; min-height: 80vh; }
.auth-card { width: min(420px, 100%); text-align: center; padding: 32px 28px; }
.auth-card form { text-align: left; margin-top: 20px; }
.tabs { display: flex; border-bottom: 1px solid var(--divider); margin-top: 20px; }
.tab {
  flex: 1; border: 0; background: transparent; padding: 10px; font: 700 14px/20px var(--font);
  color: var(--text-2); cursor: pointer; border-bottom: 4px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--accent-hover); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Password field with a show/hide button, strength meter and rules */
.field { margin-bottom: 14px; }
.field > label { margin-bottom: 4px; }
.pw-field { position: relative; }
.pw-field input { padding-right: 46px; }
.pw-toggle {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 30px; border: 0; border-radius: 6px; background: transparent;
  color: var(--text-2); cursor: pointer; display: grid; place-items: center;
}
.pw-toggle:hover { color: var(--accent); background: var(--surface-hover); }
.pw-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.pw-strength { margin-top: 8px; }
.meter { display: flex; gap: 4px; }
.meter span { flex: 1; height: 6px; border-radius: 3px; background: var(--track); transition: background .2s; }
.meter.weak span:nth-child(1) { background: var(--meter-weak); }
.meter.medium span:nth-child(-n+2) { background: var(--meter-medium); }
.meter.strong span { background: var(--meter-strong); }
.meter-label { font-size: 12px; color: var(--text-2); margin-top: 4px; }
.pw-rules { list-style: none; margin: 6px 0 0; padding: 0; font-size: 12px; line-height: 18px; color: var(--text-2); }
.pw-rules li::before { content: "•"; display: inline-block; width: 16px; text-align: center; font-weight: 700; }
.pw-rules li.ok { color: var(--good); }
.pw-rules li.ok::before { content: "✓"; }
.pw-rules li.bad { color: var(--bad); }
.pw-rules li.bad::before { content: "✗"; }
.pw-rules li.rules-head { margin-top: 4px; font-weight: 700; color: var(--text-2); }
.pw-rules li.rules-head::before { content: ""; width: 0; }
.pw-match { font-size: 12px; margin: 4px 0 0; min-height: 16px; }
.pw-match.ok { color: var(--good); }
.pw-match.bad { color: var(--bad); }

/* ---------------------------------------------------------------- learn */
.learn-view { display: grid; grid-template-columns: 300px 1fr; gap: 20px; align-items: start; }
@media (max-width: 860px) { .learn-view { grid-template-columns: 1fr; } }
.controls { position: sticky; top: 68px; }
@media (max-width: 860px) { .controls { position: static; } }

.session-box { margin-top: 16px; }
.session-bar { height: 4px; background: var(--track); border-radius: 4px; overflow: hidden; margin-top: 6px; }
.session-bar div { height: 100%; width: 0; background: var(--accent); transition: width .3s; }

.exercise-card { min-height: 380px; padding: 28px; scroll-margin-top: 110px; }
.empty-state { text-align: center; padding: 60px 20px; }
.loading { text-align: center; padding: 80px 20px; color: var(--text-2); }
.spinner {
  width: 32px; height: 32px; margin: 0 auto 14px; border-radius: 50%;
  border: 3px solid var(--track); border-top-color: var(--accent); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.chip {
  font-size: 12px; line-height: 20px; font-weight: 700; padding: 0 8px; border-radius: 4px;
  background: var(--badge-grey); color: #ffffff;
}
.chip.level { background: var(--accent); color: var(--accent-ink); }
.chip.offline { background: var(--warn); color: var(--surface); }
.instruction { color: var(--text-2); margin: 0 0 10px; }
.question { font-size: 22px; font-weight: 400; line-height: 32px; color: var(--text-heading); margin: 0 0 18px; white-space: pre-wrap; }
.question.second { font-size: 19px; line-height: 28px; color: var(--text-2); }
.gap { display: inline-block; min-width: 70px; border-bottom: 2px solid var(--accent); margin: 0 4px; }
.keyword {
  display: inline-block; font-weight: 800; letter-spacing: .08em; padding: 2px 14px; margin-bottom: 12px;
  border: 2px solid var(--accent); border-radius: 8px; color: var(--accent);
}

.options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
@media (max-width: 560px) { .options { grid-template-columns: 1fr; } }
.option {
  text-align: left; padding: 12px 16px; border-radius: 12px; border: 2px solid var(--border-input);
  background: var(--surface); color: var(--text); font: 16px/24px var(--font); cursor: pointer;
  display: flex; gap: 12px; align-items: center;
}
.option:hover:not(:disabled) { border-color: var(--accent); background: var(--surface-hover); }
.option .key {
  font-size: 12px; font-weight: 700; color: var(--text-2); border: 1px solid var(--border-input);
  border-radius: 4px; padding: 0 7px; line-height: 20px;
}
.option.correct { border-color: var(--good); background: var(--good-soft); }
.option.wrong { border-color: var(--bad); background: var(--bad-soft); }
.option:disabled { cursor: default; }

textarea { resize: vertical; font-size: 16px; line-height: 24px; }
.answer-actions { display: flex; align-items: center; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.answer-actions .btn.primary { margin-left: auto; }
.hint-box { background: var(--info-soft); border: 2px solid var(--accent); padding: 8px 14px; border-radius: 12px; margin: 12px 0 0; }

/* Console-style "flashbar" / "alert" messages */
.result { margin-top: 20px; border-radius: 12px; padding: 14px 18px; border: 2px solid var(--divider); }
.result.ok { background: var(--good-soft); border-color: var(--good); }
.result.bad { background: var(--bad-soft); border-color: var(--bad); }
.result.warn { background: var(--warn-soft); border-color: var(--warn); }
.result.neutral { background: var(--info-soft); border-color: var(--accent); }
.result-head { font-weight: 700; font-size: 16px; margin-bottom: 6px; color: var(--text-heading); }
.result-body p { margin: 6px 0; }
.result-body .label { font-weight: 700; }
.result-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.result-actions .report-link { margin-right: auto; }
.tag {
  display: inline-block; font-size: 12px; line-height: 20px; font-weight: 700; padding: 0 8px; border-radius: 4px;
  background: var(--badge-grey); color: #ffffff; margin-right: 4px;
}

.report-box { margin-top: 14px; padding: 16px 18px; border-radius: 12px; border: 2px solid var(--divider); background: var(--surface); }
.report-box h4 { color: var(--text-heading); }
.report-box textarea { font-size: 14px; line-height: 20px; margin-bottom: 12px; }
.report-actions { display: flex; gap: 10px; justify-content: flex-end; }
.appeal { margin-top: 14px; }

/* ---------------------------------------------------------------- stats */
.stats-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.stats-header h1 { margin: 0; }
.insight { margin: 16px 0; }
.insight ul { margin: 6px 0 12px; padding-left: 20px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 20px; margin: 20px 0; }
.tile {
  background: var(--surface); border: 1px solid var(--card-border); border-radius: var(--radius);
  padding: 16px 20px; box-shadow: var(--shadow);
}
.tile .value { font-size: 32px; line-height: 40px; font-weight: 300; color: var(--accent); }
.tile .label { font-size: 14px; font-weight: 700; color: var(--text-heading); }
.tile .sub { font-size: 12px; color: var(--text-2); }

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .axis-label { fill: var(--muted); font-size: 11px; font-family: var(--font); }
.chart .gridline { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--muted); stroke-width: 1; }
.chart .bar { fill: var(--series); }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover { fill: var(--surface-hover); }

.hbar-row { display: grid; grid-template-columns: minmax(110px, 40%) 1fr 52px; align-items: center; gap: 10px; margin-bottom: 10px; }
.hbar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; }
.hbar-fill { height: 100%; background: var(--series); border-radius: 0 4px 4px 0; }
.hbar-row .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--text-2); }

.level-row { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; margin-bottom: 14px; }
.level-row .lvl { font-weight: 800; color: var(--text-heading); }
.level-row .meta { font-size: 12px; color: var(--text-2); text-align: right; white-space: nowrap; }
.level-row .sub { font-size: 12px; color: var(--text-2); margin-top: 3px; }

.weak-item, .mistake { padding: 12px 0; border-top: 1px solid var(--divider); }
.weak-item:first-child, .mistake:first-child { border-top: 0; padding-top: 0; }
.weak-item { display: flex; align-items: center; gap: 10px; }
.weak-item .info { flex: 1; min-width: 0; }
.weak-item .sub { font-size: 12px; color: var(--text-2); }
.mistake .q { font-weight: 700; color: var(--text-heading); }
.mistake .a { margin-top: 3px; }
.mistake .a .yours { color: var(--bad); text-decoration: line-through; }
.mistake .a .right { color: var(--good); font-weight: 700; }
.mistake .fb { font-size: 13px; color: var(--text-2); margin-top: 3px; }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--divider); white-space: nowrap; }
.table th { font-weight: 700; color: var(--text-2); background: var(--surface); }
.table tbody tr:hover { background: var(--surface-hover); }
.table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.status { font-size: 14px; font-weight: 400; white-space: nowrap; }
.status::before { font-weight: 700; margin-right: 6px; }
.status.mastered { color: var(--good); }
.status.mastered::before { content: "✓"; }
.status.weak { color: var(--bad); }
.status.weak::before { content: "✕"; }
.status.learning { color: var(--text-2); }
.status.learning::before { content: "◔"; }

.tooltip {
  position: fixed; z-index: 100; pointer-events: none; background: var(--tooltip-bg); color: var(--tooltip-text);
  font-size: 12px; line-height: 16px; padding: 6px 10px; border-radius: 8px; white-space: nowrap;
}

/* ---------------------------------------------------------------- settings */
.settings-view .card { margin-bottom: 20px; }
.settings-view select { max-width: 420px; display: block; margin-bottom: 10px; }
.danger-zone #reset-confirm { display: inline-flex; gap: 8px; align-items: center; margin-left: 12px; flex-wrap: wrap; }
.status-line { margin: 0 0 14px; }

/* ---------------------------------------------------------------- phone */
@media (max-width: 640px) {
  .topbar { gap: 0 12px; padding: 0 12px; }
  .brand { padding: 10px 0; font-size: 15px; }
  .topbar-right { gap: 8px; padding: 8px 0; }
  .nav { order: 3; width: 100%; overflow-x: auto; margin: 0 -12px; padding: 0 4px; }
  .nav a { padding: 8px 10px; }
  .user-name, .llm-pill { display: none; }
  main { padding: 16px 12px 48px; }
  .exercise-card { padding: 20px 16px; }
  .question { font-size: 19px; line-height: 28px; }
  .answer-actions .muted { display: none; }
}
