/* Project Whiteroom — "Vibrant" white theme.
   Blue = in progress / passed. Orange = Mogul, streak, "now". Pale = not started. */
:root {
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  --blue: #2340FF;
  --blue-deep: #1828B4;
  --blue-tint: #EDF0FF;
  --orange: #FF5A1F;
  --orange-ink: #B83A0B;
  --orange-tint: #FFF0E8;
  --ink: #0E0F12;
  --text: #23252B;
  --muted: #5E636D;
  --faint: #8E949E;
  --line: #E3E6EC;
  --canvas: #EEF0F4;
  --white: #FFFFFF;
  --alert: #C8312B;
  --alert-tint: #FDEEEE;
  --ok: #0E7C5A;
  --ok-tint: #E8F6F0;

  --font: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --jp: "Noto Sans JP", sans-serif;
  --r-sm: 10px; --r-md: 14px; --r-lg: 18px;
  --side: 248px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--canvas); color: var(--text);
  font-family: var(--font); font-size: 15px; line-height: 1.5;
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; color: var(--ink); line-height: 1.2; }
h1 { font-size: 30px; font-weight: 900; letter-spacing: -0.02em; }
h2 { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
h3 { font-size: 16px; font-weight: 800; }
p { margin: 0 0 12px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--blue) 45%, transparent); outline-offset: 2px; }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.label { font-size: 13px; font-weight: 600; color: var(--muted); }
.link { color: var(--blue); font-weight: 700; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ================= shell ================= */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--white); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding-bottom: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 22px; }
.brand-name { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name b { font-weight: 900; font-size: 16px; letter-spacing: 0.14em; color: var(--ink); }
.brand-name span { font-family: var(--jp); font-size: 9px; letter-spacing: 0.28em; color: var(--faint); }
.class-card { margin: 0 14px; padding: 14px; border-radius: var(--r-md); background: var(--blue-tint); display: flex; align-items: center; gap: 12px; }
.class-glyph { width: 44px; height: 44px; flex: 0 0 auto; border-radius: var(--r-sm); background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 22px; }
.class-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.class-row { display: flex; justify-content: space-between; gap: 8px; }
.class-row b { color: var(--ink); font-weight: 800; }
.class-row span { font-size: 12px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 18px 14px 8px; }
.nav a {
  display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 12px; border-radius: var(--r-sm);
  color: var(--muted); font-weight: 600;
}
.nav a:hover { background: #F2F4F8; color: var(--ink); }
.nav a[aria-current="page"] { background: var(--ink); color: #fff; font-weight: 700; }
.nav svg { flex: 0 0 auto; }
.nav-sep { height: 1px; background: var(--line); margin: 10px 4px; }
.side-board { margin: 8px 14px 0; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-md); display: flex; flex-direction: column; gap: 8px; }
.side-board:empty { display: none; }
.side-board-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; }
.side-board-head b { color: var(--ink); }
.mini-board { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.mini-board li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 5px 0; }
.mini-board li.you { margin: 0 -8px; padding: 5px 8px; border-radius: 8px; background: var(--blue-tint); font-weight: 700; }
.mini-board li.gap { display: block; text-align: center; color: var(--faint); padding: 0; line-height: 1; }
.mini-board .r { color: var(--faint); font-weight: 700; }
.mini-board .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.mini-board .x { color: var(--muted); }
.signout {
  margin: auto 14px 0; height: 44px; border: 0; border-radius: var(--r-sm); background: transparent; cursor: pointer;
  color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 12px; padding: 0 12px;
}
.signout:hover { background: #F2F4F8; color: var(--ink); }
.mogul-tag { display: inline-block; font-size: 10px; font-weight: 800; letter-spacing: 0.04em; padding: 1px 6px; border-radius: 999px; background: var(--orange); color: #000; vertical-align: 1px; margin-left: 6px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 32px; background: var(--white); border-bottom: 1px solid var(--line); }
.search { position: relative; flex: 0 1 380px; min-width: 200px; }
.search label { display: flex; align-items: center; gap: 10px; height: 42px; padding: 0 14px; border-radius: var(--r-sm); background: var(--canvas); color: var(--faint); }
.search input { flex: 1 1 auto; min-width: 0; border: 0; outline: none; background: transparent; color: var(--text); }
.search-results { position: absolute; top: 48px; left: 0; right: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: 0 16px 40px rgba(14, 15, 18, 0.12); padding: 6px; display: none; max-height: 380px; overflow-y: auto; }
.search-results.open { display: block; }
.search-results a { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 10px; align-items: center; padding: 8px; border-radius: var(--r-sm); }
.search-results a:hover, .search-results a.active { background: var(--canvas); }
.search-results .sr-cover { width: 36px; height: 36px; border-radius: 8px; overflow: hidden; }
.search-results .sr-cover .cover { height: 36px; padding: 4px; }
.search-results .sr-cover .cover * { font-size: 0 !important; }
.search-results small { display: block; color: var(--muted); font-size: 12px; }
.search-empty { padding: 10px; color: var(--muted); font-size: 14px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 14px; border-radius: var(--r-sm); font-weight: 800; white-space: nowrap; }
.chip.streak { background: var(--orange-tint); color: var(--orange-ink); }
.chip.streak.cold { background: var(--canvas); color: var(--muted); }
.user-chip { display: inline-flex; align-items: center; gap: 10px; height: 42px; padding: 0 14px 0 6px; border-radius: var(--r-sm); border: 1px solid var(--line); font-weight: 700; color: var(--ink); }
.user-chip:hover { border-color: var(--ink); }
.room-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--blue); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }

.page { padding: 28px 32px 56px; max-width: 1180px; width: 100%; display: flex; flex-direction: column; gap: 22px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head p { margin: 6px 0 0; color: var(--muted); max-width: 68ch; }
.crumbs { font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--blue); }
.crumbs a:hover { text-decoration: underline; }

/* ================= building blocks ================= */
.card { background: var(--white); border-radius: var(--r-lg); }
.pad { padding: 20px; }
.pad-lg { padding: 24px; }
.bordered { border: 1px solid var(--line); }
.row { display: flex; flex-wrap: wrap; gap: 18px; align-items: stretch; }
.grow-2 { flex: 2 1 520px; min-width: 0; }
.grow-1 { flex: 1 1 300px; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.between { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 20px;
  border-radius: var(--r-sm); border: 1px solid transparent; background: var(--blue); color: #fff; font-weight: 700;
  cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--blue-deep); }
.btn.dark { background: var(--ink); }
.btn.dark:hover { background: #2A2C33; }
.btn.orange { background: var(--orange); color: #000; }
.btn.orange:hover { background: #E84B12; }
.btn.ghost { background: var(--white); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--ink); background: var(--white); }
.btn.danger { background: var(--white); color: var(--alert); border-color: #F0C7C5; }
.btn.danger:hover { border-color: var(--alert); }
.btn.small { height: 36px; padding: 0 14px; font-size: 14px; }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

.bar { display: block; height: 8px; border-radius: 4px; background: var(--canvas); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 4px; background: var(--blue); }
.bar.thin { height: 6px; }
.bar.orange > span { background: var(--orange); }
.bar.ink > span { background: var(--ink); }
.bar.on-white { background: #fff; }

.stat { padding: 12px 14px; border-radius: 12px; background: var(--canvas); }
.stat b { display: block; font-weight: 900; font-size: 22px; color: var(--ink); line-height: 1.25; }
.stat span { font-size: 13px; color: var(--muted); }
.stat.orange { background: var(--orange-tint); }
.stat.orange b { color: var(--orange-ink); }
.stat.blue { background: var(--blue-tint); }
.stat.blue b { color: var(--blue); }
.stats-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stats-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }

.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 6px; font-size: 12px; font-weight: 800; white-space: nowrap; background: var(--canvas); color: var(--muted); }
.tag.blue { background: var(--blue-tint); color: var(--blue); }
.tag.orange { background: var(--orange); color: #000; }
.tag.ink { background: var(--ink); color: #fff; }
.tag.outline { background: transparent; border: 1px dashed #C9CCD3; }
.tag.miss { background: var(--alert-tint); color: var(--alert); }
.tag.ok { background: var(--ok-tint); color: var(--ok); }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; padding: 6px; border-radius: 12px; background: var(--canvas); }
.seg button, .seg a {
  height: 42px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; padding: 0 10px;
}
.seg [aria-selected="true"], .seg [aria-current="page"] { background: #fff; color: var(--ink); font-weight: 800; box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg .count { font-size: 12px; font-weight: 700; color: var(--faint); }

.notice { padding: 12px 16px; border-radius: 12px; background: var(--blue-tint); color: var(--text); font-size: 15px; }
.notice.alert { background: var(--alert-tint); color: var(--alert); }
.notice a { color: var(--blue); font-weight: 700; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

/* ================= covers (typographic module art) ================= */
.cover { position: relative; height: 140px; padding: 14px 16px; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; font-weight: 900; letter-spacing: -0.03em; line-height: 0.9; }
.cover.blue { background: var(--blue); color: #fff; }
.cover.orange { background: var(--orange); color: #000; }
.cover.pale { background: var(--blue-tint); color: var(--blue); }
.cover.grey { background: #E7E9EE; color: #A3A8B1; }
.cover .c-stack { display: flex; flex-direction: column; gap: 2px; }
.cover .c-stack span:nth-child(1) { font-size: 22px; opacity: .45; }
.cover .c-stack span:nth-child(2) { font-size: 30px; opacity: .7; }
.cover .c-stack span:nth-child(3) { font-size: 40px; }
.cover .c-big { font-size: 60px; line-height: .85; letter-spacing: -0.04em; }
.cover .c-big.long { font-size: 40px; }
.cover .c-pre { font-size: 16px; font-weight: 700; opacity: .8; letter-spacing: 0; margin-bottom: 2px; }
.cover .c-num { font-size: 72px; line-height: .85; letter-spacing: -0.05em; }
.cover .c-el { width: 84px; height: 92px; border: 2px solid currentColor; border-radius: 6px; background: #fff; color: var(--blue); padding: 8px; display: flex; flex-direction: column; justify-content: space-between; letter-spacing: -0.03em; }
.cover.blue .c-el { color: var(--blue); }
.cover.orange .c-el { color: var(--orange-ink); border-color: #000; }
.cover.grey .c-el { color: #A3A8B1; background: #F3F4F7; }
.cover .c-el small { font-size: 12px; font-weight: 800; letter-spacing: 0; }
.cover .c-el b { font-size: 34px; line-height: 1; }
.cover .c-flags { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; align-content: end; height: 100%; }
.cover .c-flags > span { height: 34px; display: flex; }
.cover .c-flags > span.v { flex-direction: column; }
.cover .c-flags i { flex: 1; display: block; }
.cover .c-flags i.a { background: #fff; }
.cover .c-flags i.b { background: var(--blue-deep); }
.cover .c-flags i.c { background: var(--blue-tint); }
.cover.orange .c-flags i.b { background: #000; }
.cover.pale .c-flags i.a { background: #fff; } .cover.pale .c-flags i.b { background: var(--blue); }
.cover.grey .c-flags i.a { background: #fff; } .cover.grey .c-flags i.b, .cover.grey .c-flags i.c { background: #CDD1D8; }
.cover .c-flag-dot { align-items: center; justify-content: center; background: var(--blue-deep); }
.cover .c-flag-dot::after { content: ""; width: 14px; height: 14px; border-radius: 50%; background: #fff; }
.cover .c-badge { position: absolute; top: 12px; left: 14px; font-size: 11px; font-weight: 800; letter-spacing: 0.04em; padding: 2px 8px; border-radius: 999px; line-height: 1.5; }
.cover.orange .c-badge { background: #000; color: var(--orange); }
.cover.blue .c-badge { background: #fff; color: var(--blue); }
.cover.grey .c-badge, .cover.pale .c-badge { background: #fff; color: var(--muted); }
.cover.tall { height: 200px; }
.cover.tall .c-big { font-size: 96px; }
.cover.tall .c-num { font-size: 110px; }
.cover.tall .c-stack span:nth-child(3) { font-size: 60px; }
.cover.tall .c-stack span:nth-child(2) { font-size: 42px; }
.cover.tall .c-stack span:nth-child(1) { font-size: 30px; }

/* module cards */
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.mod-card { display: flex; flex-direction: column; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); background: #fff; transition: transform .18s ease, box-shadow .18s ease; }
.mod-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(20, 30, 60, .12); }
.mod-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1 1 auto; }
.mod-path { font-size: 13px; font-weight: 700; color: var(--muted); }
.mod-title { font-weight: 800; font-size: 17px; line-height: 1.2; color: var(--ink); }
.mod-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--muted); margin-top: auto; }
.mod-foot b { color: var(--ink); }
.mod-foot b.orange { color: var(--orange-ink); }
.mod-card.locked { opacity: .75; }
.mod-card.locked:hover { transform: none; box-shadow: none; }

/* ================= dashboard ================= */
.profile-head { display: flex; flex-wrap: wrap; align-items: center; gap: 20px; }
.avatar-xl { width: 84px; height: 84px; border-radius: 20px; background: var(--blue); display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.profile-name { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.profile-name h1 { font-size: 34px; line-height: 1; overflow-wrap: anywhere; }
.profile-name h1 span { color: var(--faint); font-weight: 700; }
.profile-head .btn { margin-left: auto; }
.hero-card { display: flex; flex-direction: column; overflow: hidden; }
.hero-art { height: 250px; padding: 22px; display: flex; flex-direction: column; justify-content: space-between; color: #fff; }
.hero-art.blue { background: var(--blue); }
.hero-art.ink { background: var(--ink); }
.hero-art .hero-kicker { font-weight: 700; font-size: 14px; opacity: .85; }
.ladder { display: flex; align-items: flex-end; justify-content: space-between; gap: 6px; }
.ladder span { font-weight: 900; line-height: .8; letter-spacing: -0.04em; font-size: 30px; opacity: .3; }
.ladder span.past { opacity: .55; }
.ladder span.now { font-size: 132px; opacity: 1; }
.t0-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.t0-tile { aspect-ratio: 1; border-radius: var(--r-sm); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: rgba(255,255,255,.1); color: #fff; }
.t0-tile b { font-weight: 900; font-size: 18px; }
.t0-tile span { font-size: 10px; font-weight: 700; opacity: .85; }
.t0-tile.passed { background: var(--blue); }
.t0-tile.mogul { background: var(--orange); color: #000; }
.streak-num { font-weight: 900; font-size: 40px; line-height: 1; letter-spacing: -0.03em; color: var(--orange); }
.streak-num.cold { color: var(--faint); }
.week-strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); }
.week-strip > span { display: flex; flex-direction: column; gap: 4px; }
.week-strip i { height: 8px; border-radius: 4px; background: var(--line); display: block; }
.week-strip i.on { background: var(--orange); }
.week-strip .today { color: var(--ink); }
.xp-bars { flex: 1 1 auto; min-height: 90px; display: flex; align-items: flex-end; gap: 3px; }
.xp-bars i { flex: 1 1 0; min-width: 0; border-radius: 3px 3px 0 0; background: var(--blue); display: block; }
.xp-bars i.zero { background: var(--line); }
.xp-bars i.today { background: var(--orange); }

/* ================= paths ================= */
.path-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.path-card { display: flex; flex-direction: column; overflow: hidden; border-radius: var(--r-lg); background: #fff; border: 1px solid var(--line); transition: transform .18s ease, box-shadow .18s ease; }
.path-card:hover { transform: translateY(-3px); box-shadow: 0 14px 30px rgba(20, 30, 60, .12); }
.path-strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); height: 96px; }
.path-strip .cover { height: 96px; padding: 8px 10px; }
.path-strip .cover .c-big { font-size: 30px; }
.path-strip .cover .c-num { font-size: 36px; }
.path-strip .cover .c-stack span { font-size: 14px !important; }
.path-strip .cover .c-el { width: 46px; height: 52px; padding: 4px; }
.path-strip .cover .c-el b { font-size: 18px; }
.path-strip .cover .c-el small { font-size: 9px; }
.path-strip .cover .c-pre { font-size: 10px; }
.path-strip .cover .c-flags > span { height: 14px; }
.path-strip .cover .c-flags { gap: 3px; }
.path-strip .cover .c-badge { display: none; }
.path-card-body { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.path-card-body h2 { font-size: 22px; }

.tier-block { display: flex; flex-direction: column; gap: 14px; }
.tier-head { display: flex; align-items: center; gap: 12px; }
.tier-num { width: 40px; height: 40px; border-radius: var(--r-sm); background: var(--ink); color: #fff; font-weight: 900; font-size: 18px; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; }
.tier-num.done { background: var(--blue); }
.tier-head b { display: block; color: var(--ink); font-weight: 800; }
.tier-head span { font-size: 13px; color: var(--muted); }
.tier-line { width: 2px; height: 22px; background: var(--line); margin-left: 19px; }
.tier-line.lit { background: var(--blue); }
.req { font-size: 12px; color: var(--muted); }

/* role cards */
.role-card { overflow: hidden; }
.role-top { padding: 22px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.role-pct { font-weight: 900; font-size: 44px; line-height: 1; letter-spacing: -0.03em; color: var(--blue); }

/* ================= module page ================= */
.mod-hero { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 0; overflow: hidden; }
.mod-hero .cover { height: 100%; min-height: 200px; }
.mod-hero-body { padding: 24px; display: flex; flex-direction: column; gap: 10px; }
.mod-hero-body h1 { font-size: 32px; }
.mod-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tabs-wrap { position: sticky; top: 71px; z-index: 5; background: var(--canvas); padding: 4px 0; }

.lesson { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.toc { position: sticky; top: 140px; display: flex; flex-direction: column; gap: 2px; padding: 14px; }
.toc a { padding: 8px 10px; border-radius: 8px; color: var(--muted); font-size: 14px; font-weight: 600; }
.toc a:hover { background: var(--canvas); color: var(--ink); }
.prose { padding: 8px 32px 32px; max-width: 100%; }
.prose section { padding-top: 24px; max-width: 72ch; }
.prose section + section { border-top: 1px solid var(--line); margin-top: 24px; }
.prose h2 { font-size: 24px; font-weight: 900; margin-bottom: 14px; scroll-margin-top: 150px; }
.prose ul { padding-left: 1.2em; margin: 0 0 14px; }
.prose li { margin-bottom: 6px; }
.prose strong { color: var(--ink); }
.callout { padding: 14px 16px; margin: 0 0 14px; border-radius: 12px; background: var(--blue-tint); }
.callout .label { display: block; color: var(--blue); font-weight: 800; margin-bottom: 2px; }
.chain { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 10px; font-size: 14px; }
.chain span { padding: 4px 12px; border-radius: 999px; background: var(--canvas); font-weight: 600; }
.chain i { font-style: normal; color: var(--faint); }
.verse { padding: 16px 20px; margin: 0 0 14px; border-radius: 12px; background: var(--canvas); color: var(--ink); font-weight: 500; }
.verse div { line-height: 1.75; }
.table-wrap { overflow-x: auto; margin: 0 0 14px; border: 1px solid var(--line); border-radius: 12px; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font-weight: 700; font-size: 13px; color: var(--muted); padding: 10px 14px; background: #F8F9FB; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
.flaggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 14px; margin-bottom: 14px; }
.flaggrid div { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.flaggrid .f { font-size: 1.6rem; line-height: 1; }
.lesson-end { margin-top: 28px; padding: 20px; border-radius: var(--r-md); background: var(--canvas); }

/* flashcards: blocks */
.block-list { display: flex; flex-direction: column; gap: 8px; }
.block-row { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.block-row.current { border-color: var(--orange); box-shadow: 0 0 0 1px var(--orange); }
.block-row.locked { background: #F8F9FB; color: var(--faint); }
.block-num { width: 52px; height: 52px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 20px; background: var(--canvas); color: var(--faint); position: relative; }
.block-row.done .block-num { background: var(--blue); color: #fff; }
.block-row.current .block-num { background: var(--orange); color: #000; }
.block-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.block-main b { color: var(--ink); }
.block-row.locked .block-main b { color: var(--faint); }
.block-preview { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.block-side { display: flex; align-items: center; gap: 10px; }
.mix-pick { width: 18px; height: 18px; margin: 0; accent-color: var(--blue); cursor: pointer; }
.block-pick { display: flex; align-items: center; gap: 10px; }
.mix-bar { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--blue-tint); margin-bottom: 4px; }
.mix-bar b { color: var(--blue); }
.stage-label { display: flex; justify-content: space-between; font-size: 13px; font-weight: 700; color: var(--muted); margin: 10px 2px 2px; }
.boxes { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.boxes > div { padding: 12px; border-radius: 12px; background: var(--canvas); }
.boxes .v { font-weight: 900; font-size: 22px; color: var(--ink); }
.boxes > div:last-child { background: var(--blue-tint); }
.boxes > div:last-child .v { color: var(--blue); }

.card-stage { max-width: 680px; margin: 0 auto; width: 100%; }
.quiz-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.pips { display: inline-flex; gap: 3px; }
.pips i { width: 14px; height: 6px; border-radius: 3px; background: var(--line); display: block; }
.pips i.on { background: var(--blue); }
.pips i.miss { background: var(--orange); }
.pips.bar { display: flex; width: 100%; height: auto; background: none; margin: 0 0 14px; }
.pips.bar i { flex: 1 1 0; min-width: 0; height: 6px; }
.fcard {
  width: 100%; min-height: 300px; border: 0; border-radius: var(--r-lg); background: #fff; position: relative; cursor: pointer;
  display: grid; place-items: center; text-align: center; padding: 40px 28px; box-shadow: 0 1px 0 var(--line), 0 18px 40px rgba(20, 30, 60, .08);
}
.fcard .corner { position: absolute; top: 16px; left: 18px; }
.fcard-front { font-size: 28px; font-weight: 800; line-height: 1.25; color: var(--ink); letter-spacing: -0.01em; }
.fcard-front.flag { font-size: 120px; line-height: 1; }
.fcard-back[hidden] { display: none; }
.fcard-back { display: block; margin-top: 22px; padding-top: 22px; border-top: 2px solid var(--blue-tint); font-size: 18px; color: var(--muted); }
.fcard-back strong { color: var(--blue); font-weight: 800; font-size: 22px; }
.grade-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.grade-btns .btn { height: 56px; font-size: 16px; }
.grade-btns .btn.miss { background: #fff; color: var(--orange-ink); border-color: #F7C9B5; }
.grade-btns .btn.miss:hover { border-color: var(--orange); }
.grade-btns .mono { opacity: .6; font-size: 13px; }

.quiz { max-width: 760px; margin: 0 auto; width: 100%; }
.meter { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--blue); border-radius: 3px; }
.timer { font-weight: 900; font-size: 18px; color: var(--ink); }
.timer.low { color: var(--orange-ink); }
.q-display { font-size: 110px; line-height: 1; margin: 22px 0 0; text-align: center; }
.q-prompt { font-size: 28px; font-weight: 900; line-height: 1.25; letter-spacing: -0.015em; margin: 26px 0 20px; color: var(--ink); }
.opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.opt {
  display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; align-items: center; text-align: left; min-height: 60px;
  padding: 12px 16px; border-radius: var(--r-md); border: 2px solid var(--line); background: #fff; cursor: pointer; font-weight: 700; color: var(--ink);
}
.opt:hover:not([disabled]) { border-color: var(--blue); }
.opt .k { width: 26px; height: 26px; border-radius: 7px; background: var(--canvas); color: var(--muted); font-size: 13px; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.opt.flag .t { font-size: 44px; line-height: 1; }
.opt.right { border-color: var(--blue); background: var(--blue-tint); }
.opt.right .k { background: var(--blue); color: #fff; }
.opt.wrong { border-color: var(--orange); background: var(--orange-tint); }
.opt.wrong .k { background: var(--orange); color: #000; }
.opt[disabled] { cursor: default; }
.typed { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
.typed input { height: 60px; border: 2px solid var(--line); border-radius: var(--r-md); padding: 0 18px; font-size: 20px; font-weight: 700; background: #fff; min-width: 0; }
.typed input:focus { outline: none; border-color: var(--blue); }
.typed .btn { height: 60px; }
.feedback { margin-top: 18px; padding: 16px 18px; border-radius: var(--r-md); background: var(--blue-tint); }
.feedback.wrong { background: var(--orange-tint); }
.feedback .verdict { font-weight: 900; font-size: 17px; color: var(--blue); margin-bottom: 2px; }
.feedback.wrong .verdict { color: var(--orange-ink); }
.feedback p { margin: 0; color: var(--text); }
.result-score { font-weight: 900; font-size: clamp(72px, 12vw, 128px); line-height: .9; letter-spacing: -0.05em; color: var(--blue); }
.result-score.mogul { color: var(--orange); }
.xp-lines { border-radius: var(--r-md); background: var(--canvas); padding: 4px 16px; max-width: 440px; }
.xp-lines > div { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-weight: 600; }
.xp-lines > div:last-child { border-bottom: 0; }
.xp-lines b { color: var(--blue); }
.miss-list { display: flex; flex-direction: column; gap: 8px; }
.miss-list > div { padding: 12px 14px; border-radius: 12px; background: var(--canvas); display: grid; gap: 2px; }

/* ================= rankings ================= */
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: end; }
.podium > div { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; min-width: 0; }
.podium .pav { width: 56px; height: 56px; border-radius: 14px; background: var(--canvas); color: var(--ink); display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 20px; }
.podium .first .pav { width: 72px; height: 72px; background: var(--blue); color: #fff; font-size: 26px; }
.podium .pname { font-weight: 800; color: var(--ink); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .pxp { font-size: 13px; color: var(--muted); }
.podium .step { width: 100%; border-radius: 12px 12px 0 0; background: var(--canvas); display: flex; align-items: flex-start; justify-content: center; padding-top: 10px; font-weight: 900; font-size: 26px; color: var(--muted); }
.podium .first .step { background: var(--blue); color: #fff; height: 120px; font-size: 40px; }
.podium .second .step { height: 84px; }
.podium .third .step { height: 60px; }
table.ranks tr.you td { background: var(--blue-tint); font-weight: 700; }
.rank-av { width: 32px; height: 32px; border-radius: 8px; background: var(--canvas); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: 12px; color: var(--muted); vertical-align: middle; margin-right: 10px; }
tr.you .rank-av { background: var(--blue); color: #fff; }

/* ================= badges ================= */
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.badge { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-md); background: var(--canvas); }
.badge .seal { width: 52px; height: 52px; flex: 0 0 auto; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 13px; letter-spacing: -0.02em; background: var(--blue); color: #fff; }
.badge.mogul { background: var(--orange-tint); }
.badge.mogul .seal { background: var(--orange); color: #000; }
.badge.locked { background: transparent; border: 1px dashed #D3D6DC; }
.badge.locked .seal { background: transparent; border: 2px dashed #C9CCD3; color: var(--faint); }
.badge-text { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.badge-text b { color: var(--ink); }
.badge.locked .badge-text b { color: var(--muted); }
.badge-text span { font-size: 12px; color: var(--muted); }

/* ================= forms ================= */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 700; color: var(--muted); }
.field input, .field select { height: 46px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 14px; background: #fff; }
.field input:focus, .field select:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-tint); }
select.inline { height: 38px; border: 1px solid var(--line); border-radius: var(--r-sm); padding: 0 10px; background: #fff; }

/* ================= sign in ================= */
body.signed-out .app { grid-template-columns: 1fr; }
body.signed-out .side, body.signed-out .topbar { display: none; }
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }
.auth-art { background: var(--blue); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 32px; overflow: hidden; }
.auth-art .brand-name b { color: #fff; font-size: 20px; }
.auth-art .brand-name span { color: rgba(255,255,255,.6); font-size: 11px; }
.auth-ladder { display: flex; align-items: flex-end; gap: 14px; font-weight: 900; line-height: .8; letter-spacing: -0.04em; }
.auth-ladder span { font-size: 48px; opacity: .3; }
.auth-ladder span.big { font-size: clamp(120px, 16vw, 220px); opacity: 1; }
.auth-art p { font-size: 20px; font-weight: 600; max-width: 30ch; margin: 0; opacity: .92; }
.auth-panel-wrap { display: flex; align-items: center; justify-content: center; padding: 32px; background: #fff; }
.auth-panel { width: 100%; max-width: 400px; }
.auth-panel h1 { margin-bottom: 6px; }
.auth-panel .seg { margin: 24px 0; }
.auth-error { color: var(--alert); font-size: 14px; font-weight: 600; min-height: 1.5em; margin-bottom: 8px; }

/* ================= moments (level up, badge unlock) ================= */
.moment { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(238, 240, 244, .86); backdrop-filter: blur(6px); animation: m-fade .2s ease-out; }
.moment-card { width: 100%; max-width: 520px; border-radius: 24px; overflow: hidden; background: #fff; box-shadow: 0 30px 80px rgba(14, 15, 18, .25); animation: m-pop .45s cubic-bezier(.2, 1.4, .4, 1); text-align: center; }
.moment-art { padding: 36px 24px 28px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.moment-art.blue { background: var(--blue); color: #fff; }
.moment-art.orange { background: var(--orange); color: #000; }
.moment-kicker { font-weight: 800; font-size: 14px; letter-spacing: .06em; opacity: .85; }
.moment-letter { font-weight: 900; font-size: 160px; line-height: .8; letter-spacing: -0.05em; }
.moment-seal { width: 140px; height: 140px; border-radius: 50%; background: #fff; color: var(--blue); display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 34px; letter-spacing: -0.03em; box-shadow: 0 0 0 10px rgba(255,255,255,.25); }
.moment-art.orange .moment-seal { background: #000; color: var(--orange); box-shadow: 0 0 0 10px rgba(0,0,0,.12); }
.moment-body { padding: 22px 28px 28px; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.moment-body h2 { font-size: 28px; font-weight: 900; }
.moment-body p { color: var(--muted); margin: 0 0 10px; }
@keyframes m-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes m-pop { from { opacity: 0; transform: scale(.85) translateY(20px); } to { opacity: 1; transform: none; } }

/* toasts + boot */
.toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 40; }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 12px; font-weight: 600; font-size: 14px; min-width: 220px; max-width: 360px; box-shadow: 0 12px 30px rgba(0,0,0,.18); animation: m-pop .25s ease-out; }
.boot { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; }
.boot .scan { width: 160px; height: 4px; border-radius: 2px; background: var(--line); position: relative; overflow: hidden; }
.boot .scan::after { content: ""; position: absolute; inset: 0 auto 0 0; width: 40%; background: var(--blue); border-radius: 2px; animation: scan 1s ease-in-out infinite; }
@keyframes scan { from { transform: translateX(-100%); } to { transform: translateX(260%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ================= responsive ================= */
@media (max-width: 1080px) {
  .lesson { grid-template-columns: minmax(0, 1fr); }
  .toc { position: static; flex-direction: row; flex-wrap: wrap; }
  .boxes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: static; height: auto; overflow: visible; border-right: 0; border-bottom: 1px solid var(--line); padding-bottom: 0; }
  .brand { padding: 14px 16px 6px; }
  .class-card, .side-board, .nav-sep, .signout { display: none; }
  .nav { flex-direction: row; overflow-x: auto; padding: 8px 12px 12px; gap: 6px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: 0 0 auto; height: 40px; }
  .topbar { position: static; padding: 12px 16px; }
  .search { flex: 1 1 100%; order: 2; }
  .top-right { margin-left: 0; width: 100%; justify-content: space-between; }
  .page { padding: 20px 16px 48px; }
  .profile-head .btn { margin-left: 0; }
  .mod-hero { grid-template-columns: minmax(0, 1fr); }
  .mod-hero .cover { min-height: 160px; height: 160px; }
  .tabs-wrap { top: 0; }
  .prose { padding: 4px 16px 24px; }
  .opts { grid-template-columns: minmax(0, 1fr); }
  .q-prompt { font-size: 22px; }
  .fcard-front { font-size: 22px; }
  .ladder span.now { font-size: 104px; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-art { padding: 28px 24px; min-height: 260px; }
  .auth-ladder span.big { font-size: 120px; }
  .block-row { grid-template-columns: 44px minmax(0, 1fr); }
  .block-num { width: 44px; height: 44px; font-size: 17px; }
  .block-side { grid-column: 1 / -1; justify-content: flex-end; }
  .toasts { left: 16px; right: 16px; }
}
