/* DataLens Learn — styles built on the DataLens design system tokens. */

/* ---------- Tokens ---------- */
:root {
  /* DataLens palette */
  --midnight-900: #010133;
  --midnight-800: #070846;
  --midnight-600: #262b80;
  --cobalt-700: #070cae;
  --periwinkle-500: #5669fd;
  --periwinkle-100: #dae0f7;
  --mist-300: #a3aac6;
  --cloud-100: #edf0f5;
  --white: #ffffff;
  --ink-900: #0b0b2a;
  --slate-400: #8a8c99;

  /* Semantic (light): airy pale-blue page, white cards, one bright blue accent */
  --surface: #f4f7fe;
  --surface-raised: var(--white);
  --surface-sunken: #edf2fc;
  --text: #0d1330;
  --text-muted: #8a93ad;
  --text-soft: #55607f; /* small secondary copy that passes 4.5:1 on light grounds */
  --primary: #2f6bff;
  --primary-hover: #1f57e6;
  --on-primary: var(--white);
  --highlight: #2f6bff;
  --on-highlight: var(--white);
  --pill: #e8efff;
  --on-pill: #1e3a8a;
  --border: #e3e9f7;
  --focus-ring: #2f6bff;
  --link: #2456e0;
  /* Soft blue light behind the whole page */
  --page-glow: radial-gradient(1200px 600px at 85% -10%, rgba(47, 107, 255, 0.14), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(120, 160, 255, 0.12), transparent 60%);

  /* Top bar */
  --chrome-bg: rgba(255, 255, 255, 0.82);
  --chrome-text: #0d1330;
  --chrome-muted: #55607f;
  --chrome-hover: #eef3ff;
  --chrome-active-bg: #e6eeff;
  --chrome-active-fg: #2f6bff;
  --chrome-border: #e3e9f7;

  /* Feature panels (home hero, final-project banner, "night" cards) */
  --feature-bg: linear-gradient(135deg, #eef3ff 0%, #dbe6ff 50%, #c6d7ff 100%);
  --feature-text: #0d1330;
  --feature-muted: #47527a;
  --feature-pill-bg: rgba(255, 255, 255, 0.75);
  --feature-pill-fg: #1e3a8a;
  --feature-accent: #2f6bff;
  --feature-button-bg: rgba(255, 255, 255, 0.8);
  --feature-button-fg: #0d1330;
  --glow-stripes: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.45) 0 22px, rgba(47, 107, 255, 0.09) 22px 30px, rgba(255, 255, 255, 0) 30px 46px);
  --glow-center: rgba(47, 107, 255, 0.22);

  /* Additions for a learning product: test results and levels */
  --success: #0f6f45;
  --success-soft: #dcf3e7;
  --danger: #b4232f;
  --danger-soft: #fbe2e4;
  --warning: #7d5300;
  --warning-soft: #fdf0d2;

  --level-1-bg: #e8efff;
  --level-1-fg: #1e3a8a;
  --level-2-bg: #c9d9ff;
  --level-2-fg: #13285e;
  --level-3-bg: #6f97ff;
  --level-3-fg: var(--white);
  --level-4-bg: #2f6bff;
  --level-4-fg: var(--white);
  /* Activity heatmap, from light to strong */
  --heat-1: rgba(47, 107, 255, 0.25);
  --heat-2: rgba(47, 107, 255, 0.5);
  --heat-3: #2f6bff;
  --heat-4: #1e3a8a;

  /* Code: a light editor that matches the page */
  --code-bg: #fbfcff;
  --code-panel: #f3f6fe;
  --code-border: #e1e8f8;
  --code-text: #1b2240;
  --code-gutter: #a3abc4;
  --code-line: rgba(47, 107, 255, 0.07);
  --code-muted: #55607f;
  --code-chip: #e3ebff;
  --code-chip-fg: #1e2a5a;
  --tok-keyword: #2f5bea;
  --tok-string: #0f8a5f;
  --tok-number: #c2410c;
  --tok-comment: #8b93ad;
  --tok-function: #7c3aed;
  --tok-builtin: #0369a1;
  --tok-tag: #2f5bea;
  --tok-attr: #b45309;
  --tok-punct: #4b5575;
  --inline-code-bg: #e8efff;
  --inline-code-fg: #1e3a8a;

  /* Shape, depth, space */
  --shadow-card: 0 1px 2px rgba(30, 60, 140, 0.05), 0 10px 30px rgba(47, 107, 255, 0.08);
  --shadow-glow: 0 8px 28px rgba(47, 107, 255, 0.35);
  --shadow-pop: 0 16px 48px rgba(30, 60, 140, 0.16);
  --radius-sm: 12px;
  --radius-lg: 24px;
  --radius-pill: 9999px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 64px;

  --font-sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --header-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* Surfaces: slate blue, in clear layers (page < cards; sunken wells darker) */
    --surface: #0f1629;
    --surface-raised: #172038;
    --surface-sunken: #0b1122;
    --text: #e6ebf7;
    --text-muted: #8a96b8;
    --text-soft: #a7b1cc;
    --pill: #1f2b4d;
    --on-pill: #c9d7ff;
    --border: #26314f;
    --link: #8fb0ff;
    --primary: #4d7fff;
    --primary-hover: #3f6ff2;
    --highlight: #4d7fff;
    --focus-ring: #6f97ff;
    --page-glow: radial-gradient(1200px 600px at 85% -10%, rgba(77, 127, 255, 0.12), transparent 60%),
      radial-gradient(900px 500px at -10% 30%, rgba(120, 100, 255, 0.08), transparent 60%);
    --success: #5fd49b;
    --success-soft: rgba(95, 212, 155, 0.14);
    --danger: #ff8795;
    --danger-soft: rgba(255, 135, 149, 0.14);
    --warning: #ffcb66;
    --warning-soft: rgba(255, 203, 102, 0.14);
    --level-1-bg: #1f2b4d;
    --level-1-fg: #c9d7ff;
    --level-2-bg: #2a3d73;
    --level-2-fg: #e6ebf7;
    --level-3-bg: #4d7fff;
    --level-3-fg: var(--white);
    --level-4-bg: #9db8ff;
    --level-4-fg: #0f1629;
    --heat-1: rgba(77, 127, 255, 0.3);
    --heat-2: rgba(77, 127, 255, 0.55);
    --heat-3: #4d7fff;
    --heat-4: #9db8ff;
    /* Top bar: dark frosted glass */
    --chrome-bg: rgba(15, 22, 41, 0.82);
    --chrome-text: #e6ebf7;
    --chrome-muted: #a7b1cc;
    --chrome-hover: #1c2643;
    --chrome-active-bg: #22305a;
    --chrome-active-fg: #9db8ff;
    --chrome-border: #222d4a;
    /* Feature panels: deep navy-to-indigo gradient */
    --feature-bg: linear-gradient(135deg, #16213f 0%, #1b2a55 55%, #243a7a 100%);
    --feature-text: #f1f4fb;
    --feature-muted: #b4bfdc;
    --feature-pill-bg: rgba(255, 255, 255, 0.08);
    --feature-pill-fg: #c9d7ff;
    --feature-accent: #9db8ff;
    --feature-button-bg: rgba(255, 255, 255, 0.1);
    --feature-button-fg: #f1f4fb;
    --glow-stripes: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 22px, rgba(77, 127, 255, 0.1) 22px 30px, rgba(255, 255, 255, 0) 30px 46px);
    --glow-center: rgba(77, 127, 255, 0.3);
    /* Code: dark slate editor, same colour families as the light editor */
    --code-bg: #121a30;
    --code-panel: #172038;
    --code-border: #26314f;
    --code-text: #e3e8f5;
    --code-gutter: #5f6b8c;
    --code-line: rgba(77, 127, 255, 0.1);
    --code-muted: #a7b1cc;
    --code-chip: #24304f;
    --code-chip-fg: #e6ebf7;
    --tok-keyword: #8fb0ff;
    --tok-string: #6fd3a5;
    --tok-number: #f7a76c;
    --tok-comment: #6f7a99;
    --tok-function: #c4a5ff;
    --tok-builtin: #7cc7f0;
    --tok-tag: #8fb0ff;
    --tok-attr: #f2c072;
    --tok-punct: #aab3cc;
    --inline-code-bg: #1f2b4d;
    --inline-code-fg: #c9d7ff;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.25);
    --shadow-glow: 0 8px 28px rgba(77, 127, 255, 0.35);
    --shadow-pop: 0 16px 48px rgba(0, 0, 0, 0.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  /* Surfaces: slate blue, in clear layers (page < cards; sunken wells darker) */
  --surface: #0f1629;
  --surface-raised: #172038;
  --surface-sunken: #0b1122;
  --text: #e6ebf7;
  --text-muted: #8a96b8;
  --text-soft: #a7b1cc;
  --pill: #1f2b4d;
  --on-pill: #c9d7ff;
  --border: #26314f;
  --link: #8fb0ff;
  --primary: #4d7fff;
  --primary-hover: #3f6ff2;
  --highlight: #4d7fff;
  --focus-ring: #6f97ff;
  --page-glow: radial-gradient(1200px 600px at 85% -10%, rgba(77, 127, 255, 0.12), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(120, 100, 255, 0.08), transparent 60%);
  --success: #5fd49b;
  --success-soft: rgba(95, 212, 155, 0.14);
  --danger: #ff8795;
  --danger-soft: rgba(255, 135, 149, 0.14);
  --warning: #ffcb66;
  --warning-soft: rgba(255, 203, 102, 0.14);
  --level-1-bg: #1f2b4d;
  --level-1-fg: #c9d7ff;
  --level-2-bg: #2a3d73;
  --level-2-fg: #e6ebf7;
  --level-3-bg: #4d7fff;
  --level-3-fg: var(--white);
  --level-4-bg: #9db8ff;
  --level-4-fg: #0f1629;
  --heat-1: rgba(77, 127, 255, 0.3);
  --heat-2: rgba(77, 127, 255, 0.55);
  --heat-3: #4d7fff;
  --heat-4: #9db8ff;
  /* Top bar: dark frosted glass */
  --chrome-bg: rgba(15, 22, 41, 0.82);
  --chrome-text: #e6ebf7;
  --chrome-muted: #a7b1cc;
  --chrome-hover: #1c2643;
  --chrome-active-bg: #22305a;
  --chrome-active-fg: #9db8ff;
  --chrome-border: #222d4a;
  /* Feature panels: deep navy-to-indigo gradient */
  --feature-bg: linear-gradient(135deg, #16213f 0%, #1b2a55 55%, #243a7a 100%);
  --feature-text: #f1f4fb;
  --feature-muted: #b4bfdc;
  --feature-pill-bg: rgba(255, 255, 255, 0.08);
  --feature-pill-fg: #c9d7ff;
  --feature-accent: #9db8ff;
  --feature-button-bg: rgba(255, 255, 255, 0.1);
  --feature-button-fg: #f1f4fb;
  --glow-stripes: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 22px, rgba(77, 127, 255, 0.1) 22px 30px, rgba(255, 255, 255, 0) 30px 46px);
  --glow-center: rgba(77, 127, 255, 0.3);
  /* Code: dark slate editor, same colour families as the light editor */
  --code-bg: #121a30;
  --code-panel: #172038;
  --code-border: #26314f;
  --code-text: #e3e8f5;
  --code-gutter: #5f6b8c;
  --code-line: rgba(77, 127, 255, 0.1);
  --code-muted: #a7b1cc;
  --code-chip: #24304f;
  --code-chip-fg: #e6ebf7;
  --tok-keyword: #8fb0ff;
  --tok-string: #6fd3a5;
  --tok-number: #f7a76c;
  --tok-comment: #6f7a99;
  --tok-function: #c4a5ff;
  --tok-builtin: #7cc7f0;
  --tok-tag: #8fb0ff;
  --tok-attr: #f2c072;
  --tok-punct: #aab3cc;
  --inline-code-bg: #1f2b4d;
  --inline-code-fg: #c9d7ff;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.25);
  --shadow-glow: 0 8px 28px rgba(77, 127, 255, 0.35);
  --shadow-pop: 0 16px 48px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page-glow), var(--surface);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 26px;
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--primary) 30%, transparent); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }

h1, h2, h3, h4 { margin: 0; }
.t-display { font-size: 64px; line-height: 68px; font-weight: 700; letter-spacing: -1.5px; }
.t-h1 { font-size: 48px; line-height: 54px; font-weight: 500; letter-spacing: -1px; }
.t-h2 { font-size: 32px; line-height: 38px; font-weight: 600; letter-spacing: -0.5px; }
.t-title { font-size: 18px; line-height: 24px; font-weight: 700; }
.t-body { font-size: 16px; line-height: 26px; }
.t-small { font-size: 14px; line-height: 20px; }
.t-label { font-size: 14px; line-height: 20px; font-weight: 600; }
.t-caption { font-size: 12px; line-height: 16px; font-weight: 500; }
.soft { color: var(--text-soft); }

@media (max-width: 720px) {
  .t-display { font-size: 40px; line-height: 44px; letter-spacing: -1px; }
  .t-h1 { font-size: 32px; line-height: 38px; }
  .t-h2 { font-size: 26px; line-height: 32px; }
}

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 var(--space-5); }
@media (max-width: 720px) { .container { padding: 0 var(--space-4); } }

@media (max-width: 760px) { .hide-sm { display: none !important; } }

/* ---------- Header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: var(--chrome-bg);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  color: var(--chrome-text);
  border-bottom: 1px solid var(--chrome-border);
}
.app-header .container { height: 100%; display: flex; align-items: center; gap: var(--space-5); max-width: none; }
.brand { display: flex; align-items: center; gap: var(--space-2); color: var(--chrome-text); font-weight: 700; font-size: 18px; line-height: 24px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--chrome-text); display: grid; place-items: center; }
.brand-mark::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); }
.nav { display: flex; gap: var(--space-1); margin-left: var(--space-4); }
.nav a { color: var(--chrome-muted); font-size: 14px; line-height: 20px; padding: 8px 14px; border-radius: var(--radius-pill); font-weight: 500; }
.nav a:hover { color: var(--chrome-text); text-decoration: none; background: var(--chrome-hover); }
.nav a.active { color: var(--chrome-active-fg); background: var(--chrome-active-bg); }
.header-right { margin-left: auto; display: flex; align-items: center; gap: var(--space-3); }
.streak-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 600; color: var(--chrome-text); padding: 6px 12px; border-radius: var(--radius-pill); background: var(--chrome-hover); }
.streak-chip svg { width: 16px; height: 16px; }
.icon-btn { width: 36px; height: 36px; border-radius: 50%; border: 0; background: transparent; color: var(--chrome-muted); display: grid; place-items: center; }
.icon-btn:hover { background: var(--chrome-hover); color: var(--chrome-text); }
.icon-btn svg { width: 18px; height: 18px; }
.menu-btn { display: none; }
@media (max-width: 900px) {
  .nav { display: none; position: absolute; top: var(--header-h); left: 0; right: 0; flex-direction: column; background: var(--surface-raised); padding: var(--space-3) var(--space-4) var(--space-4); margin: 0; border-bottom: 1px solid var(--chrome-border); }
  .nav.open { display: flex; }
  .menu-btn { display: grid; }
  .header-right .btn { display: none; }
  /* The account moves from the header into the menu */
  #account-slot { display: none; }
}
@media (max-width: 360px) {
  /* very narrow screens: tighten spacing so the header fits */
  .app-header .container { gap: var(--space-2); }
  .header-right { gap: var(--space-1); }
  .streak-chip { padding: 6px 8px; }
}

/* ---------- Pills, buttons, inputs ---------- */
.pill {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: 4px 10px; border-radius: var(--radius-pill);
  background: var(--pill); color: var(--on-pill);
  font-size: 12px; line-height: 16px; font-weight: 500; white-space: nowrap;
}
.pill.on-dark { background: var(--feature-pill-bg); color: var(--feature-pill-fg); }
.pill .accent { color: var(--primary); }
.pill.on-dark .accent { color: var(--feature-accent); }
.level-pill { font-weight: 600; }
.level-Foundations { background: var(--level-1-bg); color: var(--level-1-fg); }
.level-Intermediate { background: var(--level-2-bg); color: var(--level-2-fg); }
.level-Advanced { background: var(--level-3-bg); color: var(--level-3-fg); }
.level-Expert { background: var(--level-4-bg); color: var(--level-4-fg); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 44px; padding: 10px var(--space-5);
  border-radius: var(--radius-pill); border: 1px solid transparent;
  font-size: 14px; line-height: 20px; font-weight: 600; white-space: nowrap;
  background: var(--surface-raised); color: var(--text); border-color: var(--border);
  transition: transform 0.12s ease, background-color 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); border-color: transparent; box-shadow: var(--shadow-glow); }
.btn-primary:hover { background: var(--primary-hover); }
.btn-primary.with-disc { padding-right: 6px; }
.btn-disc { width: 32px; height: 32px; border-radius: 50%; background: var(--white); color: var(--primary); display: grid; place-items: center; }
.btn-disc svg { width: 16px; height: 16px; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-sunken); }
.btn-dark { background: var(--midnight-600); color: var(--white); border-color: transparent; }
.btn-sm { min-height: 34px; padding: 6px 14px; font-size: 13px; }
.btn svg { width: 16px; height: 16px; }
.link-more { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--text); }
.link-more svg { width: 16px; height: 16px; transition: transform 0.15s; }
.link-more:hover { text-decoration: none; }
.link-more:hover svg { transform: translateX(3px); }

.input, .select {
  min-height: 44px; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--surface-raised); color: var(--text);
  font-size: 14px; line-height: 20px;
}
.input::placeholder { color: var(--text-soft); }
.select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%238a8c99' stroke-width='1.5' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }

.chip-row { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chip {
  padding: 6px 14px; border-radius: var(--radius-pill); border: 1px solid var(--border);
  background: var(--surface-raised); color: var(--text); font-size: 13px; line-height: 20px; font-weight: 500;
}
.chip:hover { border-color: var(--primary); }
.chip.active { background: var(--highlight); color: var(--on-highlight); border-color: var(--highlight); }

/* ---------- Cards ---------- */
.card { background: var(--surface-raised); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); padding: var(--space-5); }
.card.highlight { background: var(--highlight); color: var(--on-highlight); box-shadow: var(--shadow-glow); }
.card.highlight .soft, .card.highlight .t-small { color: rgba(255, 255, 255, 0.86); }
.card.highlight .link-more { color: var(--white); }
.card.night { background: var(--feature-bg); color: var(--feature-text); }
.icon-tile { width: 44px; height: 44px; border-radius: 50%; background: var(--surface-sunken); color: var(--text); display: grid; place-items: center; flex: none; }
.card.highlight .icon-tile { background: rgba(255, 255, 255, 0.16); color: var(--white); }
.icon-tile svg { width: 22px; height: 22px; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: var(--feature-bg); color: var(--feature-text);
  padding: var(--space-7) 0 140px; text-align: center;
}
.hero-glow { position: absolute; inset: 0; pointer-events: none; }
.hero-glow::before {
  content: ""; position: absolute; left: -5%; right: -5%; bottom: 0; height: 85%;
  background: var(--glow-stripes);
  -webkit-mask-image: linear-gradient(to top, rgba(0,0,0,0.95), rgba(0,0,0,0.35) 55%, transparent 100%);
  mask-image: linear-gradient(to top, rgba(0,0,0,0.95), rgba(0,0,0,0.35) 55%, transparent 100%);
}
.hero-glow::after {
  content: ""; position: absolute; left: 50%; bottom: -30%; width: 900px; height: 520px; transform: translateX(-50%);
  background: radial-gradient(closest-side, var(--glow-center), transparent);
}
.hero > .container { position: relative; }
.hero .t-display { margin: var(--space-5) auto var(--space-4); max-width: 820px; }
.hero .sub { color: var(--feature-muted); max-width: 620px; margin: 0 auto var(--space-6); }
.hero-actions { display: flex; gap: var(--space-3); justify-content: center; flex-wrap: wrap; }
.hero .btn:not(.btn-primary) { background: var(--feature-button-bg); color: var(--feature-button-fg); border-color: transparent; }

.hero-cards {
  position: relative; z-index: 2; margin-top: -96px;
  display: grid; grid-template-columns: 1fr 1.25fr 1fr; gap: var(--space-4); align-items: stretch;
}
@media (max-width: 960px) { .hero-cards { grid-template-columns: 1fr; margin-top: -110px; } }

.stat-big { font-size: 32px; line-height: 38px; font-weight: 600; letter-spacing: -0.5px; }
.stat-row { display: flex; align-items: baseline; gap: var(--space-2); }

.today-card { display: flex; flex-direction: column; gap: var(--space-3); }
.today-card .meta { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.today-card h3 { font-size: 22px; line-height: 28px; font-weight: 700; letter-spacing: -0.3px; }
.today-card .actions { margin-top: auto; display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }

.ring { position: relative; width: 84px; height: 84px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { stroke: var(--surface-sunken); }
.ring .bar { stroke: var(--primary); stroke-linecap: round; transition: stroke-dashoffset 0.6s ease; }
.card.highlight .ring .track { stroke: rgba(255, 255, 255, 0.18); }
.card.highlight .ring .bar { stroke: var(--white); }
.ring .ring-label { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.ring.sm { width: 52px; height: 52px; }
.ring.sm .ring-label { font-size: 13px; }
.ring.lg { width: 128px; height: 128px; }
.ring.lg .ring-label { font-size: 26px; }
/* Home: the Overall progress ring and module count, sized up to fill the card. */
/* Home streak card: label, count, message and week, with the free space shared evenly between
   all four instead of pooling in one place. */
.streak-card { display: flex; flex-direction: column; justify-content: space-between; gap: var(--space-3); }
.streak-main { display: contents; }
.streak-card .week { margin-top: 0; }
/* Home: the streak count, the largest figure on the page, with a blue flame (grey with no streak). */
.streak-stat { align-items: center; gap: 12px; }
.streak-stat .stat-big { font-size: 88px; line-height: 88px; letter-spacing: -2px; }
.streak-stat .t-label { font-size: 24px; align-self: flex-end; margin-bottom: 12px; }
/* The fire emoji keeps its shading but is recoloured to the site blue (#2f6bff): drained to grey,
   tinted, rotated to blue and brightened. Values were tuned by measuring the rendered pixels. */
.streak-fire { font-size: 72px; line-height: 1; flex: none;
  filter: grayscale(1) brightness(.4) sepia(1) hue-rotate(192deg) saturate(8) brightness(1.6); }
.streak-fire.out { filter: grayscale(1); opacity: .4; }
.overall-stat { display: flex; align-items: center; gap: var(--space-5); margin: var(--space-2) 0; }
.overall-stat .stat-big { font-size: 64px; line-height: 64px; }
.overall-stat .t-label { font-size: 20px; }
.overall-stat .t-small { font-size: 16px; margin-top: 6px; }

/* ---------- Sections ---------- */
.section { padding: var(--space-7) 0 0; }
.section-head { text-align: center; margin-bottom: var(--space-6); }
.section-head .t-h1 { margin: var(--space-3) 0 var(--space-2); }
.section-head p { color: var(--text-soft); max-width: 620px; margin: 0 auto; }
.page { padding-bottom: var(--space-7); }

.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 820px) { .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .grid-4 { grid-template-columns: minmax(0, 1fr); } }

.track-card { display: flex; flex-direction: column; gap: var(--space-3); color: inherit; transition: transform 0.15s ease; min-height: 230px; }
.track-card:hover { text-decoration: none; transform: translateY(-3px); }
.track-card p { margin: 0; }
.track-card .bottom { margin-top: auto; display: flex; flex-direction: column; gap: var(--space-3); }
.progress { height: 6px; border-radius: var(--radius-pill); background: var(--surface-sunken); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: inherit; }
.card.highlight .progress { background: rgba(255, 255, 255, 0.2); }
.card.highlight .progress > span { background: var(--white); }

/* Home: this week's practice as circles, ticked on active days (streak card). */
.week { margin-top: auto; display: flex; flex-direction: column; gap: var(--space-3); }
.week-dots { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.week-day { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.week-day .dot { width: 100%; max-width: 40px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-sunken); color: var(--on-primary); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.week-day .dot.on { background: var(--primary); }
.week-day .dot svg { width: 16px; height: 16px; }
.week-day.today .dot { box-shadow: 0 0 0 2px var(--surface-raised), 0 0 0 4px color-mix(in srgb, var(--primary) 45%, transparent); }
.week-day.today .t-caption { color: var(--text); font-weight: 700; }

.track-card .row { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); }

/* minmax(0, …): let columns shrink below their content (e.g. the heatmap scrolls inside its card instead of widening the page) */
.split-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--space-4); }
@media (max-width: 900px) { .split-2 { grid-template-columns: minmax(0, 1fr); } }

.stats-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.stat-tile { padding: var(--space-4) var(--space-5); }
.stat-tile .label { color: var(--text-soft); font-size: 12px; line-height: 16px; font-weight: 500; }

/* Heatmap */
.heatmap { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 12px); gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.heatmap span { width: 12px; height: 12px; border-radius: 3px; background: var(--surface-sunken); }
.heatmap span[data-l="1"] { background: var(--heat-1); }
.heatmap span[data-l="2"] { background: var(--heat-2); }
.heatmap span[data-l="3"] { background: var(--heat-3); }
.heatmap span[data-l="4"] { background: var(--heat-4); }
.heatmap-legend { display: flex; align-items: center; gap: 4px; justify-content: flex-end; margin-top: var(--space-2); }
.heatmap-legend span { width: 12px; height: 12px; border-radius: 3px; }

.final-banner {
  position: relative; overflow: hidden; border-radius: var(--radius-lg); background: var(--feature-bg); color: var(--feature-text);
  padding: var(--space-6); display: grid; grid-template-columns: 1fr auto; gap: var(--space-5); align-items: center;
}
.final-banner .hero-glow::before { height: 100%; opacity: 0.7; }
.final-banner > * { position: relative; }
.final-banner p { color: var(--feature-muted); margin: var(--space-2) 0 0; max-width: 620px; }
@media (max-width: 720px) { .final-banner { grid-template-columns: 1fr; padding: var(--space-5); } }

/* ---------- Page header (inner pages) ---------- */
.page-head { padding: var(--space-6) 0 var(--space-5); }
.page-head .t-h1 { margin-top: var(--space-2); }
.page-head p { color: var(--text-soft); margin: var(--space-2) 0 0; max-width: 680px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 13px; line-height: 20px; color: var(--text-soft); }
.crumbs a { color: var(--text-soft); }
.crumbs svg { width: 14px; height: 14px; }

/* ---------- Module list (LeetCode-style) ---------- */
.filters { display: flex; flex-direction: column; gap: var(--space-3); margin-bottom: var(--space-4); }
.filters .row { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: center; }
.filters .input { flex: 1; min-width: 220px; }
/* clip, not hidden: hidden would make the card a scroll box and break the sticky header row. */
.list-card { padding: 0; overflow: clip; }
.mod-table { width: 100%; border-collapse: collapse; }
.mod-table th { text-align: left; font-size: 12px; line-height: 16px; font-weight: 600; color: var(--text-soft); padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--surface-raised); position: sticky; top: var(--header-h); z-index: 1; }
.mod-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); font-size: 14px; line-height: 20px; vertical-align: middle; }
.mod-table tr:last-child td { border-bottom: 0; }
.mod-table tbody tr { cursor: pointer; }
.mod-table tbody tr:nth-child(even) { background: color-mix(in srgb, var(--surface-sunken) 35%, transparent); }
.mod-table tbody tr:hover { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.mod-table .title-cell a { color: var(--text); font-weight: 600; }
.mod-table .num { color: var(--text-soft); font-variant-numeric: tabular-nums; width: 64px; }
.mod-table .status { width: 44px; }
.mod-table tr.locked { opacity: 0.55; cursor: default; }
@media (max-width: 760px) {
  .mod-table .hide-sm { display: none; }
  .mod-table td, .mod-table th { padding: 10px 12px; }
}
.status-icon { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; }
.status-icon svg { width: 16px; height: 16px; }
.status-done { background: var(--success-soft); color: var(--success); }
.status-progress { background: var(--warning-soft); color: var(--warning); }
.status-new { border: 1.5px solid var(--border); }
.status-soon { color: var(--text-soft); }
.qdots { display: inline-flex; gap: 4px; }
.qdots i { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-sunken); border: 1px solid var(--border); }
.qdots i.on { background: var(--success); border-color: var(--success); }

/* Category page */
.cat-hero { display: grid; grid-template-columns: auto 1fr auto; gap: var(--space-5); align-items: center; }
.cat-hero .icon-tile { width: 64px; height: 64px; }
.cat-hero .icon-tile svg { width: 30px; height: 30px; }
@media (max-width: 720px) { .cat-hero { grid-template-columns: auto 1fr; } .cat-hero .ring { display: none; } }
.level-block { margin-top: var(--space-6); }
.level-block > header { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); }
.mod-rows { display: flex; flex-direction: column; gap: var(--space-2); }
.mod-row { display: grid; grid-template-columns: 40px 1fr auto; gap: var(--space-4); align-items: center; padding: var(--space-4) var(--space-5); color: inherit; border-radius: var(--radius-sm); }
.mod-row:hover { text-decoration: none; box-shadow: 0 0 0 2px var(--primary); }
.mod-row .n { font-weight: 700; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.mod-row .t { font-weight: 600; }
.mod-row .s { color: var(--text-soft); font-size: 14px; line-height: 20px; }
.mod-row .right { display: flex; align-items: center; gap: var(--space-3); }
.mod-row.next { box-shadow: 0 0 0 2px var(--primary), var(--shadow-card); }
@media (max-width: 640px) { .mod-row { grid-template-columns: 28px 1fr; } .mod-row .right { grid-column: 2; } }
.prereq { display: flex; gap: var(--space-2); align-items: flex-start; padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); background: var(--warning-soft); color: var(--text); font-size: 14px; line-height: 20px; margin-top: var(--space-4); }
.prereq svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--warning); }

/* ---------- Module workspace ---------- */
.ws { display: flex; flex-direction: column; height: calc(100vh - var(--header-h)); height: calc(100dvh - var(--header-h)); }
.ws-bar { display: flex; align-items: center; gap: var(--space-4); padding: 10px var(--space-5); background: var(--surface-raised); border-bottom: 1px solid var(--border); min-height: 60px; }
.ws-bar .titles { min-width: 0; }
.ws-bar .titles .crumbs { font-size: 12px; line-height: 16px; }
.ws-bar h1 { font-size: 16px; line-height: 22px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-bar .nav-arrows { margin-left: auto; display: flex; gap: var(--space-2); }
.tabs { display: flex; gap: 4px; padding: 8px var(--space-4); background: var(--surface-raised); border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: var(--radius-pill);
  border: 0; background: transparent; color: var(--text-soft); font-size: 13px; line-height: 20px; font-weight: 600; white-space: nowrap;
}
.tab:hover { background: var(--surface-sunken); color: var(--text); }
.tab.active { background: var(--highlight); color: var(--on-highlight); }
.tab .tick { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; }
.tab .tick svg { width: 12px; height: 12px; }
.tab .tick.done { background: var(--success); color: var(--white); }
.tab.active .tick.done { background: var(--white); color: var(--highlight); }
.tab .tick.todo { border: 1.5px solid currentColor; opacity: 0.6; }
.tab .tick.tried { border: 1.5px solid var(--warning); }
/* The dot gets the same space on both sides as the gap before it. */
.tab .qlevel { display: inline-flex; gap: 8px; opacity: 0.85; font-weight: 500; }

.ws-main { flex: 1; min-height: 0; display: flex; }
.pane { min-width: 0; min-height: 0; overflow: auto; }
.pane-left { flex: 0 0 44%; background: var(--surface-raised); }
.pane-right { flex: 1; display: flex; flex-direction: column; background: var(--code-panel); }
.divider { flex: 0 0 6px; cursor: col-resize; background: var(--border); position: relative; }
.divider:hover, .divider.dragging { background: var(--primary); }
.ws-main.single .pane-left { flex: 1; }
.ws-main.single .pane-right, .ws-main.single .divider { display: none; }
@media (max-width: 900px) {
  .ws { height: auto; }
  .ws-main { flex-direction: column; }
  .pane-left { flex: none; }
  .pane-right { min-height: 70vh; flex: none; }
  .divider { display: none; }
}

.desc { padding: var(--space-5) var(--space-6) var(--space-6); max-width: 820px; }
.ws-main.single .desc { margin: 0 auto; }
@media (max-width: 720px) { .desc { padding: var(--space-4); } }
/* Previous / next question buttons. On wide screens they stay at the bottom of the question pane:
   pushed down when the question is short, pinned to the bottom edge while a long one scrolls. */
.q-nav { display: flex; justify-content: space-between; gap: 8px; margin-top: var(--space-5); }
.q-nav .btn:hover { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
@media (min-width: 901px) {
  .q-desc { display: flex; flex-direction: column; min-height: 100%; padding-bottom: 0; }
  .q-nav { position: sticky; bottom: 0; z-index: 2; margin-top: auto; padding: var(--space-3) 0 var(--space-4);
    background: var(--surface-raised); box-shadow: 0 -12px 12px -8px var(--surface-raised); }
  .q-desc > :nth-last-child(2) { margin-bottom: var(--space-5); }
}
.q-head { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; margin-bottom: var(--space-3); }
.q-head h2 { font-size: 22px; line-height: 28px; font-weight: 700; width: 100%; margin-top: var(--space-2); }
.diff { display: inline-flex; gap: 3px; align-items: center; }
.diff i { width: 6px; height: 14px; border-radius: 3px; background: var(--surface-sunken); }
.diff i.on { background: var(--primary); }

/* Lesson article */
.article { font-size: 16px; line-height: 28px; }
.article > *:first-child { margin-top: 0; }
.article h2 { font-size: 24px; line-height: 32px; font-weight: 700; letter-spacing: -0.3px; margin: var(--space-6) 0 var(--space-3); scroll-margin-top: 140px; }
.article h3 { font-size: 18px; line-height: 26px; font-weight: 700; margin: var(--space-5) 0 var(--space-2); }
.article p { margin: 0 0 var(--space-4); }
.article ul, .article ol { margin: 0 0 var(--space-4); padding-left: 24px; }
.article li { margin: 4px 0; }
.article li > ul, .article li > ol { margin: 4px 0; }
.article strong { font-weight: 700; }
.article hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-6) 0; }
.article code, .inline-code { font-family: var(--font-mono); font-size: 0.86em; background: var(--inline-code-bg); color: var(--inline-code-fg); padding: 2px 6px; border-radius: 6px; }
.article a { text-decoration: underline; text-underline-offset: 3px; }
.lesson-head { margin-bottom: var(--space-5); }
.lesson-head h1 { font-size: 34px; line-height: 40px; font-weight: 700; letter-spacing: -0.6px; margin: var(--space-3) 0 var(--space-2); }
.lesson-head .meta { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; }
.lesson-head p { color: var(--text-soft); margin: 0; font-size: 18px; line-height: 28px; }
@media (max-width: 720px) { .lesson-head h1 { font-size: 26px; line-height: 32px; } }

.callout { border-radius: var(--radius-sm); padding: var(--space-4) var(--space-5); margin: 0 0 var(--space-4); background: var(--surface-sunken); }
.callout > *:last-child { margin-bottom: 0; }
.callout-label { font-size: 12px; line-height: 16px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; display: flex; align-items: center; gap: 6px; }
.callout-label::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.callout-tip, .callout-key { background: color-mix(in srgb, var(--primary) 10%, var(--surface-raised)); }
.callout-tip .callout-label, .callout-key .callout-label { color: var(--link); }
.callout-warn { background: var(--warning-soft); }
.callout-warn .callout-label { color: var(--warning); }
.callout-analogy, .callout-real { background: var(--surface-sunken); }
.callout-clean { background: var(--success-soft); }
.callout-clean .callout-label { color: var(--success); }

.table-wrap { overflow-x: auto; margin: 0 0 var(--space-4); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.table-wrap table, table.df, .result-table { border-collapse: collapse; width: 100%; font-size: 14px; line-height: 20px; }
.table-wrap th, .table-wrap td { padding: 8px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.table-wrap th { background: var(--surface-sunken); font-weight: 600; }
.table-wrap tr:last-child td { border-bottom: 0; }

/* Code blocks in lessons */
.code-block {
  position: relative; margin: 0 0 var(--space-4); background: var(--code-bg); color: var(--code-text);
  border-radius: var(--radius-sm); padding: var(--space-4) var(--space-5); overflow-x: auto;
  font-family: var(--font-mono); font-size: 13.5px; line-height: 22px; tab-size: 4;
}
.code-block code { font-family: inherit; background: none; color: inherit; padding: 0; font-size: inherit; }
.code-block[data-lang="output"], .code-block[data-lang="text"] { background: var(--surface-sunken); color: var(--text); }
.code-block[data-lang="output"]::before { content: "Output"; display: block; font-family: var(--font-sans); font-size: 11px; line-height: 16px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-soft); margin-bottom: 4px; }
.code-tools { position: absolute; top: 8px; right: 8px; display: flex; gap: 6px; opacity: 0; transition: opacity 0.15s; }
.code-block:hover .code-tools, .code-tools:focus-within { opacity: 1; }
@media (hover: none) { .code-tools { opacity: 1; } }
.code-tools button { font-family: var(--font-sans); font-size: 12px; line-height: 16px; font-weight: 600; padding: 5px 10px; border-radius: var(--radius-pill); border: 0; background: var(--code-chip); color: var(--code-chip-fg); display: inline-flex; align-items: center; gap: 4px; }
.code-tools button.try { background: var(--primary); color: var(--on-primary); }
.code-tools svg { width: 12px; height: 12px; }

/* Syntax tokens */
.tok-kw { color: var(--tok-keyword); }
.tok-str { color: var(--tok-string); }
.tok-num { color: var(--tok-number); }
.tok-com { color: var(--tok-comment); font-style: italic; }
.tok-fn { color: var(--tok-function); }
.tok-bi { color: var(--tok-builtin); }
.tok-tag { color: var(--tok-tag); }
.tok-attr { color: var(--tok-attr); }
.tok-punct { color: var(--tok-punct); }
.tok-dec { color: var(--tok-builtin); }
.tok-prop { color: var(--tok-function); }
.code-block[data-lang="output"] [class^="tok-"], .code-block[data-lang="text"] [class^="tok-"] { color: inherit; font-style: normal; }

.lesson-end { margin-top: var(--space-6); padding: var(--space-5); border-radius: var(--radius-lg); background: var(--surface-sunken); display: flex; gap: var(--space-4); align-items: center; justify-content: space-between; flex-wrap: wrap; }
.lesson-end h3 { font-size: 18px; line-height: 24px; }
.lesson-end p { margin: 4px 0 0; color: var(--text-soft); font-size: 14px; line-height: 20px; }

/* Hints, solution, explanation */
.disclosure { margin-top: var(--space-4); border-radius: var(--radius-sm); border: 1px solid var(--border); overflow: hidden; }
.disclosure > button { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); padding: 12px var(--space-4); background: var(--surface-raised); border: 0; font-weight: 600; font-size: 14px; text-align: left; }
.disclosure > button svg { width: 16px; height: 16px; transition: transform 0.2s; }
.disclosure.open > button svg { transform: rotate(180deg); }
.disclosure .body { display: none; padding: 0 var(--space-4) var(--space-4); }
.disclosure.open .body { display: block; }
.hint-item { padding: var(--space-3) 0; border-top: 1px dashed var(--border); font-size: 15px; line-height: 24px; }
.hint-item:first-child { border-top: 0; }
.hint-item p:last-child { margin-bottom: 0; }

/* Right pane: editor + console */
.editor-bar { display: flex; align-items: center; gap: var(--space-2); padding: 8px var(--space-3); background: var(--code-panel); border-bottom: 1px solid var(--code-border); color: var(--code-muted); min-height: 52px; flex-wrap: wrap; }
.editor-bar .lang { font-size: 12px; font-weight: 600; letter-spacing: 0.02em; padding: 4px 10px; border-radius: var(--radius-pill); background: var(--code-chip); color: var(--code-chip-fg); }
.editor-bar .spacer { flex: 1; }
.editor-bar .btn { min-height: 34px; padding: 6px 16px; font-size: 13px; }
.editor-bar .btn-ghost { color: var(--code-muted); }
.editor-bar .btn-ghost:hover { background: var(--code-chip); color: var(--code-chip-fg); }
.editor-bar .btn-run { background: var(--code-chip); color: var(--code-chip-fg); border-color: transparent; }
.editor-bar .btn-run:hover { background: var(--primary); color: var(--on-primary); }
.file-tabs { display: flex; gap: 4px; }
.file-tab { padding: 4px 12px; border-radius: var(--radius-pill); border: 0; background: transparent; color: var(--code-muted); font-size: 12px; font-weight: 600; font-family: var(--font-mono); }
.file-tab.active { background: var(--code-chip); color: var(--code-chip-fg); }
.kbd { font-family: var(--font-sans); font-size: 11px; opacity: 0.75; font-weight: 500; }

.editor-wrap { flex: 1 1 55%; min-height: 160px; position: relative; display: flex; }
.console { flex: 1 1 45%; min-height: 140px; display: flex; flex-direction: column; background: var(--surface-raised); border-top: 1px solid var(--code-border); }
.console-tabs { display: flex; align-items: center; gap: 4px; padding: 6px var(--space-3); border-bottom: 1px solid var(--border); }
.console-tabs .status { margin-left: auto; font-size: 12px; line-height: 16px; color: var(--text-soft); display: flex; align-items: center; gap: 6px; }
.console-body { flex: 1; overflow: auto; padding: var(--space-3) var(--space-4); font-size: 14px; line-height: 20px; }
.console-body.pad0 { padding: 0; }
.h-split { height: 6px; cursor: row-resize; background: var(--code-border); flex: none; }
.h-split:hover, .h-split.dragging { background: var(--primary); }
@media (max-width: 900px) { .h-split { display: none; } .editor-wrap { min-height: 320px; } .console { min-height: 260px; } }

/* Playground: editor on the left, result on the right, with a draggable divider between them.
   The bar, editor, divider and result stay siblings; a grid places them in columns. */
@media (min-width: 901px) {
  .pane-right.side { display: grid; grid-template-columns: var(--editor-w, 55%) 4px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .pane-right.side .editor-bar { grid-column: 1; grid-row: 1; }
  .pane-right.side .editor-wrap { grid-column: 1; grid-row: 2; min-height: 0; }
  .pane-right.side .h-split { grid-column: 2; grid-row: 1 / 3; width: 4px; height: auto; cursor: col-resize; }
  .pane-right.side .console { grid-column: 3; grid-row: 1 / 3; min-height: 0; border-top: 0; }
  .pane-right.side.result-expanded { grid-template-columns: minmax(0, 1fr); }
  .pane-right.side.result-expanded .console { grid-column: 1; }
}
/* The two toolbars (editor | result) line up as one row. */
@media (min-width: 901px) {
  .pane-right.side .editor-bar, .pane-right.side .console-tabs { height: 52px; min-height: 52px; padding: 0 var(--space-3); flex-wrap: nowrap; }
  .pane-right.side .h-split { width: 4px; background: var(--code-border); }
  .pane-right.side .h-split:hover, .pane-right.side .h-split.dragging { background: var(--primary); }
}

/* Language dropdown in the editor bar (playground): looks like the bar's buttons. */
.lang-picker { position: relative; display: inline-flex; align-items: center; }
.lang-picker select { appearance: none; -webkit-appearance: none; height: 34px; line-height: 32px; padding: 0 34px 0 16px; border: 1px solid var(--code-border); border-radius: var(--radius-pill);
  background: transparent; color: var(--code-text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.lang-picker select:hover { background: var(--code-chip); }
.lang-picker select:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.lang-picker option { color: #111; background: #fff; }
.lang-picker svg { position: absolute; right: 12px; width: 14px; height: 14px; pointer-events: none; color: var(--code-muted); }
.lang-picker + .file-tabs { margin-left: 4px; padding-left: 12px; border-left: 1px solid var(--code-border); }

/* "Expand" hides the editor so the result fills the whole area (any width). */
.pane-right.result-expanded .editor-bar, .pane-right.result-expanded .editor-wrap, .pane-right.result-expanded .h-split { display: none; }
.pane-right.result-expanded .console { flex: 1 1 auto; }
.console-tabs .expand { min-height: 30px; padding: 4px 10px; }

.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--border); border-top-color: var(--primary); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.out-text { font-family: var(--font-mono); font-size: 13px; line-height: 20px; white-space: pre-wrap; word-break: break-word; margin: 0 0 var(--space-2); color: var(--text); }
.out-error { font-family: var(--font-mono); font-size: 13px; line-height: 20px; white-space: pre-wrap; margin: 0 0 var(--space-2); color: var(--danger); background: var(--danger-soft); border-radius: var(--radius-sm); padding: var(--space-3) var(--space-4); }
.out-empty { color: var(--text-soft); font-size: 14px; line-height: 20px; }
.out-html { margin: 0 0 var(--space-3); overflow-x: auto; }
.out-figure { background: var(--white); border-radius: var(--radius-sm); margin: 0 0 var(--space-3); min-height: 320px; overflow: hidden; }
.log-line { font-family: var(--font-mono); font-size: 13px; line-height: 20px; padding: 3px 0; border-bottom: 1px solid var(--border); white-space: pre-wrap; word-break: break-word; }
.log-line.warn { color: var(--warning); }
.log-line.error { color: var(--danger); }

table.df, .result-table { font-size: 13px; line-height: 18px; font-variant-numeric: tabular-nums; }
table.df th, table.df td, .result-table th, .result-table td { padding: 6px 12px; border-bottom: 1px solid var(--border); text-align: right; white-space: nowrap; }
table.df thead th, .result-table th { background: var(--surface-sunken); font-weight: 600; position: sticky; top: 0; }
table.df tbody th { text-align: left; color: var(--text-soft); font-weight: 600; }
.result-table th, .result-table td { text-align: left; }
.result-table td.null { color: var(--text-soft); font-style: italic; }
.df-note { font-size: 12px; line-height: 16px; color: var(--text-soft); margin-top: 6px; }

.verdict { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-sm); margin-bottom: var(--space-3); font-weight: 700; }
.verdict svg { width: 22px; height: 22px; flex: none; }
.verdict.pass { background: var(--success-soft); color: var(--success); }
.verdict.fail { background: var(--danger-soft); color: var(--danger); }
.verdict .sub { font-weight: 500; color: var(--text); font-size: 14px; }
.test-list { display: flex; flex-direction: column; gap: 6px; }
.test-item { display: grid; grid-template-columns: 22px 1fr; gap: var(--space-2); padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-sunken); font-size: 14px; line-height: 20px; }
.test-item .ico { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; }
.test-item .ico svg { width: 12px; height: 12px; }
.test-item.pass .ico { background: var(--success); color: var(--white); }
.test-item.fail .ico { background: var(--danger); color: var(--white); }
.test-item .msg { color: var(--text-soft); margin-top: 2px; white-space: pre-wrap; }
.test-item .name { font-weight: 600; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); margin-top: var(--space-3); }
.compare h4 { font-size: 12px; line-height: 16px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-soft); margin-bottom: 6px; }
@media (max-width: 1200px) { .compare { grid-template-columns: 1fr; } }

.preview-frame { width: 100%; height: 100%; min-height: 260px; border: 0; background: var(--white); display: block; margin: 0 auto; }

/* Quiz answers */
.answer-pane { padding: var(--space-5); background: var(--surface); flex: 1; overflow: auto; }
.answer-card { max-width: 640px; margin: 0 auto; }
.answer-card h3 { font-size: 16px; line-height: 22px; font-weight: 700; margin-bottom: var(--space-3); }
.options { display: flex; flex-direction: column; gap: var(--space-2); }
.option {
  display: grid; grid-template-columns: 28px 1fr; gap: var(--space-3); align-items: start; text-align: left;
  padding: 14px var(--space-4); border-radius: var(--radius-sm); border: 1.5px solid var(--border); background: var(--surface-raised);
  font-size: 15px; line-height: 22px; color: var(--text);
}
.option:hover { border-color: var(--primary); }
.option .mark { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--border); display: grid; place-items: center; font-size: 12px; font-weight: 700; color: var(--text-soft); }
.option.multi .mark { border-radius: 6px; }
.option.selected { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 8%, var(--surface-raised)); }
.option.selected .mark { background: var(--primary); border-color: var(--primary); color: var(--white); }
.option.correct { border-color: var(--success); background: var(--success-soft); }
.option.correct .mark { background: var(--success); border-color: var(--success); color: var(--white); }
.option.wrong { border-color: var(--danger); background: var(--danger-soft); }
.option.wrong .mark { background: var(--danger); border-color: var(--danger); color: var(--white); }
.option code { font-family: var(--font-mono); font-size: 0.88em; background: var(--inline-code-bg); color: var(--inline-code-fg); padding: 1px 5px; border-radius: 5px; }
.answer-actions { display: flex; gap: var(--space-2); margin-top: var(--space-4); flex-wrap: wrap; align-items: center; }
.explain { margin-top: var(--space-4); padding: var(--space-4) var(--space-5); border-radius: var(--radius-sm); background: var(--surface-raised); box-shadow: var(--shadow-card); }
.explain > *:last-child { margin-bottom: 0; }
.explain .callout-label { color: var(--link); }

/* Streamlit preview */
.st-app { font-family: var(--font-sans); color: #31333f; background: #fff; display: grid; grid-template-columns: 220px 1fr; min-height: 100%; }
.st-app.no-sidebar { grid-template-columns: 1fr; }
.st-sidebar { background: #f0f2f6; padding: 20px 16px; border-right: 1px solid #e6e9ef; }
.st-main { padding: 20px 28px 40px; min-width: 0; }
.st-el { margin: 0 0 14px; }
.st-title { font-size: 30px; line-height: 38px; font-weight: 700; color: #31333f; }
.st-header { font-size: 24px; line-height: 32px; font-weight: 600; }
.st-subheader { font-size: 19px; line-height: 26px; font-weight: 600; }
.st-caption { font-size: 13px; color: #6b6f80; }
.st-md p { margin: 0 0 8px; }
.st-md code, .st-code { font-family: var(--font-mono); font-size: 13px; background: #f0f2f6; border-radius: 6px; }
.st-md code { padding: 1px 5px; }
.st-code { display: block; padding: 12px 14px; white-space: pre; overflow-x: auto; }
.st-divider { border: 0; border-top: 1px solid #e6e9ef; }
.st-alert { padding: 12px 16px; border-radius: 8px; font-size: 14px; line-height: 20px; }
.st-success { background: #dff5e7; color: #0f5a32; }
.st-info { background: #e1ecfb; color: #183f78; }
.st-warning { background: #fdf3d5; color: #6a4a00; }
.st-error { background: #fde3e3; color: #8a1b1b; }
.st-metric .label { font-size: 13px; color: #555867; }
.st-metric .value { font-size: 30px; line-height: 38px; font-weight: 600; }
.st-metric .delta { font-size: 13px; font-weight: 600; }
.st-metric .delta.up { color: #0f7a3d; }
.st-metric .delta.down { color: #b42318; }
.st-widget label, .st-widget .lbl { display: block; font-size: 13px; line-height: 18px; color: #31333f; margin-bottom: 6px; }
.st-widget input[type="text"], .st-widget input[type="number"], .st-widget input[type="password"], .st-widget input[type="date"], .st-widget textarea, .st-widget select {
  width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid #d5d8e1; background: #f8f9fb; font-size: 14px; color: #31333f; font-family: inherit;
}
.st-widget input[type="range"] { width: 100%; accent-color: #ff4b4b; }
.st-widget .range-val { font-size: 13px; font-weight: 600; color: #ff4b4b; }
.st-btn { padding: 7px 14px; border-radius: 8px; border: 1px solid #d5d8e1; background: #fff; color: #31333f; font-size: 14px; font-family: inherit; }
.st-btn:hover { border-color: #ff4b4b; color: #ff4b4b; }
.st-btn.primary { background: #ff4b4b; border-color: #ff4b4b; color: #fff; }
.st-check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.st-radio { display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.st-columns { display: grid; gap: 16px; }
.st-tabs-nav { display: flex; gap: 16px; border-bottom: 1px solid #e6e9ef; margin-bottom: 12px; }
.st-tabs-nav button { border: 0; background: none; padding: 8px 0; font-size: 14px; color: #555867; border-bottom: 2px solid transparent; font-family: inherit; }
.st-tabs-nav button.active { color: #ff4b4b; border-color: #ff4b4b; }
.st-expander { border: 1px solid #e6e9ef; border-radius: 8px; }
.st-expander > summary { padding: 10px 14px; cursor: pointer; font-size: 14px; }
.st-expander > div { padding: 4px 14px 12px; }
.st-form { border: 1px solid #e6e9ef; border-radius: 8px; padding: 14px; }
.st-table { border-collapse: collapse; font-size: 13px; width: 100%; }
.st-table th, .st-table td { border: 1px solid #e6e9ef; padding: 5px 10px; text-align: left; white-space: nowrap; }
.st-table th { background: #f8f9fb; font-weight: 600; }
.st-df { overflow: auto; max-height: 360px; border: 1px solid #e6e9ef; border-radius: 6px; }
.st-chart { border: 1px solid #e6e9ef; border-radius: 6px; min-height: 300px; }
.st-json { font-family: var(--font-mono); font-size: 12.5px; background: #f8f9fb; border-radius: 6px; padding: 10px 12px; white-space: pre-wrap; }
.st-progress { height: 8px; border-radius: 4px; background: #e6e9ef; overflow: hidden; }
.st-progress > span { display: block; height: 100%; background: #ff4b4b; }
.st-page-nav a { display: block; padding: 6px 10px; border-radius: 6px; color: #31333f; font-size: 14px; cursor: pointer; }
.st-page-nav a.active { background: #e3e6ee; font-weight: 600; }
.st-badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #6b6f80; margin-bottom: 8px; }
.st-exception { font-family: var(--font-mono); font-size: 13px; background: #fde3e3; color: #8a1b1b; padding: 12px 14px; border-radius: 8px; white-space: pre-wrap; }

/* Flask request bar */
.req-bar { display: flex; gap: var(--space-2); padding: var(--space-3); border-bottom: 1px solid var(--border); align-items: center; flex-wrap: wrap; }
.req-bar .select { min-height: 36px; padding: 6px 30px 6px 12px; width: auto; }
.req-bar .input { min-height: 36px; padding: 6px 12px; font-family: var(--font-mono); font-size: 13px; flex: 1; min-width: 160px; }
.req-body { width: 100%; min-height: 60px; font-family: var(--font-mono); font-size: 12.5px; }
.resp-meta { display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; margin-bottom: var(--space-2); }
.status-code { font-family: var(--font-mono); font-weight: 700; font-size: 13px; padding: 2px 8px; border-radius: 6px; }
.status-code.ok { background: var(--success-soft); color: var(--success); }
.status-code.bad { background: var(--danger-soft); color: var(--danger); }
.resp-frame { width: 100%; min-height: 240px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }

/* ---------- Code editor ---------- */
.code-editor {
  position: relative; flex: 1; display: flex; overflow: auto; background: var(--code-bg);
  font-family: var(--font-mono); font-size: var(--editor-font-size, 14px); line-height: var(--editor-line, 22px); tab-size: 4; color: var(--code-text);
}
.code-editor .gutter {
  position: sticky; left: 0; z-index: 2; flex: none; padding: 14px 10px 14px 14px; text-align: right;
  color: var(--code-gutter); background: var(--code-bg); user-select: none; min-width: 48px; font-variant-numeric: tabular-nums;
}
.code-editor .gutter div.cur { color: var(--code-text); }
.code-editor .gutter div.err { color: #ff8795; font-weight: 700; }
.code-editor .body { position: relative; flex: 1; min-width: 0; }
.code-editor pre, .code-editor textarea {
  margin: 0; border: 0; padding: 14px 18px 14px 6px; font: inherit; line-height: inherit; tab-size: inherit;
  white-space: pre; word-wrap: normal; overflow-wrap: normal; letter-spacing: 0;
}
.code-editor pre { pointer-events: none; color: var(--code-text); min-height: 100%; }
.code-editor textarea {
  position: absolute; inset: 0; width: 100%; height: 100%; resize: none; outline: none; overflow: hidden;
  background: transparent; color: transparent; caret-color: var(--code-text); -webkit-text-fill-color: transparent;
}
.code-editor textarea::selection { background: rgba(162, 172, 255, 0.35); -webkit-text-fill-color: transparent; }
.code-editor .err-line { position: absolute; left: 0; right: 0; height: var(--editor-line, 22px); background: rgba(255, 135, 149, 0.13); pointer-events: none; }
.code-editor.readonly textarea { caret-color: transparent; }

/* ---------- Final project ---------- */
.task-tag { font-size: 11px; line-height: 16px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }

/* ---------- Settings / misc ---------- */
/* Cards in a row share one height; each card is a column whose buttons sit at the bottom edge. */
.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.settings-grid .card { display: flex; flex-direction: column; }
.settings-grid .card > .pill, .settings-grid .card > .btn { align-self: flex-start; }
.settings-grid .card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.settings-grid .span-all, .settings-grid .wide { grid-column: 1 / -1; }

/* Segmented control (one choice from a few) and an on/off switch. */
.seg { display: inline-flex; flex-wrap: wrap; padding: 4px; border-radius: var(--radius-pill); background: var(--surface-sunken); gap: 4px; }
.seg button { border: 0; background: transparent; padding: 6px 14px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 600; color: var(--text-soft); }
.seg button.active { background: var(--surface-raised); color: var(--text); box-shadow: var(--shadow-card); }
.switch { appearance: none; -webkit-appearance: none; flex: none; width: 44px; height: 26px; margin: 0; border-radius: 99px; background: var(--border); position: relative; cursor: pointer; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch:checked { background: var(--primary); }
.switch:checked::after { transform: translateX(18px); }
.switch:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* Code editor preferences */
.pref-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; padding: var(--space-3) 0; border-top: 1px solid var(--border); }
.pref-label { display: flex; flex-direction: column; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--text); }
.pref-label .t-small { font-weight: 400; }
.pref-toggle { cursor: pointer; flex-wrap: nowrap; }
.editor-preview { display: flex; margin-top: auto; border-radius: var(--radius-sm); overflow: hidden; }
.editor-preview .code-editor { overflow-x: auto; overflow-y: hidden; }

/* Payment history */
.payment-list ul { list-style: none; margin: 0; padding: 0; }
.payment-list li { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--space-3); flex-wrap: wrap; padding: var(--space-3) 0; border-top: 1px solid var(--border); }
.payment-list .payment-main { display: flex; flex-direction: column; min-width: 0; }
.payment-list .payment-side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.payment-list .mono { font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; }
.status-badge { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: var(--radius-pill); background: var(--surface-sunken); color: var(--text-soft); }
.status-badge.paid { background: var(--success-soft, #dcf5e7); color: var(--success); }
.status-badge.failed { background: var(--danger-soft); color: var(--danger); }

/* Delete account */
.btn-danger { color: var(--danger); border-color: var(--danger-soft); }
.btn-danger:hover:not(:disabled) { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:disabled { opacity: .5; cursor: not-allowed; }
.settings-grid .danger-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-2) var(--space-5); }
.settings-grid .danger-card > .btn { align-self: center; }
.danger-card [hidden] { display: none; }
.danger-card .danger-text p { margin: 0; }
.danger-card .danger-confirm { grid-column: 1 / -1; }
.danger-card .danger-confirm label { display: block; font-size: 14px; margin-bottom: var(--space-2); }
.danger-row { display: flex; gap: 8px; flex-wrap: wrap; }
.danger-row .input { flex: 1 1 160px; max-width: 240px; }
@media (max-width: 560px) { .settings-grid .danger-card { grid-template-columns: minmax(0, 1fr); } .settings-grid .danger-card > .btn { justify-self: start; } }
.engine-list { list-style: none; margin: 0 0 var(--space-4); padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.engine-list li { display: flex; align-items: flex-start; gap: var(--space-3); font-size: 14px; line-height: 20px; color: var(--text-soft); }
.engine-list svg { width: 18px; height: 18px; flex: none; margin-top: 1px; color: var(--primary); }
.engine-list strong { display: block; color: var(--text); font-weight: 600; }
.settings-grid .card .warm-status { margin: var(--space-3) 0 0; }
.settings-grid .card .warm-status:empty { display: none; }
@media (max-width: 820px) { .settings-grid { grid-template-columns: minmax(0, 1fr); } }
.settings-grid .card h3 { font-size: 18px; line-height: 24px; margin-bottom: var(--space-2); }
.settings-grid .card p { color: var(--text-soft); font-size: 14px; line-height: 20px; margin: 0 0 var(--space-4); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; z-index: 100;
  background: var(--text); color: var(--surface); padding: 12px 20px; border-radius: var(--radius-pill);
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow-pop); transition: all 0.25s ease; pointer-events: none;
  display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast svg { width: 18px; height: 18px; color: #93e2b4; flex: none; }

.empty-state { text-align: center; padding: var(--space-7) var(--space-5); color: var(--text-soft); }
.loading-page { display: grid; place-items: center; min-height: 50vh; color: var(--text-soft); gap: var(--space-3); }

.celebrate { position: fixed; inset: 0; pointer-events: none; z-index: 90; overflow: hidden; }
.celebrate i { position: absolute; top: -12px; width: 8px; height: 14px; border-radius: 2px; animation: fall 1.6s ease-in forwards; }
@keyframes fall { to { transform: translateY(105vh) rotate(540deg); opacity: 0.2; } }

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

/* ---------- Accounts: login dialog, account menu, Pro labels, upgrade and admin cards ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: var(--space-4);
  background: rgb(13 19 48 / 0.35); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.modal { position: relative; width: min(420px, 100%); background: var(--surface-raised); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-pop); padding: var(--space-6); }
.modal h2 { font-size: 22px; line-height: 28px; margin: 0 0 var(--space-2); }
.modal .modal-close { position: absolute; top: 12px; right: 12px; color: var(--text-soft); }
.modal .modal-close:hover { background: var(--surface-sunken); color: var(--text); }
/* "Continue with Google": white button with the colour G, per Google's sign-in branding. */
.google-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  background: #fff; color: #1f1f1f; border: 1px solid #dadce0; font-weight: 600; }
.google-btn:hover { background: #f8f9fa; border-color: #c6c9cf; }
.google-btn:disabled { opacity: .7; cursor: progress; }
.google-g { width: 18px; height: 18px; flex: none; }
.modal .google-btn { width: 100%; margin: var(--space-4) 0 var(--space-2); }
.auth-message { min-height: 0; margin: 4px 0 0; font-size: 13px; line-height: 18px; color: var(--danger); }
.auth-message:empty { display: none; }

#account-slot { display: inline-flex; }
.account-login { background: transparent; border-color: var(--chrome-border); color: var(--chrome-text); }
.account-login:hover { background: var(--chrome-hover); }
.account-menu { position: relative; }
.account-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px 3px 3px; border-radius: var(--radius-pill);
  border: 1px solid var(--chrome-border); background: transparent; color: var(--chrome-text); cursor: pointer; font: inherit; }
.account-chip:hover { background: var(--chrome-hover); }
.account-chip .avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: var(--primary); color: var(--on-primary); }
.tier-badge { font-size: 11px; line-height: 16px; font-weight: 700; padding: 1px 8px; border-radius: var(--radius-pill); background: var(--pill); color: var(--on-pill); }
.tier-badge.pro { background: var(--primary); color: var(--on-primary); }
.account-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 240px; padding: var(--space-2);
  background: var(--surface-raised); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-pop); }
.account-pop .who { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; font-size: 13px; line-height: 18px; }
.account-pop .who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-pop a, .account-pop button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.account-pop a:hover, .account-pop button:hover { background: var(--surface-sunken); text-decoration: none; }
.account-pop svg { width: 16px; height: 16px; }

.pro-pill { background: var(--pill); color: var(--on-pill); font-weight: 700; }
/* A short glow on the Pro card when a locked page sends the visitor to it. */
.card.flash { animation: flash 1.6s ease-out 0.3s 1; }
@keyframes flash { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 55%, transparent); } 100% { box-shadow: 0 0 0 18px transparent; } }
.status-icon.status-pro { color: var(--primary); }

.upgrade-card { background: var(--feature-bg); color: var(--feature-text); }
.upgrade-card h3 { font-size: 22px; line-height: 28px; margin: var(--space-3) 0 var(--space-2); }
.upgrade-card p { color: var(--feature-muted); }
/* Each price stays on one line ("Rp 99.000" never splits); on narrow cards the pieces wrap as wholes. */
.upgrade-card .price { display: flex; flex-wrap: wrap; align-items: center; gap: 6px var(--space-3); margin: var(--space-3) 0 var(--space-4); }
.upgrade-card .price .now { font-size: clamp(26px, 7vw, 32px); line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; color: var(--feature-text); }
.upgrade-card .price .was { display: inline-flex; align-items: center; gap: var(--space-2); }
.upgrade-card .price s { color: var(--feature-muted); font-size: 15px; white-space: nowrap; }
.upgrade-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: var(--space-4); }
.upgrade-status:empty { display: none; }
.pro-lock .upgrade-card { max-width: 560px; margin-bottom: var(--space-5); }
/* The account cards sit inside the settings grid as if they were its own cards. */
.account-section { display: contents; }
.account-section .admin-card { grid-column: 1 / -1; }

.admin-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: var(--space-3); }
.admin-row .input:first-of-type { flex: 1; min-width: 220px; }
.admin-result { margin-top: var(--space-3); }
.admin-result p { margin: 0 0 6px; color: var(--text); }
@media (max-width: 900px) { #account-slot .tier-badge { display: none; } }

/* Phones: long button labels ("Start: <module title>") wrap instead of running off the screen. */
@media (max-width: 560px) { .btn.with-disc { white-space: normal; max-width: 100%; text-align: left; } }

/* Account section at the bottom of the mobile menu (hidden on desktop, where the header has it) */
.nav-account { display: none; flex-direction: column; gap: 8px; margin-top: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--border); }
.nav-account .who { display: flex; align-items: center; gap: 10px; padding: 4px 14px 6px; font-size: 14px; line-height: 20px; color: var(--text); min-width: 0; }
.nav-account .who .avatar { width: 32px; height: 32px; flex: none; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--primary); color: var(--on-primary); }
.nav-account .who span:last-child { display: flex; flex-direction: column; min-width: 0; }
.nav-account .who strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-account .btn { width: 100%; }
.nav-account button.nav-link { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border: 0; border-radius: var(--radius-pill);
  background: transparent; color: var(--chrome-muted); font: inherit; font-size: 14px; font-weight: 500; text-align: left; cursor: pointer; }
.nav-account button.nav-link:hover { background: var(--chrome-hover); color: var(--chrome-text); }
.nav-account svg { width: 16px; height: 16px; }
@media (max-width: 900px) { .nav-account { display: flex; } }
