/* =====================================================================
   App shell v3: floating sidebar + top bar + content panel, near-black theme.
   Loaded after style.css and app.css; overrides their layout rules.
   ===================================================================== */

:root,
:root[data-theme="dark"] {
  --bg: #08080a;
  --surface: #0f0f11;
  --bg-2: #121215;
  --panel: #151518;
  --panel-2: #1c1c20;
  --border: #222226;
  --border-strong: #303036;
  --text: #ececee;
  --muted: #8b8b94;
  --accent: #4f8cff;
  --accent-2: #4fb8c2;
  --accent-soft: rgba(79, 140, 255, 0.13);
  --gold: #f2b84b;
  --code-bg: #0e0e11;
  --shadow: none;
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.55);
  --lvl-basic: #34d399;
  --lvl-core: #fbbf24;
  --lvl-pro: #f87171;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #eceef2;
  --surface: #ffffff;
  --bg-2: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #f2f3f6;
  --border: #e3e5ea;
  --border-strong: #cfd3da;
  --text: #121318;
  --muted: #646a77;
  --accent: #2f6fed;
  --accent-soft: #e8f0fe;
  --gold: #b7791f;
  --code-bg: #f6f7f9;
  --shadow: none;
  --shadow-lg: 0 16px 40px rgba(16, 24, 40, 0.14);
  --lvl-basic: #059669;
  --lvl-core: #b45309;
  --lvl-pro: #dc2626;
  color-scheme: light;
}

html {
  scroll-padding-top: 150px;
}
body {
  background: var(--bg);
}
a {
  color: var(--accent);
}

/* ------------------------------------------------------------ shell grid */
.shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
  min-height: 100vh;
  transition: grid-template-columns 0.2s ease;
}
body.side-collapsed .shell {
  grid-template-columns: 66px minmax(0, 1fr);
}
.main-col {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#main {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  min-height: calc(100vh - 88px);
}
.page {
  /* every page fills the content area (capped only on very wide monitors) */
  max-width: 1720px;
  padding: 30px 32px 48px;
}
.page.wide {
  max-width: 1720px;
}
.page.with-rail {
  max-width: 1720px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 24px;
  align-items: start;
}
.rail-main {
  min-width: 0;
}
.rail {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.rail-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
}
.rail-card h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 12px;
  font-size: 16px;
  font-weight: 600;
}
.rail-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.card {
  background: var(--panel);
  border-color: var(--border);
  box-shadow: none;
}

/* ------------------------------------------------------------ sidebar */
.sidebar {
  position: sticky;
  top: 10px;
  height: calc(100vh - 20px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 0;
  overflow: hidden;
  z-index: 40;
}
body.ws-mode .sidebar {
  display: flex;
}
.side-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 14px 12px 12px 16px;
  border-bottom: 1px solid var(--border);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  min-width: 0;
}
.brand-mark {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  font: 800 11.5px Inter, sans-serif;
  letter-spacing: 0.02em;
}
.brand-name {
  font: 500 16px Inter, sans-serif;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.brand-name b {
  font-weight: 700;
  color: var(--accent);
}
.icon-btn {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover {
  background: var(--panel-2);
  color: var(--text);
}
.side-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 6px 10px;
  scrollbar-width: thin;
}
.nav-group {
  border-bottom: 1px solid var(--border);
  padding: 4px 0 8px;
}
.nav-group:last-child {
  border-bottom: 0;
}
.nav-group-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 8px;
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 12.5px Inter, sans-serif;
  cursor: pointer;
}
.nav-group-head > span {
  display: flex;
  align-items: center;
  gap: 6px;
}
.nav-group-head:hover {
  color: var(--text);
}
.chev {
  transition: transform 0.18s ease;
}
.nav-group:not(.open) .nav-group-head .chev {
  transform: rotate(-90deg);
}
.nav-group:not(.open) .nav-group-body {
  display: none;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 10px;
  border: 0;
  background: none;
  color: color-mix(in srgb, var(--text) 88%, var(--muted));
  text-decoration: none;
  font: 500 14.5px Inter, sans-serif;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.nav-item .ico {
  flex: none;
  color: var(--muted);
}
.nav-item:hover {
  background: var(--panel-2);
  color: var(--text);
}
.nav-item.active {
  background: var(--panel-2);
  color: var(--text);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px var(--border);
}
.nav-item.active .ico,
.nav-item.active-parent .ico {
  color: var(--text);
}
.nav-item.active-parent {
  color: var(--text);
}
.nav-tree .tree-chev {
  margin-left: auto;
  color: var(--muted);
}
.nav-tree:not(.open) .tree-chev {
  transform: rotate(-90deg);
}
.nav-tree-body {
  display: none;
  margin: 2px 0 6px 20px;
  padding-left: 12px;
  border-left: 1px solid var(--border-strong);
}
.nav-tree.open .nav-tree-body {
  display: block;
}
.nav-leaf {
  display: block;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}
.nav-leaf:hover {
  color: var(--text);
  background: var(--panel-2);
}
.nav-leaf.active {
  color: var(--text);
  font-weight: 600;
}
.nav-part summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
}
.nav-part summary::-webkit-details-marker {
  display: none;
}
.nav-part summary:hover {
  background: var(--panel-2);
}
.nav-part[open] summary .chev {
  transform: rotate(90deg);
}
.nav-count {
  margin-left: auto;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--panel-2);
  padding: 1px 7px;
  border-radius: 99px;
}
.nav-group-head .nav-count {
  margin-left: 0;
}
.nav-sub {
  padding: 2px 0 6px 4px;
}
.nav-ch {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13.5px;
}
.nav-ch:hover {
  background: var(--panel-2);
  color: var(--text);
}
.nav-ch.active {
  background: var(--panel-2);
  color: var(--text);
  font-weight: 600;
}
.ch-dot {
  --p: 0;
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text);
  background: radial-gradient(closest-side, var(--surface) 76%, transparent 79% 100%), conic-gradient(var(--accent) calc(var(--p) * 1%), var(--border-strong) 0);
}
.ch-dot.complete {
  background: var(--ok);
  color: #fff;
}
.nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-empty {
  margin: 4px 10px 6px;
  color: var(--muted);
  font-size: 12.5px;
}
.side-bottom {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px 12px;
  border-top: 1px solid var(--border);
}
.side-login {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 8px;
  padding: 11px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: var(--panel-2);
  color: var(--text);
  font: 600 14px Inter, sans-serif;
  cursor: pointer;
}
.side-login:hover {
  background: color-mix(in srgb, var(--text) 8%, var(--panel-2));
}
.side-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 6px 8px 8px;
  border-radius: 12px;
  background: var(--panel-2);
}
.side-user .nav-label {
  flex: 1;
  display: flex;
  flex-direction: column;
}
.side-user .nav-label b {
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-user .nav-label span {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
}
.avatar {
  display: inline-grid;
  place-items: center;
  flex: none;
  text-decoration: none;
}
.avatar.sm {
  width: 30px;
  height: 30px;
  font-size: 12px;
}

/* collapsed icon rail */
body.side-collapsed .brand,
body.side-collapsed .nav-label,
body.side-collapsed .nav-group-head,
body.side-collapsed .tree-chev,
body.side-collapsed .nav-tree-body,
body.side-collapsed .nav-group[data-group="chapters"],
body.side-collapsed .nav-group[data-group="spaces"],
body.side-collapsed .side-user .icon-btn {
  display: none !important;
}
body.side-collapsed .side-top {
  justify-content: center;
  padding: 14px 0 12px;
}
body.side-collapsed .side-scroll {
  padding: 6px 8px;
}
body.side-collapsed .nav-group {
  border: 0;
}
body.side-collapsed .nav-item,
body.side-collapsed .side-login {
  justify-content: center;
  padding: 10px 0;
}
body.side-collapsed .side-bottom {
  padding: 8px;
}
body.side-collapsed .side-user {
  justify-content: center;
  padding: 6px;
  background: none;
}

/* ------------------------------------------------------------ top bar */
.topbar {
  position: sticky;
  top: 10px;
  z-index: 30;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 0 18px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  border-radius: 16px;
}
/* covers the gap above the floating bar while content scrolls underneath */
.topbar::before {
  content: "";
  position: absolute;
  left: -11px;
  right: -11px;
  top: -11px;
  height: 10px;
  background: var(--bg);
}
.menu-btn {
  display: none;
}
.crumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  font-size: 14px;
  color: var(--muted);
}
.crumbs a {
  color: var(--muted);
  text-decoration: none;
}
.crumbs a:hover {
  color: var(--text);
}
.crumbs .cur {
  color: var(--text);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
}
.crumbs .sep {
  opacity: 0.45;
}
.top-right {
  display: flex;
  align-items: center;
  gap: 6px;
}
.top-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  min-width: 210px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-2);
  color: var(--muted);
  font: 500 13.5px Inter, sans-serif;
  cursor: pointer;
  margin-right: 4px;
}
.top-search:hover {
  border-color: var(--border-strong);
  color: var(--text);
}
.top-search kbd {
  margin-left: auto;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 5px;
  border: 1px solid var(--border);
}
.top-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 13.5px;
}
a.top-pill:hover {
  background: var(--panel-2);
}
.top-pill b {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.top-pill .ico {
  color: var(--muted);
}
.top-pill.flame .ico {
  color: var(--muted);
}
.top-pill.flame.lit .ico {
  color: #f97316;
}
.top-pill.coin .ico {
  color: var(--gold);
}
.top-pill.due .ico {
  color: var(--warn);
}
.top-cta {
  background: color-mix(in srgb, var(--gold) 10%, var(--panel)) !important;
  border-color: color-mix(in srgb, var(--gold) 35%, var(--border)) !important;
  color: var(--gold) !important;
  margin-left: 4px;
}
.top-cta:hover {
  background: color-mix(in srgb, var(--gold) 16%, var(--panel)) !important;
}
.top-right .avatar {
  margin-left: 4px;
}

/* ------------------------------------------------------------ sheet header (hub, practice) */
.sheet-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 28px;
  align-items: start;
  margin-bottom: 26px;
}
.sheet-intro h1 {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 2px 0 8px;
}
.sheet-intro p {
  margin: 0;
  font-size: 15.5px;
  max-width: 640px;
}
.sheet-intro p a {
  white-space: nowrap;
}
.stat-line {
  display: flex;
  flex-wrap: wrap;
  margin-top: 18px;
  row-gap: 8px;
}
.stat-line span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 18px;
  border-left: 1px solid var(--border-strong);
  color: var(--muted);
  font-size: 15px;
}
.stat-line span:first-child {
  padding-left: 0;
  border-left: 0;
}
.stat-line b {
  color: var(--text);
  font-weight: 600;
}
.progress-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
}
.pc-label {
  font: 600 12px Inter, sans-serif;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.pc-value {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 10px 0 12px;
}
.pc-value b {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
}
.pc-value span {
  color: var(--muted);
  font-size: 14px;
}
.pc-track {
  height: 6px;
  border-radius: 99px;
  background: var(--panel-2);
  overflow: hidden;
}
.pc-track.thin {
  height: 4px;
  margin: 10px 0 12px;
}
.pc-track span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
}
.pc-next {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 13.5px;
  color: var(--accent);
  text-decoration: none;
}
.pc-next:hover {
  text-decoration: underline;
}
.pc-lock {
  margin: 0 0 6px;
  color: var(--muted);
}
.pc-split {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 12px;
}
.pc-split > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.pc-split b {
  font-size: 15px;
  font-weight: 600;
}
.mini-track {
  display: block;
  height: 5px;
  border-radius: 99px;
  background: var(--panel-2);
  overflow: hidden;
  margin: 0;
}
.mini-track span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
}
.mini-track.basic span {
  background: var(--lvl-basic);
}
.mini-track.core span {
  background: var(--lvl-core);
}
.mini-track.pro span {
  background: var(--lvl-pro);
}
.stat .mini-track span {
  background: var(--ok);
}
.block-title {
  font-size: 19px;
  font-weight: 600;
  margin: 6px 0 14px;
}

/* learning modes strip */
.modes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  margin-bottom: 30px;
}
.mode {
  padding: 20px 22px;
}
.mode + .mode {
  border-left: 1px solid var(--border);
}
.mode-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.mode h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
}
.mode p {
  margin: 0;
  font-size: 14.5px;
}
.btn.accent-outline {
  border-color: var(--accent);
  color: var(--accent);
  background: transparent;
}

/* modules accordion */
.modules-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--border);
  padding-top: 22px;
  scroll-margin-top: 90px;
}
.mh-actions {
  display: flex;
  gap: 4px;
}
.module {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-bottom: 12px;
  overflow: hidden;
}
.module summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  cursor: pointer;
}
.module summary::-webkit-details-marker {
  display: none;
}
.module summary:hover {
  background: color-mix(in srgb, var(--text) 2%, transparent);
}
.module[open] summary {
  border-bottom: 1px solid var(--border);
}
.module[open] summary .chev {
  transform: rotate(180deg);
}
.mod-title {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.mod-title b {
  font-size: 16px;
  font-weight: 600;
}
.mod-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 190px;
}
.mod-progress .mini-track {
  flex: 1;
}
.lt-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.6fr) 72px minmax(150px, 1.4fr) 110px 104px;
  gap: 14px;
  align-items: center;
  padding: 12px 18px;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.lt-row:last-child {
  border-bottom: 0;
}
a.lt-row:hover {
  background: color-mix(in srgb, var(--text) 3%, transparent);
}
.lt-head {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 500;
  padding-top: 10px;
  padding-bottom: 10px;
  background: var(--bg-2);
}
.lt-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14.5px;
  font-weight: 500;
  min-width: 0;
}
.lt-name > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.status {
  flex: none;
  display: inline-flex;
  color: var(--border-strong);
}
.status.done,
.status.solved {
  color: var(--ok);
}
.status.part {
  color: var(--accent);
}
.status.missed {
  color: var(--bad);
}
.pill-lvl {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 6px;
}
.pill-lvl.basic {
  color: var(--lvl-basic);
  background: color-mix(in srgb, var(--lvl-basic) 13%, transparent);
}
.pill-lvl.core {
  color: var(--lvl-core);
  background: color-mix(in srgb, var(--lvl-core) 13%, transparent);
}
.pill-lvl.pro {
  color: var(--lvl-pro);
  background: color-mix(in srgb, var(--lvl-pro) 13%, transparent);
}
.lt-topics {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
}
.topic {
  display: inline-block;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
}
.more {
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}
.lt-prog {
  display: flex;
  align-items: center;
  gap: 8px;
}
.lt-prog .mini-track {
  flex: 1;
}
.lt-res {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12.5px;
}

/* rail widgets */
.planner-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 4px 4px;
  text-align: center;
}
.planner-empty > .ico {
  width: 46px;
  height: 46px;
  padding: 11px;
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--text);
}
.planner-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13.5px;
  color: var(--muted);
}
.planner-stats span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.planner-stats b {
  color: var(--text);
}
.plan-list {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.plan-list a {
  display: flex;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
}
.plan-list a:hover {
  background: var(--panel-2);
}
.plan-list a > span:last-child {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13.5px;
}
.plan-dot {
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--accent);
}
.plan-dot.review {
  background: var(--warn);
}
.plan-dot.weak {
  background: var(--bad);
}
.plan-dot.design {
  background: var(--ok);
}
.promo {
  background: color-mix(in srgb, var(--accent) 5%, var(--panel));
}
.promo h3 {
  margin: 12px 0 6px;
  font-size: 18px;
}
.promo p {
  margin: 0;
  font-size: 14px;
}
.promo-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 14px;
}
.promo-list span {
  font-size: 12.5px;
  padding: 4px 9px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.study-steps {
  margin: 0;
  padding-left: 18px;
  font-size: 13.5px;
  color: var(--muted);
}
.study-steps li {
  margin: 6px 0;
}
.study-steps b {
  color: var(--text);
  font-weight: 600;
}

/* ------------------------------------------------------------ practice: question bank */
.seg-group {
  display: inline-flex;
  flex-wrap: wrap;
  margin-top: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
}
.seg-group a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  color: var(--text);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
}
.seg-group a + a {
  border-left: 1px solid var(--border);
}
.seg-group a:hover {
  background: var(--panel-2);
}
.count-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--warn);
  color: #111;
}
.bank-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.bank-toolbar select {
  width: auto;
  padding: 8px 10px;
  font-size: 13.5px;
  border-radius: 10px;
  background: var(--panel);
}
.search-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 230px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  color: var(--muted);
}
.search-field input {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 9px 0 !important;
  font-size: 14px !important;
}
.q-table {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
}
.qt-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px 108px 200px;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 13px 18px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: none;
  color: var(--text);
  font: 500 14.5px Inter, sans-serif;
  text-align: left;
  cursor: pointer;
}
.qt-body .qt-row:last-child {
  border-bottom: 0;
}
.qt-body .qt-row:hover {
  background: color-mix(in srgb, var(--text) 3%, transparent);
}
.qt-head {
  cursor: default;
  color: var(--muted);
  font-size: 13px;
  background: var(--bg-2);
  padding-top: 11px;
  padding-bottom: 11px;
}
.qt-q {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.qt-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.due-tag,
.type-tag {
  flex: none;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
}
.due-tag {
  color: var(--warn);
  border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent);
}
.type-tag {
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
}
.qt-more {
  text-align: center;
  margin-top: 12px;
}
.qt-empty {
  padding: 10px;
}
.drill-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.drill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 6px 6px 6px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
}
.drill:hover {
  border-color: var(--border-strong);
}
.drill span {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drill b {
  font-size: 11.5px;
  padding: 1px 7px;
  border-radius: 6px;
  background: var(--border);
  color: var(--muted);
}

/* ------------------------------------------------------------ existing pages, retuned */
.toc {
  top: 78px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}
.page-head h1,
.dash-head h1,
.page h1 {
  font-weight: 700;
}
.problem-card,
.mode-card,
.stat,
.report-top,
.report-sec,
.module,
.ch-card {
  background: var(--panel);
}
.ws {
  height: calc(100vh - 90px);
  border-radius: 16px;
  overflow: hidden;
}
body.ws-mode #main {
  min-height: 0;
  overflow: hidden;
}
body.ws-mode main {
  height: auto;
}
.ws-head,
.ws-side {
  background: var(--surface);
}
.coach {
  top: 10px;
  bottom: 10px;
  right: 10px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.shortcuts td {
  padding: 7px 10px;
}
.shortcuts kbd {
  font-size: 12px;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--panel-2);
}

/* ------------------------------------------------------------ responsive */
@media (max-width: 1280px) {
  .page.with-rail {
    grid-template-columns: minmax(0, 1fr) 280px;
  }
  .lt-row {
    grid-template-columns: minmax(200px, 1.6fr) 72px minmax(120px, 1.2fr) 100px;
  }
  .lt-row > :nth-child(5) {
    display: none;
  }
}
@media (max-width: 1100px) {
  .page.with-rail {
    grid-template-columns: minmax(0, 1fr);
  }
  .rail {
    position: static;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  }
  .sheet-head {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
  .top-search {
    min-width: 0;
  }
  .top-search span,
  .top-search kbd {
    display: none;
  }
}
@media (max-width: 960px) {
  .shell,
  body.side-collapsed .shell {
    grid-template-columns: minmax(0, 1fr);
    padding: 8px;
  }
  .sidebar {
    position: fixed;
    top: 8px;
    left: 8px;
    bottom: 8px;
    height: auto;
    width: 280px;
    max-width: calc(100vw - 16px);
    transform: translateX(calc(-100% - 20px));
    transition: transform 0.22s ease;
    z-index: 50;
  }
  body.nav-open .sidebar {
    transform: none;
  }
  body.side-collapsed .sidebar .nav-label,
  body.side-collapsed .sidebar .brand,
  body.side-collapsed .sidebar .nav-group-head,
  body.side-collapsed .nav-group[data-group="chapters"],
  body.side-collapsed .nav-group[data-group="spaces"] {
    display: revert !important;
  }
  .side-toggle {
    display: none;
  }
  body.nav-open .scrim {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 45;
  }
  .menu-btn {
    display: inline-grid;
  }
  .topbar {
    top: 8px;
    padding: 0 8px;
  }
  .sheet-head {
    grid-template-columns: minmax(0, 1fr);
  }
  .modes {
    grid-template-columns: minmax(0, 1fr);
  }
  .mode + .mode {
    border-left: 0;
    border-top: 1px solid var(--border);
  }
  .ws {
    height: auto;
  }
}
@media (max-width: 700px) {
  .page {
    padding: 20px 16px 40px;
  }
  .crumbs {
    display: none;
  }
  .top-pill:first-of-type {
    display: none;
  }
  .lt-row {
    grid-template-columns: minmax(0, 1fr) 72px;
  }
  .lt-row > :nth-child(3),
  .lt-row > :nth-child(4),
  .lt-row > :nth-child(5) {
    display: none;
  }
  .qt-row {
    grid-template-columns: minmax(0, 1fr) 70px;
  }
  .qt-row > :nth-child(3),
  .qt-row > :nth-child(4) {
    display: none;
  }
  .mod-progress {
    width: 110px;
  }
  .mod-title .muted {
    display: none;
  }
  .stat-line span {
    padding: 0 10px;
    font-size: 14px;
  }
  .search-field {
    min-width: 0;
    flex: 1 1 100%;
  }
  .sheet-intro h1 {
    font-size: 25px;
  }
}

/* polish */
#main:focus,
#main:focus-visible {
  outline: none;
  box-shadow: none;
}
.stat-line span {
  padding: 0 14px;
}
.bank-toolbar select[data-f="ch"] {
  max-width: 220px;
}
.lt-topics .topic {
  max-width: 100%;
}

/* interview simulator list */
.seg-group.static span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--muted);
}
.seg-group.static span + span {
  border-left: 1px solid var(--border);
}
.seg-group.static b {
  color: var(--text);
  font-weight: 600;
}
.pt-row {
  cursor: default;
}
.pt-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.pt-title b {
  font-weight: 600;
  overflow-wrap: anywhere;
}
.pt-title .small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pt-actions {
  display: flex;
  flex-wrap: wrap; /* never spill over the score column */
  gap: 6px;
  justify-content: flex-start; /* lines up under the Start heading */
  min-width: 0;
}
.design-mini {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.design-mini a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
}
.design-mini a:hover {
  background: var(--panel-2);
}
.dm-icon {
  font-size: 18px;
}
.dm-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.dm-text b {
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 700px) {
  .pt-actions {
    justify-content: flex-start;
  }
}

/* chapter header with progress card */
.ch-head.sheet-head {
  margin-bottom: 18px;
}
.ch-head .progress-card .pc-value b {
  font-size: 32px;
}
.shell {
  overflow-x: clip;
}
@media (max-width: 960px) {
  .topbar::before {
    left: -9px;
    right: -9px;
    top: -9px;
    height: 8px;
  }
}

/* roomier design canvas on laptop screens */
@media (max-width: 1500px) {
  .ws-body {
    grid-template-columns: 320px minmax(0, 1fr);
  }
  .pal-item {
    font-size: 12px;
    padding: 6px 7px;
  }
}

/* ------------------------------------------------------------ cheat sheet */
.cs-head {
  align-items: end;
}
.cs-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}
.cs-parts {
  flex-wrap: wrap;
  margin: 4px 0 20px;
}
.cs-grid {
  columns: 2 380px;
  column-gap: 16px;
}
.cs-card {
  break-inside: avoid;
  margin: 0 0 16px;
  padding: 18px 20px 8px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
}
.cs-card h2 {
  margin: 0 0 10px;
  font-size: 17px;
}
.cs-card h2 a,
.cs-sec h3 a {
  color: var(--text);
  text-decoration: none;
}
.cs-card h2 a:hover,
.cs-sec h3 a:hover {
  color: var(--accent);
}
.cs-sec {
  break-inside: avoid;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}
.cs-sec h3 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 650;
}
.cs-sec h3 a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cs-done {
  display: inline-flex;
  color: var(--ok);
}
.cs-sec ul {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
  line-height: 1.55;
  color: color-mix(in srgb, var(--text) 82%, var(--muted));
}
.cs-sec li + li {
  margin-top: 3px;
}
.cs-empty {
  text-align: center;
  padding: 40px 0;
}
@media (max-width: 760px) {
  .cs-actions {
    justify-content: stretch;
  }
  .cs-actions .search-field {
    flex: 1;
    min-width: 0;
  }
}

/* ------------------------------------------------------------ print (cheat sheet and reports) */
@media print {
  :root,
  :root[data-theme="dark"],
  :root[data-theme="light"] {
    --bg: #fff;
    --surface: #fff;
    --panel: #fff;
    --panel-2: #fff;
    --border: #d6d8de;
    --text: #111;
    --muted: #555;
    color-scheme: light;
  }
  .sidebar,
  .topbar,
  .scrim,
  .coach-fab,
  .cs-actions,
  .cs-parts,
  .skip-link {
    display: none !important;
  }
  .shell {
    display: block;
    padding: 0;
  }
  #main {
    border: 0;
    border-radius: 0;
    min-height: 0;
  }
  .page {
    padding: 0;
    max-width: none;
  }
  .cs-grid {
    columns: 2;
  }
  .cs-card {
    border-color: #d6d8de;
  }
  a {
    color: inherit !important;
  }
}

/* ------------------------------------------------------------ question of the day */
.qotd .q {
  padding: 0;
  border: 0;
  background: none;
}
.qotd .q-text {
  font-size: 14.5px;
  font-weight: 600;
  margin: 0 0 10px;
}
.qotd .q-opt {
  font-size: 13.5px;
  padding: 8px 10px;
}
.qotd .q-why {
  font-size: 13.5px;
}
.qotd-done {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.qotd-done > .ico {
  flex: none;
  color: var(--ok);
}
.qotd-done b {
  display: block;
}

/* ------------------------------------------------------------ brand */
.brand-mark {
  background: none;
  border-radius: 8px;
}
.brand-name {
  display: flex;
  flex-direction: column;
  font-size: 15px;
  font-weight: 650;
  line-height: 1.1;
}
.brand-name small {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 2px;
}

/* ------------------------------------------------------------ problem glyphs */
/* Start column: room for Guided, Interview and Voice side by side. Level and
   Best hold short things (a label, a score ring): centred under their headings. */
.pt-row {
  grid-template-columns: minmax(0, 1fr) 96px 72px 292px;
  column-gap: 20px;
}
.pt-row > :nth-child(2),
.pt-row > :nth-child(3) {
  display: flex;
  justify-content: center;
  text-align: center;
}
.pt-glyph {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
}
.ws-title .pt-glyph {
  width: 28px;
  height: 28px;
  border-radius: 8px;
}
.dm-icon {
  display: inline-flex;
  color: var(--muted);
}
.promo-list .glyph {
  vertical-align: -3px;
  color: var(--muted);
}
@media (max-width: 1280px) {
  .pt-row {
    grid-template-columns: minmax(0, 1fr) 92px 68px 280px;
    column-gap: 16px;
  }
  .pt-actions .btn.small {
    padding: 5px 9px;
  }
}
/* medium screens (sidebar and rail both open): Interview and Voice become icon
   buttons (their names show on hover), so problem names keep their room */
@media (min-width: 701px) and (max-width: 1440px) {
  .pt-row {
    grid-template-columns: minmax(0, 1fr) 92px 68px 176px;
    column-gap: 16px;
  }
  .pt-actions .pt-lbl {
    display: none;
  }
  .pt-actions .btn.small:has(.pt-lbl) {
    padding: 5px 8px;
  }
}
@media (max-width: 700px) {
  .pt-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .pt-row > :nth-child(2),
  .pt-row > :nth-child(3) {
    display: none;
  }
  /* the generic question-table rule hides the 4th cell; here it's the actions */
  .pt-row > .pt-actions {
    display: flex;
    justify-content: flex-start;
    padding-left: 72px;
  }
  .qt-head.pt-row > :nth-child(4) {
    display: none;
  }
}

/* ------------------------------------------------------------ line-icon accents (dashboard, chapter header) */
.ch-icon.ch-glyph {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 13px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0;
}
.m-icon {
  display: inline-flex;
  color: var(--muted);
}
.stat-icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 11px;
  background: var(--panel-2);
}
.stat-icon.s-flame {
  color: #fb923c;
  background: color-mix(in srgb, #fb923c 12%, transparent);
}
.stat-icon.s-xp {
  color: var(--gold);
  background: color-mix(in srgb, var(--gold) 12%, transparent);
}
.stat-icon.s-time {
  color: var(--accent-2);
  background: color-mix(in srgb, var(--accent-2) 12%, transparent);
}
.stat-icon.s-goal {
  color: var(--accent);
  background: var(--accent-soft);
}
.dl-glyph {
  display: inline-flex;
  color: var(--muted);
}
.badge-card .badge-ico {
  display: inline-flex;
  color: var(--muted);
}
.badge-card.earned .badge-ico {
  color: var(--gold);
}

/* ------------------------------------------------------------ interview goal */
.countdown {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--border));
  background: var(--accent-soft);
}
.countdown > b {
  font-size: 30px;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.countdown > span {
  display: flex;
  flex-direction: column;
  font-size: 14px;
}
.set-date {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 13.5px;
}
.goal-opts {
  display: grid;
  gap: 8px;
}
.goal-opt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 13px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.goal-opt:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 6%, var(--panel-2));
}
.goal-opt b {
  font-size: 15px;
}
.goal-opt span {
  font-size: 13px;
  color: var(--muted);
}
.goal-opt.loading {
  opacity: 0.6;
  pointer-events: none;
}
.goal-foot {
  display: flex;
  justify-content: center;
  margin-top: 12px;
}

.dash-countdown {
  color: var(--accent);
  font-weight: 600;
}

.help-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 14px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

/* ------------------------------------------------------------ Google sign-in */
.google-btn {
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: var(--panel);
}
.or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 6px;
  color: var(--muted);
  font-size: 12.5px;
}
.or::before,
.or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.auth-error {
  margin: 0 0 14px;
}

.toggle-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 12px 0;
  cursor: pointer;
}
.toggle-row + .toggle-row {
  border-top: 1px solid var(--border);
}
.toggle-row input {
  width: 18px;
  height: 18px;
  margin-top: 3px;
  accent-color: var(--accent);
  flex: none;
}
.toggle-row > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ------------------------------------------------------------ admin */
.adm-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.adm-head h1 {
  margin: 0 0 4px;
}
.adm-head p {
  margin: 0;
}
.adm-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel);
}
.kpi > span:first-child {
  font-size: 13px;
  color: var(--muted);
}
.kpi b {
  font-size: 26px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.adm-grid3,
.adm-grid2 {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}
.adm-grid3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.adm-grid2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.admin .card {
  margin: 0 0 16px;
}
.adm-grid2 .card,
.adm-grid3 .card {
  margin: 0;
}
.admin h3 {
  margin: 0 0 10px;
  font-size: 15px;
}
.adm-chart-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.adm-chart-head b {
  font-size: 20px;
  font-variant-numeric: tabular-nums;
}
.cols {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 120px;
  border-bottom: 1px solid var(--border);
}
.col {
  position: relative;
  flex: 1;
  height: 100%;
  display: flex;
  align-items: flex-end;
  outline: none;
}
.col i {
  display: block;
  width: 100%;
  min-height: 0;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
}
.col:hover i,
.col:focus-visible i {
  background: color-mix(in srgb, var(--accent) 75%, var(--text));
}
.col em {
  display: none;
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-style: normal;
  font-size: 12px;
  padding: 4px 8px;
  border-radius: 7px;
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  z-index: 2;
  pointer-events: none;
}
.col:hover em,
.col:focus-visible em {
  display: block;
}
.cols-axis {
  display: flex;
  gap: 2px;
  margin-top: 4px;
}
.cols-axis span {
  flex: 1;
  font-size: 10.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: visible;
}
.funnel {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}
.fn-row {
  display: grid;
  grid-template-columns: 170px 1fr 52px 40px;
  gap: 10px;
  align-items: center;
  font-size: 13.5px;
}
.fn-track {
  height: 10px;
  border-radius: 99px;
  background: var(--panel-2);
  overflow: hidden;
}
.fn-track i {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
}
.fn-row b {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.adm-table {
  width: 100%;
  font-size: 13.5px;
}
.adm-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.adm-errors {
  list-style: none;
  margin: 0;
  padding: 0;
}
.adm-errors li {
  border-top: 1px solid var(--border);
  padding: 8px 0;
}
.adm-errors summary {
  display: flex;
  gap: 8px;
  align-items: baseline;
  flex-wrap: wrap;
  cursor: pointer;
}
.adm-errors pre {
  white-space: pre-wrap;
  font-size: 12px;
  background: var(--code-bg);
  padding: 10px;
  border-radius: 8px;
  max-height: 240px;
  overflow: auto;
}
@media (max-width: 1100px) {
  .adm-grid3,
  .adm-grid2 {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 600px) {
  .fn-row {
    grid-template-columns: 1fr 52px 40px;
  }
  .fn-track {
    grid-column: 1 / -1;
    order: 2;
  }
}

/* ------------------------------------------------------------ leaderboard */
.lb-head h1 {
  margin: 0 0 4px;
}
.lb-join {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  border-color: color-mix(in srgb, var(--accent) 40%, var(--border));
  background: var(--accent-soft);
}
.lb-join > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.lb-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.lb-grid .card {
  margin: 0;
}
.lb-grid h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  margin: 0;
}
.board {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}
.board li {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  font-variant-numeric: tabular-nums;
}
.board li:nth-child(odd) {
  background: var(--panel-2);
}
.board li.you {
  outline: 1px solid var(--accent);
}
.rank {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}
.rank.r1 {
  background: color-mix(in srgb, var(--gold) 20%, transparent);
  color: var(--gold);
}
.rank.r2,
.rank.r3 {
  background: var(--border);
  color: var(--text);
}
.challenge .ch-title {
  display: flex;
  gap: 12px;
  align-items: center;
  margin: 6px 0 8px;
}
.challenge .ch-title h2 {
  margin: 0 0 4px;
}
.challenge h3 {
  margin: 20px 0 0;
  font-size: 15px;
}
@media (max-width: 900px) {
  .lb-grid {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------------------------------------ flashcards */
.fc-page {
  max-width: 820px;
}
.flash-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
}
.flash-head h1 {
  margin: 0 0 4px;
}
.flash-head p {
  margin: 0;
  max-width: 520px;
}
.flash-filter {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.flash-filter select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 8px 10px;
  max-width: 300px;
}
.flash-stats {
  display: flex;
  gap: 18px;
  margin: 18px 0 12px;
  color: var(--muted);
  font-size: 14px;
}
.flash-stats b {
  color: var(--text);
}
.flash-progress {
  height: 4px;
  border-radius: 9px;
  background: var(--panel-2);
  overflow: hidden;
  margin-bottom: 14px;
}
.flash-progress span {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width 0.3s;
}
.flash-card {
  display: block;
  width: 100%;
  min-height: 280px;
  padding: 34px 32px;
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s;
  animation: fadeUp 0.25s ease;
}
.flash-card:hover {
  border-color: var(--accent);
}
.flash-card.flipped {
  cursor: default;
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
}
.fc-face {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.fc-face b {
  font-size: 26px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.fc-meta {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
.fc-hint {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 24px;
  font-size: 13px;
  color: var(--muted);
}
.fc-face ul {
  margin: 0;
  padding-left: 20px;
  font-size: 16.5px;
  line-height: 1.6;
}
.fc-face li + li {
  margin-top: 6px;
}
.flash-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.flash-actions[hidden] {
  display: none;
}
.flash-actions .btn {
  justify-content: center;
}
.flash-actions .again {
  border-color: color-mix(in srgb, var(--bad) 40%, var(--border));
}
.flash-link {
  text-align: center;
  margin-top: 12px;
}
.flash-done {
  text-align: center;
  padding: 40px 24px;
}
.flash-done .ico {
  color: var(--ok);
}
.flash-keys {
  text-align: center;
}

/* ------------------------------------------------------------ certificate card */
.cert-row {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}
.cert-row > div:nth-child(2) {
  flex: 1;
  min-width: 240px;
}
.cert-row h2 {
  margin: 0 0 4px;
}
.cert-row p {
  margin: 0 0 8px;
}
.cert-ico {
  display: inline-grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  color: var(--gold);
  background: color-mix(in srgb, var(--gold) 13%, transparent);
  flex: none;
}

.pro-tag {
  flex: none;
}
.upgrade .tag {
  margin-top: 12px;
}

/* ------------------------------------------------------------ design workspace header on smaller screens */
@media (max-width: 1280px) {
  .ws-head .lbl {
    display: none;
  }
}
@media (max-width: 760px) {
  .ws-badge,
  .save-state span {
    display: none;
  }
}
/* phones and small tablets: the guide sits above the canvas (this must come
   after the laptop-width .ws-body rule above, which would otherwise win) */
@media (max-width: 960px) {
  .ws-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(480px, 1fr);
  }
  .ws-side {
    max-height: none;
    border-right: 0;
    border-bottom: 1px solid var(--border);
  }
  .g-body {
    overflow: visible;
  }
  .ws.no-side .ws-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(480px, 1fr);
  }
  .ws-canvas {
    min-height: 480px;
  }
  .ws-title .pt-glyph {
    display: none;
  }
}
.adm-stack {
  align-items: start;
}
.adm-col {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* streak shields */
.pill-shield {
  display: inline-flex;
  margin-left: 1px;
  color: var(--accent-2);
}
.shield-note {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--accent-2);
  font-weight: 600;
}
.shield-note .ico,
.planner-stats .ico + b + .ico {
  vertical-align: -2px;
}

/* goal setup: interview level */
.goal-level {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 4px 0 14px;
}
.goal-levels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.goal-levels .chip[aria-checked="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}
