:root {
  --ink: #1e2937;
  --paper: #f8fafc;
  --card: #ffffff;
  --line: #e2e8f0;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --ok: #15803d;
  --bad: #be123c;
  --focus: #0d9488;
  --muted: #64748b;
  --sim-bg: #f1f5f9;
  --sim-ink: #0f172a;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  line-height: 1.5;
  font-size: 16px;
}
button, input, textarea, select {
  font: inherit;
}
[hidden] {
  display: none !important;
}
body:not(.is-authenticated) #mainNav,
body:not(.is-authenticated) .account {
  display: none !important;
}
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
}
.skip-link:focus {
  left: 8px;
  background: #fff;
  color: var(--ink);
  padding: 8px;
  z-index: 20;
}
.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.5rem;
}
.banner-top {
  background: #0f172a;
  color: #fff;
  box-shadow: var(--shadow);
}
.brand {
  font-weight: 700;
  letter-spacing: -0.02em;
  font-size: 1.125rem;
}
.banner-nav {
  background: #1e293b;
  gap: 0.25rem;
  justify-content: flex-start;
  padding: 0 1.5rem;
  border-bottom: 1px solid #334155;
}
.nav-tab {
  background: transparent;
  color: #cbd5e1;
  border: 0;
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  font-weight: 500;
  transition: color 0.15s, border-color 0.15s;
}
.nav-tab:hover {
  color: #fff;
}
.nav-tab[aria-current="page"] {
  border-bottom-color: #60a5fa;
  color: #fff;
}
.account { position: relative; }
.account-toggle {
  background: transparent;
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  padding: 0.4rem 0.8rem;
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.9rem;
}
.account-toggle:hover,
.account-toggle[aria-expanded="true"] {
  background: rgba(255,255,255,0.1);
}
.account-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: #fff;
  color: var(--ink);
  color: var(--ink);
  min-width: 12rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 10;
  overflow: hidden;
}
.account-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: #fff;
  color: var(--ink);
  border: 0;
  padding: 0.75rem 1rem;
  cursor: pointer;
  font-size: 0.95rem;
}
.account-menu button:hover,
.account-menu button:focus {
  background: #f1f5f9;
}
.app-main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 2rem 1.25rem 4rem;
}
.app-main.sim-active {
  max-width: none;
  padding: 0;
}
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1.75rem;
  box-shadow: var(--shadow);
}
#view-login {
  max-width: 540px;
  margin: 3rem auto;
  text-align: left;
}
#view-login h1 {
  margin: 0 0 0.5rem;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
#view-login p {
  color: var(--muted);
  margin: 0 0 1.5rem;
}
.stack { display: grid; gap: 0.75rem; }
label {
  font-weight: 600;
  font-size: 0.9rem;
  color: #334155;
}
input[type="email"], input[type="text"], input[type="number"], input[type="password"], textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
button {
  background: var(--accent);
  color: #fff;
  border: 0;
  padding: 0.7rem 1.1rem;
  cursor: pointer;
  border-radius: 8px;
  font-weight: 600;
  transition: background 0.15s;
}
button:hover {
  background: var(--accent-hover);
}
button.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid #cbd5e1;
}
button.secondary:hover {
  background: #f8fafc;
  border-color: var(--accent);
}
button:focus, .nav-tab:focus, .account-toggle:focus {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.status {
  min-height: 1.5em;
  font-size: 0.95rem;
  margin-top: 0.5rem;
}
.status.error { color: var(--bad); }
.status.ok { color: var(--ok); }
.choice-row { display: flex; gap: 0.75rem; flex-wrap: wrap; }
.question-card, .review-card {
  display: grid;
  gap: 1rem;
}
.choices { display: grid; gap: 0.5rem; }
.choices label {
  font-weight: 400;
  border: 1px solid var(--line);
  padding: 0.75rem 1rem;
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.choices label:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}
.result.correct { border-left: 4px solid var(--ok); padding-left: 1rem; }
.result.incorrect { border-left: 4px solid var(--bad); padding-left: 1rem; }
.muted { color: var(--muted); }
.sim {
  min-height: calc(100vh - 4rem);
  background: var(--sim-bg);
  color: var(--sim-ink);
  display: grid;
  grid-template-columns: 240px 1fr;
  grid-template-rows: auto 1fr auto;
}
.sim-top {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  background: #0f172a;
  color: #fff;
}
.sim-nav {
  background: #e2e8f0;
  padding: 0.75rem;
  overflow: auto;
}
.sim-body {
  padding: 1.25rem 1.5rem 2rem;
  background: #fff;
  color: var(--ink);
}
.sim-foot {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: #e2e8f0;
}
.qnum {
  display: block;
  width: 100%;
  margin: 0 0 0.4rem;
  border: 1px solid #94a3b8;
  background: #ecfdf5;
  color: inherit;
  padding: 0.35rem;
  border-radius: 4px;
  font-size: 0.9rem;
}
.qnum.answered { background: #475569; color: #fff; }
.qnum.current { outline: 2px solid #ea580c; outline-offset: 1px; }
.qnum.flagged { box-shadow: inset 4px 0 0 #d97706; }
.timer { font-variant-numeric: tabular-nums; font-size: 1.15rem; font-weight: 600; }
.break-screen, .instr-screen, .done-screen {
  max-width: 42rem;
  margin: 2rem auto;
  background: #fff;
  color: var(--ink);
  padding: 2rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}
.legend { display: flex; gap: 1rem; font-size: 0.9rem; }
.swatch { display: inline-block; width: 1rem; height: 0.25rem; vertical-align: middle; margin-right: 0.35rem; }
.report-below {
  margin-top: 10rem;
}
.admin-bank article { margin-bottom: 1.5rem; padding-bottom: 1rem; border-bottom: 1px solid #ccc; }
.admin-expl { width: 100%; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}
@media (max-width: 800px) {
  .sim { grid-template-columns: 1fr; }
  .sim-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    max-height: 6rem;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .qnum { width: auto; min-width: 2.5rem; }
  .banner { padding: 0.75rem 1rem; }
  .app-main { padding: 1.25rem 1rem 3rem; }
  #view-login { margin: 1.5rem auto; }
}
body.sim-mode .banner-nav { display: none; }
body.sim-mode .app-main { max-width: none; padding: 0; }
body.sim-mode .panel { border: 0; background: transparent; padding: 0; box-shadow: none; border-radius: 0; }

/* ===== UI optimizations for desktop & mobile ===== */
h1, h2, h3 { line-height: 1.25; }
h1 { font-size: clamp(1.4rem, 4vw, 1.75rem); margin: 0 0 0.75rem; }
h2 { font-size: 1.25rem; margin: 1.25rem 0 0.5rem; }
h3 { font-size: 1.05rem; margin: 1rem 0 0.4rem; }

/* Navigation: scrollable on small screens, better tap targets */
.banner-nav {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  flex-wrap: nowrap;
}
.nav-tab {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0.65rem 1rem;
  white-space: nowrap;
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 1rem 0;
}
table.perf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
table.perf-table th,
table.perf-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
table.perf-table th {
  background: #f1f5f9;
  font-weight: 600;
}
table.perf-table tr:hover td {
  background: #f8fafc;
}

/* Forms & fieldsets */
fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
}
fieldset legend {
  font-weight: 600;
  padding: 0 0.4rem;
}
.filters, .session-options {
  display: grid;
  gap: 0.75rem;
}
@media (min-width: 700px) {
  .filters {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
  .session-options {
    grid-template-columns: 1fr 1fr;
  }
}
label {
  display: block;
  margin-bottom: 0.25rem;
}
select, input[type="number"], input[type="search"], input[type="email"] {
  width: 100%;
  max-width: 100%;
}

/* Touch-friendly controls */
button, .nav-tab, .account-toggle, .qnum {
  min-height: 44px;
}
.choices label {
  min-height: 44px;
  align-items: center;
}

/* Admin bank */
.admin-bank article.review-item {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.25rem;
}
.admin-expl {
  min-height: 4.5rem;
  font-family: inherit;
}

/* Charts */
.chart-wrap {
  overflow-x: auto;
  margin: 1rem 0;
}
.chart-wrap svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Practice / review */
.passage {
  background: #f8fafc;
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  border-radius: 0 8px 8px 0;
}
.report-below {
  margin-top: 1.5rem;
}

/* Responsive refinements */
@media (max-width: 640px) {
  .banner { padding: 0.6rem 0.75rem; }
  .brand { font-size: 1rem; }
  .app-main { padding: 1rem 0.75rem 2.5rem; }
  .panel { padding: 1.1rem; border-radius: 8px; }
  .choice-row { gap: 0.5rem; }
  .choice-row button { flex: 1 1 auto; }
  .sim-top, .sim-foot { padding: 0.6rem 0.75rem; flex-wrap: wrap; }
  .sim-body { padding: 1rem 0.75rem 1.5rem; }
  table.perf-table { font-size: 0.85rem; }
  table.perf-table th,
  table.perf-table td { padding: 0.45rem 0.4rem; }
}

@media (max-width: 480px) {
  .account-toggle span { max-width: 8rem; overflow: hidden; text-overflow: ellipsis; display: inline-block; }
  .nav-tab { padding: 0.6rem 0.7rem; font-size: 0.9rem; }
}

/* ===== Test-Taking Techniques Tab ===== */
.tech-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 1rem;
  margin-bottom: 1rem;
}
.tech-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  flex-wrap: wrap;
}
.tech-badge-box {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.tech-pill-badge {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}
.tech-jump-nav {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin: 0 0 1.25rem;
}
.tech-filter-btn {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  padding: 0.45rem 0.9rem;
  font-size: 0.88rem;
  font-weight: 600;
  min-height: 38px;
}
.tech-filter-btn:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.tech-filter-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.tech-sections {
  display: grid;
  gap: 1.5rem;
}
.tech-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.25rem 1.35rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
.tech-card-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.tech-card-head h2 {
  margin: 0;
  font-size: 1.25rem;
}
.tech-step-num {
  background: #0f172a;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem;
  border-radius: 6px;
}
.tech-callout-grid {
  display: grid;
  gap: 1rem;
  margin-top: 0.75rem;
}
@media (min-width: 720px) {
  .tech-callout-grid.two-col {
    grid-template-columns: 1fr 1fr;
  }
}
.tech-callout {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
}
.tech-callout h3 {
  margin: 0 0 0.45rem;
  font-size: 1.02rem;
  color: #0f172a;
}
.tech-list {
  margin: 0.35rem 0 0;
  padding-left: 1.25rem;
}
.tech-list li {
  margin-bottom: 0.4rem;
}
.tech-formula {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  font-weight: 700;
  display: inline-block;
  margin: 0.25rem 0 0.45rem;
}
.tech-tag {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
}
.tech-tag-stop {
  background: #ffe4e6;
  color: #9f1239;
}
.tech-tag-go {
  background: #dcfce7;
  color: #166534;
}
.tech-pos {
  color: var(--ok);
}

/* Structured answer explanations (practice result + session review) */
.explanation { margin: 0.75rem 0; }
.explanation-steps { margin: 0.25rem 0 0.75rem; padding-left: 1.5rem; }
.explanation-steps li { margin: 0.25rem 0; line-height: 1.45; }
.explanation-traps { border-left: 3px solid #c9a227; padding: 0.25rem 0 0.25rem 0.75rem; margin-top: 0.5rem; }
.explanation-traps ul { margin: 0.25rem 0 0; padding-left: 1.25rem; }
.explanation-traps li { margin: 0.2rem 0; line-height: 1.4; }

/* Simulator post-test answer review cards */
.done-screen .review-item {
  border: 1px solid var(--line);
  border-left: 4px solid #94a3b8;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin: 0.75rem 0;
  background: #fff;
}
.done-screen .review-item.correct { border-left-color: var(--ok, #15803d); }
.done-screen .review-item.incorrect { border-left-color: #dc2626; }
.done-screen .review-item h3 { margin: 0 0 0.4rem; font-size: 1rem; }
.done-screen .review-item details summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; }
.sim-review-section { margin-top: 1.5rem; }
.done-screen .review-item,
.explanation,
.passage { overflow-wrap: anywhere; }

@media (max-width: 640px) {
  .break-screen, .instr-screen, .done-screen { margin: 1rem auto; padding: 1.1rem; border-radius: 8px; }
  .done-screen .review-item { padding: 0.65rem 0.75rem; }
  .explanation-steps { padding-left: 1.25rem; }
  .explanation-traps { padding-left: 0.6rem; }
  .explanation-traps ul { padding-left: 1rem; }
}

/* Age screen, consent, legal pages, footer, account deletion (CCO launch review, Oct 29) */
.age-row { display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: center; }
.age-row select { min-height: 44px; min-width: 8rem; }
.consent-label { display: flex; gap: 0.5rem; align-items: flex-start; line-height: 1.4; }
.consent-label input { margin-top: 0.25rem; min-width: 1.1rem; min-height: 1.1rem; }
.notice { border-left: 4px solid #c9a227; background: #fffbeb; padding: 0.6rem 0.9rem; border-radius: 6px; }
.privacy-notice { margin-bottom: 0.75rem; }
.estimate-label { font-size: 0.85em; color: #555; }
.legal-links { margin-top: 1rem; }
.site-footer { max-width: 960px; margin: 2rem auto 1rem; padding: 0 1rem; font-size: 0.85rem; color: #555; text-align: center; }
.site-footer nav a { margin: 0 0.25rem; }
.tm-disclaimer { font-size: 0.85rem; }
.draft-banner { background: #fef3c7; border: 2px dashed #b45309; color: #78350f; padding: 0.6rem 0.9rem; border-radius: 6px; margin-bottom: 1rem; }
.legal-doc { max-width: 760px; line-height: 1.55; overflow-wrap: anywhere; }
.legal-page .brand a { color: inherit; text-decoration: none; }
.danger-zone { margin-top: 2rem; border-top: 1px solid var(--line, #ddd); padding-top: 1rem; }
button.danger { background: #b91c1c; border-color: #b91c1c; color: #fff; }
.brand-name { font-weight: 700; }
.brand-tagline { font-size: 0.8em; font-weight: 400; opacity: 0.85; }
.unfilled-placeholder{background:#fde047;color:#7c2d12;font-weight:700;padding:0 .25em;border:2px dashed #b91c1c;border-radius:3px}

/* Public intro above sign-in: brand first, SSAT only in the smaller plain tagline. */
#view-login .intro {
  margin: 0 0 1.5rem;
  padding-bottom: 1.25rem;
  border-bottom: 1px solid var(--line);
}
#view-login .intro-brand {
  margin: 0;
  font-size: 1.6rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}
#view-login .intro-tagline {
  margin: 0.25rem 0 0.5rem;
  font-size: 1rem;
  font-weight: 400;
  color: var(--muted);
}
#view-login .intro-free {
  margin: 0 0 1rem;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}
#view-login .intro-features {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
  display: grid;
  gap: 0.35rem;
  color: var(--ink);
}
#view-login .intro-note {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
}
#view-login .intro-note.tm-disclaimer { font-size: 0.8rem; margin-bottom: 0; }
#view-login .signin-title {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  font-weight: 700;
}
@media (max-width: 480px) {
  #view-login .intro-brand { font-size: 1.35rem; }
  #view-login .signin-title { font-size: 1.2rem; }
}
