/* EQEdb — a calm, paper-like interface for practicing EQE questions. */

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("../fonts/source-sans-3-latin-ext.c6ba61588d7d.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("../fonts/source-sans-3-latin.9ef356ea553a.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  color-scheme: light;
  --bg: #f6f5f2;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1efeb;
  --surface-3: #e8e5df;
  --border: #e3e0d9;
  --border-strong: #cbc7bd;
  --ink: #151512;
  --text: #23231f;
  --text-soft: #423f38;
  --muted: #6f6b62;
  --accent: #24456f;
  --accent-strong: #182f4f;
  --accent-contrast: #ffffff;
  --danger: #9e3a34;
  --danger-strong: #7d2a25;
  --success: #2f6b4c;
  --warning: #8a6a24;
  --shadow: 0 1px 2px rgba(21, 21, 18, 0.06);
  --shadow-pop: 0 12px 32px rgba(21, 21, 18, 0.14);
  --radius-sm: 5px;
  --radius: 8px;
  --radius-lg: 10px;
  --measure: 44rem;
  --font-sans: "Source Sans 3", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-reading: "Source Sans 3", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141311;
  --bg-elevated: #1c1b18;
  --surface: #1b1a17;
  --surface-2: #24231f;
  --surface-3: #2e2b26;
  --border: #37342e;
  --border-strong: #4c4841;
  --ink: #f5f3ee;
  --text: #e9e6df;
  --text-soft: #cfcbc1;
  --muted: #a49f95;
  --accent: #a9c2e2;
  --accent-strong: #c8d8ef;
  --accent-contrast: #12161d;
  --danger: #f0a8a2;
  --danger-strong: #f7c6c2;
  --success: #9ccbae;
  --warning: #d9bc7e;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.32);
  --shadow-pop: 0 12px 32px rgba(0, 0, 0, 0.5);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
}

main.container {
  flex: 1;
  padding-top: 2.5rem;
  padding-bottom: 5rem;
}

.container {
  width: min(1120px, calc(100% - 2.5rem));
  margin-inline: auto;
}

h1, h2, h3, h4 {
  margin: 0 0 0.6em;
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.01em;
}

h1 { font-size: clamp(1.8rem, 2.8vw, 2.5rem); }
h2 { font-size: clamp(1.25rem, 1.8vw, 1.5rem); }
h3 { font-size: 1.1rem; }

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 0.2em;
}

a:hover { color: var(--accent-strong); }

img { max-width: 100%; display: block; }

input, textarea, select, button {
  font: inherit;
  color: inherit;
}

::selection {
  background: color-mix(in srgb, var(--accent) 22%, transparent);
  color: var(--text);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

code, pre {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.9em;
}

code {
  padding: 0.1em 0.3em;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--surface-2);
}

pre {
  overflow-x: auto;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  line-height: 1.55;
}

pre code {
  padding: 0;
  border: 0;
  background: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 100;
  padding: 0.7rem 1rem;
  background: var(--accent);
  color: var(--accent-contrast);
  border-radius: var(--radius-sm);
  font-weight: 600;
}

.skip-link:focus { top: 1rem; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.block { display: block; }

/* Header ------------------------------------------------------------------ */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  min-height: 68px;
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: 0.1rem;
  color: var(--text);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.brand:hover { color: var(--text); }

.brand-mark {
  border: 1.5px solid var(--text);
  border-radius: 4px;
  padding: 0.02rem 0.28rem;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}

.brand-name {
  color: var(--muted);
  font-weight: 500;
  font-size: 1.15rem;
}

.main-nav {
  display: flex;
  gap: 0.25rem;
  flex: 1;
}

.nav-link {
  color: var(--muted);
  padding: 0.45rem 0.7rem;
  border-radius: var(--radius-sm);
  font-size: 0.94rem;
  font-weight: 500;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface-2);
}

.nav-link.is-active {
  color: var(--text);
  background: var(--surface-2);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-shrink: 0;
}

.account-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.account-name { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }

.avatar {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 600;
}

.avatar-small { width: 24px; height: 24px; font-size: 0.7rem; }
.avatar-large { width: 48px; height: 48px; font-size: 1.1rem; }

.icon-button {
  width: 36px;
  height: 36px;
  display: inline-grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  color: var(--text-soft);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.icon-button:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.icon-button svg {
  width: 18px;
  height: 18px;
}

.icon-button-small {
  width: 30px;
  height: 30px;
}

.icon-button-small svg {
  width: 16px;
  height: 16px;
}

.icon-button-danger:hover {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
}

.inline-form { display: inline; margin: 0; }

/* Buttons ----------------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 40px;
  padding: 0.55rem 1.05rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  font-size: 0.94rem;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.button:hover {
  background: var(--accent-strong);
  color: var(--accent-contrast);
}

.button.is-disabled,
.button[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

.button-small { min-height: 34px; padding: 0.35rem 0.75rem; font-size: 0.85rem; }

.button-quiet {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-soft);
}

.button-quiet:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  color: var(--text);
}

.button-danger {
  background: transparent;
  border-color: color-mix(in srgb, var(--danger) 50%, transparent);
  color: var(--danger);
}

.button-danger:hover {
  background: color-mix(in srgb, var(--danger) 12%, transparent);
  color: var(--danger-strong);
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 0.82rem;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.link-button:hover { color: var(--text); }
.link-danger:hover { color: var(--danger); }

.text-link { font-weight: 500; font-size: 0.92rem; }

/* Messages ---------------------------------------------------------------- */

.messages {
  padding-top: 1.25rem;
  display: grid;
  gap: 0.6rem;
}

.message {
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.93rem;
}

.message-error { border-left-color: var(--danger); color: var(--danger); }
.message-success { border-left-color: var(--success); }
.message-warning { border-left-color: var(--warning); }
.message-info { border-left-color: var(--accent); }

/* Hero & home ------------------------------------------------------------- */

.home-hero {
  padding: 3rem 0 2.75rem;
  border-bottom: 1px solid var(--border);
  max-width: 820px;
}

.eyebrow {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.home-hero h1 { margin-bottom: 0.45rem; }

.lede {
  color: var(--text-soft);
  font-size: 1.06rem;
  line-height: 1.65;
  max-width: 42rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.6rem;
}

.hero-note {
  margin-top: 1.3rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.spotlight {
  padding: clamp(2.5rem, 5vw, 4rem) 0;
  border-top: 1px solid var(--border);
  scroll-margin-top: 6rem;
}

.home-hero + .spotlight { border-top: 0; }

.spotlight-inner {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 4.5rem);
}

.spotlight-copy .eyebrow { margin-bottom: 0.55rem; }

.spotlight-copy h2 {
  max-width: 20ch;
  margin-bottom: 0.75rem;
}

.spotlight-copy > p:not(.eyebrow) {
  max-width: 32rem;
  margin: 0;
  color: var(--text-soft);
  font-size: 1rem;
  line-height: 1.65;
}

.spotlight-alt .spotlight-visual { order: 2; }
.spotlight-alt .spotlight-copy { order: 1; }

.spotlight-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(11rem, 20vw, 16rem);
  overflow: clip;
  background: radial-gradient(
    circle at 50% 45%,
    color-mix(in srgb, var(--accent) 12%, transparent),
    transparent 65%
  );
}

.spotlight-emblem {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.spotlight-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(6rem, 11vw, 8.5rem);
  aspect-ratio: 1;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: linear-gradient(145deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow);
  color: var(--accent);
}

.spotlight-icon svg {
  width: 42%;
  height: 42%;
}

.spotlight-emblem .badge {
  padding: 0.35rem 0.95rem;
  font-size: 0.85rem;
}

.landing-cta {
  padding: clamp(3.5rem, 8vw, 6rem) 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.landing-cta h2 {
  margin-bottom: 0.9rem;
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.landing-cta p:not(.eyebrow) {
  max-width: 32rem;
  margin: 0 auto;
  color: var(--text-soft);
  font-size: 1rem;
  line-height: 1.7;
}

.landing-cta .hero-actions { justify-content: center; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.9rem;
  margin: 1.75rem 0 3rem;
}

.stat-card {
  padding: 1.15rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.stat-note { color: var(--muted); font-size: 0.8rem; }

.section-block { margin-top: 3rem; }

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.section-heading h2 { margin-bottom: 0; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 0.8rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.16s ease, background 0.16s ease;
  overflow: hidden;
}

.card:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.card-link {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 1rem 1.1rem;
  min-height: 100%;
  color: var(--text);
}

.card-link:hover { color: var(--text); }

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  min-height: 20px;
}

.card-date { color: var(--muted); font-size: 0.76rem; }

.card-title {
  margin: 0;
  font-size: 1.02rem;
  line-height: 1.3;
}

.card-snippet {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.86rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.35rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.dot { opacity: 0.6; }

/* Badges & chips ---------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  background: var(--surface-2);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.badge-attested {
  border-color: color-mix(in srgb, var(--success) 45%, transparent);
  background: color-mix(in srgb, var(--success) 12%, transparent);
  color: var(--success);
}

.badge-answered {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

.badge-reproducible {
  border-color: color-mix(in srgb, var(--warning) 45%, transparent);
  background: color-mix(in srgb, var(--warning) 12%, transparent);
  color: var(--warning);
}

.badge-eqe {
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  color: var(--accent);
}

.badge-group {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.badge-small { font-size: 0.66rem; padding: 0.05rem 0.42rem; }

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.chip {
  display: inline-flex;
  padding: 0.28rem 0.7rem;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 0.83rem;
}

.chip:hover { border-color: var(--border-strong); color: var(--text); }

.more-chips summary { cursor: pointer; list-style: none; }
.more-chips summary::-webkit-details-marker { display: none; }
.chip-more { color: var(--muted); }
.chip-row-more { margin-top: 0.55rem; }

/* Page headings, filters -------------------------------------------------- */

.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.page-heading h1 { margin-bottom: 0.3rem; }
.page-heading .lede { font-size: 0.98rem; }

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.85rem;
  padding: 0.85rem;
  margin-bottom: 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.search-field { flex: 1 1 280px; }

.search-field input {
  width: 100%;
  min-height: 40px;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
}

.filter-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.select-label {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.select-label select {
  min-height: 36px;
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
}

.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
}

.checkbox-label input { accent-color: var(--accent); }

.view-toggle {
  display: inline-flex;
  gap: 2px;
  margin: 0;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.view-toggle-option {
  position: relative;
  display: inline-flex;
}

.view-toggle-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.view-toggle-option span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0.25rem 0.7rem;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}

.view-toggle-option input:checked + span {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow);
}

.view-toggle-option input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.question-results {
  transition: opacity 0.15s ease;
}

.question-results[aria-busy="true"] {
  opacity: 0.55;
}

.empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  color: var(--text-soft);
}

.empty-state h3 { color: var(--text); }

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 2.5rem;
}

.pagination-status { color: var(--muted); font-size: 0.85rem; }

/* Breadcrumb -------------------------------------------------------------- */

.breadcrumb {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--text); }

/* Question page ----------------------------------------------------------- */

.question-sheet {
  padding: clamp(1.6rem, 4vw, 3.25rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.question-header { margin-bottom: 2rem; }

.question-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.question-header h1 {
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  margin-bottom: 0.5rem;
  max-width: var(--measure);
}

.question-byline {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem;
  color: var(--muted);
  font-size: 0.86rem;
}

.question-byline a {
  color: var(--text-soft);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 0.18em;
}

.question-byline a:hover { color: var(--text); }

.more-chips-inline {
  display: inline;
  margin-left: 0.15rem;
}

.more-chips-inline > summary {
  display: inline;
  cursor: pointer;
  list-style: none;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.more-chips-inline > summary:hover { color: var(--text); }

.byline-more-collections { margin-left: 0.2rem; }

.question-statement {
  font-family: var(--font-reading);
  font-size: 1.0625rem;
  line-height: 1.75;
  max-width: var(--measure);
  color: var(--ink);
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border);
}

.question-statement p { margin-bottom: 1.2em; }

.question-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
  margin: 2rem 0 0;
  padding: 1.4rem 0 0;
  border-top: 1px solid var(--border);
}

.question-stats div { display: flex; flex-direction: column-reverse; gap: 0.15rem; }
.question-stats dt {
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.question-stats dd { margin: 0; font-size: 1.15rem; font-weight: 600; }

.question-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  margin: 1.5rem 0;
}

/* Notebook tab ------------------------------------------------------------ */

.notebook {
  margin-top: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  overflow: hidden;
}

.notebook summary {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.9rem 1.1rem;
  cursor: pointer;
  list-style: none;
  border-bottom: 1px solid transparent;
}

.notebook summary::-webkit-details-marker { display: none; }

.notebook[open] summary { border-bottom-color: var(--border); }

.notebook-tab {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.85rem;
  background: var(--surface-3);
  border: 1px solid var(--border-strong);
  border-radius: 8px 8px 0 0;
  color: var(--text);
  font-size: 0.83rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.notebook-hint { color: var(--muted); font-size: 0.8rem; }

.notebook-page { padding: 1.4rem 1.4rem 1.6rem; }

/* Notebook tabs (question page) ------------------------------------------- */

.notebook-tabs {
  margin-top: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  overflow: hidden;
  scroll-margin-top: 5.5rem;
}

.notebook-tabbar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.35rem;
  padding: 0.55rem 0.65rem 0;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

.notebook-tab-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.notebook-tabbar-tools {
  display: flex;
  align-items: center;
  margin-left: auto;
  padding: 0.55rem 0.15rem;
}

.notebook-toggle {
  color: var(--muted);
  font-size: 0.78rem;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-transform: lowercase;
}

.notebook-toggle:hover { color: var(--text); }

.notebook-toggle-collapse { display: none; }

.notebook-tabs:has(.notebook-panel:target) .notebook-toggle-expand {
  display: none;
}

.notebook-tabs:has(.notebook-panel:target) .notebook-toggle-collapse {
  display: inline-flex;
}

.notebook-tabbar .notebook-tab {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.95rem;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-decoration: none;
}

.notebook-tabbar .notebook-tab:hover { color: var(--text); }

.notebook-tabs:has(#model-answer:target) .notebook-tab[href="#model-answer"],
.notebook-tabs:has(#collections:target) .notebook-tab[href="#collections"],
.notebook-tabs:has(#your-answers:target) .notebook-tab[href="#your-answers"],
.notebook-tabs:has(#comments:target) .notebook-tab[href="#comments"] {
  background: var(--bg-elevated);
  border-color: var(--border-strong);
  color: var(--text);
}

.notebook-panel {
  display: none;
  position: relative;
  padding: 1.4rem 1.4rem 1.6rem;
  scroll-margin-top: 8rem;
}

.notebook-panel:target { display: block; }

.model-answer + .model-answer {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.model-answer-meta { color: var(--muted); font-size: 0.78rem; margin-bottom: 0.6rem; }

.your-answer-list { display: grid; gap: 1rem; }

.your-answer {
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.your-answer + .your-answer { margin-top: 0; }

.your-answer-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.65rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.your-answer-time { white-space: nowrap; }

.prose {
  color: var(--ink);
  font-family: var(--font-reading);
  font-size: 1rem;
  line-height: 1.72;
  max-width: var(--measure);
}

.prose p { margin-bottom: 1em; }
.prose-compact { font-size: 0.94rem; line-height: 1.55; }

.markdown { overflow-x: auto; }
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown p { margin: 0 0 1em; }
.markdown ul,
.markdown ol { margin: 0 0 1em 1.35em; padding: 0; }
.markdown li { margin: 0.2em 0; }
.markdown li > p { margin-bottom: 0.35em; }
.markdown blockquote {
  margin: 1em 0;
  padding: 0.1em 0 0.1em 1em;
  border-left: 3px solid var(--border-strong);
  color: var(--text-soft);
}
.markdown code {
  padding: 0.1em 0.3em;
  border-radius: 4px;
  background: var(--surface-2);
  font-size: 0.92em;
}
.markdown pre {
  overflow-x: auto;
  margin: 1em 0;
  padding: 0.8em 1em;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.markdown pre code { padding: 0; background: none; }
.markdown table {
  width: 100%;
  margin: 1em 0;
  border-collapse: collapse;
  font-size: 0.94em;
}
.markdown th,
.markdown td {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.markdown th { background: var(--surface-2); font-weight: 600; }
.markdown a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}
.markdown hr {
  margin: 1.5em 0;
  border: 0;
  border-top: 1px solid var(--border);
}

/* Comments ---------------------------------------------------------------- */

.comments { margin-top: 0; }
.comment-list { display: grid; gap: 0.55rem; margin-bottom: 1rem; }

.comment {
  padding: 0.65rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.comment-header {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.35rem;
}

.comment-author { font-weight: 600; font-size: 0.88rem; }

.comment-header time { color: var(--muted); font-size: 0.76rem; }
.comment-edited { color: var(--muted); font-size: 0.74rem; font-style: italic; }

.comment-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-left: auto;
}

.comment-actions form { margin: 0; }

.comment-form {
  padding: 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.comment-form .button { margin-top: 0.75rem; }

.comment-edit-form {
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.comment-edit-form .button { margin-top: 0; }

.comment-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.55rem;
}

.pagination-compact { margin-top: 1rem; }

/* Question actions ------------------------------------------------------- */

.question-actions .badge { margin-right: 0.15rem; }

.notice {
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 0.92rem;
}

/* Panel ------------------------------------------------------------------- */

.panel {
  padding: 1.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.panel + .panel { margin-top: 1rem; }
.panel h2 { font-size: 1.15rem; }

.panel-note {
  margin: 0.35rem 0 0;
  color: var(--text-soft);
  font-size: 0.85rem;
  line-height: 1.55;
}

.panel-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.panel-heading h2 { margin-bottom: 0; }

/* Forms ------------------------------------------------------------------- */

.form-page { max-width: 820px; }

.stack-form { display: grid; gap: 1.1rem; }

.field { display: grid; gap: 0.4rem; align-content: start; }

.field label {
  color: var(--text-soft);
  font-size: 0.88rem;
  font-weight: 600;
}

.field-checkbox { gap: 0.3rem; }

.field-checkbox .checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
}

.field-checkbox .checkbox-label input[type="checkbox"] {
  flex: none;
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: var(--accent);
}

.field-checkbox .help { padding-left: 1.65rem; }

.required-marker {
  color: var(--danger);
  margin-left: 0.2rem;
}

.field input:not([type="checkbox"]):not([type="radio"]),
.field textarea,
.field select {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  transition: border-color 0.15s ease;
}

.field textarea { resize: vertical; min-height: 90px; line-height: 1.6; }

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.field.has-error input,
.field.has-error textarea,
.field.has-error select { border-color: var(--danger); }

.help { margin: 0; color: var(--muted); font-size: 0.78rem; }
.field-error { margin: 0; color: var(--danger); font-size: 0.82rem; }

.password-field-group {
  display: grid;
  gap: 0.4rem;
  align-content: start;
}

.password-feedback {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.password-feedback[hidden] { display: none; }

.password-field { position: relative; }

.field .password-field:has(> .password-field-toggle:not([hidden])) input {
  padding-right: 3.1rem;
}

.password-field-toggle {
  position: absolute;
  top: 50%;
  right: 0.3rem;
  transform: translateY(-50%);
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.password-field-toggle[hidden] { display: none; }

.password-field-toggle:hover {
  color: var(--text);
  background: var(--surface-2);
}

.password-field-toggle svg {
  width: 19px;
  height: 19px;
}

.password-field-toggle .password-icon-hide { display: none; }
.password-field-toggle[aria-pressed="true"] .password-icon-show { display: none; }
.password-field-toggle[aria-pressed="true"] .password-icon-hide { display: block; }

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1rem;
  align-items: start;
}

.form-grid .field:first-child { grid-column: 1; }
.form-grid .field:nth-child(2) { grid-column: 2; }

.question-context {
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.5rem;
  border-left: 2px solid var(--border-strong);
  color: var(--muted);
}

.question-context h2 { color: var(--text); font-size: 1.05rem; }

.auth-page {
  display: grid;
  place-items: start center;
  padding-top: 2rem;
}

.auth-card {
  width: min(440px, 100%);
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.auth-card h1 { font-size: 1.9rem; }
.auth-card .lede { font-size: 0.94rem; margin-bottom: 1.5rem; }
.auth-card .button { width: 100%; }
.auth-switch { margin-top: 1.2rem; color: var(--muted); font-size: 0.88rem; text-align: center; }

.settings-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(250px, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.settings-main { display: grid; gap: 1.25rem; }
.settings-main .panel + .panel { margin-top: 0; }

.settings-panel form { margin: 0; }
.settings-panel .theme-choices { margin-bottom: 1.15rem; }

.account-summary h2 { margin-bottom: 1rem; }

.account-summary-identity {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding-bottom: 1rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.account-summary-name { margin: 0; font-weight: 600; }
.account-summary-role { margin: 0; color: var(--muted); font-size: 0.82rem; }

.theme-choices {
  display: flex;
  gap: 0.65rem;
  margin: 0 0 1rem;
  padding: 0;
  border: 0;
}

.theme-choice {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  cursor: pointer;
  font-size: 0.9rem;
}

.theme-choice:has(input:checked) {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--bg-elevated));
}

.theme-choice input { accent-color: var(--accent); }

.detail-list { margin: 0; display: grid; gap: 0.7rem; }
.detail-list div { display: flex; justify-content: space-between; gap: 1rem; }
.detail-list dt { color: var(--muted); font-size: 0.86rem; }
.detail-list dd { margin: 0; font-size: 0.9rem; text-align: right; }

/* Exam mode --------------------------------------------------------------- */

.exam-body { background: var(--bg); }

.exam-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(900px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--border);
}

.exam-label {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.exam-timer {
  margin-left: 0.45rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  text-transform: none;
}

.exam-exit { color: var(--muted); font-size: 0.86rem; }
.exam-exit:hover { color: var(--text); }
button.exam-exit {
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  font: inherit;
}

.exam-messages { width: min(900px, calc(100% - 2rem)); margin: 1rem auto 0; }

.exam-main {
  width: min(900px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3rem 0 5rem;
}

.exam-sheet {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: clamp(1.6rem, 4vw, 3rem);
}

.exam-question-statement {
  font-family: var(--font-reading);
  font-size: 1.0625rem;
  line-height: 1.78;
  color: var(--ink);
  padding-bottom: 1.8rem;
  margin-bottom: 1.8rem;
  border-bottom: 1px solid var(--border);
}

.exam-answer-form { display: grid; gap: 0.6rem; }

.exam-answer-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-soft);
}

.exam-answer-form textarea {
  width: 100%;
  min-height: 340px;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  line-height: 1.7;
  resize: vertical;
}

.exam-answer-form textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.exam-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1rem;
}

.exam-note { color: var(--muted); font-size: 0.8rem; margin-top: 0.4rem; }

/* Answer confirmation ---------------------------------------------------- */

.answer-confirm {
  width: min(30rem, calc(100vw - 2rem));
  padding: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow-pop);
}

.answer-confirm::backdrop {
  background: rgba(18, 17, 15, 0.55);
}

.answer-confirm h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.answer-confirm p {
  margin: 0 0 0.9rem;
  color: var(--text-soft);
  font-size: 0.9rem;
  line-height: 1.6;
}

.answer-confirm-option {
  color: var(--text);
  font-size: 0.92rem;
}

.answer-confirm-time {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 1rem;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.answer-confirm-time strong {
  color: var(--text);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: none;
  font-variant-numeric: tabular-nums;
}

.answer-confirm-note {
  margin-top: 0.45rem;
  font-size: 0.8rem;
}

.answer-confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  margin-top: 1.25rem;
}

.answer-confirm .exit-confirm-hint {
  padding: 0.7rem 0.85rem;
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--text);
}

.exit-confirm-actions {
  flex-wrap: wrap;
}

/* Practice history -------------------------------------------------------- */

.practice-list { display: grid; border-top: 1px solid var(--border); }

.practice-item {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.practice-row {
  display: grid;
  flex: 1;
  min-width: 0;
  grid-template-columns: 120px minmax(0, 1fr) auto auto;
  grid-template-areas: "date main counts open";
  align-items: center;
  gap: 0.65rem 1rem;
  padding: 1rem 0.4rem;
  color: var(--text);
}

.practice-item:hover { background: var(--surface); }
.practice-row:hover { background: transparent; color: var(--text); }

.practice-abort { padding-right: 0.4rem; }

.practice-date { grid-area: date; color: var(--muted); font-size: 0.83rem; }
.practice-main { grid-area: main; display: flex; flex-direction: column; gap: 0.1rem; }
.practice-kind {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.practice-title { font-weight: 600; }
.practice-counts {
  grid-area: counts;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
}
.practice-count {
  padding: 0.12rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.74rem;
  white-space: nowrap;
}
.practice-count-correct {
  border-color: color-mix(in srgb, var(--success) 35%, transparent);
  background: color-mix(in srgb, var(--success) 10%, transparent);
  color: var(--success);
}
.practice-count-incorrect {
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  color: var(--danger);
}
.practice-count-paused {
  border-color: color-mix(in srgb, var(--accent) 35%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  color: var(--accent);
}
.practice-open { grid-area: open; color: var(--muted); }

.practice-block { margin-top: 1.75rem; }

.practice-block-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.practice-block-heading h2 { margin: 0; font-size: 1.05rem; }

.practice-block-count {
  padding: 0.1rem 0.45rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}

.practice-list-empty {
  margin: 1rem 0;
  border-radius: var(--radius);
}

.practice-view-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 2.5rem 0 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.practice-view-bar h2 { margin: 0; font-size: 1.05rem; }
.practice-view-bar + .practice-block { margin-top: 0; }

.view-switch {
  display: inline-flex;
  gap: 2px;
  margin: 0;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.view-switch-option {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 0.25rem 0.7rem;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.view-switch-option:hover { color: var(--text); }

.view-switch-option.is-active {
  background: var(--bg-elevated);
  color: var(--text);
  box-shadow: var(--shadow);
}

.view-switch-option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.calendar-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.calendar-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

.calendar-month { margin: 0; font-size: 1rem; min-width: 9rem; text-align: center; }

.practice-calendar-wrap { overflow-x: auto; }

.practice-calendar-table {
  width: 100%;
  min-width: 42rem;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.8rem;
}

.practice-calendar-table th {
  padding: 0.55rem 0.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-align: left;
  text-transform: uppercase;
}

.practice-calendar-table td {
  height: 7rem;
  padding: 0.4rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.practice-calendar-table td:last-child { border-right: 0; }
.practice-calendar-table tbody tr:last-child td { border-bottom: 0; }

.calendar-day.is-outside { background: var(--surface-2); color: var(--muted); }
.calendar-day.is-today { box-shadow: inset 0 0 0 2px var(--accent); }

.calendar-day-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.4rem;
  min-height: 1.4rem;
  margin-bottom: 0.3rem;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.78rem;
}

.calendar-day.is-today .calendar-day-number {
  background: var(--accent);
  color: var(--bg);
  font-weight: 700;
}

.calendar-entries { display: flex; flex-direction: column; gap: 0.25rem; }

.calendar-entry {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  padding: 0.25rem 0.35rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  line-height: 1.25;
  text-decoration: none;
}

.calendar-entry:hover { background: var(--bg-elevated); color: var(--text); }

.calendar-entry-title {
  display: -webkit-box;
  overflow: hidden;
  font-weight: 600;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.calendar-entry-meta { color: var(--muted); font-size: 0.68rem; }

.calendar-empty { margin: 0; }

.practice-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 2rem;
}
.practice-summary-item {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.practice-summary-label {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.practice-summary-item strong { font-size: 1.35rem; }
.practice-summary-correct strong { color: var(--success); }
.practice-summary-incorrect strong { color: var(--danger); }
.practice-detail-actions { margin-top: 1.5rem; }

.practice-paused {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}
.practice-paused h2 { margin: 0.15rem 0 0.35rem; }
.practice-paused p { margin: 0; color: var(--text-soft); }
.practice-draft {
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.practice-draft h2 { margin-top: 0; }

/* Collections ------------------------------------------------------------- */

.collection-header { margin-bottom: 2.5rem; }
.collection-header h1 { margin-bottom: 0.35rem; }
.collection-header .lede { margin-bottom: 0.5rem; }

.collection-admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.1rem;
}

.collection-tree {
  border-top: 1px solid var(--border);
}

.tree-section {
  padding: 1.35rem 0;
  border-bottom: 1px solid var(--border);
}

.section-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.section-row-display {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  column-gap: 1rem;
  row-gap: 0;
}

.section-title {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.6rem;
  min-width: 0;
}

.section-disclosure {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
}

.section-title h3 { margin: 0; font-size: 1.1rem; }

.section-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  flex-shrink: 0;
  grid-column: 2;
  grid-row: 1;
}

.section-code {
  display: inline-block;
  min-width: 2.1rem;
  padding: 0.1rem 0.4rem;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 0.78rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.section-questions {
  list-style: none;
  margin: 0.8rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
}

.section-disclosure > summary.section-title {
  margin: -0.15rem -0.35rem;
  padding: 0.15rem 0.35rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  list-style: none;
}

.section-disclosure > summary.section-title::-webkit-details-marker { display: none; }

.section-disclosure > summary.section-title::before {
  content: "";
  flex: 0 0 auto;
  align-self: center;
  width: 0;
  height: 0;
  border-left: 5px solid var(--muted);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.15s ease;
}

.section-disclosure[open] > summary.section-title::before { transform: rotate(90deg); }

.section-disclosure > summary.section-title:hover,
.section-disclosure > summary.section-title:focus-visible {
  background: var(--surface);
}

.section-questions-display {
  grid-column: 1 / -1;
  grid-row: 2;
  margin-top: 0.55rem;
  padding-left: 0.2rem;
  gap: 0.15rem;
}

.section-disclosure:not([open]) ~ .section-questions-display { display: none; }

.section-questions li {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0.35rem 0.55rem;
  border-radius: var(--radius-sm);
}

.section-questions-display li { padding: 0.25rem 0 0.25rem 0.45rem; }

.section-questions li:hover { background: var(--surface); }
.section-questions li .link-button { margin-left: auto; }
.section-questions .question-practice { margin-left: auto; white-space: nowrap; }
.section-actions .button,
.section-questions .question-practice { min-width: 9.25rem; }

.section-empty { margin: 0.7rem 0 0; }

.tree-children {
  margin: 0.9rem 0 0 1.1rem;
  padding-left: 1.1rem;
  border-left: 1px solid var(--border);
}

.tree-children .tree-section { padding: 0.9rem 0; }
.tree-children .tree-section:last-child { border-bottom: 0; }

.manage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1rem;
  margin-top: 2.5rem;
  align-items: start;
}

.manage-grid .panel + .panel { margin-top: 0; }
.manage-grid .form-grid { grid-template-columns: 90px 1fr; }
.manage-grid .form-grid .field:nth-child(3),
.manage-grid .form-grid .field:nth-child(4) { grid-column: auto; }

/* Collection editing ------------------------------------------------------- */

html:has(.edit-page) { scroll-behavior: auto; }

.edit-page { max-width: 860px; }

.edit-header { margin-bottom: 2.25rem; }

.edit-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-bottom: 0.35rem;
}

.edit-header-top .eyebrow { margin: 0; }

.edit-title-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.5rem;
}

.edit-title-row h1 { margin: 0; }

.edit-description-row {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.edit-description-row > p { margin: 0; }

.edit-description {
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text-soft);
  font-size: 1.02rem;
  line-height: 1.65;
}

.inline-title-form {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}

.inline-title-form input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.1rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  font-size: clamp(1.6rem, 2.6vw, 2.2rem);
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.inline-title-form input:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.inline-description-form {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.inline-description-form textarea {
  width: 100%;
  min-height: 150px;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  line-height: 1.6;
  resize: vertical;
}

.inline-description-form textarea:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.edit-sections { margin-top: 0.5rem; }
.edit-sections-heading { align-items: flex-start; flex-wrap: wrap; }
.edit-section-add {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.edit-tree { border-top: 0; }

.edit-tree-section { padding: 1.1rem 0; }
.edit-tree-section:first-child { padding-top: 0.35rem; }
.section-actions-edit { gap: 0.35rem; }
.section-move-form { display: flex; gap: 0.35rem; }
.section-questions-edit { margin-top: 0.65rem; }
.section-questions-edit li { padding: 0.45rem 0.6rem; }
.section-questions-edit li .icon-button { margin-left: auto; }

.icon-button:disabled {
  opacity: 0.35;
  cursor: default;
}

.icon-button:disabled:hover {
  background: transparent;
  border-color: var(--border);
  color: var(--text-soft);
}

.section-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  align-items: start;
}

.section-form-grid > .field:nth-child(1) {
  grid-column: 1;
  grid-row: 1;
}

.section-form-grid > .field:nth-child(2) {
  grid-column: 1 / -1;
  grid-row: 2;
}

.section-form-grid > .field:nth-child(3) {
  grid-column: 1 / -1;
  grid-row: 3;
}

.section-form-grid > .field:nth-child(4) {
  grid-column: 2;
  grid-row: 1;
}

.question-picker-search {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.9rem;
}

.question-picker-search input[type="search"] {
  flex: 1 1 14rem;
  min-height: 40px;
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
}

.question-picker-search input[type="search"]:focus {
  border-color: var(--accent);
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.question-picker-count { margin: 0 0 0.25rem; }

.question-picker-list {
  list-style: none;
  margin: 0.35rem 0 0;
  padding: 0;
  max-height: 42vh;
  overflow-y: auto;
  border-top: 1px solid var(--border);
}

.question-picker-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.5rem 0.15rem;
  border-bottom: 1px solid var(--border);
}

.question-picker-text {
  display: grid;
  gap: 0.05rem;
  min-width: 0;
}

.question-picker-text a { overflow-wrap: anywhere; }

.app-dialog {
  width: min(600px, calc(100% - 2rem));
  max-height: calc(100vh - 2rem);
  margin: auto;
  padding: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-pop);
  overflow: auto;
  z-index: 100;
}

.app-dialog[open] {
  position: fixed;
  inset: 0;
}

.app-dialog::backdrop { background: rgba(21, 21, 18, 0.45); }
html[data-theme="dark"] .app-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }

.dialog-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.dialog-heading h2 { margin: 0; font-size: 1.15rem; }

.empty-state-compact { padding: 1.75rem 1rem; }

/* Exam practice progress -------------------------------------------------- */

.exam-progress {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1.1rem;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.exam-progress-scope { color: var(--text-soft); }
.exam-progress .dot { color: var(--border-strong); }
.practice-report {
  margin-top: 2rem;
  border-top: 1px solid var(--border);
  padding-top: 1.5rem;
}

.practice-report-heading { margin-bottom: 1.1rem; }

.report-item {
  padding: 1.25rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 5.5rem;
}

.report-item:first-of-type { padding-top: 0.5rem; }
.report-item:last-of-type { border-bottom: 0; }

.report-item-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin-bottom: 0.9rem;
}

.report-item-header h3 { margin: 0.15rem 0 0; }
.report-item-header h3 a { color: var(--text); }

.report-time {
  color: var(--muted);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.report-question {
  color: var(--ink);
  font-family: var(--font-reading);
  font-size: 0.94rem;
  line-height: 1.68;
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.report-answer,
.report-model {
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.report-model {
  background: var(--surface-2);
}

.report-answer h4,
.report-model h4 {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.report-assessment {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}

.report-assessment fieldset {
  padding: 0;
  margin: 0;
  border: 0;
}

.report-assessment legend {
  padding: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.report-assessment-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem;
  margin-top: 0.4rem;
  color: var(--text-soft);
  font-size: 0.86rem;
}

.report-assessment-options label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
}

.practice-assess-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  box-shadow: 0 -6px 18px color-mix(in srgb, var(--bg) 80%, transparent);
}

.practice-assess-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
}

/* Dashboard --------------------------------------------------------------- */

.dashboard-heading { margin-bottom: 1.5rem; }

.dashboard-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  padding-bottom: 0.75rem;
  margin-bottom: 1.75rem;
  border-bottom: 1px solid var(--border);
}

.dashboard-nav a {
  padding: 0.45rem 0.8rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.dashboard-nav a:hover { background: var(--surface-2); color: var(--text); }
.dashboard-nav a.is-active { background: var(--surface-2); color: var(--text); }

.bulk-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin: 0 0 1rem;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.bulk-actions-label {
  margin-right: auto;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
}

.stats-grid-admin { margin-top: 0; }

.plain-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.7rem;
}

.plain-list li {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--border);
}

.plain-list li:last-child { padding-bottom: 0; border-bottom: 0; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th {
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.73rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  padding: 0.8rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: var(--bg-elevated); }

.actions-cell { text-align: right; }

.data-table .select-column {
  width: 2.5rem;
  text-align: center;
}

.select-column input { accent-color: var(--accent); }

.users-table td { white-space: nowrap; }
.users-table td:first-child { white-space: normal; }

.question-table { min-width: 720px; }
.question-table td:first-child { min-width: 18rem; }
.question-table td:nth-child(2),
.question-table td:nth-child(5) { white-space: nowrap; }
.question-table-date { color: var(--muted); }

/* Footer ------------------------------------------------------------------ */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.footer-inner p { margin: 0; }

/* Responsive -------------------------------------------------------------- */

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .question-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .settings-layout { grid-template-columns: 1fr; }
  .main-nav { gap: 0; }
  .spotlight-inner { grid-template-columns: 1fr; gap: 2.5rem; }
  .spotlight-alt .spotlight-visual,
  .spotlight-alt .spotlight-copy { order: 0; }
  .spotlight-visual { min-height: 14rem; }
}

@media (max-width: 760px) {
  .container { width: calc(100% - 1.5rem); }
  .header-inner {
    flex-wrap: wrap;
    gap: 0.6rem;
    padding: 0.65rem 0;
    min-height: 0;
  }
  .main-nav { order: 3; flex-basis: 100%; overflow-x: auto; padding-top: 0.2rem; }
  .header-actions { margin-left: auto; }
  .account-name { display: none; }
  .home-hero { padding-top: 2rem; }
  .spotlight { padding: 2.5rem 0; }
  .spotlight-inner { gap: 2rem; }
  .spotlight-visual { min-height: 11rem; }
  .spotlight-icon { width: 6.5rem; }
  .spotlight-emblem { gap: 0.8rem; }
  .page-heading { flex-direction: column; gap: 1rem; }
  .section-heading { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .field:first-child,
  .form-grid .field:nth-child(2) { grid-column: auto; }
  .section-form-grid { grid-template-columns: 1fr; }
  .section-form-grid > .field:nth-child(1),
  .section-form-grid > .field:nth-child(2),
  .section-form-grid > .field:nth-child(3),
  .section-form-grid > .field:nth-child(4) {
    grid-column: auto;
    grid-row: auto;
  }
  .edit-tree-section .section-row { flex-direction: column; gap: 0.55rem; }
  .practice-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "date open"
      "main open"
      "counts open";
  }
  .practice-counts { justify-content: flex-start; }
  .practice-view-bar { align-items: flex-start; }
  .calendar-toolbar { align-items: flex-start; }
  .calendar-month { min-width: 0; text-align: left; }
  .practice-summary { grid-template-columns: 1fr; }
  .report-assessment { align-items: flex-start; }
  .practice-assess-actions { align-items: flex-start; flex-direction: column; }
  .practice-assess-actions .button { width: 100%; }
  .question-sheet { border-radius: var(--radius); }
  .exam-header { flex-wrap: wrap; }
}

@media (max-width: 520px) {
  body { font-size: 15px; }
  .stats-grid { grid-template-columns: 1fr; }
  .card-grid { grid-template-columns: 1fr; }
  .hero-actions .button { width: 100%; }
  .notebook summary { flex-wrap: wrap; gap: 0.5rem; }
  .notebook-tabbar .notebook-tab { flex: 1 1 auto; justify-content: center; }
  .notebook-panel { padding: 1.15rem 1rem 1.35rem; scroll-margin-top: 6rem; }
  .question-actions .button { flex: 1 1 auto; }
  .data-table th, .data-table td { padding: 0.65rem 0.6rem; }
  .section-row-display { grid-template-columns: 1fr; }
  .section-row-display .section-actions { grid-column: 1; grid-row: 2; justify-self: start; margin-top: 0.35rem; }
  .section-row-display .section-questions-display { grid-row: 3; }
}

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