@font-face {
  font-family: "Inter Variable";
  src: url("assets/fonts/InterVariable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Inter Variable";
  src: url("assets/fonts/InterVariable-Italic.woff2") format("woff2");
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --slate-950: #020617;
  --slate-900: #0f172a;
  --slate-800: #1e293b;
  --slate-700: #334155;
  --slate-600: #475569;
  --slate-500: #64748b;
  --slate-400: #94a3b8;
  --slate-300: #cbd5e1;
  --slate-200: #e2e8f0;
  --slate-100: #f1f5f9;
  --slate-50: #f8fafc;
  --red-600: #dc2626;
  --red-700: #b91c1c;
  --red-soft: #fdf0ee;
  --emerald-700: #047857;
  --emerald-800: #065f46;
  --emerald-50: #ecfdf5;
  --heading: #17201e;
  --ink: #343937;
  --muted: #687471;
  --paper: #fbfaf6;
  --canvas: #eceae2;
  --line: #d8d5ca;
  --passage: #f3f0e7;
  --accent: #bd4f35;
  --green: #355e55;
  --green-soft: #e4eeea;
  --shadow: 0 18px 50px rgb(49 55 51 / 10%);
  --font-sans: "Inter Variable", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: Georgia, ui-serif, serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  overflow: hidden;
}

button, select, input { font: inherit; }

.topbar {
  height: 82px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 0 28px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: white;
  background: var(--accent);
  border-radius: 11px;
  font: 600 20px var(--font-sans);
}

.brand h1 { margin: 0; color: var(--heading); font: 600 20px var(--font-sans); letter-spacing: -.025em; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }

.controls { display: flex; align-items: center; gap: 8px; }

.nav-button, .text-button {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: .18s ease;
}

.nav-button {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  font-size: 18px;
}

.nav-button:hover, .text-button:hover { border-color: var(--accent); color: var(--accent); }
.nav-button:disabled { cursor: not-allowed; opacity: .35; }

.question-picker, .test-picker {
  height: 38px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
}

.question-picker select, .test-picker select {
  height: 100%;
  min-width: 62px;
  border: 0;
  border-left: 1px solid var(--line);
  padding: 0 9px;
  background: transparent;
  color: var(--ink);
  font-weight: 500;
  outline: none;
}

.test-picker select { min-width: 88px; }

.status { justify-self: end; display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }

.bookmark-filter, .bookmark-button, .account-button {
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--paper);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: .18s ease;
}

.bookmark-filter:hover, .bookmark-button:hover, .account-button:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--passage);
}

.bookmark-filter.active, .bookmark-button.active {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-soft);
}

.bookmark-filter [aria-hidden="true"], .bookmark-button [aria-hidden="true"] { font-size: 16px; }
.bookmark-filter { min-width: 48px; }
.bookmark-filter-label { display: none; }
.bookmark-button[hidden] { display: none; }

.account-button {
  min-width: 70px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: var(--paper);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}
.sync-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--slate-400); }
.account-button[data-status="synced"] .sync-dot { background: var(--emerald-700); }
.account-button[data-status="syncing"] .sync-dot { background: var(--accent); animation: sync-pulse 1s ease-in-out infinite; }
.account-button[data-status="error"] .sync-dot { background: var(--red-600); }
@keyframes sync-pulse { 50% { opacity: .35; } }

.level-badge {
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  font-weight: 500;
  letter-spacing: .05em;
}

.workspace {
  height: calc(100vh - 82px);
  height: calc(100dvh - 82px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px minmax(0, 1fr);
  padding: 18px 20px 20px;
}

.panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel-heading {
  min-height: 76px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 24px;
  border-bottom: 1px solid var(--line);
}

.eyebrow { color: var(--accent); font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.panel-heading h2 { margin: 4px 0 0; color: var(--heading); font: 600 18px var(--font-sans); letter-spacing: 0; }

.text-button {
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--ink);
  background: var(--paper);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
}
.guide-toggle { min-width: 126px; white-space: nowrap; }
.guide-toggle:hover { background: var(--passage); }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 28px clamp(22px, 4vw, 54px) 60px;
  scroll-behavior: smooth;
}

.content::-webkit-scrollbar { width: 10px; }
.content::-webkit-scrollbar-thumb { background: #d2cfc4; border: 3px solid var(--paper); border-radius: 99px; }

.content p, .content li {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 26px;
  letter-spacing: 0;
}
.content p { margin: 0 0 18px; }
.content h3 { margin: 34px 0 10px; color: var(--green); font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; }
.content h3:first-child { margin-top: 0; }
.content ul { margin: 0 0 22px; padding-left: 21px; }
.content li { margin: 7px 0; }
.content strong { color: var(--heading); font-weight: 500; }

.test-content .passage {
  padding: 24px;
  margin-bottom: 28px;
  background: var(--passage);
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
}

.test-content .passage p:last-child { margin-bottom: 0; }
.test-content .passage p { color: var(--ink); line-height: 28px; }
.test-content .prompt { margin: 0 0 16px; color: var(--heading); font-weight: 500; font-size: 16px; line-height: 26px; }

.answers { display: grid; gap: 10px; }

.answer {
  width: 100%;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 13px 15px;
  text-align: left;
  color: var(--ink);
  background: white;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
}

.answer:hover { border-color: #aaa69a; color: var(--heading); transform: translateY(-1px); }
.answer.selected { border-color: #8a8173; background: var(--passage); color: var(--heading); }
.answer-letter { color: var(--accent); font-weight: 600; }
.answer > span:nth-child(2) { flex: 1; }
.answer.selected .answer-letter { color: var(--heading); }
.answer.correct { border-color: var(--green); background: var(--green-soft); color: var(--green); }
.answer.correct .answer-letter { color: var(--green); }
.answer.incorrect { border-color: var(--red-700); background: var(--red-soft); color: var(--red-700); }
.answer.incorrect .answer-letter { color: var(--red-700); }
.answer-result { margin-left: auto; white-space: nowrap; font-size: 14px; font-weight: 650; }

.guide-content > p:first-child {
  padding: 16px 18px;
  background: var(--green-soft);
  border-radius: 10px;
  color: var(--green);
}

.guide-content > p:first-child strong { font-weight: 600; }

.guide-content blockquote {
  margin: 0 0 24px;
  padding: 1px 0 1px 20px;
  color: #4c5855;
  border-left: 3px solid #aabbb5;
}

.guide-content p, .guide-content li { color: var(--ink); line-height: 26px; }
.guide-content blockquote p { color: #4c5855; font-style: italic; line-height: 28px; }
.empty-state {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px;
  text-align: center;
  color: var(--muted);
}
.empty-state > span { color: var(--accent); font-size: 34px; }
.empty-state h3 { margin: 14px 0 6px; color: var(--heading); font-size: 18px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.empty-state p { max-width: 420px; margin: 0; color: var(--muted); }
.empty-state.compact { min-height: 260px; }
.divider { display: grid; place-items: center; color: #99978f; }
.divider span { display: grid; place-items: center; width: 26px; height: 26px; background: var(--canvas); font-size: 13px; }

.workspace.guide-hidden { grid-template-columns: minmax(0, 760px); justify-content: center; }
.workspace.guide-hidden .guide-panel, .workspace.guide-hidden .divider { display: none; }

.error { position: fixed; inset: auto 20px 20px; padding: 14px 18px; background: var(--red-700); color: white; border-radius: 10px; font-size: 14px; }

.account-dialog {
  width: min(440px, calc(100vw - 32px));
  padding: 0;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgb(23 32 30 / 24%);
}
.account-dialog::backdrop { background: rgb(23 32 30 / 40%); backdrop-filter: blur(3px); }
.dialog-heading { display: flex; align-items: center; justify-content: space-between; padding: 22px 24px 18px; border-bottom: 1px solid var(--line); }
.dialog-heading h2 { margin: 4px 0 0; color: var(--heading); font-size: 18px; font-weight: 600; }
.dialog-close { width: 34px; height: 34px; border: 0; border-radius: 9px; color: var(--muted); background: transparent; font-size: 24px; cursor: pointer; }
.dialog-close:hover { color: var(--heading); background: var(--passage); }
.dialog-body { padding: 22px 24px 24px; }
.dialog-body > p { margin: 0 0 18px; color: var(--slate-600); font-size: 14px; line-height: 22px; }
.sync-field { display: grid; gap: 7px; color: var(--slate-700); font-size: 13px; font-weight: 500; }
.sync-field input { width: 100%; height: 42px; padding: 0 12px; color: var(--heading); background: white; border: 1px solid var(--line); border-radius: 10px; outline: none; }
.sync-field input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgb(53 94 85 / 12%); }
.sync-primary, .sync-secondary { min-height: 40px; padding: 0 14px; border-radius: 10px; font-size: 13px; font-weight: 500; cursor: pointer; }
.sync-primary { width: 100%; margin-top: 12px; border: 1px solid var(--green); color: white; background: var(--green); }
.sync-primary:hover { background: #294f47; }
.sync-primary:disabled { cursor: wait; opacity: .65; }
.sync-secondary { border: 1px solid var(--line); color: var(--slate-700); background: transparent; }
.sync-message { min-height: 22px; margin: 14px 0 0 !important; color: var(--green) !important; }
.signed-in-actions p { margin: 0 0 16px; color: var(--slate-600); font-size: 14px; }
.signed-in-actions strong { color: var(--heading); font-weight: 500; }

@media (max-width: 900px) {
  body { overflow: auto; }
  .topbar { height: auto; grid-template-columns: 1fr auto; padding: 14px 16px; }
  .controls { grid-column: 1 / -1; grid-row: 2; justify-content: center; }
  .status { grid-column: 2; grid-row: 1; }
  .bookmark-filter { padding: 0 9px; }
  .account-button { min-width: 38px; width: 38px; padding: 0; }
  .account-button-label { display: none; }
  .bookmark-button-label { display: none; }
  .bookmark-button { width: 38px; padding: 0; }
  .brand p { display: none; }
  .controls { flex-wrap: wrap; }
  .workspace, .workspace.guide-hidden { height: auto; grid-template-columns: 1fr; gap: 14px; padding: 14px; }
  .divider { display: none; }
  .panel { min-height: 70vh; }
  .content { max-height: 65vh; padding: 24px 20px 48px; }
  .guide-toggle { min-width: 112px; font-size: 12px; }
}
