/* app.css: "Cinematic" (Netflix-style) theme for Nalar Linuwih.
 * Dark canvas, bold sans type, a red accent, a hero banner, and horizontal
 * poster rows. Classless base for reading pages + a few layout classes
 * (.hero/.row/.rail/.poster) for the catalog lineups. No build step, no Node.
 */

:root {
  --bg: #0b0b0f;          /* near-black canvas */
  --bg-2: #121218;        /* raised surface */
  --surface: #1b1b23;     /* cards, sidebars */
  --surface-2: #26262f;
  --fg: #f5f5f7;          /* bright text */
  --muted-fg: #a1a1aa;    /* secondary text */
  --border: #2a2a33;
  --border-light: #35353f;
  --accent: #e50914;      /* signature red */
  --accent-2: #ff2d3a;
  --accent-fg: #ffffff;

  --sans: "Helvetica Neue", Helvetica, Arial, system-ui, "Segoe UI", Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --r: 6px;
  --r-lg: 10px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
  --shadow-hover: 0 18px 50px rgba(0, 0, 0, 0.7);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--fg);
  background: var(--bg);
  font-family: var(--sans);
  font-size: 1.02rem;
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ---- layout ---- */
.container { width: 100%; max-width: 82rem; margin-inline: auto; padding-inline: 1.25rem; }
@media (min-width: 900px) { .container { padding-inline: 3rem; } }
main.container { padding-block: 1.5rem 5rem; }

.grid { display: grid; grid-template-columns: 1fr; gap: 1.25rem; }
@media (min-width: 760px) { .grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; } }

.with-sidebar { display: grid; grid-template-columns: 1fr; gap: 2rem; min-width: 0; }
.with-sidebar > * { min-width: 0; }
@media (min-width: 900px) { .with-sidebar { grid-template-columns: 16rem minmax(0, 1fr); gap: 2.5rem; align-items: start; } }

/* practice workspace: compact step rail + wide answer area */
.practice-layout { display: grid; grid-template-columns: 1fr; gap: 1.5rem; min-width: 0; }
.practice-layout > * { min-width: 0; }
@media (min-width: 900px) { .practice-layout { grid-template-columns: 17rem minmax(0, 1fr); gap: 2.5rem; align-items: start; } }

section { margin-bottom: 2.5rem; }
section:last-child { margin-bottom: 0; }

/* ---- typography ---- */
h1, h2, h3, h4, h5, h6 { font-weight: 800; line-height: 1.12; letter-spacing: -0.02em; margin: 0 0 0.5em; color: var(--fg); }
h1 { font-size: clamp(2rem, 5vw, 3.25rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.08rem; }
hgroup { margin-bottom: 1.75rem; }
hgroup > p { color: var(--muted-fg); font-size: 1.15rem; max-width: 60ch; }

p { margin: 0 0 1.05rem; }
strong { font-weight: 800; color: #fff; }
a { color: #fff; text-decoration: none; }
article a, .prose a, main p a { color: var(--accent-2); }
article a:hover, main p a:hover { color: #fff; }
small { color: var(--muted-fg); font-size: 0.85rem; }
mark { background: var(--accent); color: #fff; padding: 0.1em 0.45em; border-radius: 3px; }
ins { text-decoration: none; background: rgba(229, 9, 20, 0.18); color: #ff9ba0; padding: 0.15em 0.55em; border-radius: 3px; font-size: 0.92rem; }
hr { border: none; height: 1px; margin: 2.5rem 0; background: var(--border); }
blockquote { margin: 1.5rem 0; padding: 0.75rem 1.4rem; border-left: 4px solid var(--accent); background: var(--surface); border-radius: 0 var(--r) var(--r) 0; color: #e9e9ee; }
ul, ol { padding-left: 1.4rem; }
li { margin-bottom: 0.4rem; }
li::marker { color: var(--muted-fg); }

/* ---- top bar ---- */
header.container { position: sticky; top: 0; z-index: 50; padding-block: 0.9rem;
  background: linear-gradient(180deg, rgba(11,11,15,0.96), rgba(11,11,15,0.72) 70%, transparent);
  backdrop-filter: blur(4px); max-width: none; padding-inline: 1.25rem; }
@media (min-width: 900px) { header.container { padding-inline: 3rem; } }
header nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; max-width: 82rem; margin-inline: auto; }
header nav ul { list-style: none; display: flex; gap: 1.4rem; margin: 0; padding: 0; align-items: center; }
header nav a { color: var(--muted-fg); font-weight: 600; font-size: 0.95rem; }
header nav a:hover { color: #fff; }
header nav strong a { color: var(--accent); font-weight: 900; font-size: 1.5rem; letter-spacing: -0.03em; text-transform: uppercase; }
header nav form { margin: 0; }
header nav .nav-logout button { background: none; border: none; box-shadow: none; color: var(--muted-fg); padding: 0; min-height: auto; font: inherit; font-weight: 600; cursor: pointer; }
header nav .nav-logout button:hover { background: none; color: #fff; transform: none; box-shadow: none; }

.lang-nav { display: inline-flex; border: 1px solid var(--border-light); border-radius: 4px; overflow: hidden; }
.lang-nav a { padding: 0.2rem 0.6rem; font-size: 0.72rem; font-weight: 700; color: var(--muted-fg); }
.lang-nav a:hover { color: #fff; }
.lang-nav a[aria-current="true"], .lang-nav a[aria-current="true"]:hover { background: var(--accent); color: #fff; }

nav[aria-label="breadcrumb"] ul { list-style: none; display: flex; flex-wrap: wrap; gap: 0.55rem; padding: 0; margin: 0 0 1.5rem; font-size: 0.9rem; color: var(--muted-fg); }
nav[aria-label="breadcrumb"] a { color: var(--muted-fg); }
nav[aria-label="breadcrumb"] a:hover { color: #fff; }
nav[aria-label="breadcrumb"] li + li::before { content: "›"; margin-right: 0.55rem; color: var(--border-light); }

/* ---- hero banner ---- */
.hero { position: relative; overflow: hidden; border-radius: var(--r-lg); margin: 0 0 2.5rem; padding: clamp(2rem, 6vw, 5rem) clamp(1.5rem, 5vw, 4rem);
  background:
    radial-gradient(120% 140% at 12% 8%, rgba(229,9,20,0.55), transparent 55%),
    radial-gradient(120% 120% at 92% 90%, rgba(60,20,120,0.6), transparent 55%),
    linear-gradient(120deg, #17171e, #0d0d12);
  border: 1px solid var(--border); box-shadow: var(--shadow); }
.hero::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, rgba(11,11,15,0.8), transparent 60%); pointer-events: none; }
.hero > * { position: relative; z-index: 1; }
.hero .eyebrow, .lp-hero .eyebrow { font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.18em; font-size: 0.72rem; color: var(--accent-2); font-weight: 700; margin: 0 0 0.75rem; }
.hero h1 { font-size: clamp(2.2rem, 6vw, 4.25rem); max-width: 18ch; margin-bottom: 0.5rem; }
.hero p { color: #d5d5db; font-size: 1.15rem; max-width: 52ch; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 1.75rem; }

/* ---- rows / rails / posters ---- */
.row { margin: 0 0 2.75rem; }
.row-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.9rem; }
.row-head h2 { margin: 0; font-size: 1.35rem; }
.row-head .count { color: var(--muted-fg); font-size: 0.85rem; font-family: var(--mono); }
.rail { display: flex; gap: 1rem; overflow-x: auto; overflow-y: visible; padding: 0.75rem 0.25rem 1.25rem; scroll-snap-type: x proximity; scrollbar-width: none; }
.rail::-webkit-scrollbar { display: none; }

.poster { flex: 0 0 auto; width: 17rem; max-width: 78vw; aspect-ratio: 16 / 10; border-radius: var(--r-lg);
  position: relative; overflow: hidden; scroll-snap-align: start; border: 1px solid var(--border-light);
  transition: transform 220ms ease, box-shadow 220ms ease; box-shadow: 0 4px 16px rgba(0,0,0,0.5); }
.poster:hover, .poster:focus-within { transform: scale(1.06); z-index: 2; box-shadow: var(--shadow-hover); }
.poster > a { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 1rem 1.1rem; color: #fff; text-decoration: none; }
.poster > a::before { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0.05) 35%, rgba(0,0,0,0.72)); }
.poster .p-body { position: relative; }
.poster .p-kicker { font-family: var(--mono); font-size: 0.65rem; letter-spacing: 0.12em; text-transform: uppercase; opacity: 0.85; }
.poster .p-title { font-weight: 800; font-size: 1.1rem; line-height: 1.2; letter-spacing: -0.01em; margin-top: 0.2rem; text-shadow: 0 2px 10px rgba(0,0,0,0.6); }
.poster .p-desc { margin-top: 0.35rem; font-size: 0.82rem; color: #e6e6ea; opacity: 0; max-height: 0; overflow: hidden; transition: opacity 200ms ease, max-height 200ms ease; }
.poster:hover .p-desc, .poster:focus-within .p-desc { opacity: 1; max-height: 5rem; }
.poster .p-badge { position: absolute; top: 0.7rem; left: 0.8rem; z-index: 1; font-family: var(--mono); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.1em; background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.25); padding: 0.15rem 0.5rem; border-radius: 999px; }
.poster.g0 { background: linear-gradient(135deg, #3a1c71, #d76d77); }
.poster.g1 { background: linear-gradient(135deg, #0f2027, #2c5364); }
.poster.g2 { background: linear-gradient(135deg, #8e0e00, #1f1c18); }
.poster.g3 { background: linear-gradient(135deg, #42275a, #734b6d); }
.poster.g4 { background: linear-gradient(135deg, #16222a, #3a6073); }
.poster.g5 { background: linear-gradient(135deg, #c31432, #240b36); }
.poster.g6 { background: linear-gradient(135deg, #1d4350, #a43931); }
.poster.g7 { background: linear-gradient(135deg, #2b5876, #4e4376); }
.poster.g8 { background: linear-gradient(135deg, #cb2d3e, #ef473a); }
.poster.g9 { background: linear-gradient(135deg, #004e92, #000428); }
.poster .p-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 0; }

/* header image banner on detail pages */
.page-banner { border-radius: var(--r-lg); overflow: hidden; margin: 0 0 1.75rem; border: 1px solid var(--border); box-shadow: var(--shadow); aspect-ratio: 32 / 9; max-height: 20rem; }
.page-banner img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---- landing page ---- */
.lp-art { position: relative; overflow: hidden; border-radius: var(--r-lg); border: 1px solid var(--border); box-shadow: var(--shadow);
  background:
    radial-gradient(120% 130% at 15% 10%, rgba(229,9,20,0.5), transparent 55%),
    radial-gradient(120% 120% at 90% 90%, rgba(60,20,120,0.6), transparent 55%),
    linear-gradient(120deg, #17171e, #0d0d12); }
.lp-art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

.lp-hero { display: grid; grid-template-columns: 1fr; gap: 2.5rem; align-items: center; margin: 1rem 0 4rem; }
@media (min-width: 900px) { .lp-hero { grid-template-columns: 1.05fr 0.95fr; gap: 3.5rem; margin: 2rem 0 5rem; } }
.lp-hero h1 { font-size: clamp(2.3rem, 5.5vw, 4rem); max-width: 15ch; margin: 0.4rem 0 0.75rem; }
.lp-lede { color: #d5d5db; font-size: 1.2rem; max-width: 48ch; }
.lp-hero .actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin: 1.75rem 0 1.5rem; }
.lp-trust { color: var(--muted-fg); font-family: var(--mono); font-size: 0.8rem; letter-spacing: 0.02em; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.lp-art-hero { aspect-ratio: 16 / 9; }

.lp-props { display: grid; grid-template-columns: 1fr; gap: 1.25rem; margin: 0 0 4rem; }
@media (min-width: 800px) { .lp-props { grid-template-columns: repeat(3, 1fr); } }
.lp-props article { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 1.75rem; margin: 0; }
.lp-props h3 { font-size: 1.2rem; }
.lp-props p { color: var(--muted-fg); margin: 0; }

.lp-how { margin: 0 0 4rem; }
.lp-steps { display: grid; grid-template-columns: 1fr; gap: 1.5rem; }
@media (min-width: 640px) { .lp-steps { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1050px) { .lp-steps { grid-template-columns: repeat(4, 1fr); } }
.lp-step { background: none; border: none; box-shadow: none; padding: 0; margin: 0; }
.lp-art-step { aspect-ratio: 16 / 10; margin-bottom: 0.9rem; }
.lp-step-num { position: absolute; top: 0.7rem; left: 0.8rem; z-index: 1; width: 1.9rem; height: 1.9rem; display: grid; place-items: center; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 800; font-size: 0.95rem; box-shadow: 0 2px 8px rgba(0,0,0,0.5); }
.lp-step h3 { font-size: 1.15rem; margin-bottom: 0.35rem; }
.lp-step p { color: var(--muted-fg); font-size: 0.95rem; margin: 0; }

.lp-faq { margin: 0 0 4rem; max-width: 52rem; }
.lp-faq details { background: var(--surface); }
.lp-faq summary { font-size: 1.05rem; }
.lp-faq details[open] summary { color: var(--accent-2); }
.lp-faq details p { color: var(--muted-fg); margin: 0.75rem 0 0; }

.lp-cta { text-align: center; padding: clamp(2.5rem, 6vw, 4.5rem) 1.5rem; margin: 0 0 3rem; border-radius: var(--r-lg); border: 1px solid var(--border);
  background: radial-gradient(120% 160% at 50% 0%, rgba(229,9,20,0.35), transparent 60%), linear-gradient(180deg, #17171e, #0d0d12); }
.lp-cta h2 { font-size: clamp(1.8rem, 4vw, 2.75rem); margin-bottom: 0.4rem; }
.lp-cta p { color: var(--muted-fg); margin-bottom: 1.5rem; }

.lp-footer { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; padding-top: 2rem; border-top: 1px solid var(--border); color: var(--muted-fg); }
.lp-footer nav { display: flex; gap: 1.5rem; }
.lp-footer a { color: var(--muted-fg); }
.lp-footer a:hover { color: #fff; }

/* ---- cards (reading pages) ---- */
article { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 1.6rem 1.9rem; margin: 0 0 1.5rem; }
.grid > article { margin: 0; transition: transform 200ms ease, border-color 200ms ease; }
.grid > article:hover { transform: translateY(-3px); border-color: var(--border-light); }
.grid > article h3 a { color: #fff; }
.grid > article h3 a:hover { color: var(--accent-2); }
figure { margin: 1.5rem 0; }
figure pre.mermaid, figure .mermaid { background: var(--surface); color: var(--fg); border: 1px solid var(--border); border-radius: var(--r); padding: 1.25rem; overflow-x: auto; }
/* mermaid renders node labels as HTML with htmlLabels; force them light on the dark card */
.mermaid .nodeLabel, .mermaid .edgeLabel, .mermaid span, .mermaid p, .mermaid foreignObject div { color: var(--fg) !important; }
.mermaid .edgeLabel { background: var(--surface) !important; }
figcaption { margin-top: 0.6rem; color: var(--muted-fg); }
.with-sidebar article { max-width: 52rem; }
article { overflow-wrap: break-word; }
/* tables fill their column; enhance.js wraps them in .table-scroll for overflow */
article table, main table { width: 100%; }
.table-scroll { overflow-x: auto; margin: 0 0 1.5rem; border-radius: var(--r); }
.table-scroll > table { margin-bottom: 0; }

/* ---- sidebars ---- */
aside.tracknav, aside.steprail, aside:not(.tracknav):not(.steprail) { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 1.25rem; }
aside.tracknav { position: sticky; top: 5rem; }
aside.tracknav h2, aside.steprail h3 { font-family: var(--mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted-fg); font-weight: 700; margin-bottom: 0.75rem; }
aside.tracknav ol, aside.tracknav ul { list-style: none; padding: 0; margin: 0; }
aside.tracknav a { display: block; color: var(--muted-fg); padding: 0.45rem 0.65rem; border-radius: var(--r); font-size: 0.95rem; line-height: 1.35; }
aside.tracknav a:hover { background: var(--surface-2); color: #fff; }
aside.tracknav .current { display: block; background: var(--accent); color: #fff; padding: 0.45rem 0.65rem; border-radius: var(--r); font-weight: 700; font-size: 0.95rem; }
.pager { display: flex; justify-content: space-between; gap: 1rem; margin-top: 2rem; flex-wrap: wrap; }
.pager a { color: var(--muted-fg); } .pager a:hover { color: #fff; }
.pager a[role="button"] { text-align: right; }

/* catalog TOC (kept for detail sidebars) */
.catalog-toc { max-height: calc(100vh - 7rem); overflow-y: auto; }
.catalog-toc details { border: none; background: none; padding: 0; margin: 0 0 0.35rem; }
.catalog-toc summary { list-style: none; cursor: pointer; font-weight: 700; font-size: 0.9rem; padding: 0.4rem 0.5rem; border-radius: var(--r); display: flex; align-items: center; gap: 0.45rem; color: #fff; }
.catalog-toc summary::-webkit-details-marker { display: none; }
.catalog-toc summary::before { content: "\25B8"; font-size: 0.7rem; color: var(--muted-fg); transition: transform 150ms; }
.catalog-toc details[open] > summary::before { transform: rotate(90deg); }
.catalog-toc summary:hover { background: var(--surface-2); }
.catalog-toc summary small { margin-left: auto; color: var(--muted-fg); }
.catalog-toc ul { list-style: none; margin: 0.1rem 0 0.5rem 0.6rem; padding: 0 0 0 0.9rem; border-left: 1px solid var(--border-light); }
.catalog-toc li a { display: block; padding: 0.3rem 0.5rem; font-size: 0.88rem; color: var(--muted-fg); border-radius: var(--r); }
.catalog-toc li a:hover { background: var(--surface-2); color: #fff; }

aside.steprail { position: sticky; top: 5rem; }
aside.steprail ol { list-style: none; counter-reset: step; padding: 0; margin: 0; }
aside.steprail li { counter-increment: step; margin-bottom: 0.6rem; padding-left: 1.7rem; position: relative; line-height: 1.3; }
aside.steprail li::before { content: counter(step); position: absolute; left: 0; top: 0.1rem; width: 1.25rem; height: 1.25rem; border: 1px solid var(--border-light); border-radius: 999px; font-size: 0.72rem; display: grid; place-items: center; color: var(--muted-fg); }
aside.steprail a { display: block; color: var(--muted-fg); font-size: 0.92rem; }
aside.steprail a:hover { color: #fff; }
aside.steprail .current { display: block; color: var(--accent-2); font-weight: 800; font-size: 0.92rem; }
aside.steprail li:has(.current)::before { background: var(--accent); color: #fff; border-color: var(--accent); }
aside.steprail .locked { display: block; color: #6b6b74; font-size: 0.92rem; }
aside.steprail small { display: block; font-size: 0.72rem; color: var(--muted-fg); }

/* ---- buttons ---- */
button, [role="button"], a[role="button"] {
  display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--sans); font-size: 1rem; font-weight: 700;
  color: #0b0b0f; background: #fff; border: none; border-radius: var(--r); padding: 0.7rem 1.6rem; min-height: 2.75rem;
  cursor: pointer; text-decoration: none; transition: transform 120ms ease, background 160ms ease, opacity 160ms ease; }
button:hover, [role="button"]:hover, a[role="button"]:hover { background: #e6e6e6; transform: translateY(-1px); }
button:active, [role="button"]:active { transform: translateY(0); }
button.secondary, button.outline, .secondary, button.contrast, a.secondary {
  background: rgba(255,255,255,0.14); color: #fff; }
button.secondary:hover, button.outline:hover, .secondary:hover { background: rgba(255,255,255,0.26); }
.hero .actions a[role="button"]:first-child, button.accent { background: var(--accent); color: #fff; }
.hero .actions a[role="button"]:first-child:hover, button.accent:hover { background: var(--accent-2); }
button:focus-visible, a:focus-visible, [role="button"]:focus-visible, summary:focus-visible {
  outline: none; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }

/* ---- forms ---- */
label { display: block; margin-bottom: 0.85rem; font-weight: 600; color: var(--fg); }
input, select, textarea { font-family: var(--sans); font-size: 1rem; color: var(--fg); background: var(--surface-2); border: 1px solid var(--border-light); border-radius: var(--r); padding: 0.7rem 1rem; width: 100%; margin-top: 0.3rem; }
textarea { min-height: 9rem; resize: vertical; }
input::placeholder, textarea::placeholder { color: #7a7a83; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(229,9,20,0.35); }
form { margin-bottom: 1.25rem; }
fieldset { border: 1px solid var(--border); border-radius: var(--r); margin: 0 0 1rem; padding: 1rem; }

/* ---- details / tables / code ---- */
details { border: 1px solid var(--border); border-radius: var(--r-lg); padding: 1rem 1.25rem; margin-bottom: 1.5rem; background: var(--surface); }
summary { cursor: pointer; font-weight: 700; color: #fff; }
table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 0 0 1.5rem; border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; background: var(--surface); }
th, td { padding: 0.7rem 0.95rem; text-align: left; border-bottom: 1px solid var(--border); }
thead th { background: var(--surface-2); color: #fff; font-weight: 700; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
pre, code { font-family: var(--mono); }
pre { background: #08080b; border: 1px solid var(--border); border-radius: var(--r); padding: 1rem; overflow-x: auto; font-size: 0.9rem; color: #e6e6ea; }
:not(pre) > code { background: var(--surface-2); padding: 0.1em 0.4em; border-radius: 4px; font-size: 0.92em; color: #ffd9db; }
img { max-width: 100%; height: auto; border-radius: var(--r); }

a.skip-link { position: absolute; left: -999px; top: 0; z-index: 100; background: var(--accent); color: #fff; padding: 0.75rem 1.25rem; border-radius: var(--r); }
a.skip-link:focus { left: 0.75rem; top: 0.75rem; }

/* action rows + progress */
.btn-row { display: flex; flex-wrap: wrap; gap: 0.85rem; align-items: flex-start; margin: 0.5rem 0 0; }
.btn-row form { margin: 0; }
/* practice step action bar: save status left, skip + submit right */
.answer-bar { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 0.85rem; }
.save-status { color: var(--muted-fg); font-size: 0.85rem; min-height: 1rem; }
.answer-bar-actions { display: flex; align-items: center; gap: 0.75rem; margin-left: auto; }
.answer-bar-actions form { margin: 0; }
button.ghost { background: none; color: var(--muted-fg); box-shadow: none; }
button.ghost:hover { background: rgba(255, 255, 255, 0.08); color: #fff; transform: none; box-shadow: none; }

/* optional per-problem stopwatch */
.timer { display: flex; justify-content: flex-end; align-items: center; gap: 0.5rem; min-height: 2rem; margin: 0 0 0.5rem; }
.timer button { min-height: auto; padding: 0.35rem 0.85rem; font-size: 0.82rem; font-weight: 600; border-radius: 999px; box-shadow: none; }
.timer-toggle { background: var(--surface-2); color: var(--muted-fg); border: 1px solid var(--border-light); }
.timer-toggle:hover { background: var(--surface); color: #fff; transform: none; box-shadow: none; }
.timer-chip { display: inline-flex; align-items: center; gap: 0.4rem; font-family: var(--mono); font-size: 0.85rem; color: var(--fg); background: var(--surface-2); border: 1px solid var(--border-light); padding: 0.35rem 0.8rem; border-radius: 999px; }
.timer-value { font-variant-numeric: tabular-nums; }
.timer-done strong { color: var(--accent-2); }
.timer-stop, .timer-reset { background: none; color: var(--muted-fg); border: 1px solid var(--border-light); }
.timer-stop:hover, .timer-reset:hover { background: var(--surface-2); color: #fff; transform: none; box-shadow: none; }

/* final-review time breakdown */
.time-breakdown { list-style: none; padding: 0; margin: 0.5rem 0 1rem; }
.time-breakdown li { display: grid; grid-template-columns: 1fr 7rem auto; align-items: center; gap: 0.75rem; padding: 0.3rem 0; }
.time-breakdown .tb-title { font-size: 0.92rem; color: var(--muted-fg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.time-breakdown li.longest .tb-title { color: #fff; font-weight: 700; }
.tb-bar { height: 0.5rem; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.tb-bar > span { display: block; height: 100%; min-width: 2px; background: var(--muted-fg); border-radius: 999px; }
.time-breakdown li.longest .tb-bar > span { background: var(--accent); }
.tb-time { font-family: var(--mono); font-size: 0.82rem; color: var(--fg); font-variant-numeric: tabular-nums; text-align: right; }
.tb-hint { color: var(--muted-fg); font-size: 0.95rem; }
.tb-hint strong { color: var(--accent-2); }

/* submissions history */
.verdict-tag { font-weight: 700; color: #fff; }
.answer-text { font-family: var(--sans); white-space: pre-wrap; word-break: break-word; font-size: 0.98rem; line-height: 1.6; overflow-x: visible; margin: 0.5rem 0 0.25rem; }
#feedback-panel { margin: 1.75rem 0; }
article#sample-panel { margin-top: 1.75rem; }
.htmx-indicator { opacity: 0; transition: opacity 200ms; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.progress-note { display: none; align-items: center; gap: 0.65rem; margin-top: 0.9rem; color: var(--accent-2); font-weight: 700; }
.htmx-request.progress-note, .htmx-request .progress-note { display: flex; }
.spinner { width: 1.15rem; height: 1.15rem; flex: none; border: 3px solid var(--border-light); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
[disabled], button:disabled { opacity: 0.55; cursor: progress; }

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

/* ---- pricing + paywall (billing) ---------------------------------------- */
.pricing-head { text-align: center; max-width: 46rem; margin: 1rem auto 2.5rem; }
.pricing-head h1 { font-size: clamp(1.9rem, 4vw, 2.9rem); }
.pricing-head .lp-lede { color: var(--muted-fg); }

.pricing-grid { display: grid; grid-template-columns: 1fr; gap: 1.25rem; margin: 0 0 2rem; align-items: start; }
@media (min-width: 820px) { .pricing-grid { grid-template-columns: repeat(3, 1fr); } }

.plan-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 1.9rem; margin: 0; display: flex; flex-direction: column; gap: 1rem; }
/* highlight the middle (Pro) plan */
.pricing-grid .plan-card:nth-child(2) { border-color: var(--accent); box-shadow: var(--shadow); }
.plan-card h3 { font-size: 1.3rem; margin: 0; }
.plan-price { margin: 0; display: flex; flex-direction: column; }
.plan-price strong { font-size: 2rem; letter-spacing: -0.03em; }
.plan-period { color: var(--muted-fg); font-size: 0.9rem; }
.plan-features { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; flex: 1; }
.plan-features li { position: relative; padding-left: 1.5rem; color: var(--fg); font-size: 0.95rem; }
.plan-features li::before { content: "✓"; position: absolute; left: 0; color: var(--accent-2); font-weight: 800; }
.plan-actions { display: flex; flex-direction: column; gap: 0.5rem; }
.plan-actions form { margin: 0; }
.plan-actions button { width: 100%; }
.plan-current { color: var(--muted-fg); font-weight: 700; text-align: center; padding: 0.5rem 0; }

.paywall { text-align: center; max-width: 40rem; margin: 3rem auto; padding: clamp(2rem, 5vw, 3.5rem) 1.5rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.paywall .eyebrow { color: var(--accent-2); }
.paywall h1 { font-size: clamp(1.6rem, 3.5vw, 2.4rem); }
.paywall .actions { justify-content: center; margin: 1.5rem 0 1rem; }

.verdict-lock { margin-top: 1.5rem; padding: 1.5rem; border: 1px dashed var(--accent); border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface)); text-align: center; }
.verdict-lock-tag { font-weight: 800; color: var(--accent-2); margin: 0 0 0.5rem; }
.verdict-lock .actions { justify-content: center; margin: 1rem 0 0.5rem; }

/* ---- interview simulation ---------------------------------------------- */
.inline-form { display: inline; margin: 0; }
.interview-banner { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border: 1px solid var(--accent);
  border-radius: var(--r-lg); padding: 0.7rem 1rem; margin: 0 0 1.25rem; font-size: 0.95rem; }
.timer-interview { background: color-mix(in srgb, var(--accent) 14%, var(--surface-2)); border-color: var(--accent); }
.timer-interview.timer-over { background: var(--accent); color: var(--accent-fg); }

.followups, .followups-graded { margin-top: 1.75rem; padding-top: 1.25rem; border-top: 2px solid var(--accent); }
.followups h3, .followups-graded h3 { margin-bottom: 0.4rem; }
.followup-q { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 1.1rem 1.3rem; margin: 0 0 1rem; }
.followup-q textarea { width: 100%; margin-top: 0.5rem; }
.fu-focus { display: inline-block; text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.7rem;
  color: var(--accent-2); font-weight: 700; margin-bottom: 0.3rem; }

/* ---- profile / account card -------------------------------------------- */
.account-card { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 1.25rem 1.6rem; margin: 0 0 2rem; }
.account-id h2 { margin: 0 0 0.15rem; font-size: 1.4rem; }
.account-id p { margin: 0; }
.account-plan { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 0.35rem; }
.plan-badge { display: inline-block; padding: 0.3rem 0.8rem; border-radius: 999px; font-weight: 700; font-size: 0.9rem;
  border: 1px solid var(--border-light); background: var(--surface-2); color: var(--fg); }
.plan-badge.plan-pro { border-color: var(--accent); color: var(--fg); }
.plan-badge.plan-premium { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.account-plan p { margin: 0; }
.account-cta { margin-top: 0.2rem; }

/* ---- profile stats ----------------------------------------------------- */
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 0 0 2rem; }
@media (max-width: 560px) { .stats-row { grid-template-columns: 1fr; } }
.stat-tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 1.1rem 1.3rem; display: flex; flex-direction: column; gap: 0.25rem; }
.stat-num { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.stat-label { color: var(--muted-fg); font-size: 0.85rem; }
