:root {
  --bg: #f6f9fb;
  --surface: #ffffff;
  --surface-soft: #edf5f8;
  --surface-strong: #dcecef;
  --text: #12242b;
  --muted: #587078;
  --line: #cadce1;
  --accent: #c99b3d;
  --accent-strong: #7b5815;
  --success: #1d7f5f;
  --danger: #b4233a;
  --warning: #b86b00;
  --shadow: 0 24px 70px rgba(18, 36, 43, 0.12);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 9px;
  --font-sans: "Figtree", "Noto Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --aurora-x: 50%;
  --aurora-y: 20%;
}

[data-theme="amoled"] {
  --bg: #000000;
  --surface: #050708;
  --surface-soft: #090f12;
  --surface-strong: #0e181d;
  --text: #f4fbff;
  --muted: #9ab7c2;
  --line: #373023;
  --accent: #d2aa5c;
  --accent-strong: #f2d390;
  --success: #45df9a;
  --danger: #ff5f7d;
  --warning: #ffd166;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.78);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(circle at top left, color-mix(in srgb, var(--accent) 16%, transparent), transparent 34rem),
    linear-gradient(135deg, var(--bg), var(--surface-soft));
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
}

.soft-aurora-container {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(circle at var(--aurora-x) var(--aurora-y), color-mix(in srgb, var(--accent) 18%, transparent), transparent 19rem),
    radial-gradient(circle at 88% 18%, rgba(84, 214, 184, 0.18), transparent 24rem),
    radial-gradient(circle at 16% 78%, rgba(123, 92, 255, 0.14), transparent 25rem);
  filter: saturate(112%);
}

.soft-aurora-container::before,
.soft-aurora-container::after {
  content: "";
  position: absolute;
  inset: -18%;
  opacity: 0.74;
  transform-origin: center;
  will-change: transform;
}

.soft-aurora-container::before {
  background:
    conic-gradient(from 175deg at 42% 48%, transparent 0deg, rgba(210, 170, 92, 0.2) 58deg, transparent 118deg, rgba(242, 211, 144, 0.15) 206deg, transparent 292deg),
    linear-gradient(120deg, transparent 18%, rgba(255, 255, 255, 0.14), transparent 58%);
  filter: blur(56px);
  animation: auroraDrift 18s ease-in-out infinite alternate;
}

.soft-aurora-container::after {
  background:
    radial-gradient(ellipse at 52% 24%, rgba(210, 170, 92, 0.18), transparent 38%),
    radial-gradient(ellipse at 72% 72%, rgba(123, 88, 21, 0.16), transparent 34%);
  filter: blur(72px);
  animation: auroraFloat 22s ease-in-out infinite alternate;
}

[data-theme="amoled"] .soft-aurora-container {
  background:
    radial-gradient(circle at var(--aurora-x) var(--aurora-y), rgba(210, 170, 92, 0.16), transparent 19rem),
    radial-gradient(circle at 84% 16%, rgba(242, 211, 144, 0.11), transparent 23rem),
    radial-gradient(circle at 12% 78%, rgba(123, 88, 21, 0.12), transparent 25rem),
    #000000;
}

@keyframes auroraDrift {
  from {
    transform: translate3d(-2%, -1%, 0) rotate(-3deg) scale(1);
  }

  to {
    transform: translate3d(3%, 2%, 0) rotate(4deg) scale(1.06);
  }
}

@keyframes auroraFloat {
  from {
    transform: translate3d(2%, 2%, 0) rotate(2deg) scale(1.02);
  }

  to {
    transform: translate3d(-3%, -2%, 0) rotate(-5deg) scale(1.08);
  }
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 50;
  transform: translateY(calc(-100% - 24px));
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 900;
  text-decoration: none;
  transition: transform 160ms ease;
}

.skip-link:focus-visible {
  transform: translateY(0);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 42%, transparent);
  outline-offset: 3px;
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 18px 0 48px;
}

.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface) 82%, transparent);
}

.nav-pill {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 9px;
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}

.nav-pill.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 8px 22px rgba(18, 36, 43, 0.08);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px;
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: var(--muted);
  font-size: 0.82rem;
}

.topbar-actions,
.toolbar-controls,
.action-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-actions {
  margin-left: 0;
}

.auth-view,
.home-view,
.dashboard-view,
.quiz-view {
  animation: enter 320ms ease both;
}

.auth-view {
  min-height: calc(100dvh - 96px);
  display: grid;
  place-items: center;
  padding: 28px 0;
}

.home-view {
  min-height: calc(100dvh - 96px);
  display: grid;
  place-items: center;
  padding: 28px 0;
}

.auth-panel {
  width: min(100%, 980px);
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.78fr);
  gap: 28px;
  align-items: stretch;
}

.home-panel {
  width: min(100%, 980px);
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: stretch;
}

.auth-copy,
.home-copy,
.home-action-card,
.profile-rail,
.workspace-panel,
.form-card,
.question-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
}

.auth-copy {
  min-height: 430px;
  padding: clamp(28px, 5vw, 58px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 14%, var(--surface)), var(--surface)),
    var(--surface);
}

.home-copy {
  min-height: 310px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(28px, 5vw, 52px);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 12%, var(--surface)), var(--surface)),
    var(--surface);
}

.home-copy h1 {
  max-width: 13ch;
  margin: 0 0 18px;
  font-size: clamp(2.65rem, 6vw, 4.8rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.home-copy p:not(.micro-label) {
  max-width: 54ch;
  margin: 0;
  font-size: 1.04rem;
}

.home-summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.home-summary span {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 13px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  color: var(--muted);
  font-weight: 800;
}

.home-summary strong {
  color: var(--text);
}

.home-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-content: center;
}

.home-action-card {
  min-height: 176px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 18px;
  padding: 24px;
  color: var(--text);
  text-align: left;
}

.home-action-card i {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 18px;
  background: var(--surface-soft);
  color: var(--accent-strong);
  font-size: 2rem;
}

.home-action-card strong,
.home-action-card small {
  display: block;
}

.home-action-card strong {
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.1;
}

.home-action-card small {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.45;
}

.home-action-card.primary-card {
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.auth-copy h1 {
  max-width: 10ch;
  margin: 0 0 18px;
  font-size: clamp(2.8rem, 7vw, 5.8rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.auth-copy p:not(.micro-label) {
  max-width: 58ch;
  margin: 0;
  color: var(--muted);
  font-size: 1.04rem;
}

.form-card {
  padding: 24px;
  align-self: center;
}

.micro-label {
  margin: 0 0 12px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.segmented {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.segmented.compact {
  white-space: nowrap;
}

.segment {
  min-height: 42px;
  border: 0;
  border-radius: 9px;
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
}

.segment.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 8px 24px rgba(18, 36, 43, 0.08);
}

form {
  margin: 22px 0 0;
}

.field {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 750;
}

.field + .field {
  margin-top: 16px;
}

.field span {
  font-size: 0.92rem;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 13px;
  background: var(--surface);
  color: var(--text);
}

input::placeholder {
  color: color-mix(in srgb, var(--muted) 72%, transparent);
}

.form-error {
  min-height: 22px;
  margin: 12px 0;
  color: var(--danger);
  font-weight: 700;
}

.form-status {
  min-height: 22px;
  margin: 0 0 12px;
  color: var(--success);
  font-weight: 750;
}

.primary-button,
.ghost-button,
.icon-button,
.text-button {
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 0 16px;
  font-weight: 800;
  transition: transform 180ms ease, background-color 180ms ease, border-color 180ms ease;
}

.primary-button {
  background: var(--accent);
  color: #ffffff;
}

.ghost-button,
.icon-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

.text-button {
  min-height: 36px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent-strong);
}

.primary-button:hover,
.ghost-button:hover,
.icon-button:hover,
.text-button:hover {
  transform: translateY(-1px);
}

.primary-button:active,
.ghost-button:active,
.icon-button:active {
  transform: translateY(1px);
}

.full-width {
  width: 100%;
}

.dashboard-view,
.quiz-view {
  padding-top: 24px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.35fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.profile-rail,
.workspace-panel {
  padding: 24px;
}

.profile-rail {
  position: sticky;
  top: 18px;
}

.profile-rail h2,
.workspace-panel h2,
.quiz-toolbar h2 {
  margin: 0;
  font-size: clamp(1.65rem, 3vw, 2.6rem);
  line-height: 1.08;
}

.muted {
  color: var(--muted);
}

.rail-stat {
  margin-top: 32px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.rail-stat strong {
  display: block;
  font-size: 3rem;
  line-height: 1;
}

.panel-heading,
.quiz-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.filter-grid .field + .field {
  margin-top: 0;
}

.action-row {
  margin-top: 22px;
}

.quiz-toolbar {
  margin-bottom: 18px;
}

.quiz-score-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.quiz-score-row span {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 800;
}

.quiz-score-row strong {
  color: var(--text);
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 10px 0 18px;
  color: var(--muted);
  font-weight: 750;
}

.progress-bar {
  flex: 1;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-strong);
}

.progress-bar span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 220ms ease;
}

.question-list {
  display: grid;
  gap: 18px;
}

.question-list.horizontal {
  display: block;
}

.question-card {
  padding: 22px;
}

.question-card.inactive {
  display: none;
}

.question-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.question-text {
  margin: 0 0 18px;
  font-size: clamp(1.1rem, 2vw, 1.45rem);
}

.option-list {
  display: grid;
  gap: 10px;
}

.option-button {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.option-key {
  display: grid;
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 9px;
  background: var(--surface-soft);
  font-weight: 900;
}

.option-button.correct {
  border-color: color-mix(in srgb, var(--success) 70%, var(--line));
  background: color-mix(in srgb, var(--success) 14%, var(--surface));
}

.option-button.incorrect {
  border-color: color-mix(in srgb, var(--danger) 70%, var(--line));
  background: color-mix(in srgb, var(--danger) 12%, var(--surface));
}

.explanation {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
  padding: 16px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.explanation p {
  margin: 6px 0 0;
  color: var(--muted);
}

.explanation-content {
  min-width: 0;
}

.explanation-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.explanation-text,
.review-explanation p,
#explanationEditField {
  font-family: "Noto Sans Arabic", var(--font-sans);
  unicode-bidi: plaintext;
  text-align: right;
  white-space: pre-wrap;
}

.edit-explanation-button {
  flex: 0 0 auto;
  min-height: 36px;
  padding-inline: 8px;
  font-size: 0.82rem;
}

.explanation img {
  width: min(100%, 560px);
  aspect-ratio: 16 / 9;
  justify-self: center;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}

.horizontal-controls {
  position: sticky;
  bottom: 14px;
  width: min(100%, 920px);
  margin: 18px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  box-shadow: var(--shadow);
}

.vertical-controls {
  position: sticky;
  bottom: 14px;
  z-index: 16;
  width: min(100%, 360px);
  margin: 18px auto 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.vertical-controls .done-for-now-button,
.vertical-controls .submit-exam-button {
  flex: 1 1 0;
  min-width: 0;
}

.primary-button,
.ghost-button,
.icon-button,
.text-button,
.queue-button,
.bookmark-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary-button,
.ghost-button,
.icon-button,
.segment,
.nav-pill,
.queue-button,
.bookmark-button,
.home-action-card,
.brand {
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease,
    color 180ms ease;
}

.primary-button:hover,
.ghost-button:hover,
.icon-button:hover,
.queue-button:hover,
.bookmark-button:hover,
.home-action-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 48%, var(--line));
  box-shadow: 0 18px 42px rgba(18, 36, 43, 0.14);
}

.home-action-card:hover {
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
}

.home-action-card:hover i,
.queue-button:hover i,
.bookmark-button:hover i,
.primary-button:hover i,
.ghost-button:hover i,
.icon-button:hover i {
  transform: scale(1.08);
}

.home-action-card.primary-card:hover {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
}

.segment:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.nav-pill:hover {
  color: var(--text);
  background: color-mix(in srgb, var(--surface) 72%, transparent);
}

.brand:hover {
  transform: translateY(-1px);
}

.brand:hover .brand-mark {
  box-shadow: 0 12px 28px color-mix(in srgb, var(--accent) 28%, transparent);
}

.primary-button:active,
.ghost-button:active,
.icon-button:active,
.queue-button:active,
.bookmark-button:active,
.home-action-card:active {
  transform: translateY(1px) scale(0.99);
  box-shadow: none;
}

button:disabled,
button:disabled:hover,
button:disabled:active {
  transform: none;
  box-shadow: none;
}

.ph {
  font-size: 1.15em;
  line-height: 1;
  transition: transform 180ms ease;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.stat-card {
  min-height: 104px;
  display: grid;
  align-content: space-between;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.stat-card i {
  color: var(--accent-strong);
  font-size: 1.35rem;
}

.stat-card strong {
  display: block;
  font-size: 1.8rem;
  line-height: 1;
}

.stat-card span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.resume-note {
  margin: 18px 0 0;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--accent-strong);
  font-weight: 750;
}

.queue-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.queue-button {
  min-height: 72px;
  justify-content: flex-start;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  background: var(--surface-soft);
  color: var(--text);
  text-align: left;
  font-weight: 800;
}

.queue-button strong {
  margin-left: auto;
  min-width: 34px;
  min-height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface);
  color: var(--accent-strong);
}

.queue-button:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.question-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.bookmark-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
}

.bookmark-button.active {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent-strong);
}

.result-pill {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0 12px;
  font-weight: 900;
}

.result-pill.correct {
  background: color-mix(in srgb, var(--success) 15%, var(--surface));
  color: var(--success);
}

.result-pill.incorrect {
  background: color-mix(in srgb, var(--danger) 14%, var(--surface));
  color: var(--danger);
}

.hidden {
  display: none !important;
}

@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 24px, 1180px);
    padding-top: 12px;
  }

  .auth-panel,
  .home-panel,
  .dashboard-grid,
  .filter-grid,
  .queue-row,
  .explanation {
    grid-template-columns: 1fr;
  }

  .auth-copy {
    min-height: 340px;
  }

  .home-copy {
    min-height: 280px;
  }

  .home-actions {
    grid-template-columns: 1fr;
  }

  .panel-heading,
  .quiz-toolbar {
    display: grid;
  }

  .toolbar-controls {
    align-items: stretch;
  }

  .segmented {
    width: 100%;
  }

  .segment {
    width: 100%;
  }

  .profile-rail {
    position: static;
  }
}

[data-theme="amoled"] .brand strong {
  color: var(--text);
}

[data-theme="amoled"] .brand small {
  color: var(--muted);
}

[data-theme="amoled"] .page-nav,
[data-theme="amoled"] .topbar-actions .icon-button,
[data-theme="amoled"] .topbar-actions .ghost-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

[data-theme="amoled"] .nav-pill {
  color: var(--muted);
}

[data-theme="amoled"] .nav-pill.active {
  background: var(--accent);
  color: #15120e;
  box-shadow: 0 10px 28px rgba(210, 170, 92, 0.18);
}

/* Audit improvements: streak, dialogs, and time map */
.streak-strip {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line));
  border-radius: 8px;
  padding: 12px;
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
}

.streak-strip > i {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--text);
  color: var(--accent);
  font-size: 1.3rem;
}

.streak-strip strong,
.streak-strip span {
  display: block;
}

.streak-strip span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.4;
}

.history-retention-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.time-map-panel {
  display: grid;
  gap: 18px;
}

.time-map-panel h3 {
  margin: 3px 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2vw, 2rem);
}

.answer-time-map {
  display: grid;
  gap: 10px;
}

.time-map-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(180px, 1.5fr) 90px 90px;
  align-items: center;
  gap: 14px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
  border-radius: 8px;
  padding: 14px;
  background: color-mix(in srgb, var(--surface) 84%, transparent);
}

.time-map-row strong,
.time-map-row small {
  display: block;
}

.time-map-row small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.76rem;
}

.time-map-meter {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.time-map-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #b8892e, #e1c47f);
}

.time-map-row.slow .time-map-meter span {
  background: var(--warning);
}

.app-dialog {
  width: min(100% - 28px, 620px);
  max-height: min(88dvh, 760px);
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
}

.app-dialog::backdrop {
  background: rgba(5, 5, 4, 0.58);
  backdrop-filter: blur(6px);
}

.dialog-panel {
  display: grid;
  gap: 20px;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line));
  border-radius: 8px;
  padding: clamp(20px, 4vw, 32px);
  background: var(--surface);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.28);
}

.dialog-heading,
.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.dialog-heading h2 {
  margin: 3px 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 4vw, 2.7rem);
  line-height: 1;
}

.dialog-close {
  flex: 0 0 auto;
}

.dialog-actions {
  justify-content: flex-end;
}

.queue-subject-count,
.explanation-edit-note {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 13px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.field textarea {
  width: 100%;
  min-height: 120px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1.5;
}

#explanationEditField {
  min-height: 210px;
  font-size: 1rem;
}

.shortcut-list {
  display: grid;
  gap: 10px;
}

.shortcut-list > span {
  min-height: 54px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.shortcut-list > span:last-child {
  border-bottom: 0;
}

.shortcut-list strong {
  margin-left: auto;
  text-align: right;
}

@media (max-width: 720px) {
  .time-map-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }

  .time-map-meter {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .dialog-actions > button {
    flex: 1;
  }
}

@media (max-width: 520px) {
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .page-nav {
    order: 3;
    width: 100%;
    justify-content: stretch;
  }

  .nav-pill {
    flex: 1;
    justify-content: center;
  }

  .brand small {
    display: none;
  }

  .auth-copy,
  .home-copy,
  .home-action-card,
  .profile-rail,
  .workspace-panel,
  .form-card,
  .question-card {
    padding: 18px;
    border-radius: 14px;
  }

  .auth-copy h1 {
    max-width: 12ch;
    font-size: clamp(2.4rem, 15vw, 4.2rem);
  }

  .home-copy h1 {
    max-width: 12ch;
    font-size: clamp(2.35rem, 14vw, 4rem);
  }

  .home-action-card {
    min-height: 150px;
    grid-template-columns: 1fr;
  }

  .progress-wrap {
    display: grid;
  }

  .horizontal-controls {
    position: static;
    margin-top: 16px;
  }
}

/* Bookmarks, records, and competitive leaderboard */
.statistics-view,
.bookmarks-view,
.leaderboard-view {
  animation: viewIn 260ms ease both;
}

.home-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-grid {
  grid-template-columns: minmax(300px, 0.28fr) minmax(0, 1fr);
  grid-template-areas:
    "profile setup"
    "profile analytics"
    "profile history";
}

.dashboard-grid > .insight-panel:nth-of-type(2) {
  grid-area: analytics;
}

.dashboard-grid > .insight-panel:nth-of-type(3) {
  grid-area: history;
}

.best-record-strip {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  margin: 18px 0 0;
  border: 1px solid color-mix(in srgb, var(--accent) 48%, var(--line));
  border-radius: 8px;
  padding: 14px;
  background:
    linear-gradient(115deg, color-mix(in srgb, var(--accent) 14%, var(--surface)), color-mix(in srgb, var(--surface) 94%, transparent));
}

.best-record-strip > i {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  border-radius: 8px;
  background: var(--text);
  color: var(--accent);
  font-size: 1.35rem;
}

.best-record-strip div,
.best-record-strip span,
.best-record-strip strong,
.best-record-strip small {
  display: block;
}

.best-record-strip span,
.best-record-strip small {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.best-record-strip strong {
  margin: 3px 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.12rem;
}

.bookmarks-panel {
  overflow: hidden;
}

.bookmark-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.bookmark-library-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.04fr) minmax(0, 0.96fr);
  gap: 24px;
}

.bookmark-library-section {
  min-width: 0;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.section-heading-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.section-heading-row h3 {
  margin: 3px 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2.4vw, 2.35rem);
}

.bookmark-question-list {
  display: grid;
  gap: 10px;
}

.bookmark-question-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 104px;
  border: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
  border-radius: 8px;
  padding: 16px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  transition: border-color 180ms ease, background-color 180ms ease, transform 180ms ease;
}

.bookmark-question-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 56%, var(--line));
  background: color-mix(in srgb, var(--accent) 7%, var(--surface));
}

.bookmark-question-card strong,
.bookmark-question-card small,
.bookmark-question-card div > span {
  display: block;
}

.bookmark-question-card strong {
  margin-top: 5px;
  line-height: 1.45;
}

.bookmark-question-card small,
.bookmark-question-card div > span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.popular-question-card {
  grid-template-columns: 38px minmax(0, 1fr) auto;
}

.bookmark-rank {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent-strong);
  font-weight: 900;
}

.bookmark-list-action {
  min-width: 82px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 800;
}

.bookmark-list-action.active {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent-strong);
}

.bookmark-empty-state {
  min-height: 210px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px dashed color-mix(in srgb, var(--line) 88%, transparent);
  border-radius: 8px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.bookmark-empty-state i {
  color: var(--accent);
  font-size: 2rem;
}

.bookmark-empty-state strong {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 1.3rem;
}

.leaderboard-stage {
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 38%, var(--line));
  border-radius: 8px;
  padding: clamp(20px, 4vw, 42px);
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 28rem),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, var(--accent) 4%), var(--surface-soft));
  color: var(--text);
}

.leaderboard-stage-heading {
  align-items: center;
}

.leaderboard-stage h3 {
  color: var(--text);
}

.privacy-note {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.leaderboard-podium {
  min-height: 360px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: clamp(10px, 2vw, 22px);
  padding-top: 28px;
}

.podium-card {
  position: relative;
  min-height: 236px;
  display: grid;
  place-items: center;
  align-content: start;
  gap: 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 34%, var(--line));
  border-radius: 8px 8px 0 0;
  padding: 24px 14px;
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--accent) 5%, var(--surface)));
  box-shadow: 0 16px 36px rgba(42, 34, 22, 0.07);
  text-align: center;
}

.podium-rank-1 {
  min-height: 310px;
  border-color: color-mix(in srgb, var(--accent) 72%, var(--line));
  background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 17%, var(--surface)), var(--surface));
  box-shadow: 0 22px 50px rgba(123, 88, 21, 0.13);
}

.podium-rank-2 {
  min-height: 258px;
}

.podium-rank-3 {
  min-height: 226px;
}

.podium-rank {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent-strong);
  font-weight: 900;
}

.podium-avatar {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 58%, var(--line));
  border-radius: 8px;
  background: linear-gradient(145deg, #2a241b, var(--accent));
  color: #fff8e9;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 800;
}

.podium-card strong {
  margin-top: 4px;
  font-size: 1rem;
}

.podium-card > small,
.podium-score small {
  color: var(--muted);
}

.podium-score {
  display: grid;
  gap: 2px;
  margin-top: 8px;
}

.podium-score span {
  color: var(--accent-strong);
  font-size: 1.5rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

[data-theme="amoled"] .best-record-strip > i {
  background: var(--accent);
  color: #15120e;
}

[data-theme="amoled"] .leaderboard-stage {
  background:
    radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 28rem),
    linear-gradient(180deg, #17140f, #090807);
  color: #fffaf0;
}

[data-theme="amoled"] .leaderboard-stage h3 {
  color: #fffaf0;
}

[data-theme="amoled"] .privacy-note,
[data-theme="amoled"] .podium-card > small,
[data-theme="amoled"] .podium-score small {
  color: #d8caaa;
}

[data-theme="amoled"] .podium-card {
  border-color: rgba(210, 170, 92, 0.28);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(210, 170, 92, 0.06));
  box-shadow: none;
}

[data-theme="amoled"] .podium-rank-1 {
  border-color: rgba(242, 211, 144, 0.7);
  background: linear-gradient(180deg, rgba(210, 170, 92, 0.2), rgba(210, 170, 92, 0.06));
}

[data-theme="amoled"] .podium-rank,
[data-theme="amoled"] .podium-score span {
  color: #f2d390;
}

@media (max-width: 1120px) {
  .dashboard-grid {
    grid-template-columns: minmax(280px, 0.34fr) minmax(0, 1fr);
    grid-template-areas:
      "profile setup"
      "profile analytics"
      "history history";
  }

  .bookmark-library-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .home-actions,
  .dashboard-grid,
  .bookmark-summary-grid,
  .bookmark-library-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-grid {
    grid-template-areas:
      "profile"
      "setup"
      "analytics"
      "history";
  }

  .leaderboard-podium {
    min-height: 0;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .podium-rank-1 {
    order: 1;
  }

  .podium-rank-2 {
    order: 2;
  }

  .podium-rank-3 {
    order: 3;
  }

  .podium-card,
  .podium-rank-1,
  .podium-rank-2,
  .podium-rank-3 {
    min-height: 0;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    place-items: center start;
    text-align: left;
    border-radius: 8px;
  }

  .podium-card > small {
    grid-column: 3;
  }

  .podium-score {
    grid-column: 4;
    grid-row: 1 / span 2;
    text-align: right;
  }
}

@media (max-width: 520px) {
  .bookmark-question-card,
  .popular-question-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .bookmark-rank {
    width: 32px;
    height: 32px;
  }

  .bookmark-list-action {
    width: 100%;
  }

  .podium-card,
  .podium-rank-1,
  .podium-rank-2,
  .podium-rank-3 {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .podium-card > strong,
  .podium-card > small {
    grid-column: 2;
  }

  .podium-score {
    grid-column: 2;
    grid-row: auto;
    text-align: left;
  }
}

/* Exam pages expansion: quiet gold data rooms */
.statistics-view,
.leaderboard-view {
  animation: viewIn 260ms ease both;
}

.standalone-panel {
  display: grid;
  gap: clamp(18px, 3vw, 28px);
  padding: clamp(22px, 4vw, 38px);
  border-radius: 8px;
}

.standalone-heading,
.standalone-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.standalone-heading h2 {
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 4.2rem);
  line-height: 0.98;
}

.stats-overview-grid,
.leaderboard-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.leaderboard-summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.wide-stat {
  align-items: start;
  gap: 8px;
}

.wide-stat strong {
  display: block;
  margin: 2px 0;
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1;
}

.wide-stat small,
.wide-stat span {
  color: var(--muted);
}

.split-insight-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.72fr);
  gap: 18px;
}

.soft-panel {
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--surface) 92%, transparent), color-mix(in srgb, var(--surface-soft) 88%, transparent));
  box-shadow: none;
}

.analytics-grid.expanded,
.session-history-list.expanded {
  display: grid;
  gap: 12px;
}

.detail-card {
  min-height: 88px;
}

.leaderboard-detail-list {
  display: grid;
  gap: 12px;
}

.leaderboard-detail-card {
  display: grid;
  grid-template-columns: 52px minmax(180px, 1fr) minmax(360px, 1.3fr);
  align-items: center;
  gap: 16px;
  min-height: 92px;
  padding: 16px;
  border: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
}

.leaderboard-detail-card strong {
  display: block;
  font-size: 1.05rem;
}

.leaderboard-detail-card small {
  color: var(--muted);
}

.rank-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--accent-strong);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.leaderboard-detail-card dl {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.leaderboard-detail-card dl div {
  padding: 10px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft) 82%, transparent);
}

.leaderboard-detail-card dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
}

.leaderboard-detail-card dd {
  margin: 4px 0 0;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

[data-theme="amoled"] {
  --bg: #050504;
  --surface: #0d0b09;
  --surface-soft: #15120e;
  --surface-strong: #211c15;
  --text: #faf6ea;
  --muted: #b8ad9a;
  --line: #373023;
  --accent: #d2aa5c;
  --accent-strong: #f2d390;
}

[data-theme="amoled"] body {
  background:
    radial-gradient(circle at 16% 0%, rgba(210, 170, 92, 0.12), transparent 30rem),
    linear-gradient(180deg, rgba(5, 5, 4, 0.97), rgba(13, 11, 9, 1)),
    repeating-linear-gradient(90deg, rgba(210, 170, 92, 0.035) 0 1px, transparent 1px 92px);
}

[data-theme="amoled"] .border-glow-card {
  --glow-color: rgba(210, 170, 92, 0.92);
  --glow-secondary: rgba(242, 211, 144, 0.56);
  --glow-tertiary: rgba(123, 88, 21, 0.48);
}

[data-theme="amoled"] .brand-mark,
[data-theme="amoled"] .primary-button {
  color: #15120e;
}

[data-theme="amoled"] .home-copy,
[data-theme="amoled"] .home-action-card.primary-card,
[data-theme="amoled"] .stat-card,
[data-theme="amoled"] .soft-panel {
  background:
    radial-gradient(circle at 88% 20%, rgba(210, 170, 92, 0.14), transparent 16rem),
    linear-gradient(135deg, #0d0b09, #15120e);
}

[data-theme="amoled"] .explanation {
  background:
    linear-gradient(135deg, rgba(210, 170, 92, 0.08), rgba(13, 11, 9, 0.96));
}

@media (max-width: 920px) {
  .stats-overview-grid,
  .leaderboard-summary-grid,
  .split-insight-grid,
  .leaderboard-detail-card,
  .leaderboard-detail-card dl {
    grid-template-columns: 1fr;
  }

  .leaderboard-detail-card {
    align-items: start;
  }

  .app-shell {
    width: min(100% - 28px, 1360px);
  }
}

/* Luxury studio redesign: quiet black, ivory, and gold system */
:root {
  --bg: #f7f5ef;
  --surface: #fffefa;
  --surface-soft: #f0ece2;
  --surface-strong: #e5ded0;
  --text: #15120e;
  --muted: #6f685e;
  --line: #d7cdbb;
  --accent: #c99b3d;
  --accent-strong: #7b5815;
  --success: #1c7256;
  --danger: #a73434;
  --warning: #9b650e;
  --shadow: 0 24px 70px rgba(42, 34, 22, 0.1);
  --radius-lg: 8px;
  --radius-md: 8px;
  --radius-sm: 8px;
  --font-sans: "Inter", "Noto Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Fraunces", Georgia, serif;
}

[data-theme="amoled"] {
  --bg: #050504;
  --surface: #0d0b09;
  --surface-soft: #15120e;
  --surface-strong: #211c15;
  --text: #faf6ea;
  --muted: #b8ad9a;
  --line: #373023;
  --accent: #d2aa5c;
  --accent-strong: #f2d390;
  --success: #62d0a5;
  --danger: #ff7d75;
  --warning: #f0c36d;
  --shadow: 0 26px 80px rgba(0, 0, 0, 0.72);
}

html {
  background: var(--bg);
  scroll-padding-top: 110px;
}

body {
  background:
    linear-gradient(180deg, rgba(255, 254, 250, 0.94), rgba(247, 245, 239, 0.98)),
    repeating-linear-gradient(90deg, rgba(21, 18, 14, 0.025) 0 1px, transparent 1px 84px);
  color: var(--text);
  letter-spacing: 0;
}

[data-theme="amoled"] body {
  background:
    linear-gradient(180deg, rgba(5, 5, 4, 0.96), rgba(13, 11, 9, 0.99)),
    repeating-linear-gradient(90deg, rgba(210, 170, 92, 0.035) 0 1px, transparent 1px 92px);
}

.soft-aurora-container,
.soft-aurora-container::before,
.soft-aurora-container::after {
  inset: 0;
  animation: none;
  background:
    linear-gradient(90deg, transparent, rgba(201, 155, 61, 0.04), transparent),
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 34%);
  filter: none;
  opacity: 1;
}

[data-theme="amoled"] .soft-aurora-container,
[data-theme="amoled"] .soft-aurora-container::before,
[data-theme="amoled"] .soft-aurora-container::after {
  background:
    linear-gradient(90deg, transparent, rgba(210, 170, 92, 0.05), transparent),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 38%);
}

.app-shell {
  width: min(1360px, calc(100% - 56px));
  padding: 20px 0 64px;
}

.topbar {
  position: sticky;
  top: 16px;
  z-index: 20;
  min-height: 70px;
  margin-bottom: 22px;
  border-radius: 8px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  box-shadow: 0 18px 48px rgba(42, 34, 22, 0.08);
}

[data-theme="amoled"] .topbar {
  background: rgba(13, 11, 9, 0.9);
  box-shadow: 0 18px 52px rgba(0, 0, 0, 0.62);
}

.brand {
  gap: 14px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  border: 1px solid color-mix(in srgb, var(--accent) 58%, var(--line));
  border-radius: 8px;
  background:
    linear-gradient(135deg, #15120e, #3a2b12 64%, var(--accent));
  color: #f7e2ad;
  font-family: var(--font-display);
  font-size: 1.35rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

[data-theme="amoled"] .brand-mark {
  background:
    linear-gradient(135deg, #050504, #2a210f 66%, #d2aa5c);
}

.brand strong {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 750;
}

.brand small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 0.78rem;
}

.page-nav,
.segmented {
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft) 72%, transparent);
}

.nav-pill,
.segment {
  min-height: 44px;
  border-radius: 6px;
}

.nav-pill.active,
.segment.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 10px 24px rgba(42, 34, 22, 0.08);
}

.auth-view,
.home-view {
  min-height: calc(100dvh - 124px);
  padding-top: clamp(18px, 4vh, 52px);
}

.auth-panel {
  width: min(100%, 1180px);
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.58fr);
  gap: clamp(18px, 3vw, 34px);
}

.home-panel {
  width: min(100%, 1180px);
  gap: 20px;
}

.auth-copy,
.home-copy,
.home-action-card,
.profile-rail,
.workspace-panel,
.form-card,
.question-card {
  border: 1px solid color-mix(in srgb, var(--line) 86%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
}

[data-theme="amoled"] .auth-copy,
[data-theme="amoled"] .home-copy,
[data-theme="amoled"] .home-action-card,
[data-theme="amoled"] .profile-rail,
[data-theme="amoled"] .workspace-panel,
[data-theme="amoled"] .form-card,
[data-theme="amoled"] .question-card {
  box-shadow:
    0 30px 86px rgba(0, 0, 0, 0.66),
    inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.border-glow-card {
  --glow-color: rgba(210, 170, 92, 0.72);
  --glow-secondary: rgba(21, 18, 14, 0.18);
  --glow-tertiary: rgba(111, 104, 94, 0.22);
}

[data-theme="amoled"] .border-glow-card {
  --glow-color: rgba(210, 170, 92, 0.86);
  --glow-secondary: rgba(250, 246, 234, 0.12);
  --glow-tertiary: rgba(123, 88, 21, 0.26);
}

.auth-copy,
.home-copy {
  min-height: clamp(390px, 46vh, 560px);
  padding: clamp(30px, 6vw, 76px);
  justify-content: center;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 16%, transparent) 0 1px, transparent 1px 100%),
    linear-gradient(135deg, color-mix(in srgb, var(--surface) 98%, var(--accent) 2%), var(--surface));
  background-size: 72px 100%, auto;
}

.home-copy::after {
  content: "";
  position: absolute;
  inset: auto clamp(24px, 5vw, 72px) clamp(24px, 5vw, 58px) auto;
  width: min(34vw, 360px);
  height: 1px;
  border: 0;
  border-radius: 0;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0.8;
}

.micro-label {
  margin-bottom: 14px;
  color: var(--accent-strong);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0;
}

.auth-copy h1,
.home-copy h1 {
  max-width: 13ch;
  margin-bottom: 22px;
  font-family: var(--font-display);
  font-weight: 650;
  letter-spacing: 0;
}

.auth-copy h1 {
  font-size: clamp(3rem, 7vw, 6.8rem);
  line-height: 0.94;
}

.home-copy h1 {
  font-size: clamp(3rem, 7vw, 6.35rem);
  line-height: 0.95;
}

.auth-copy p:not(.micro-label),
.home-copy p:not(.micro-label) {
  max-width: 61ch;
  color: var(--muted);
  font-size: clamp(1rem, 1.35vw, 1.16rem);
  line-height: 1.72;
}

.form-card {
  padding: clamp(22px, 3vw, 32px);
}

.home-summary {
  gap: 12px;
  margin-top: 30px;
}

.home-summary span,
.quiz-score-row span,
.result-pill {
  border-radius: 8px;
}

.home-summary span {
  border-color: color-mix(in srgb, var(--accent) 26%, var(--line));
  background: color-mix(in srgb, var(--surface) 80%, transparent);
}

.home-actions {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}

.home-action-card {
  min-height: 196px;
  padding: clamp(24px, 3.5vw, 38px);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, var(--accent) 4%), var(--surface));
}

.home-action-card.primary-card {
  border-color: color-mix(in srgb, var(--accent) 64%, var(--line));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 17%, var(--surface)), var(--surface));
}

.home-action-card.continue-card:not(:disabled) {
  border-color: color-mix(in srgb, var(--accent) 44%, var(--line));
}

.home-action-card:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  border-color: var(--line);
  background: color-mix(in srgb, var(--surface-soft) 74%, var(--surface));
}

.home-action-card:disabled i {
  color: var(--muted);
  background: var(--surface-strong);
}

.home-action-card:disabled:hover {
  border-color: var(--line);
  background: color-mix(in srgb, var(--surface-soft) 74%, var(--surface));
}

.home-action-card i,
.stat-card i {
  border-radius: 8px;
  border-color: color-mix(in srgb, var(--accent) 32%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--accent-strong);
}

.home-action-card strong,
.profile-rail h2,
.workspace-panel h2,
.quiz-toolbar h2,
.question-text {
  font-family: var(--font-display);
  font-weight: 650;
  letter-spacing: 0;
}

.home-action-card strong {
  font-size: clamp(1.55rem, 2.6vw, 2.15rem);
}

.dashboard-grid {
  grid-template-columns: minmax(300px, 0.3fr) minmax(0, 1fr);
  gap: 28px;
}

.profile-rail,
.workspace-panel {
  padding: clamp(24px, 3vw, 34px);
}

.profile-rail {
  top: 114px;
}

.profile-rail h2,
.workspace-panel h2,
.quiz-toolbar h2 {
  font-size: clamp(1.85rem, 3vw, 3rem);
}

.rail-stat strong {
  font-family: var(--font-display);
  font-weight: 650;
}

.stat-card {
  min-height: 118px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface-soft) 72%, var(--surface));
}

.field {
  gap: 9px;
}

.field span,
.stat-card span {
  font-size: 0.86rem;
  letter-spacing: 0;
}

input,
select {
  min-height: 50px;
  border-radius: 8px;
  background: var(--surface);
}

.primary-button,
.ghost-button,
.icon-button,
.queue-button,
.bookmark-button {
  min-height: 48px;
  border-radius: 8px;
}

.primary-button {
  border-color: color-mix(in srgb, var(--accent) 76%, #5c3e08);
  background: linear-gradient(135deg, #d7b568, #b8892e);
  color: #17120d;
}

.ghost-button,
.icon-button,
.bookmark-button {
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.text-button {
  min-height: 44px;
  color: var(--accent-strong);
}

.primary-button:hover,
.ghost-button:hover,
.icon-button:hover,
.queue-button:hover,
.bookmark-button:hover,
.home-action-card:hover {
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
  box-shadow: 0 16px 40px rgba(42, 34, 22, 0.13);
}

.queue-row {
  gap: 14px;
}

.queue-button {
  min-height: 78px;
  background: color-mix(in srgb, var(--surface-soft) 74%, var(--surface));
}

.queue-button strong {
  color: var(--accent-strong);
}

.resume-note {
  border-color: color-mix(in srgb, var(--accent) 36%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--accent-strong);
}

.quiz-view {
  max-width: 1120px;
  margin: 0 auto;
}

.quiz-toolbar {
  margin-bottom: 22px;
}

.progress-wrap {
  margin: 12px 0 22px;
}

.progress-bar {
  height: 8px;
  background: var(--surface-strong);
}

.progress-bar span {
  background: linear-gradient(90deg, #b8892e, #e1c47f);
}

.question-card {
  padding: clamp(22px, 3vw, 34px);
}

.question-text {
  font-size: clamp(1.28rem, 2vw, 1.75rem);
  line-height: 1.32;
}

.difficulty {
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--accent-strong);
}

.chapter-tag {
  color: var(--muted);
}

.option-list {
  gap: 12px;
}

.option-button {
  min-height: 58px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
}

.option-button span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.option-button:not(:disabled):hover {
  transform: translateX(3px);
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.option-key {
  border-radius: 6px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface-soft));
  color: var(--accent-strong);
}

.option-button.correct {
  border-color: color-mix(in srgb, var(--success) 72%, var(--line));
  background: color-mix(in srgb, var(--success) 13%, var(--surface));
}

.option-button.incorrect {
  border-color: color-mix(in srgb, var(--danger) 72%, var(--line));
  background: color-mix(in srgb, var(--danger) 11%, var(--surface));
}

.explanation {
  border-radius: 8px;
  border-color: color-mix(in srgb, var(--accent) 22%, var(--line));
  background: color-mix(in srgb, var(--surface-soft) 76%, var(--surface));
}

.explanation img {
  border-radius: 8px;
}

.bookmark-button.active {
  border-color: color-mix(in srgb, var(--accent) 66%, var(--line));
  background: color-mix(in srgb, var(--accent) 13%, var(--surface));
  color: var(--accent-strong);
}

.horizontal-controls {
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
}

@media (max-width: 940px) {
  .app-shell {
    width: min(100% - 32px, 1360px);
  }

  .auth-panel,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .profile-rail {
    position: static;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 24px, 1360px);
    padding-top: 12px;
  }

  .topbar {
    position: static;
    flex-wrap: wrap;
    align-items: flex-start;
  }

  .page-nav {
    order: 3;
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    justify-content: flex-start;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
  }

  .page-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-pill {
    flex: 0 0 auto;
  }

  .auth-copy,
  .home-copy {
    min-height: 330px;
    padding: 26px;
  }

  .auth-copy h1,
  .home-copy h1 {
    max-width: 12ch;
    font-size: clamp(2.45rem, 14vw, 4rem);
  }

  .home-actions,
  .filter-grid,
  .queue-row {
    grid-template-columns: 1fr;
  }

  .home-action-card {
    min-height: 156px;
    grid-template-columns: auto minmax(0, 1fr);
  }

  .panel-heading,
  .quiz-toolbar {
    display: grid;
  }
}

/* Exam mode, analytics, and peer signal layer */
.dashboard-grid {
  grid-template-columns: minmax(300px, 0.28fr) minmax(0, 1fr) minmax(280px, 0.28fr);
  grid-template-areas:
    "profile setup setup"
    "profile analytics popular"
    "profile analytics leaderboard"
    "profile history history";
}

.profile-rail {
  grid-area: profile;
}

.workspace-panel {
  grid-area: setup;
}

.insight-panel {
  padding: clamp(22px, 3vw, 30px);
}

.dashboard-grid > .insight-panel:nth-of-type(2) {
  grid-area: analytics;
}

.dashboard-grid > .insight-panel:nth-of-type(3) {
  grid-area: popular;
}

.dashboard-grid > .insight-panel:nth-of-type(4) {
  grid-area: leaderboard;
}

.dashboard-grid > .insight-panel:nth-of-type(5) {
  grid-area: history;
}

.insight-panel h2 {
  margin: 0 0 18px;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.1;
}

.profile-year-field {
  margin-top: 22px;
}

.alias-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.alias-note strong {
  display: block;
  margin-top: 2px;
  color: var(--accent-strong);
}

.ghost-mode-toggle {
  position: relative;
  display: flex;
  min-height: 52px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding: 9px 11px;
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  cursor: pointer;
  transition: border-color 180ms ease, background-color 180ms ease;
}

.ghost-mode-toggle:hover {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.ghost-mode-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.ghost-mode-copy strong {
  color: var(--text);
  font-size: 0.92rem;
}

.ghost-mode-copy small {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

.ghost-mode-toggle input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  width: 44px;
  height: 24px;
  flex: 0 0 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  transition: border-color 180ms ease, background-color 180ms ease;
}

.switch-track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  content: "";
  transition: transform 180ms ease, background-color 180ms ease;
}

.ghost-mode-toggle input:checked + .switch-track {
  border-color: var(--accent);
  background: var(--accent);
}

.ghost-mode-toggle input:checked + .switch-track::after {
  background: #17120d;
  transform: translateX(20px);
}

.ghost-mode-toggle input:focus-visible + .switch-track {
  outline: 3px solid color-mix(in srgb, var(--accent) 35%, transparent);
  outline-offset: 3px;
}

.mini-stat-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.mini-stat-list span {
  display: grid;
  gap: 2px;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: 8px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.mini-stat-list strong {
  color: var(--text);
  font-size: 1rem;
}

.exam-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0;
}

.exam-mode-card {
  min-height: 126px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--text);
  text-align: left;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.exam-mode-card i {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 36%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  color: var(--accent-strong);
  font-size: 1.35rem;
}

.exam-mode-card strong,
.exam-mode-card small {
  display: block;
}

.exam-mode-card strong {
  font-family: var(--font-display);
  font-size: 1.18rem;
  line-height: 1.15;
}

.exam-mode-card small {
  margin-top: 7px;
  color: var(--muted);
  line-height: 1.45;
}

.exam-mode-card:hover,
.exam-mode-card.active {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 70%, var(--line));
  background:
    radial-gradient(circle at 92% 12%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 8rem),
    color-mix(in srgb, var(--surface) 92%, var(--accent) 8%);
  box-shadow: 0 18px 42px rgba(42, 34, 22, 0.12);
}

.chapter-field {
  grid-column: 1 / -1;
}

.chapter-field-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 14px;
}

.chapter-selection-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chapter-selection-actions .text-button {
  min-height: 32px;
  padding: 0 7px;
  font-size: 0.78rem;
}

.chapter-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: color-mix(in srgb, var(--surface) 86%, transparent);
}

.chapter-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  cursor: pointer;
}

.chapter-chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chapter-chip span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid color-mix(in srgb, var(--line) 88%, transparent);
  border-radius: 999px;
  padding: 0 13px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.chapter-chip input:checked + span {
  border-color: color-mix(in srgb, var(--accent) 72%, var(--line));
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent-strong);
}

.chapter-chip:hover span {
  transform: translateY(-1px);
}

.analytics-grid,
.popular-list,
.leaderboard-list,
.session-history-list {
  display: grid;
  gap: 12px;
}

.analytics-card,
.popular-item,
.leaderboard-item,
.history-item {
  border: 1px solid color-mix(in srgb, var(--line) 84%, transparent);
  border-radius: 8px;
  padding: 13px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
}

.analytics-card {
  display: grid;
  gap: 10px;
}

.analytics-card div:first-child,
.popular-item,
.leaderboard-item,
.history-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

.analytics-card strong,
.popular-item strong,
.leaderboard-item strong,
.history-item strong {
  display: block;
  color: var(--text);
}

.analytics-card span,
.analytics-card small,
.popular-item small,
.leaderboard-item small,
.history-item small {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

.popular-item > span,
.leaderboard-item > span,
.leaderboard-item > b,
.history-item > span,
.history-item > b {
  display: grid;
  min-width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 12%, var(--surface));
  color: var(--accent-strong);
  font-weight: 900;
}

.mini-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.mini-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #b8892e, #e1c47f);
}

.empty-inline {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.timer-pill {
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line)) !important;
  background: color-mix(in srgb, var(--accent) 11%, var(--surface)) !important;
}

.timer-pill.urgent {
  color: var(--danger);
  animation: timerPulse 900ms ease-in-out infinite alternate;
}

.report-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
  transition: transform 160ms ease, border-color 160ms ease, background-color 160ms ease;
}


.exam-result-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 18px 0;
  border: 1px solid color-mix(in srgb, var(--accent) 46%, var(--line));
  border-radius: 8px;
  padding: 18px;
  background:
    radial-gradient(circle at 88% 20%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 14rem),
    color-mix(in srgb, var(--surface) 86%, var(--accent) 6%);
  box-shadow: 0 18px 48px rgba(42, 34, 22, 0.09);
}

.exam-result-panel h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2.4vw, 2.15rem);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(100px, 1fr));
  gap: 10px;
  min-width: min(100%, 560px);
}

.result-grid span {
  display: grid;
  gap: 2px;
  border: 1px solid color-mix(in srgb, var(--line) 82%, transparent);
  border-radius: 8px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--surface) 80%, transparent);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.result-grid strong {
  color: var(--text);
  font-size: 1.18rem;
}

.report-button:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--warning) 64%, var(--line));
  background: color-mix(in srgb, var(--warning) 10%, var(--surface));
}

.report-button.active {
  color: var(--warning);
  border-color: color-mix(in srgb, var(--warning) 70%, var(--line));
  background: color-mix(in srgb, var(--warning) 12%, var(--surface));
}

.option-button.selected {
  border-color: color-mix(in srgb, var(--accent) 66%, var(--line));
  background: color-mix(in srgb, var(--accent) 11%, var(--surface));
}

[data-theme="amoled"] .brand-mark,
[data-theme="amoled"] .home-action-card i,
[data-theme="amoled"] .stat-card i,
[data-theme="amoled"] .exam-mode-card i {
  background:
    linear-gradient(135deg, #0d0b09, #3f2f12 62%, #d2aa5c);
  color: #ffe8ad;
}

[data-theme="amoled"] .soft-aurora-container {
  background:
    radial-gradient(circle at var(--aurora-x) var(--aurora-y), rgba(210, 170, 92, 0.13), transparent 18rem),
    radial-gradient(circle at 82% 12%, rgba(242, 211, 144, 0.08), transparent 22rem),
    #050504;
}

@keyframes timerPulse {
  from {
    box-shadow: 0 0 0 rgba(167, 52, 52, 0);
  }

  to {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 18%, transparent);
  }
}

@media (max-width: 1120px) {
  .dashboard-grid {
    grid-template-columns: minmax(280px, 0.34fr) minmax(0, 1fr);
    grid-template-areas:
      "profile setup"
      "profile analytics"
      "popular leaderboard"
      "history history";
  }

  .exam-mode-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .dashboard-view,
  .quiz-view {
    padding-top: 8px;
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "profile"
      "setup"
      "analytics"
      "popular"
      "leaderboard"
      "history";
  }

  .analytics-card div:first-child,
  .popular-item,
  .leaderboard-item,
  .history-item {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .leaderboard-item > b,
  .history-item > b {
    grid-column: 2;
    justify-self: start;
  }

  .exam-result-panel,
  .result-grid {
    grid-template-columns: 1fr;
  }

  .exam-result-panel {
    display: grid;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 20px, 1240px);
  }

  .home-view,
  .auth-view {
    padding-top: 18px;
  }

  .home-copy {
    min-height: 330px;
  }

  .home-copy h1 {
    font-size: clamp(2.45rem, 13vw, 4rem);
  }

  .home-summary span {
    width: fit-content;
    justify-content: flex-start;
  }

  .home-action-card {
    min-height: 142px;
  }

  .question-topline {
    display: grid;
  }
}

/* Sticky progress for vertical quiz flow */
.quiz-view .progress-wrap.is-sticky {
  position: sticky;
  top: 90px;
  z-index: 18;
  display: block;
  margin: -6px 0 22px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

[data-theme="amoled"] .quiz-view .progress-wrap.is-sticky {
  background: transparent;
  box-shadow: none;
}

.quiz-view .progress-wrap.is-sticky .progress-bar {
  height: 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 18%, var(--surface-strong));
  box-shadow: none;
}

@media (max-width: 720px) {
  html {
    scroll-padding-top: 12px;
  }

  .quiz-view .progress-wrap.is-sticky {
    top: 0;
    margin-top: 0;
  }
}

/* Completion, review, and feedback layer */
.results-view {
  min-height: calc(100dvh - 120px);
  display: grid;
  place-items: center;
  gap: 28px;
  padding: 32px 0;
  animation: enter 280ms ease-out both;
}

.results-panel {
  width: min(100%, 760px);
  padding: clamp(28px, 5vw, 52px);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 8px;
  background:
    radial-gradient(circle at 88% 14%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 16rem),
    color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: var(--shadow);
}

.results-panel h2 {
  max-width: 14ch;
  margin: 0 0 28px;
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 4.4rem);
  line-height: 0.98;
}

.results-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.results-stat-grid .stat-card {
  min-height: 132px;
}

.results-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.results-review {
  width: min(100%, 1120px);
}

.results-review-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.results-review-heading h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.8rem);
  line-height: 1;
}

.results-review-list {
  display: grid;
  gap: 18px;
}

.review-question-card {
  padding: clamp(20px, 3vw, 32px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 16px 44px color-mix(in srgb, var(--text) 7%, transparent);
}

.review-question-header {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: start;
  gap: 14px;
  margin-bottom: 20px;
}

.review-question-number {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 52%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--accent) 11%, var(--surface));
  color: var(--accent-strong);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.review-question-header small {
  color: var(--muted);
  font-weight: 750;
}

.review-question-header h3 {
  margin: 5px 0 0;
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  line-height: 1.3;
}

.review-option-list {
  display: grid;
  gap: 10px;
}

.review-option {
  min-height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 14px;
  background: var(--surface);
}

.review-option.correct {
  border-color: color-mix(in srgb, var(--success) 70%, var(--line));
  background: color-mix(in srgb, var(--success) 13%, var(--surface));
}

.review-option.incorrect {
  border-color: color-mix(in srgb, var(--danger) 70%, var(--line));
  background: color-mix(in srgb, var(--danger) 11%, var(--surface));
}

.review-option.selected {
  font-weight: 750;
}

.review-answer-status {
  width: fit-content;
  margin: 14px 0 0;
  border-radius: 8px;
  padding: 8px 11px;
  background: var(--surface-soft);
  color: var(--muted);
  font-weight: 800;
}

.review-answer-status.correct {
  background: color-mix(in srgb, var(--success) 12%, var(--surface));
  color: var(--success);
}

.review-answer-status.incorrect {
  background: color-mix(in srgb, var(--danger) 11%, var(--surface));
  color: var(--danger);
}

.review-answer-status.unanswered {
  border: 1px solid color-mix(in srgb, var(--warning) 46%, var(--line));
  background: color-mix(in srgb, var(--warning) 10%, var(--surface));
  color: var(--warning);
}

.review-explanation {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin-top: 16px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  border-radius: 8px;
  padding: 18px;
  background: color-mix(in srgb, var(--surface-soft) 76%, var(--surface));
}

.review-explanation p {
  margin: 6px 0 0;
  color: var(--muted);
}

.review-explanation img {
  width: min(100%, 560px);
  aspect-ratio: 16 / 9;
  justify-self: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
}

.keyboard-hint {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0;
  font-size: 0.8rem;
}

kbd {
  display: inline-block;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 6px;
  background: var(--surface-soft);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.76rem;
  font-weight: 800;
}

.question-map {
  display: flex;
  flex-wrap: nowrap;
  gap: 7px;
  margin: 0 0 18px;
  padding: 2px 0 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
}

.q-dot {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  transition: transform 160ms ease, background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.q-dot:hover,
.q-dot:focus-visible {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
}

.q-dot.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent-strong);
}

.q-dot.answered-correct {
  border-color: color-mix(in srgb, var(--success) 64%, var(--line));
  background: color-mix(in srgb, var(--success) 13%, var(--surface));
  color: var(--success);
}

.q-dot.answered-wrong {
  border-color: color-mix(in srgb, var(--danger) 64%, var(--line));
  background: color-mix(in srgb, var(--danger) 11%, var(--surface));
  color: var(--danger);
}

.module-breakdown {
  margin-top: 24px;
}

.module-breakdown .micro-label {
  margin-bottom: 10px;
}

.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.breakdown-row {
  display: grid;
  gap: 6px;
}

.breakdown-label {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 750;
}

.breakdown-label strong {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.breakdown-bar-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-strong);
}

.breakdown-bar-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #a97920, #e1c47f);
  transition: width 400ms ease-out;
}

.toast-container {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-width: 220px;
  max-width: 340px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 750;
  animation: toastIn 220ms ease-out both;
  pointer-events: auto;
}

.toast.success {
  border-color: color-mix(in srgb, var(--success) 54%, var(--line));
}

.toast.error {
  border-color: color-mix(in srgb, var(--danger) 54%, var(--line));
}

.toast.info {
  border-color: color-mix(in srgb, var(--accent) 54%, var(--line));
}

.toast.leaving {
  animation: toastOut 160ms ease-in both;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toastOut {
  to {
    opacity: 0;
    transform: translateY(6px) scale(0.98);
  }
}

@media (max-width: 820px) {
  .results-stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .standalone-panel,
  .standalone-heading,
  .stats-overview-grid,
  .leaderboard-summary-grid,
  .split-insight-grid,
  .split-insight-grid > *,
  .leaderboard-detail-list,
  .leaderboard-detail-card,
  .leaderboard-detail-card dl {
    min-width: 0;
    max-width: 100%;
  }

  .standalone-panel,
  .stats-overview-grid,
  .leaderboard-summary-grid,
  .split-insight-grid,
  .leaderboard-detail-card,
  .leaderboard-detail-card dl {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 520px) {
  .keyboard-hint {
    display: none;
  }

  .q-dot {
    flex-basis: 32px;
    width: 32px;
    height: 32px;
    font-size: 0.72rem;
  }

  .results-stat-grid {
    grid-template-columns: 1fr 1fr;
  }

  .results-actions > * {
    width: 100%;
  }

  .results-review-heading {
    display: grid;
    align-items: start;
  }

  .review-question-header {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .review-question-number {
    width: 36px;
    height: 36px;
  }

  .toast-container {
    right: 12px;
    bottom: 16px;
    left: 12px;
  }

  .toast {
    max-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .results-view,
  .toast,
  .toast.leaving {
    animation: none;
  }

  .q-dot,
  .breakdown-bar-fill {
    transition: none;
  }
}

.done-for-now-button {
  white-space: nowrap;
}

.submit-exam-button {
  white-space: nowrap;
}

.session-exit-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

@media (max-width: 620px) {
  .topbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 10px;
  }

  .brand {
    min-width: 0;
  }

  .brand > span:last-child {
    min-width: 0;
  }

  .brand strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-actions {
    justify-content: flex-end;
    flex-wrap: nowrap;
  }

  .topbar-actions .icon-button,
  .topbar-actions .ghost-button {
    width: 44px;
    min-width: 44px;
    padding-inline: 0;
  }

  .topbar-actions .theme-symbol,
  .topbar-actions .ghost-button span {
    display: none;
  }

  .page-nav {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 4px;
    overflow: visible;
  }

  .nav-pill {
    width: 100%;
    min-width: 0;
    height: 66px;
    min-height: 66px;
    flex-direction: column;
    gap: 5px;
    padding: 7px 1px;
    font-size: clamp(0.55rem, 2.2vw, 0.68rem);
    line-height: 1.1;
  }

  .nav-pill i {
    font-size: clamp(1.3rem, 4.4vw, 1.55rem);
  }

  .nav-pill span {
    display: block;
    width: 100%;
    overflow: visible;
    text-align: center;
    transform: scaleX(0.88);
    white-space: nowrap;
  }

  .horizontal-controls {
    flex-wrap: wrap;
  }

  .horizontal-controls > #horizontalCounter {
    order: -1;
    width: 100%;
    text-align: center;
  }

  .horizontal-controls > button {
    flex: 1 1 calc(50% - 8px);
  }

  .horizontal-controls .session-exit-actions {
    width: 100%;
  }

  .horizontal-controls .session-exit-actions > button {
    flex: 1 1 0;
    min-width: 0;
  }

  .vertical-controls {
    bottom: 10px;
    width: 100%;
  }
}

/* Final layout ownership for the simplified dashboard and home actions. */
.home-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "profile"
    "setup";
}

.profile-rail {
  position: static;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(240px, 0.7fr) minmax(240px, 0.65fr);
  align-items: center;
  gap: clamp(22px, 4vw, 54px);
}

.profile-intro,
.profile-controls {
  min-width: 0;
}

.profile-intro h2 {
  max-width: none;
}

.welcome-name {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin-top: 2px;
  background: linear-gradient(
    100deg,
    var(--accent-strong) 0%,
    color-mix(in srgb, var(--accent) 68%, var(--text)) 48%,
    var(--accent-strong) 100%
  );
  background-size: 180% 100%;
  background-clip: text;
  color: var(--accent-strong);
  filter: drop-shadow(0 8px 18px color-mix(in srgb, var(--accent) 18%, transparent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: welcomeNameShimmer 7s ease-in-out infinite alternate;
}

@keyframes welcomeNameShimmer {
  from {
    background-position: 0% 50%;
  }

  to {
    background-position: 100% 50%;
  }
}

.profile-year-field {
  margin-top: 0;
}

.profile-controls .alias-note {
  margin-top: 12px;
}

.profile-rail .streak-strip {
  margin: 0;
}

@media (max-width: 820px) {
  .home-actions,
  .dashboard-grid,
  .profile-rail {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-grid {
    grid-template-areas:
      "profile"
      "setup";
  }

  .profile-rail {
    align-items: start;
  }

  .profile-intro h2 {
    max-width: none;
  }
}

/* Noir header contrast must win over earlier component declarations. */
[data-theme="amoled"] .brand strong {
  color: var(--text);
}

[data-theme="amoled"] .brand small {
  color: var(--muted);
}

[data-theme="amoled"] .page-nav,
[data-theme="amoled"] .topbar-actions .icon-button,
[data-theme="amoled"] .topbar-actions .ghost-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--text);
}

[data-theme="amoled"] .nav-pill {
  color: var(--muted);
}

[data-theme="amoled"] .nav-pill.active {
  background: var(--accent);
  color: #15120e;
  box-shadow: 0 10px 28px rgba(210, 170, 92, 0.18);
}

/* ══════════════════════════════════════════════════════════════════
   SIRIUS · Observatory premium layer (Editorial Luxury)
   Warm-ivory + gold (light) · premium warm-black + soft gold (dark)
   Double-bezel surfaces · film grain · gold-tinted depth · spring motion
   Authoritative final layer — last wins for design tokens.
   ══════════════════════════════════════════════════════════════════ */
:root {
  --ease-spring: cubic-bezier(0.34, 1.32, 0.5, 1);
  --ease-smooth: cubic-bezier(0.32, 0.72, 0, 1);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 9px;
  /* warm gold-tinted ambient depth instead of flat black shadow */
  --shadow: 0 30px 70px -28px rgba(78, 56, 16, 0.34), 0 8px 20px -12px rgba(78, 56, 16, 0.18);
}

[data-theme="amoled"] {
  /* Deep premium near-black with restrained, soft gold */
  --bg: #050403;
  --surface: #100e0c;
  --surface-soft: #15120f;
  --surface-strong: #201b15;
  --text: #f1eae0;
  --muted: #9d9384;
  --line: #28231d;
  --accent: #d8bd86;
  --accent-strong: #ecd9ad;
  --success: #6fcf9f;
  --danger: #ef6f7b;
  --warning: #e6b765;
  --shadow: 0 36px 96px -32px rgba(0, 0, 0, 0.9), 0 12px 30px -16px rgba(0, 0, 0, 0.75);
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
}

[data-theme="amoled"] body {
  background:
    radial-gradient(120% 80% at 80% -8%, rgba(216, 189, 134, 0.03), transparent 58%),
    var(--bg);
}

/* Warm ambient backdrop behind the starfield (subtle, single hue — no AI gradient) */
.cosmos-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 45% at 80% 8%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 60%),
    radial-gradient(70% 55% at 12% 96%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 64%);
  opacity: 0.7;
}

[data-theme="amoled"] .cosmos-backdrop {
  background:
    radial-gradient(54% 40% at 82% 5%, rgba(216, 189, 134, 0.08), transparent 58%),
    radial-gradient(60% 50% at 8% 98%, rgba(150, 118, 60, 0.06), transparent 62%);
  opacity: 1;
}

/* Animated starfield: prominent at night, a faint dusting by day */
.starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  display: block;
  opacity: 0.9;
}

[data-theme="amoled"] .starfield {
  opacity: 1;
}

/* Film-grain: physical paper / night-sky texture (fixed, GPU-cheap) */
.grain-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: 0.04;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

[data-theme="amoled"] .grain-overlay {
  opacity: 0.06;
  mix-blend-mode: soft-light;
}

/* Brand mark: gold star chip that glows */
.brand-mark {
  overflow: visible;
  color: #f7e2ad;
}

.brand-mark svg {
  filter: drop-shadow(0 0 7px color-mix(in srgb, var(--accent) 70%, transparent));
}

[data-theme="amoled"] .brand-mark {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 0 1px rgba(227, 196, 137, 0.22),
    0 10px 30px -8px rgba(227, 196, 137, 0.3);
}

/* ── Double-bezel surfaces: machined depth, inset highlight, tinted shadow ── */
.auth-copy,
.home-copy,
.home-action-card,
.profile-rail,
.workspace-panel,
.form-card,
.question-card,
.standalone-panel,
.results-panel,
.insight-panel,
.review-question-card {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    var(--shadow);
}

[data-theme="amoled"] .auth-copy,
[data-theme="amoled"] .home-copy,
[data-theme="amoled"] .home-action-card,
[data-theme="amoled"] .profile-rail,
[data-theme="amoled"] .workspace-panel,
[data-theme="amoled"] .form-card,
[data-theme="amoled"] .question-card,
[data-theme="amoled"] .standalone-panel,
[data-theme="amoled"] .results-panel,
[data-theme="amoled"] .insight-panel,
[data-theme="amoled"] .review-question-card {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    inset 0 0 0 1px rgba(227, 196, 137, 0.04),
    var(--shadow);
}

/* ── Eyebrow micro-labels become small machined badges ── */
.micro-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  width: fit-content;
  padding: 5px 11px;
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  font-size: 0.68rem;
  letter-spacing: 0.16em;
}

.micro-label::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 80%, transparent);
}

/* ── Button-in-button: leading icon nested in its own glowing disc ── */
.primary-button i.ph {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  margin: -2px 2px -2px -6px;
  border-radius: 50%;
  background: color-mix(in srgb, #2a2008 22%, transparent);
  font-size: 0.95em;
  transition: transform 320ms var(--ease-spring);
}

[data-theme="amoled"] .primary-button i.ph {
  background: rgba(10, 8, 7, 0.28);
}

.primary-button:hover i.ph {
  transform: translateX(2px) scale(1.06);
}

/* Softer, restrained gold for the night CTA (premium, not loud) */
[data-theme="amoled"] .primary-button {
  background: linear-gradient(135deg, #f0d8a4, #d8b771);
  border-color: color-mix(in srgb, var(--accent) 70%, #5c451a);
  color: #1a1208;
  box-shadow: 0 14px 34px -14px rgba(227, 196, 137, 0.5);
}

[data-theme="amoled"] .primary-button:hover {
  box-shadow: 0 18px 44px -14px rgba(227, 196, 137, 0.62);
}

/* ── Spring motion across interactive elements ── */
.primary-button,
.ghost-button,
.icon-button,
.segment,
.nav-pill,
.queue-button,
.bookmark-button,
.home-action-card,
.exam-mode-card,
.option-button,
.q-dot,
.chapter-chip span,
.brand {
  transition-timing-function: var(--ease-spring);
}

.home-action-card:hover,
.exam-mode-card:hover {
  transform: translateY(-4px);
}

/* ── Staggered entry: cards rise in, never all at once ── */
@keyframes riseIn {
  from { opacity: 0; transform: translateY(22px); }
  to { opacity: 1; transform: translateY(0); }
}

.question-list > .question-card,
.home-actions > .home-action-card,
.exam-mode-grid > .exam-mode-card,
.results-stat-grid > .stat-card {
  animation: riseIn 620ms var(--ease-smooth) both;
}

.question-list > .question-card:nth-child(1),
.home-actions > .home-action-card:nth-child(1),
.exam-mode-grid > .exam-mode-card:nth-child(1),
.results-stat-grid > .stat-card:nth-child(1) { animation-delay: 40ms; }
.question-list > .question-card:nth-child(2),
.home-actions > .home-action-card:nth-child(2),
.exam-mode-grid > .exam-mode-card:nth-child(2),
.results-stat-grid > .stat-card:nth-child(2) { animation-delay: 110ms; }
.question-list > .question-card:nth-child(3),
.home-actions > .home-action-card:nth-child(3),
.exam-mode-grid > .exam-mode-card:nth-child(3),
.results-stat-grid > .stat-card:nth-child(3) { animation-delay: 180ms; }
.question-list > .question-card:nth-child(4),
.results-stat-grid > .stat-card:nth-child(4) { animation-delay: 250ms; }
.question-list > .question-card:nth-child(n+5) { animation-delay: 320ms; }

/* ── Typography polish: confident display, balanced wrapping, tabular data ── */
.auth-copy h1,
.home-copy h1,
.standalone-heading h2,
.results-panel h2,
.profile-rail h2,
.workspace-panel h2 {
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.auth-copy p,
.home-copy p,
.muted {
  text-wrap: pretty;
}

.stat-card strong,
.wide-stat strong,
.quiz-score-row strong,
.podium-score span,
.rank-mark,
.q-dot {
  font-variant-numeric: tabular-nums;
}

/* Quiet, premium focus ring in gold */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 66%, transparent);
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  .question-list > .question-card,
  .home-actions > .home-action-card,
  .exam-mode-grid > .exam-mode-card,
  .results-stat-grid > .stat-card {
    animation: none;
  }
  html { scroll-behavior: auto; }
}

/* ══════════════════════════════════════════════════════════════════
   SIRIUS · round-two adjustments
   ══════════════════════════════════════════════════════════════════ */

/* Remove the vertical hairline grid inside the headline panels (light) */
.auth-copy,
.home-copy {
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface) 97%, var(--accent) 3%), var(--surface));
  background-size: auto;
}

/* Time-and-accuracy map now lives in the narrow split column — stack it */
.compact-time-map .time-map-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
  row-gap: 8px;
}

.compact-time-map .time-map-meter {
  grid-column: 1 / -1;
  grid-row: 2;
}

/* Ghost-mode leaderboard lock notice */
.leaderboard-locked {
  grid-column: 1 / -1;
  display: grid;
  justify-items: center;
  gap: 12px;
  max-width: 480px;
  margin: 0 auto;
  padding: clamp(30px, 6vw, 64px) clamp(20px, 4vw, 40px);
  text-align: center;
}

.leaderboard-locked i {
  font-size: 2.5rem;
  color: var(--accent-strong);
}

.leaderboard-locked strong {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  letter-spacing: -0.01em;
}

.leaderboard-locked span {
  color: var(--muted);
  line-height: 1.65;
}

.leaderboard-locked .primary-button {
  margin-top: 8px;
}

/* ── Extra life: tasteful, non-conflicting motion ── */
@keyframes brandTwinkle {
  0%, 100% { transform: scale(1); opacity: 0.92; }
  50% { transform: scale(1.1); opacity: 1; }
}

.brand-mark svg {
  animation: brandTwinkle 3.6s ease-in-out infinite;
}

@keyframes navGlow {
  0%, 100% { box-shadow: 0 8px 22px -8px color-mix(in srgb, var(--accent) 40%, transparent); }
  50% { box-shadow: 0 10px 30px -6px color-mix(in srgb, var(--accent) 64%, transparent); }
}

.nav-pill.active {
  animation: navGlow 3.2s ease-in-out infinite;
}

@keyframes flameFlicker {
  0%, 100% { transform: scale(1) rotate(0deg); }
  35% { transform: scale(1.12) rotate(-4deg); }
  70% { transform: scale(1.06) rotate(3deg); }
}

.streak-strip > i {
  animation: flameFlicker 2.6s ease-in-out infinite;
  transform-origin: 50% 70%;
}

@media (prefers-reduced-motion: reduce) {
  .brand-mark svg,
  .nav-pill.active,
  .streak-strip > i {
    animation: none;
  }
}
