/* Layout concept: dark Supercent shell (bento home, quiet reading pages); light "paper" boards for work surfaces later. */
@font-face {
  font-family: 'SB Aggro';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2108@1.1/SBAggroB.woff') format('woff');
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: 'SB Aggro';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_2108@1.1/SBAggroM.woff') format('woff');
  font-weight: 500;
  font-display: swap;
}

:root {
  /* supercent.io tokens (measured 2026-10-22) */
  --bg: #121212;
  --black: #0b0b0b;
  --surface: #171717;
  --surface-2: #1c1c1c;
  --card: #2a2a2a;
  --line: #303030;
  --line-strong: #474747;
  --muted: #8a8a8a;
  --soft: #b0b0b0;
  --text: #dcdcdc;
  --white: #ffffff;
  --cyan: #1aafff;
  --violet: #6b1bff;
  --magenta: #f10ee2;
  --mint: #21dda9;
  --grad-brand: linear-gradient(90deg, var(--cyan) 0%, var(--violet) 45%, var(--magenta) 100%);
  --grad-text: linear-gradient(90deg, var(--cyan) 0%, var(--magenta) 100%);
  --grad-mint: linear-gradient(116deg, #0fcfff 0%, #00ff9d 100%);
  --grad-pink: linear-gradient(97deg, #ff15d0 0%, #6f00ff 100%);
  --grad-yellow: linear-gradient(178deg, #ffeb0f 3.82%, #ff9000 96.18%);
  --grad-dark: linear-gradient(116deg, #1b1b1b 0%, #303030 100%);
  /* semantic (kept apart from the brand hues) */
  --ok: #3ccf7a;
  --warn: #f5b84b;
  --bad: #ff5c5c;
  --info: #6aa8ff;
  /* light "paper" work surfaces inside the dark shell (spec 10.2) */
  --paper: #ffffff;
  --paper-2: #f6f6f4;
  --paper-hover: #efefec;
  --paper-line: #e3e3df;
  --paper-line-strong: #c7c7c2;
  --ink: #1d1d1d;
  --ink-soft: #484848;
  --ink-muted: #6e6e6e;
  --ink-accent: #0b6fae;
  --ink-ok: #1d7a43;
  --ink-bad: #c0262d;
  --ink-focus: rgba(26, 175, 255, 0.35);
  /* workbench chrome */
  --wb-handle-w: 28px;
  --wb-slide: 200ms;
  /* type */
  --font-display: 'SB Aggro', 'Pretendard Variable', Pretendard, system-ui, sans-serif;
  --font-body: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --radius-card: 20px;
  --radius-pill: 40px;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  word-break: keep-all;
  overflow-wrap: break-word;
}
img { max-width: 100%; }
a { color: var(--cyan); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
[hidden] { display: none !important; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--white); color: var(--black); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 16px; }

/* ---- top bar --------------------------------------------------------------- */
.topbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  display: flex; align-items: center; gap: 24px;
  padding: 14px var(--gutter-r) 14px var(--gutter);
  background: rgba(18, 18, 18, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { font-family: var(--font-display); font-weight: 700; font-size: 20px; color: var(--white); text-decoration: none; letter-spacing: 0.01em; white-space: nowrap; }
.brand span { font-weight: 500; font-size: 14px; color: var(--soft); margin-left: 6px; }
.nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.nav a { color: var(--soft); text-decoration: none; padding: 6px 12px; border-radius: var(--radius-pill); white-space: nowrap; font-size: 15px; }
.nav a:hover { color: var(--white); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--black); background: var(--white); }
.who { display: flex; align-items: center; gap: 10px; white-space: nowrap; font-size: 14px; }
.who .role { font-size: 12px; color: var(--muted); border: 1px solid var(--line-strong); padding: 1px 8px; border-radius: var(--radius-pill); }
.linkbtn { background: none; border: 0; color: var(--soft); cursor: pointer; padding: 4px; text-decoration: underline; text-underline-offset: 3px; }
.linkbtn:hover { color: var(--white); }

main { padding: 32px var(--gutter-r) 64px var(--gutter); max-width: 1200px; margin: 0 auto; outline: none; }

/* ---- shared pieces ----------------------------------------------------------- */
h1, h2, h3 { text-wrap: balance; }
.display { font-family: var(--font-display); font-weight: 700; color: var(--white); line-height: 1.15; margin: 0; }
.grad-text { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.eyebrow { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; cursor: pointer; text-decoration: none;
  font-family: var(--font-display); font-weight: 700; font-size: 16px;
  padding: 11px 26px 9px; border-radius: var(--radius-pill);
  background: var(--grad-brand); color: var(--white);
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--line-strong); }
.btn.small { font-size: 14px; padding: 7px 16px 5px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--font-display); font-weight: 500; font-size: 13px;
  background: var(--white); color: var(--black); padding: 3px 12px 1px; border-radius: 30px; text-decoration: none;
}
.chip.dim { background: rgba(255,255,255,0.14); color: var(--white); }
.field { display: grid; gap: 6px; }
.field label { font-size: 14px; color: var(--soft); }
.field input {
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px;
  padding: 12px 14px; font-size: 16px; width: 100%;
}
.field input:focus { border-color: var(--cyan); outline: none; }
.hint { font-size: 13px; color: var(--muted); margin: 0; }
.error { color: var(--bad); font-size: 14px; margin: 0; min-height: 1.4em; }
.notice { border: 1px solid var(--line-strong); border-radius: 14px; padding: 14px 16px; background: var(--surface); color: var(--soft); }
.progress { height: 8px; background: var(--surface-2); border-radius: 8px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--grad-brand); border-radius: 8px; transition: width .3s ease; }
.tabular { font-variant-numeric: tabular-nums; }

/* ---- login ------------------------------------------------------------------- */
.login { min-height: calc(100vh - 96px); display: grid; place-items: center; }
.login-card { width: min(440px, 100%); display: grid; gap: 22px; }
.login-card .display { font-size: clamp(40px, 9vw, 64px); }
.login-card .sub { font-family: var(--font-display); font-weight: 500; font-size: 20px; color: var(--soft); margin: 4px 0 0; }
.login-card form { display: grid; gap: 16px; padding: 24px; border-radius: var(--radius-card); background: var(--surface); border: 1px solid var(--line); }
.login-card form h2 { margin: 0; font-family: var(--font-display); font-size: 20px; color: var(--white); }
.login-switch { justify-self: center; }

/* ---- home bento ---------------------------------------------------------------- */
.bento { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tile {
  position: relative; border-radius: var(--radius-card); padding: 22px; min-height: 180px;
  display: flex; flex-direction: column; gap: 10px; color: var(--black); text-decoration: none; overflow: hidden;
}
.tile h2, .tile h3 { font-family: var(--font-display); font-weight: 700; margin: 0; line-height: 1.15; }
.tile h3 { font-size: 26px; }
.tile p { margin: 0; }
.tile .foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tile.mint { background: var(--grad-mint); }
.tile.pink { background: var(--grad-pink); color: var(--white); }
.tile.yellow { background: var(--grad-yellow); }
.tile.dark { background: var(--grad-dark); color: var(--white); border: 1px solid var(--line); }
.tile.hero { grid-column: span 2; grid-row: span 2; background: var(--black); border: 1px solid var(--line); color: var(--white); min-height: 376px; }
.tile.hero .display { font-size: clamp(34px, 4.4vw, 56px); }
.tile.wide { grid-column: span 2; }
.tile .count { font-family: var(--font-display); font-size: 15px; }
.tile .bar { height: 6px; border-radius: 6px; background: rgba(0,0,0,0.18); overflow: hidden; }
.tile.pink .bar, .tile.dark .bar { background: rgba(255,255,255,0.2); }
.tile .bar > i { display: block; height: 100%; background: currentColor; }
a.tile:hover { transform: translateY(-2px); transition: transform .15s ease; }
.tile .soon { position: absolute; top: 18px; right: 18px; }

/* ---- course ------------------------------------------------------------------- */
.page-head { display: grid; gap: 8px; margin-bottom: 28px; }
.page-head .display { font-size: clamp(30px, 4vw, 44px); }
.days { display: grid; gap: 20px; }
.day { border-radius: var(--radius-card); background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.day-head { display: flex; align-items: center; gap: 14px; padding: 18px 22px; flex-wrap: wrap; }
.day-head .badge { font-family: var(--font-display); font-weight: 700; font-size: 15px; padding: 4px 12px 2px; border-radius: 30px; color: var(--black); }
.badge.mint { background: var(--grad-mint); } .badge.pink { background: var(--grad-pink); color: var(--white) !important; }
.badge.yellow { background: var(--grad-yellow); } .badge.dark { background: var(--white); }
.day-head h2 { margin: 0; font-size: 19px; color: var(--white); font-weight: 700; flex: 1; min-width: 0; }
.day-head .count { color: var(--muted); font-size: 14px; }
.lessons { list-style: none; margin: 0; padding: 0 10px 10px; display: grid; gap: 2px; }
.lessons a { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; text-decoration: none; color: var(--text); }
.lessons a:hover { background: var(--surface-2); }
.check { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--line-strong); flex: none; display: grid; place-items: center; font-size: 13px; color: var(--black); }
.check.on { background: var(--mint); border-color: var(--mint); }
.kind { margin-left: auto; font-size: 12px; color: var(--muted); border: 1px solid var(--line-strong); border-radius: 30px; padding: 1px 9px; white-space: nowrap; }
.kind.practice { color: var(--mint); border-color: rgba(33, 221, 169, 0.45); }

/* ---- lesson / reference reading pages ---------------------------------------------------- */
.reader { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 32px; align-items: start; }
.sidenav { position: sticky; top: 84px; display: grid; gap: 2px; font-size: 14px; }
.sidenav .group { color: var(--muted); font-size: 12px; letter-spacing: 0.06em; margin: 14px 10px 4px; }
.sidenav a { color: var(--soft); text-decoration: none; padding: 7px 10px; border-radius: 10px; display: flex; gap: 8px; align-items: center; }
.sidenav a:hover { background: var(--surface-2); color: var(--white); }
.sidenav a[aria-current="page"] { background: var(--surface-2); color: var(--white); }
.sidenav .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-strong); flex: none; }
.sidenav .dot.on { background: var(--mint); }
article.doc { min-width: 0; max-width: 760px; }
.doc-head { display: grid; gap: 10px; margin-bottom: 24px; }
.doc-head .display { font-size: clamp(28px, 3.6vw, 40px); }
.doc-meta { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 13px; }
.prose { font-size: 17px; line-height: 1.75; color: var(--text); }
.prose h2 { font-size: 24px; color: var(--white); margin: 44px 0 12px; padding-top: 8px; border-top: 1px solid var(--line); }
.prose h3 { font-size: 19px; color: var(--white); margin: 30px 0 8px; }
.prose h4 { font-size: 16px; color: var(--soft); margin: 22px 0 6px; }
.prose p, .prose ul, .prose ol { margin: 0 0 14px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose strong { color: var(--white); }
.prose code { font-family: var(--font-mono); font-size: 0.88em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 6px; }
.prose pre { background: var(--black); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; overflow-x: auto; font-size: 14px; line-height: 1.6; }
.prose pre code { background: none; border: 0; padding: 0; }
.prose blockquote { margin: 0 0 16px; padding: 12px 16px; border-left: 3px solid var(--cyan); background: var(--surface); border-radius: 0 12px 12px 0; color: var(--soft); }
.prose blockquote p:last-child { margin: 0; }
.prose table { border-collapse: collapse; width: 100%; font-size: 15px; margin: 0 0 18px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 8px 12px; text-align: left; vertical-align: top; }
.prose th { background: var(--surface-2); color: var(--white); font-weight: 600; white-space: nowrap; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
.prose a { overflow-wrap: anywhere; }
.doc-foot { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }
.doc-foot .pager { display: flex; gap: 8px; }

/* ---- practice lesson → workbench link ---------------------------------------------------- */
.practice-open { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 24px; }
.practice-open p { margin: 0; flex: 1 1 280px; }

/* ---- workbench (spec 4A) ------------------------------------------------------------------ */
/* The workbench fills the viewport under the top bar and uses the full width (no reading container). */
body.fill { height: 100vh; height: 100dvh; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
body.fill .topbar { flex: none; }
body.fill main { flex: 1 1 auto; min-height: 0; width: 100%; max-width: none; margin: 0; padding: 0; }
.wb { height: 100%; display: flex; flex-direction: column; }
.wb-bar {
  flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px;
  padding: 8px var(--gutter-r) 8px var(--gutter); border-bottom: 1px solid var(--line); background: var(--black);
}
.wb-days { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 3px; }
.wb-day {
  display: inline-flex; align-items: baseline; gap: 6px; border: 0; background: none; cursor: pointer;
  color: var(--soft); padding: 5px 14px 4px; border-radius: var(--radius-pill); font-family: var(--font-display); font-weight: 700; font-size: 14px;
  white-space: nowrap;
}
.wb-day:hover { color: var(--white); }
.wb-day[aria-pressed="true"] { background: var(--white); color: var(--black); }
.wb-build { font-family: var(--font-body); font-weight: 500; font-size: 12px; opacity: 0.75; }
.wb-hint { margin: 0; font-size: 13px; color: var(--muted); flex: 1 1 260px; }

.wb-stage { flex: 1 1 auto; min-height: 0; display: flex; overflow: hidden; }
.wb-game { flex: 1 1 0; min-width: 360px; display: flex; flex-direction: column; align-items: center; padding-top: 12px; }
.wb-framebox { flex: 1 1 auto; min-height: 0; width: 100%; container-type: size; display: grid; place-items: center; }
/* Portrait ~9:19.5, as tall as the column allows. Never narrower than 360px (on short screens the ratio
   widens a little instead), and never taller than 19.5/9 of its width. */
.wb-frame {
  display: block; border: 0; border-radius: 14px; background: var(--black);
  width: min(100cqw, max(360px, 100cqh * 9 / 19.5)); height: min(100cqh, 100cqw * 19.5 / 9);
  box-shadow: 0 0 0 1px var(--line);
}
.wb-frame-empty { display: grid; align-content: center; justify-items: center; gap: 6px; padding: 24px; text-align: center; color: var(--muted); font-size: 14px; }
.wb-frame-empty p { margin: 0; }
.wb-frame-empty .wb-frame-title { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--text); }
.wb-game-foot { flex: none; height: 30px; display: flex; align-items: center; }
.wb-newtab { font-size: 13px; color: var(--soft); text-decoration: none; }
.wb-newtab:hover { color: var(--white); text-decoration: underline; }

/* Vertical tab handles on the game column's edges. They are flex items, so they never sit on the game. */
.wb-handle {
  flex: none; align-self: center; width: var(--wb-handle-w); padding: 16px 0; cursor: pointer;
  writing-mode: vertical-rl; font-family: var(--font-display); font-weight: 700; font-size: 13px; letter-spacing: 0.06em;
  color: var(--soft); background: var(--surface-2); border: 1px solid var(--line-strong);
}
.wb-handle.left { border-left: 0; border-radius: 0 12px 12px 0; }
.wb-handle.right { border-right: 0; border-radius: 12px 0 0 12px; }
.wb-handle:hover { color: var(--white); background: var(--card); }
.wb-handle[aria-expanded="true"] { color: var(--black); background: var(--white); border-color: var(--white); }

/* Drawers animate their width (push, not overlay); the inner box keeps its width, so content slides in from the edge. */
.wb-drawer { flex: none; width: 0; height: 100%; overflow: hidden; display: flex; transition: width var(--wb-slide) ease; }
.wb-drawer.open { width: var(--w); }
.wb-drawer.left { justify-content: flex-end; }
.wb-drawer.right { justify-content: flex-start; }
.wb-stage.no-anim .wb-drawer, .wb-stage.resizing .wb-drawer { transition: none; }
.wb-stage.resizing { cursor: col-resize; user-select: none; }
.wb-stage.resizing iframe { pointer-events: none; }
.wb-drawer-inner { position: relative; flex: none; width: var(--w); height: 100%; padding: 12px; }
.wb-drawer.left .wb-drawer-inner { padding-right: 14px; }
.wb-drawer.right .wb-drawer-inner { padding-left: 14px; }
.wb-drawer-body { height: 100%; min-height: 0; }
.wb-grip { position: absolute; top: 0; bottom: 0; width: 12px; cursor: col-resize; touch-action: none; }
.wb-drawer.left .wb-grip { right: 0; }
.wb-drawer.right .wb-grip { left: 0; }
.wb-grip::after { content: ''; position: absolute; top: 50%; left: 5px; width: 2px; height: 44px; margin-top: -22px; border-radius: 2px; background: var(--line-strong); }
.wb-grip:hover::after, .wb-grip:focus-visible::after, .wb-stage.resizing .wb-grip::after { background: var(--cyan); }
.wb-soon { height: 100%; display: grid; align-content: center; justify-items: center; gap: 6px; text-align: center; border: 1px dashed var(--line-strong); border-radius: 16px; color: var(--muted); padding: 24px; }
.wb-soon h2 { margin: 0; font-size: 17px; color: var(--text); }
.wb-soon p { margin: 0; font-size: 14px; }

/* ---- paper work surface + play memo ------------------------------------------------------- */
.paper { background: var(--paper); color: var(--ink); color-scheme: light; border-radius: 14px; }
.paper :focus-visible { outline-color: var(--ink-accent); }
.memo { height: 100%; display: flex; flex-direction: column; overflow: hidden; }
.memo-head { flex: none; display: flex; align-items: flex-start; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; padding: 14px 16px 10px; border-bottom: 1px solid var(--paper-line); }
.memo-title { flex: 1 1 240px; min-width: 0; }
.memo-head h2 { margin: 0; font-size: 17px; color: var(--ink); }
.memo-hint { margin: 2px 0 0; font-size: 13px; line-height: 1.5; color: var(--ink-muted); }
.memo-status { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink-muted); white-space: nowrap; padding-top: 3px; }
.memo-status[data-state="ok"] .memo-status-text { color: var(--ink-ok); }
.memo-status[data-state="error"] .memo-status-text { color: var(--ink-bad); font-weight: 600; }
.memo-retry { border: 1px solid var(--paper-line-strong); background: var(--paper); color: var(--ink); border-radius: 30px; padding: 1px 10px; font-size: 12px; cursor: pointer; }
.memo-retry:hover { background: var(--paper-hover); }
.memo-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.memo-lines { list-style: none; margin: 0; padding: 6px 0; }
.memo-line { display: grid; grid-template-columns: 52px minmax(0, 1fr) 32px; align-items: start; gap: 4px; padding: 0 8px 0 12px; }
.memo-line:hover, .memo-line:focus-within { background: var(--paper-2); }
.memo-time { padding: 7px 0 0; font-size: 12px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.memo-text, .memo-input {
  display: block; width: 100%; resize: none; overflow: hidden; border: 1px solid transparent; border-radius: 8px;
  background: transparent; color: var(--ink); font-size: 15px; line-height: 1.5; padding: 4px 8px; min-height: 32px;
  field-sizing: content;
}
.memo-text:hover { border-color: var(--paper-line); }
.memo-text:focus, .memo-input:focus { outline: none; border-color: var(--ink-accent); box-shadow: 0 0 0 3px var(--ink-focus); background: var(--paper); }
.memo-del {
  width: 28px; height: 28px; margin-top: 2px; border: 0; border-radius: 8px; background: none; cursor: pointer;
  color: var(--ink-muted); font-size: 18px; line-height: 1; opacity: 0;
}
.memo-line:hover .memo-del, .memo-line:focus-within .memo-del, .memo-del:focus-visible { opacity: 1; }
.memo-del:hover { background: var(--paper-hover); color: var(--ink-bad); }
@media (hover: none) { .memo-del { opacity: 1; } }
.memo-day { margin: 10px 12px 4px; font-size: 12px; font-weight: 600; color: var(--ink-muted); border-bottom: 1px solid var(--paper-line); padding-bottom: 2px; }
.memo-empty { padding: 18px 16px; font-size: 14px; color: var(--ink-muted); }
.memo-note { flex: none; margin: 0; padding: 8px 16px; font-size: 13px; color: var(--ink-bad); border-top: 1px solid var(--paper-line); }
.memo-compose { flex: none; display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--paper-line); background: var(--paper-2); }
.memo-input { flex: 1; background: var(--paper); border-color: var(--paper-line-strong); padding: 7px 10px; min-height: 38px; max-height: 160px; overflow-y: auto; }
.memo-input::placeholder { color: var(--ink-muted); }
.memo-input:disabled { background: var(--paper-2); }
.memo-add { flex: none; height: 38px; padding: 0 14px; border: 0; border-radius: 10px; background: var(--ink); color: var(--paper); font-weight: 600; font-size: 14px; cursor: pointer; }
.memo-add:disabled { opacity: 0.4; cursor: default; }

/* ---- lead feedback (shared by the trainee's memo panel and the lead's detail page) ---------- */
.memo-feedback { flex: none; max-height: 40%; overflow-y: auto; overscroll-behavior: contain; border-top: 1px solid var(--paper-line); }
.memo-feedback > summary { cursor: pointer; padding: 8px 16px; font-size: 13px; font-weight: 600; color: var(--ink-accent); background: var(--paper-2); position: sticky; top: 0; }
.fb-list { list-style: none; margin: 0; padding: 0; }
.fb-item { padding: 10px 16px; border-bottom: 1px solid var(--paper-line); }
.fb-item:last-child { border-bottom: 0; }
.fb-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 10px; font-size: 12px; color: var(--ink-muted); }
.fb-meta strong { color: var(--ink); font-size: 13px; }
.fb-meta time { font-variant-numeric: tabular-nums; }
.fb-body { margin: 4px 0 0; font-size: 14px; line-height: 1.55; color: var(--ink); white-space: pre-wrap; overflow-wrap: anywhere; }
.fb-none { padding: 14px 16px; font-size: 14px; color: var(--ink-muted); }
.fb-del { margin-left: auto; border: 0; background: none; cursor: pointer; font-size: 12px; color: var(--ink-muted); padding: 2px 6px; border-radius: 6px; text-decoration: underline; text-underline-offset: 2px; }
.fb-del:hover { color: var(--ink-bad); background: var(--paper-hover); }
.fb-form { padding: 12px 16px; border-top: 1px solid var(--paper-line); background: var(--paper-2); display: grid; gap: 8px; }
.fb-input {
  display: block; width: 100%; resize: vertical; min-height: 78px; max-height: 320px;
  border: 1px solid var(--paper-line-strong); border-radius: 8px; background: var(--paper); color: var(--ink);
  font-size: 15px; line-height: 1.5; padding: 8px 10px;
}
.fb-input::placeholder { color: var(--ink-muted); }
.fb-input:focus { outline: none; border-color: var(--ink-accent); box-shadow: 0 0 0 3px var(--ink-focus); }
.fb-form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fb-counter { font-size: 12px; color: var(--ink-muted); }
.fb-needmemo { color: var(--ink-muted); }

/* ---- lead dashboard ---------------------------------------------------------------------- */
.dim { color: var(--muted); }
.lead-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.lead-notice { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.lead-notice p { margin: 0; }
.lead-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.lead-stats:empty { display: none; }
.stat { display: grid; gap: 2px; padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-family: var(--font-display); font-weight: 700; font-size: 24px; color: var(--white); }
.lead-table { padding: 8px 14px; }
.lead-empty p { margin: 0; color: var(--soft); }
.sort-btn { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; cursor: pointer; font: inherit; color: inherit; }
.sort-btn:hover { color: var(--white); }
th[aria-sort="ascending"] .sort-btn, th[aria-sort="descending"] .sort-btn { color: var(--white); }
.sort-mark { display: inline-block; min-width: 1em; font-size: 10px; }
.lead-row { cursor: pointer; }
.lead-row:hover td { background: var(--surface-2); }
.lead-name { color: var(--white); font-weight: 600; text-decoration: none; }
.lead-name:hover { text-decoration: underline; text-underline-offset: 3px; }
.lead-progress { display: flex; align-items: center; gap: 10px; }
.lead-progress .progress { width: 110px; flex: none; }
.dchips { display: flex; gap: 6px; }
.dchip {
  display: inline-flex; align-items: center; font-size: 12px; line-height: 1.5; padding: 1px 9px; border-radius: 30px;
  border: 1px solid var(--line-strong); color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.dchip.part { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
.dchip.done { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 55%, transparent); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.lead-back { justify-self: start; font-size: 14px; color: var(--soft); text-decoration: none; }
.lead-back:hover { color: var(--white); text-decoration: underline; text-underline-offset: 3px; }
.lead-detail { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; align-items: start; }
.lead-col { display: grid; gap: 20px; min-width: 0; align-content: start; }
.lead-col .panel { margin: 0; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.panel-head h2 { margin-bottom: 0; }
.lead-day { margin-top: 18px; }
.lead-day-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; }
.lead-day-head h3 { margin: 0; font-size: 15px; color: var(--white); }
.lead-lessons { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 2px; }
.lead-lessons li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 6px 2px; font-size: 14px; }
.lead-lesson-title { min-width: 0; }
.lead-lessons .dim { font-size: 13px; }
.lead-score { background: none; border-style: dashed; border-color: var(--line-strong); }
.lead-score h2 { margin-bottom: 6px; }
.memo-ro { overflow: hidden; }
.memo-ro-scroll { max-height: min(60vh, 480px); overflow-y: auto; overscroll-behavior: contain; }
.memo-line.ro { grid-template-columns: 52px minmax(0, 1fr); padding: 0 16px 0 12px; }
.memo-line.ro:hover { background: none; }
.memo-ro-text { margin: 0; padding: 4px 8px; font-size: 15px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 980px) {
  .lead-detail { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .lead-table { padding: 4px 8px; }
}

/* Narrow screens: the game on top, the open drawer stacked below it (one at a time), the page scrolls. */
@media (max-width: 899px) {
  body.fill { height: auto; min-height: 100vh; display: block; overflow: visible; }
  .wb { height: auto; }
  .wb-stage { flex-direction: column; overflow: visible; }
  .wb-game { order: 1; flex: none; min-width: 0; height: min(calc(100svh - 150px), 760px); }
  .wb-handle.left { order: 2; } .wb-drawer.left { order: 3; }
  .wb-handle.right { order: 4; } .wb-drawer.right { order: 5; }
  .wb-handle { writing-mode: horizontal-tb; align-self: stretch; width: auto; padding: 10px 16px; margin: 6px var(--gutter-r) 0 var(--gutter); border: 1px solid var(--line-strong); border-radius: 12px; }
  .wb-handle.left, .wb-handle.right { border: 1px solid var(--line-strong); border-radius: 12px; }
  .wb-drawer, .wb-drawer.open { width: auto; height: auto; transition: none; }
  .wb-drawer:not(.open) { display: none; }
  .wb-drawer-inner { width: 100%; height: min(70svh, 560px); padding: 8px var(--gutter-r) 8px var(--gutter); }
  .wb-drawer.left .wb-drawer-inner, .wb-drawer.right .wb-drawer-inner { padding: 8px var(--gutter-r) 8px var(--gutter); }
  .wb-grip { display: none; }
  .wb-day { padding: 5px 10px 4px; }
}

/* ---- admin -------------------------------------------------------------------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 22px; margin-bottom: 20px; }
.panel h2 { margin: 0 0 14px; font-size: 19px; color: var(--white); }
.table-wrap { overflow-x: auto; }
table.data { border-collapse: collapse; width: 100%; font-size: 15px; }
table.data th, table.data td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.data th { color: var(--muted); font-weight: 500; font-size: 13px; }
.row-actions { display: flex; gap: 6px; }
.pill { font-size: 12px; border-radius: 30px; padding: 1px 9px; border: 1px solid var(--line-strong); color: var(--soft); }
.pill.pending { color: var(--warn); border-color: rgba(245,184,75,.5); }
.pill.active { color: var(--ok); border-color: rgba(60,207,122,.45); }
.pill.rejected { color: var(--bad); border-color: rgba(255,92,92,.45); }
.inline-form { display: flex; gap: 10px; align-items: end; flex-wrap: wrap; }
.inline-form .field { width: 180px; }

.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--white); color: var(--black); padding: 10px 18px; border-radius: 30px; font-size: 15px; z-index: 40; box-shadow: 0 8px 30px rgba(0,0,0,.4); }

@media (max-width: 980px) {
  .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reader { grid-template-columns: minmax(0, 1fr); }
  .sidenav { position: static; display: none; }
}
@media (max-width: 640px) {
  .bento { grid-template-columns: minmax(0, 1fr); }
  .tile.hero, .tile.wide { grid-column: auto; grid-row: auto; min-height: 260px; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .nav { order: 3; flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
.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; }
