@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600;700&family=IBM+Plex+Serif:ital,wght@0,400;0,500;1,400&display=swap');

/* ---------------------------------------------------------------
   Reviewer — a study instrument for quantitative finance and ML.
   Palette reads as a lab bench at night: graphite, teal signal,
   saffron for anything that needs attention.
   --------------------------------------------------------------- */
:root {
  --ink: #0d1117;
  --panel: #141a23;
  --raised: #1b2330;
  --line: #26313f;
  --line-soft: #1e2733;
  --text: #e8edf4;
  --muted: #8a99ad;
  --faint: #5d6c80;

  --signal: #4cc9c0;
  --signal-dim: #2a6f6b;
  --attention: #f2a65a;
  --correct: #5bd99a;
  --wrong: #f2555a;
  --violet: #9a7cf0;

  --sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --serif: 'IBM Plex Serif', Georgia, 'Times New Roman', serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --radius: 6px;
  --rail: 232px;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 24px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body::before {
  /* A faint plotted grid, like graph paper under the instruments. */
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(var(--line-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
  background-size: 56px 56px;
  opacity: .35;
  mask-image: radial-gradient(ellipse 90% 70% at 50% 0%, #000 20%, transparent 78%);
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
p { margin: 0 0 .8em; }
a { color: var(--signal); text-decoration: none; }
a:hover { text-decoration: underline; }

.mono, .num {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'zero' 1;
}

.eyebrow {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 500;
}

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.hidden { display: none !important; }

/* --- focus ring: visible everywhere, never removed --------------- */
:focus-visible {
  outline: 2px solid var(--signal);
  outline-offset: 2px;
  border-radius: 3px;
}

/* --- buttons ----------------------------------------------------- */
.btn {
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .55em 1.05em;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease, transform .08s ease;
}
.btn:hover:not(:disabled) { background: #222c3a; border-color: #33414f; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .42; cursor: not-allowed; }

.btn-primary {
  background: var(--signal);
  border-color: var(--signal);
  color: #06211f;
  font-weight: 600;
}
.btn-primary:hover:not(:disabled) { background: #61dcd3; border-color: #61dcd3; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: var(--raised); color: var(--text); }

.btn-sm { font-size: 12.5px; padding: .38em .8em; }
.btn-danger { border-color: #57282c; color: #f2888c; }
.btn-danger:hover:not(:disabled) { background: #2a1618; border-color: #7a3439; }

/* --- forms ------------------------------------------------------- */
label { display: block; font-size: 13px; color: var(--muted); margin-bottom: .35em; }

input[type=text], input[type=password], select {
  width: 100%;
  font-family: var(--sans);
  font-size: 14.5px;
  color: var(--text);
  background: #0f151d;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .62em .8em;
}
input:focus, select:focus { border-color: var(--signal-dim); outline-offset: 0; }
.field { margin-bottom: 1.05em; }

.form-error {
  background: #2a1518;
  border: 1px solid #58282d;
  border-left: 3px solid var(--wrong);
  color: #f4a9ac;
  border-radius: var(--radius);
  padding: .65em .85em;
  font-size: 13.5px;
  margin-bottom: 1em;
}
.form-note {
  background: #12251f;
  border: 1px solid #24513f;
  border-left: 3px solid var(--correct);
  color: #9fe0bf;
  border-radius: var(--radius);
  padding: .65em .85em;
  font-size: 13.5px;
  margin-bottom: 1em;
}

/* --- sign-in ----------------------------------------------------- */
.gate {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 2rem 1.25rem;
}
.gate-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 2.1rem 1.9rem 1.7rem;
  box-shadow: var(--shadow);
}
.gate-mark {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .3em;
  color: var(--signal);
  margin-bottom: .5rem;
}
.gate-card h1 { font-size: 25px; margin-bottom: .3rem; }
.gate-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 1.6rem; }
.gate-switch { margin-top: 1.2rem; font-size: 13px; color: var(--muted); text-align: center; }
.gate-rules { font-size: 12px; color: var(--faint); margin-top: -.6em; }

/* --- shell ------------------------------------------------------- */
.shell { position: relative; z-index: 1; display: flex; min-height: 100vh; }

.rail {
  width: var(--rail);
  flex: 0 0 var(--rail);
  border-right: 1px solid var(--line);
  background: rgba(15, 20, 27, .82);
  backdrop-filter: blur(6px);
  padding: 1.4rem 1rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.rail-mark {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .28em;
  color: var(--signal);
  padding: 0 .6rem;
  margin-bottom: 1.6rem;
}
.rail nav { display: flex; flex-direction: column; gap: 2px; }
.rail-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .6em;
  padding: .5em .6rem;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  border: 1px solid transparent;
  background: none;
  font-family: var(--sans);
  text-align: left;
  width: 100%;
}
.rail-link:hover { background: var(--raised); color: var(--text); }
.rail-link.active {
  background: var(--raised);
  color: var(--text);
  border-color: var(--line);
  box-shadow: inset 2px 0 0 var(--signal);
}
.rail-badge {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
}
.rail-foot { margin-top: auto; padding: 0 .6rem; }
.rail-user { font-size: 13px; margin-bottom: .5em; }
.rail-user strong { display: block; font-weight: 600; }

.main { flex: 1; min-width: 0; padding: 2rem 2.2rem 5rem; max-width: 1160px; }

.page-head { margin-bottom: 1.7rem; }
.page-head h2 { font-size: 22px; margin-bottom: .18em; }
.page-head p { color: var(--muted); font-size: 14px; margin: 0; }

/* --- panels ------------------------------------------------------ */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.15rem;
}
.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1em;
  margin-bottom: 1rem;
}
.panel-head h3 { font-size: 15px; }

/* --- readout strip ----------------------------------------------- */
.readout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 1.15rem;
}
.readout-cell { background: var(--panel); padding: 1rem 1.15rem; }
.readout-cell .eyebrow { display: block; margin-bottom: .45em; }
.readout-value {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 27px;
  font-weight: 500;
  line-height: 1.1;
  letter-spacing: -.02em;
}
.readout-value small { font-size: 14px; color: var(--faint); font-weight: 400; }
.readout-note { font-size: 12px; color: var(--faint); margin-top: .25em; }

/* --- the mastery grid: the signature element --------------------- */
.grid-legend {
  display: flex;
  align-items: center;
  gap: .55em;
  font-size: 11.5px;
  color: var(--faint);
  font-family: var(--mono);
}
.legend-ramp {
  width: 92px;
  height: 8px;
  border-radius: 2px;
  background: linear-gradient(90deg, #f2555a, #f2a65a, #4cc9c0, #5bd99a);
}

.book-block { margin-bottom: 1.35rem; }
.book-block:last-child { margin-bottom: 0; }
.book-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12.5px;
  color: var(--muted);
  padding-bottom: .4em;
  margin-bottom: .6em;
  border-bottom: 1px solid var(--line-soft);
}
.book-label .num { color: var(--faint); font-size: 11.5px; }

.cells { display: flex; flex-wrap: wrap; gap: 5px; }
.cell {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 4px;
  border: 1px solid transparent;
  cursor: pointer;
  padding: 0;
  font-family: var(--mono);
  font-size: 9.5px;
  color: rgba(6, 20, 22, .72);
  font-weight: 600;
  display: grid;
  place-items: center;
  transition: transform .12s ease, box-shadow .12s ease;
}
.cell:hover, .cell:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .5);
  z-index: 3;
}
.cell.untested {
  background: transparent;
  border: 1px dashed var(--line);
  color: var(--faint);
}
.cell.provisional::after {
  /* Diagonal hatch marks a topic with too little evidence to trust. */
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 3px;
  background: repeating-linear-gradient(
    45deg, transparent, transparent 3px,
    rgba(13, 17, 23, .45) 3px, rgba(13, 17, 23, .45) 5px);
}

.tip {
  position: fixed;
  z-index: 60;
  max-width: 290px;
  background: #0b0f15;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: .65em .8em;
  font-size: 12.5px;
  line-height: 1.45;
  box-shadow: var(--shadow);
  pointer-events: none;
}
.tip strong { display: block; margin-bottom: .25em; font-size: 13px; }
.tip .row {
  display: flex;
  justify-content: space-between;
  gap: 1.2em;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
}

/* --- lists ------------------------------------------------------- */
.row-item {
  display: flex;
  align-items: center;
  gap: 1em;
  padding: .7em 0;
  border-bottom: 1px solid var(--line-soft);
}
.row-item:last-child { border-bottom: none; }
.row-item .grow { flex: 1; min-width: 0; }
.row-title { font-size: 14px; }
.row-sub { font-size: 12px; color: var(--faint); }

.meter { height: 5px; border-radius: 3px; background: #101720; overflow: hidden; }
.meter span { display: block; height: 100%; border-radius: 3px; }

.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .06em;
  padding: .2em .5em;
  border-radius: 3px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}
.tag.easy { color: #86d3a5; border-color: #2c5340; }
.tag.moderate { color: #e5b478; border-color: #5a4429; }
.tag.hard { color: #ef8f92; border-color: #5d2f32; }

/* --- drill ------------------------------------------------------- */
.drill-bar {
  display: flex;
  align-items: center;
  gap: 1.1em;
  margin-bottom: 1.1rem;
  flex-wrap: wrap;
}
.drill-progress {
  flex: 1;
  min-width: 180px;
  height: 3px;
  background: #101720;
  border-radius: 2px;
  overflow: hidden;
}
.drill-progress span {
  display: block;
  height: 100%;
  background: var(--signal);
  transition: width .3s ease;
}

.qcard {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.5rem 1.7rem 1.35rem;
}
.qmeta {
  display: flex;
  gap: .55em;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1rem;
}
.qindex {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--signal);
  letter-spacing: .06em;
}
.qtext {
  font-family: var(--serif);
  font-size: 18.5px;
  line-height: 1.5;
  margin-bottom: .5em;
}
.qhint {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--attention);
  letter-spacing: .04em;
  margin-bottom: 1.1em;
}

.opt {
  display: flex;
  gap: .85em;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  background: #10161e;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .8em 1em;
  margin-bottom: .5em;
  cursor: pointer;
  color: var(--text);
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.5;
  transition: border-color .12s ease, background .12s ease;
}
.opt:hover:not(:disabled) { border-color: #37485a; }
.opt-key {
  flex: 0 0 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 1px;
}
.opt.picked { border-color: var(--signal-dim); background: #12242a; }
.opt.picked .opt-key { background: var(--signal); border-color: var(--signal); color: #06211f; }
.opt:disabled { cursor: default; }
.opt.key-right { border-color: #2f6b4c; background: #10221a; }
.opt.key-right .opt-key { background: var(--correct); border-color: var(--correct); color: #062015; }
.opt.key-wrong { border-color: #6b3034; background: #221315; }
.opt.key-wrong .opt-key { background: var(--wrong); border-color: var(--wrong); color: #24070a; }
.opt-mark {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--faint);
  white-space: nowrap;
  padding-left: .8em;
}

.verdict {
  margin-top: 1.1rem;
  border-top: 1px solid var(--line);
  padding-top: 1.05rem;
}
.verdict-line {
  display: flex;
  align-items: baseline;
  gap: .8em;
  font-family: var(--mono);
  font-size: 13px;
  margin-bottom: .7em;
  flex-wrap: wrap;
}
.verdict-line .ok { color: var(--correct); }
.verdict-line .no { color: var(--wrong); }
.rationale {
  font-size: 14px;
  color: #c3cedd;
  background: #0f151d;
  border-left: 2px solid var(--line);
  padding: .8em 1em;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.palette {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 1.1rem;
}
.pip {
  width: 25px;
  height: 25px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: #10161e;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 10.5px;
  cursor: pointer;
  padding: 0;
}
.pip:hover { border-color: #3a4a5c; color: var(--text); }
.pip.done { background: #1b2733; color: var(--muted); }
.pip.right { background: #16301f; border-color: #2f6b4c; color: #86d3a5; }
.pip.wrong { background: #2a1518; border-color: #6b3034; color: #ef8f92; }
.pip.here { box-shadow: 0 0 0 2px var(--signal); color: var(--text); }
.pip.flag { border-color: var(--attention); }

/* --- Claude notes ------------------------------------------------ */
.claude-note {
  margin-top: 1rem;
  background: #0f1720;
  border: 1px solid var(--line);
  border-left: 2px solid var(--violet);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 1em 1.15em;
  font-size: 14px;
  line-height: 1.6;
}
.claude-note h4 { font-size: 14px; margin: 1em 0 .4em; }
.claude-note h4:first-child { margin-top: 0; }
.claude-note ul { margin: .4em 0 .8em; padding-left: 1.2em; }
.claude-note li { margin-bottom: .25em; }
.claude-note code {
  font-family: var(--mono);
  font-size: 12.5px;
  background: #182029;
  padding: .1em .35em;
  border-radius: 3px;
}
.claude-byline {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--faint);
  letter-spacing: .08em;
  margin-top: .9em;
  text-transform: uppercase;
}

.spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--line);
  border-top-color: var(--signal);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  vertical-align: -1px;
  margin-right: .5em;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- misc -------------------------------------------------------- */
.toast {
  position: fixed;
  bottom: 1.4rem;
  left: 50%;
  transform: translateX(-50%);
  background: #0b0f15;
  border: 1px solid var(--line);
  border-left: 3px solid var(--signal);
  border-radius: var(--radius);
  padding: .7em 1.1em;
  font-size: 13.5px;
  box-shadow: var(--shadow);
  z-index: 90;
  max-width: 440px;
}
.toast.bad { border-left-color: var(--wrong); }

.empty {
  text-align: center;
  padding: 2.6rem 1rem;
  color: var(--faint);
  font-size: 14px;
}
.empty strong { display: block; color: var(--muted); font-size: 15px; margin-bottom: .35em; }

.split { display: grid; grid-template-columns: 1.5fr 1fr; gap: 1.15rem; align-items: start; }
.chips { display: flex; flex-wrap: wrap; gap: .4em; }
.chip {
  font-size: 13px;
  padding: .35em .75em;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: #10161e;
  color: var(--muted);
  cursor: pointer;
  font-family: var(--sans);
}
.chip.on { border-color: var(--signal-dim); background: #12242a; color: var(--signal); }

.bars { display: flex; align-items: flex-end; gap: 4px; height: 74px; }
.bar { flex: 1; min-width: 6px; background: var(--signal-dim); border-radius: 2px 2px 0 0; position: relative; }
.bar:last-child { background: var(--signal); }

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

/* --- responsive -------------------------------------------------- */
@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .rail {
    width: 100%;
    flex: none;
    height: auto;
    position: static;
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding: .9rem 1rem;
  }
  .rail-mark { margin-bottom: .8rem; }
  .rail nav { flex-direction: row; flex-wrap: wrap; }
  .rail-link { width: auto; }
  .rail-foot { margin-top: .8rem; padding: 0; display: flex; gap: .8em; align-items: center; }
  .rail-user { margin-bottom: 0; }
  .main { padding: 1.3rem 1.1rem 4rem; }
  .split { grid-template-columns: 1fr; }
  .qcard { padding: 1.1rem 1.1rem 1rem; }
  .qtext { font-size: 17px; }
}

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