/* blueyetutor — visual style v2
 * Direction: Linear / Vercel — minimal, white base, generous whitespace,
 * 1px hairlines, two font weights only. Navy is the SINGLE brand accent
 * and lives on ~10% of pixels: CTAs, active indicators, links, key numbers.
 * Large surfaces (cards, tables, panels) stay white. Hover/selection is
 * navy at 5% tint, never a saturated fill.
 */

:root {
  /* base palette */
  --bg:         #ffffff;
  --surface:    #ffffff;
  --surface-2:  #fafafa;       /* very light gray for stripes / hover-on-white */
  --border:     #ececec;        /* hairline */
  --border-2:   #d4d4d4;        /* slightly stronger (inputs) */
  --text:       #0a0a0b;
  --text-2:     #6b6b70;
  --text-3:     #a0a0a5;

  /* brand — navy (sampled from the actual Blueye logo). Used on ~10% of pixels only. */
  --navy:       #34327B;
  --navy-hover: #292766;        /* darker for button hover */
  --navy-fg:    #ffffff;
  --navy-5:     rgba(52, 50, 123, 0.05);
  --navy-10:    rgba(52, 50, 123, 0.10);
  --navy-20:    rgba(52, 50, 123, 0.20);

  /* status — kept understated */
  --ok:         #1f7a45;
  --warn:       #8a6b1a;
  --danger:     #9a2b2b;

  /* shape */
  --r:    8px;
  --r-sm: 6px;
  --r-lg: 10px;

  /* spacing */
  --gap-1: 4px;
  --gap-2: 8px;
  --gap-3: 12px;
  --gap-4: 16px;
  --gap-6: 24px;
  --gap-8: 32px;
  --gap-10: 40px;

  /* type — Pretendard, two weights only */
  --font-sans: "Pretendard Variable", Pretendard, -apple-system,
               BlinkMacSystemFont, "Apple SD Gothic Neo", system-ui, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, monospace;

  /* sidebar width */
  --sidebar-w: 220px;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.008em;
}
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
code, kbd { font-family: var(--font-mono); font-size: 0.92em; color: var(--text-2); }
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }

h1, h2, h3, h4 { font-weight: 700; letter-spacing: -0.02em; margin: 0; }

/* ============================== Shell ============================== */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 22px 22px 26px;
  font-size: 17px; font-weight: 700;
  color: var(--text);
  letter-spacing: -0.025em;
  text-decoration: none;
}
.sidebar-brand:hover { text-decoration: none; }
.brand-mark {
  width: 18px; height: 18px;
  background: var(--navy);
  border-radius: 4px;
  flex-shrink: 0;
  position: relative;
}
/* tiny dandelion glyph inside the mark — radiating hairlines */
.brand-mark::before, .brand-mark::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(  0deg, transparent 47%, #fff 47%, #fff 53%, transparent 53%),
    linear-gradient( 90deg, transparent 47%, #fff 47%, #fff 53%, transparent 53%);
  background-size: 100% 100%;
  opacity: 0.85;
}
.brand-mark::after {
  background:
    linear-gradient( 45deg, transparent 47%, #fff 47%, #fff 53%, transparent 53%),
    linear-gradient(135deg, transparent 47%, #fff 47%, #fff 53%, transparent 53%);
  opacity: 0.55;
}

.sidebar-nav {
  display: flex; flex-direction: column;
  padding: 4px 12px;
  gap: 1px;
}
.sidebar-section-label {
  padding: 12px 12px 6px;
  font-size: 11px; font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.sidebar-nav a {
  position: relative;
  display: flex; align-items: center;
  padding: 8px 12px;
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  text-decoration: none;
}
.sidebar-nav a:hover { background: var(--navy-5); color: var(--text); text-decoration: none; }
.sidebar-nav a.active {
  background: var(--navy-5);
  color: var(--text);
  font-weight: 600;
}
.sidebar-nav a.active::before {
  content: "";
  position: absolute;
  left: -12px; top: 6px; bottom: 6px;
  width: 2px; background: var(--navy);
  border-radius: 0 2px 2px 0;
}
.sidebar-footer {
  margin-top: auto;
  padding: 16px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.sidebar-footer .user-meta {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
}
.sidebar-footer .email {
  font-size: 12px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.avatar {
  width: 28px; height: 28px; border-radius: 999px;
  background: var(--navy-10); color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}

.app-main {
  flex: 1; min-width: 0;
  background: var(--bg);
}

/* ============================== Page ============================== */
.page {
  padding: 48px 56px 64px;
  max-width: 1240px;
  margin: 0 auto;
}
.page-header { margin-bottom: 36px; position: relative; }
.page-header .eyebrow {
  display: inline-block;
  font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--navy);
  margin-bottom: 10px;
}
.page-header h1 {
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.028em;
  margin: 0 0 10px;
  line-height: 1.15;
}
.page-header .subtitle {
  font-size: 15px;
  color: var(--text-2);
  margin: 0;
  max-width: 720px;
  font-weight: 400;
  line-height: 1.55;
}

/* layout helpers */
.row { display: flex; gap: var(--gap-3); }
.col { display: flex; flex-direction: column; gap: var(--gap-3); }
.grow { flex: 1 1 auto; min-width: 0; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--border); margin: var(--gap-4) 0; border: 0; }
.cluster { display: flex; gap: var(--gap-2); flex-wrap: wrap; align-items: center; }
.stretch { width: 100%; }

/* ============================== Card ============================== */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: var(--gap-3);
}
.card-header h3 {
  font-size: 14.5px; font-weight: 700; margin: 0;
  letter-spacing: -0.01em;
}
.card-body { padding: 16px; }
.card-pad-lg { padding: 28px; }

/* ============================== Tabs ============================== */
.tabs {
  display: flex; gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tabs button {
  background: none; border: none; cursor: pointer;
  padding: 11px 18px;
  font-size: 14px; font-weight: 500;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color 0.12s;
}
.tabs button:hover { color: var(--text); }
.tabs button.active {
  color: var(--text);
  font-weight: 700;
  border-bottom-color: var(--navy);
}

/* ============================== Buttons ============================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  padding: 7px 14px;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
  font-size: 13px;
  line-height: 1.4;
  transition: background 0.12s, border-color 0.12s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary {
  background: var(--navy); color: var(--navy-fg); border-color: var(--navy);
  font-weight: 600;
}
.btn.primary:hover { background: var(--navy-hover); border-color: var(--navy-hover); }
.btn.danger {
  background: var(--surface); color: var(--danger);
  border-color: var(--border-2);
}
.btn.danger:hover { background: #fdf2f2; border-color: #f0d6d6; }
.btn.ghost {
  background: none; border-color: transparent; color: var(--text-2);
}
.btn.ghost:hover { background: var(--navy-5); color: var(--text); }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: var(--r-sm); }
.btn.lg { padding: 11px 20px; font-size: 14.5px; font-weight: 700; }
.btn.block { width: 100%; }

/* ============================== Form ============================== */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label {
  font-size: 12px; font-weight: 500; color: var(--text-2);
  letter-spacing: 0;
}
.input, .select, .textarea {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  padding: 8px 11px;
  font-size: 13.5px;
  width: 100%;
  outline: none;
  color: var(--text);
  transition: border-color 0.12s, box-shadow 0.12s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px var(--navy-10);
}
.select[multiple] { padding: 6px; }
.help { font-size: 12px; color: var(--text-3); }

.checkbox, .radio {
  display: inline-flex; gap: 8px; align-items: center; cursor: pointer;
  font-size: 13.5px;
}
.checkbox input, .radio input {
  accent-color: var(--navy);
  margin: 0;
}

input[type="range"] {
  accent-color: var(--navy);
  height: 4px;
}

/* segmented control */
.segmented {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 2px;
  gap: 2px;
}
.segmented button {
  background: none; border: none; cursor: pointer;
  padding: 4px 12px;
  border-radius: 5px;
  color: var(--text-2);
  font-weight: 400;
  font-size: 13px;
  transition: background 0.1s, color 0.1s;
}
.segmented button:hover { color: var(--text); }
.segmented button.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  border: 1px solid var(--border);
}

/* ============================== Badge / chip ============================== */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0;
}
.badge.solid { background: var(--navy); color: var(--navy-fg); border-color: var(--navy); }
.badge.ok    { color: var(--ok);     background: #f1f8f4; border-color: #d4ead9; }
.badge.warn  { color: var(--warn);   background: #fdf6e3; border-color: #ecdfb0; }
.badge.danger{ color: var(--danger); background: #fdf2f2; border-color: #f0d6d6; }
.badge.navy  { color: var(--navy);   background: var(--navy-5); border-color: var(--navy-10); }
.badge.mono  { font-family: var(--font-mono); font-size: 11px; }

.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 11px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-2);
  background: var(--surface);
  cursor: pointer;
  font-size: 13px;
  color: var(--text-2);
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.chip:hover { background: var(--navy-5); color: var(--text); }
.chip.active {
  background: var(--navy-5);
  color: var(--navy);
  border-color: var(--navy-20);
  font-weight: 600;
}

/* ============================== Metric ============================== */
.metric-grid {
  display: grid; gap: var(--gap-3);
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.metric {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 18px;
}
.metric .label {
  font-size: 12px; color: var(--text-2);
  font-weight: 500;
}
.metric .value {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin-top: 4px;
  font-feature-settings: "tnum" 1;
  color: var(--text);
}
.metric.highlight .value { color: var(--navy); }
.metric .delta { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.metric .delta.ok { color: var(--ok); }
.metric .delta.bad { color: var(--danger); }

/* ============================== Banner ============================== */
.banner {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r);
  padding: 12px 14px;
  display: flex; gap: 10px; align-items: flex-start;
}
.banner.info   { background: var(--navy-5); border-color: var(--navy-10); }
.banner.warn   { background: #fdf6e3; border-color: #ecdfb0; color: #6b531a; }
.banner.error  { background: #fdf2f2; border-color: #f0d6d6; color: #6b1a1a; }
.banner.ok     { background: #f1f8f4; border-color: #d4ead9; color: #1f4a2a; }
.banner h4 { margin: 0 0 4px 0; font-size: 13px; font-weight: 600; }
.banner p { margin: 0; font-size: 13px; }

/* ============================== Empty state ============================== */
.empty {
  background: var(--surface);
  border: 1px dashed var(--border-2);
  border-radius: var(--r);
  padding: 56px 24px;
  text-align: center;
  color: var(--text-2);
}
.empty .title {
  font-weight: 600; font-size: 15px;
  color: var(--text);
  margin-bottom: 6px;
}

/* ============================== Progress ============================== */
.progress {
  position: relative;
  height: 4px;
  background: var(--navy-5);
  border-radius: 999px;
  overflow: hidden;
}
.progress > span {
  display: block;
  height: 100%;
  background: var(--navy);
  transition: width 0.3s;
}
.progress.indeterminate > span {
  width: 35%;
  animation: indeterm 1.6s ease-in-out infinite;
}
@keyframes indeterm {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(285%); }
}

/* Spinner for long-running operations (workbook PDF build, etc.) */
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.build-overlay-card {
  text-align: center;
  padding: 30px 28px;
  max-width: 380px;
}
.build-overlay-card .build-overlay-title {
  font-size: 17px; font-weight: 700; margin-bottom: 10px;
}
.build-overlay-card .build-overlay-hint {
  font-size: 13px; color: var(--text-2); line-height: 1.55;
}

/* ============================== Problem grid / crop placeholder ============================== */
.problem-grid {
  display: grid; gap: 14px;
  grid-template-columns: repeat(3, 1fr);
  min-width: 0;          /* never let the grid blow past its container */
}
.problem-grid.frq { grid-template-columns: 1fr; }
.problem {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--r);
  background: var(--surface);
  padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  font-size: 13px;
  transition: border-color 0.12s, background 0.12s;
  /* grid/flex items default to min-width:auto → a natural-size crop wider
     than the column expands the cell and pushes the layout right. Pin to 0
     so the card stays in its track and the image scrolls inside instead. */
  min-width: 0;
}
/* fullscreen toggle — top-right of every card, above the crop */
.problem .prob-zoom {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 26px; height: 26px;
  background: rgba(255, 255, 255, 0.86);
  border: 1px solid var(--border);
  opacity: 0; transition: opacity 0.12s, background 0.12s;
}
.problem:hover .prob-zoom,
.problem .prob-zoom:focus-visible { opacity: 1; }
.problem .prob-zoom:hover { background: #fff; color: var(--navy); }
.problem .head {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  padding-right: 30px;   /* clear the absolute .prob-zoom button */
}
.problem .head strong { font-weight: 600; }
.problem .meta { font-size: 12px; color: var(--text-3); }
.problem.selectable { cursor: pointer; }
.problem.selectable:hover { background: var(--navy-5); }
.problem.selected {
  border-color: var(--navy);
  background: var(--navy-5);
}
.crop {
  width: 100%;
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
  background-image: repeating-linear-gradient(
    45deg, transparent 0, transparent 7px, #f0f0f0 7px, #f0f0f0 8px);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: center;
  padding: 8px;
}
.crop.frq    { aspect-ratio: 8 / 11; }
.crop.figure { aspect-ratio: 1 / 1; }

/* Real cropped-problem image. Base (FRQ single-column cards, scoring guide,
   History): fit the card width — tall is fine, never overflows sideways. */
.crop-real { width: 100%; max-width: 100%; }
.crop-real img {
  display: block; width: auto; height: auto; max-width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: #fff;
}

/* MCQ 3-up grid: every cell is the SAME fixed-size viewport so the row
   stays aligned (stimulus composites no longer hijack a full row). The
   crop renders at its true DISPLAY_SCALE size — so text is at a single
   consistent scale across every card — and the viewport just clips it.
   overflow:auto means the pan bar shows up ONLY when a crop is actually
   bigger than the box (most short MCQ stems fit and get no scrollbar). */
.problem-grid:not(.frq) .problem .crop-real {
  height: var(--mcq-crop-h, 360px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  display: grid;
  /* center crops smaller than the box; 'safe' falls back to start when the
     crop is larger so the scroll origin stays reachable (top-left). */
  place-content: safe center;
}
.problem-grid:not(.frq) .problem .crop-real img {
  border: 0; border-radius: 0;
  max-width: none; max-height: none;
}
/* slim, obvious pan bar for the cells that do overflow */
.problem-grid:not(.frq) .problem .crop-real::-webkit-scrollbar { height: 9px; width: 9px; }
.problem-grid:not(.frq) .problem .crop-real::-webkit-scrollbar-thumb {
  background: var(--border-2); border-radius: 999px;
}
.problem-grid:not(.frq) .problem .crop-real::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* unit editor chip */
.unit-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 9px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border-2);
  background: var(--surface);
  font-size: 12px;
  cursor: pointer;
  color: var(--text-2);
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  align-self: flex-start;
}
.unit-chip:hover { background: var(--navy-5); border-color: var(--navy-20); color: var(--navy); }
.unit-chip.empty { color: var(--text-3); border-style: dashed; }
.unit-chip .edit-mark {
  color: var(--text-3); font-size: 10px;
}

/* ============================== File picker / search ============================== */
.filepick { display: flex; flex-direction: column; gap: 8px; }
.filepick-toggle {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--r-sm);
  padding: 8px 11px;
  font-size: 13.5px; color: var(--text);
  cursor: pointer;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.filepick-toggle:hover { border-color: var(--navy-20); }
.filepick-toggle:focus-visible {
  border-color: var(--navy); box-shadow: 0 0 0 3px var(--navy-10); outline: none;
}
.filepick-summary { flex: 1; min-width: 0; }
.filepick-panel {
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px;
  display: flex; flex-direction: column; gap: 6px;
  background: var(--surface);
}
.filepick-search { display: flex; align-items: center; gap: 8px; }
.filepick-search svg { color: var(--text-3); flex-shrink: 0; }
.filepick-search .input { flex: 1; }
.filepick-list {
  display: flex; flex-direction: column; gap: 2px;
  max-height: 220px; overflow-y: auto;
  margin-top: 2px;
}
.filepick-row {
  width: 100%; padding: 6px 6px; border-radius: var(--r-sm);
}
.filepick-row:hover { background: var(--navy-5); }

/* ============================== Upload log tail ============================== */
.log-tail {
  max-height: 220px; overflow-y: auto;
  background: #0f1115; color: #c8d0da;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 11.5px; line-height: 1.55;
}
.log-line { white-space: pre-wrap; word-break: break-word; }

/* ============================== Modal ============================== */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 10, 11, 0.32);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}
.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  overflow: auto;
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.modal-header h3 { margin: 0; font-size: 14px; font-weight: 600; }
.modal-body { padding: 20px; }
.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end;
}

/* ============================== Lightbox (fullscreen crop) ============================== */
.lightbox-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(10, 10, 11, 0.82);
  display: flex; flex-direction: column;
  backdrop-filter: blur(2px);
}
.lightbox-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  color: #fff; flex-shrink: 0;
}
.lightbox-title {
  font-family: var(--font-mono); font-size: 12px;
  color: rgba(255, 255, 255, 0.72); flex: 1;
}
.lightbox-bar .icon-btn { color: #fff; }
.lightbox-bar .icon-btn:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }
.lightbox-stage {
  flex: 1; min-height: 0;
  overflow: auto;
  display: grid; place-content: safe center;
  padding: 0 24px 28px;
}
.lightbox-stage img {
  display: block;
  max-width: calc(100vw - 48px);
  background: #fff;
  border-radius: var(--r-sm);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}

/* ============================== Table ============================== */
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td {
  text-align: left; padding: 9px 12px;
  border-bottom: 1px solid var(--border);
}
.table th {
  color: var(--text-2); font-weight: 500; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.05em;
}
.table tr:last-child td { border-bottom: 0; }

/* ============================== Icons (inline SVG carriers) ============================== */
.ic { width: 14px; height: 14px; flex-shrink: 0; display: inline-block; vertical-align: -2px; stroke: currentColor; stroke-width: 1.5; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ic-lg { width: 18px; height: 18px; vertical-align: -3px; }
.ic-sm { width: 12px; height: 12px; }
.icon-btn {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-sm);
  background: none; border: 1px solid transparent;
  cursor: pointer; color: var(--text-2);
}
.icon-btn:hover { background: var(--navy-5); color: var(--text); }

/* ============================== Login ============================== */
.login-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 1fr);
  min-height: 100vh;
  background: var(--bg);
}
.login-hero {
  position: relative;
  overflow: hidden;
  background: var(--navy);
  display: flex; flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 56px;
  color: #fff;
}
.login-hero canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  z-index: 1;
}
.login-hero-brand {
  position: absolute; top: 40px; left: 40px;
  z-index: 3;
  display: flex; flex-direction: row; align-items: center;
  gap: 14px;
  pointer-events: none;
}
.login-hero-brand .dandelion-mark {
  width: 44px; height: 44px;
  flex-shrink: 0;
  background: var(--navy);
  border-radius: 50%;
}
.login-hero-brand .wordmark {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1;
  color: #ffffff;
}
.login-hero-body {
  position: relative; z-index: 2;
  pointer-events: none;
  max-width: 620px;
  text-align: center;
}
.login-hero-body .greeting {
  font-size: 76px;
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 1;
  margin: 0 0 4px;
  color: #fff;
}
.login-hero-body h1 {
  font-size: 52px;
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.15;
  margin: 0 0 24px;
  color: #fff;
}
.login-hero-body .hero-sub {
  font-size: 19px;
  color: rgba(255, 255, 255, 0.82);
  margin: 0 0 6px;
  line-height: 1.55;
  font-weight: 400;
}
.login-hero-body .hero-sub.muted {
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
}

.login-form {
  display: flex; align-items: center; justify-content: center;
  padding: 64px 56px;
}
.login-card {
  width: 100%; max-width: 380px;
}
.login-card h2 {
  font-size: 24px; font-weight: 700;
  letter-spacing: -0.025em;
  margin: 0 0 6px;
}
.login-card .sub {
  color: var(--text-2);
  font-size: 14px;
  font-weight: 400;
  margin: 0 0 28px;
}

@media (max-width: 920px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-hero { min-height: 320px; padding: 32px; }
  .login-form { padding: 40px 28px; }
  .login-hero-brand { top: 24px; left: 24px; gap: 10px; }
  .login-hero-brand .wordmark { font-size: 18px; }
  .login-hero-brand .dandelion-mark { width: 36px; height: 36px; }
  .login-hero-body { max-width: 100%; }
  .login-hero-body .greeting { font-size: 48px; }
  .login-hero-body h1 { font-size: 30px; }
  .login-hero-body .hero-sub { font-size: 15px; }
}

/* ============================== Utility ============================== */
.muted { color: var(--text-2); }
.mono  { font-family: var(--font-mono); }
.small { font-size: 12px; }
.tiny  { font-size: 11px; }
.right { text-align: right; }
.nowrap{ white-space: nowrap; }
.navy  { color: var(--navy); }
.scroll-x { overflow-x: auto; }

/* student roster row */
.student-row {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  background: none; border: 1px solid transparent;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--text-2);
  position: relative;
}
.student-row:hover { background: var(--navy-5); color: var(--text); }
.student-row[data-active="true"] {
  background: var(--navy-5);
  color: var(--text);
}
.student-row[data-active="true"]::before {
  content: ""; position: absolute;
  left: -1px; top: 8px; bottom: 8px;
  width: 2px; background: var(--navy);
  border-radius: 0 2px 2px 0;
}
.student-row .name { font-weight: 600; font-size: 13.5px; }
.student-row[data-active="true"] .name { color: var(--navy); }

/* MCQ grid responsive */
@media (max-width: 1100px) {
  .problem-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .problem-grid { grid-template-columns: 1fr; }
  .page { padding: 24px 20px; }
  .sidebar { display: none; }
}

/* hide focus rings when not keyboard nav */
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
