:root {
  color-scheme: light;
  --bg: #f3f7f7;
  --surface: #ffffff;
  --surface-soft: #edf5f3;
  --ink: #13292e;
  --ink-soft: #334b50;
  --muted: #6c7c80;
  --line: #d9e4e4;
  --line-strong: #bed0cf;
  --accent: #0e8a78;
  --accent-strong: #096c5f;
  --accent-soft: #dff3ef;
  --blackbelt: #263236;
  --good: #168566;
  --good-soft: #e4f6ef;
  --bad: #c44c44;
  --bad-soft: #fff0ee;
  --warn: #b27718;
  --shadow: 0 16px 38px rgba(21, 57, 61, 0.08);
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --sidebar: 232px;
  font-family: Inter, "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  color: inherit;
}

button,
[role="button"] {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(14, 138, 120, 0.23);
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 26px 18px 20px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 30px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: white;
  font-size: 22px;
  font-weight: 780;
  line-height: 1;
  background: var(--accent);
  border-radius: 11px;
}

.brand-name {
  font-size: 16px;
  font-weight: 760;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.nav-button {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 46px;
  padding: 0 13px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 620;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-button:hover {
  color: var(--ink);
  background: #f1f6f5;
}

.nav-button.active {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.nav-button svg,
.mobile-nav button svg {
  width: 19px;
  height: 19px;
  stroke-width: 1.8;
}

.sidebar-spacer {
  flex: 1;
}

.offline-status {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 14px 10px 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
  border-top: 1px solid var(--line);
}

.membership-panel {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 13px 9px 3px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.membership-panel strong,
.membership-panel small {
  display: block;
}

.membership-panel strong {
  color: var(--ink);
  font-size: 11px;
}

.membership-panel small {
  max-width: 128px;
  margin-top: 3px;
  overflow: hidden;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.membership-panel button,
.table-actions button,
.admin-title > button,
.generated-box button,
.danger-link {
  padding: 0;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.mobile-account {
  display: flex;
  gap: 8px;
  align-items: center;
}

.mobile-account > span {
  color: var(--muted);
  font-size: 11px;
}

.status-dot {
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  background: var(--good);
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgba(22, 133, 102, 0.1);
}

.app-content {
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-height: 66px;
  padding: 12px 34px;
  background: rgba(243, 247, 247, 0.92);
  border-bottom: 1px solid rgba(217, 228, 228, 0.75);
  backdrop-filter: blur(12px);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.main {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 28px 36px 56px;
}

.mobile-brand {
  display: none;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 22px;
  margin-bottom: 26px;
}

.page-head h1,
.practice-intro h1,
.quiz-title {
  margin: 0;
  color: var(--ink);
  font-size: clamp(28px, 3.1vw, 42px);
  font-weight: 760;
  letter-spacing: -0.045em;
  line-height: 1.12;
}

.page-head p,
.practice-intro p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.belt-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  background: #e8eeee;
  border-radius: 12px;
}

.belt-switch button {
  min-width: 74px;
  min-height: 36px;
  padding: 0 15px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
}

.belt-switch button.active {
  color: var(--accent-strong);
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(31, 68, 70, 0.08);
}

.belt-switch.black-active button.active {
  color: white;
  background: var(--blackbelt);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 326px;
  gap: 28px;
  align-items: start;
}

.dashboard-main {
  min-width: 0;
}

.practice-panel {
  position: relative;
  overflow: hidden;
  padding: clamp(26px, 4vw, 46px);
  background-color: var(--surface);
  background-image:
    linear-gradient(rgba(14, 138, 120, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(14, 138, 120, 0.045) 1px, transparent 1px);
  background-size: 32px 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.practice-panel::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 9px;
  height: 100%;
  background: var(--accent);
}

.practice-panel.black::after {
  background: var(--blackbelt);
}

.practice-intro {
  position: relative;
  z-index: 1;
  max-width: 680px;
}

.practice-kicker {
  margin-bottom: 16px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 720;
}

.practice-panel.black .practice-kicker {
  color: var(--blackbelt);
}

.primary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 11px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  padding: 0 17px;
  font-size: 13px;
  font-weight: 700;
  background: transparent;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  cursor: pointer;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease, color 150ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #9eb6b4;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.button svg,
.icon-button svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.9;
}

.button.primary {
  color: white;
  background: var(--accent);
  border-color: var(--accent);
}

.button.primary:hover:not(:disabled) {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.button.dark {
  color: white;
  background: var(--blackbelt);
  border-color: var(--blackbelt);
}

.button.ghost {
  background: var(--surface);
}

.button.danger {
  color: var(--bad);
  border-color: #ecc8c5;
}

.button.compact {
  min-height: 36px;
  padding: 0 12px;
  font-size: 12px;
}

.section-block {
  margin-top: 30px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-title-row h2,
.summary-panel h2,
.source-panel h2 {
  margin: 0;
  font-size: 17px;
  font-weight: 740;
  letter-spacing: -0.02em;
}

.section-note {
  color: var(--muted);
  font-size: 12px;
}

.module-rail {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.module-row {
  display: grid;
  grid-template-columns: 44px minmax(120px, 1fr) minmax(140px, 1.2fr) 66px 34px;
  gap: 14px;
  align-items: center;
  width: 100%;
  min-height: 70px;
  padding: 11px 16px;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
}

.module-row:last-child {
  border-bottom: 0;
}

.module-row:hover {
  background: #f8fbfa;
}

.module-index {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  background: var(--accent-soft);
  border-radius: 9px;
}

.module-name {
  display: block;
  font-size: 14px;
  font-weight: 710;
}

.module-sub {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

.progress-track {
  height: 7px;
  overflow: hidden;
  background: #e8eeee;
  border-radius: 99px;
}

.progress-track > span {
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 280ms ease;
}

.black-theme .progress-track > span,
.practice-panel.black + * .progress-track > span {
  background: var(--blackbelt);
}

.module-percent {
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.chevron {
  color: var(--muted);
}

.summary-panel {
  position: sticky;
  top: 94px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.belt-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.mastery-wrap {
  display: grid;
  place-items: center;
  padding: 30px 0 26px;
}

.mastery-ring {
  --value: 0;
  position: relative;
  display: grid;
  place-items: center;
  width: 132px;
  height: 132px;
  background: conic-gradient(var(--accent) calc(var(--value) * 1%), #e6eeee 0);
  border-radius: 50%;
}

.mastery-ring::before {
  content: "";
  position: absolute;
  width: 104px;
  height: 104px;
  background: var(--surface);
  border-radius: 50%;
}

.mastery-ring.black-ring {
  background: conic-gradient(var(--blackbelt) calc(var(--value) * 1%), #e6eeee 0);
}

.mastery-value {
  position: relative;
  text-align: center;
}

.mastery-value strong {
  display: block;
  font-size: 29px;
  font-weight: 780;
  letter-spacing: -0.05em;
}

.mastery-value span {
  color: var(--muted);
  font-size: 11px;
}

.metric-list {
  border-top: 1px solid var(--line);
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  color: var(--muted);
  font-size: 12px;
  border-bottom: 1px solid var(--line);
}

.metric-row strong {
  color: var(--ink);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.recent-practice {
  margin-top: 22px;
}

.recent-practice h3 {
  margin: 0 0 12px;
  font-size: 12px;
}

.recent-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  font-size: 12px;
}

.recent-line + .recent-line {
  border-top: 1px dashed var(--line);
}

.recent-line span {
  color: var(--muted);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.search-field {
  position: relative;
  flex: 1 1 260px;
}

.search-field svg {
  position: absolute;
  top: 50%;
  left: 13px;
  width: 17px;
  height: 17px;
  color: var(--muted);
  transform: translateY(-50%);
}

.search-field input,
.select-control {
  width: 100%;
  min-height: 42px;
  color: var(--ink);
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.search-field input {
  padding: 0 14px 0 40px;
}

.select-control {
  width: auto;
  min-width: 132px;
  padding: 0 34px 0 12px;
}

.question-list {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.question-row {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.question-row:last-child {
  border-bottom: 0;
}

.question-row:hover {
  background: #fafcfc;
}

.question-number {
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.question-preview {
  min-width: 0;
}

.question-preview p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 620;
  line-height: 1.55;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.question-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
}

.question-meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.state-mark {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.state-mark.good {
  background: var(--good);
}

.state-mark.bad {
  background: var(--bad);
}

.state-mark.new {
  background: #b6c4c4;
}

.empty-state {
  padding: 64px 24px;
  color: var(--muted);
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.empty-state svg {
  width: 36px;
  height: 36px;
  margin-bottom: 12px;
  color: #9aabab;
  stroke-width: 1.5;
}

.empty-state h2 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 17px;
}

.empty-state p {
  margin: 0 auto 20px;
  max-width: 440px;
  font-size: 13px;
  line-height: 1.65;
}

.quiz-shell {
  max-width: 920px;
  margin: 0 auto;
}

.quiz-top {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 22px;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  cursor: pointer;
}

.quiz-context {
  min-width: 0;
}

.quiz-context strong {
  display: block;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quiz-context span,
.quiz-count {
  color: var(--muted);
  font-size: 11px;
}

.quiz-progress {
  height: 5px;
  margin-bottom: 30px;
  overflow: hidden;
  background: #e0e9e9;
  border-radius: 99px;
}

.quiz-progress span {
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
}

.quiz-card {
  padding: clamp(22px, 4vw, 42px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.quiz-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 24px;
  color: var(--muted);
  font-size: 11px;
}

.quiz-title {
  max-width: 830px;
  margin-bottom: 30px;
  font-size: clamp(20px, 3vw, 29px);
  line-height: 1.45;
  letter-spacing: -0.025em;
}

.option-list {
  display: grid;
  gap: 11px;
}

.option-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 22px;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 10px 14px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.55;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
}

.option-row:hover:not(:disabled) {
  border-color: #9fc2bd;
  background: #fbfdfd;
}

.option-row.selected {
  color: var(--accent-strong);
  background: #f0faf8;
  border-color: var(--accent);
}

.option-row.correct {
  color: #0b674f;
  background: var(--good-soft);
  border-color: #76bda9;
}

.option-row.wrong {
  color: #9c3933;
  background: var(--bad-soft);
  border-color: #e4a39e;
}

.option-letter {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
  background: #f0f4f4;
  border-radius: 8px;
}

.option-row.selected .option-letter,
.option-row.correct .option-letter {
  color: white;
  background: var(--accent);
}

.option-row.wrong .option-letter {
  color: white;
  background: var(--bad);
}

.option-state {
  display: grid;
  place-items: center;
  color: var(--good);
}

.option-state svg {
  width: 18px;
  height: 18px;
}

.answer-panel {
  margin-top: 20px;
  padding: 20px;
  color: var(--ink-soft);
  background: var(--good-soft);
  border-left: 4px solid var(--good);
  border-radius: 10px;
}

.answer-panel.incorrect {
  background: var(--bad-soft);
  border-left-color: var(--bad);
}

.answer-panel h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 9px;
  color: var(--good);
  font-size: 15px;
}

.answer-panel h3 svg {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.answer-panel.incorrect h3 {
  color: var(--bad);
}

.answer-panel p {
  margin: 0;
  font-size: 13px;
  line-height: 1.8;
}

.answer-source {
  margin-top: 11px !important;
  color: var(--muted);
  font-size: 11px !important;
}

.quiz-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 20px;
}

.quiz-actions-right {
  display: flex;
  gap: 10px;
}

.result-shell {
  max-width: 900px;
  margin: 0 auto;
}

.result-hero {
  padding: 40px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

.score-line {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 16px 0 10px;
}

.score-line strong {
  font-size: 64px;
  font-weight: 780;
  letter-spacing: -0.06em;
  line-height: 1;
}

.score-line span {
  padding-bottom: 7px;
  color: var(--muted);
  font-size: 15px;
}

.result-hero p {
  color: var(--muted);
  font-size: 13px;
}

.review-list {
  margin-top: 22px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.review-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.review-row:last-child {
  border-bottom: 0;
}

.review-status {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: white;
  background: var(--good);
  border-radius: 50%;
}

.review-status.bad {
  background: var(--bad);
}

.review-status svg {
  width: 14px;
  height: 14px;
}

.review-row p {
  margin: 1px 0 5px;
  font-size: 13px;
  font-weight: 620;
  line-height: 1.55;
}

.review-row small {
  color: var(--muted);
  line-height: 1.5;
}

.progress-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
}

.stats-panel,
.source-panel {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stats-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.stat-cell {
  padding: 22px;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.stat-cell:last-child {
  border-right: 0;
}

.stat-cell span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 11px;
}

.stat-cell strong {
  font-size: 25px;
  font-variant-numeric: tabular-nums;
}

.module-stat-row {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) 62px;
  gap: 16px;
  align-items: center;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.module-stat-row:last-child {
  border-bottom: 0;
}

.module-stat-row span {
  font-size: 12px;
}

.module-stat-row strong {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.source-list {
  margin-top: 16px;
}

.source-item {
  padding: 15px 0;
  border-bottom: 1px solid var(--line);
}

.source-item:last-child {
  border-bottom: 0;
}

.source-item strong {
  display: block;
  font-size: 12px;
  line-height: 1.55;
}

.source-item span,
.source-item p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.55;
}

.source-item p {
  margin: 5px 0 0;
}

.source-warning {
  margin-top: 18px;
  padding: 13px;
  color: #6c552c;
  font-size: 11px;
  line-height: 1.6;
  background: #fff8e9;
  border: 1px solid #ead6ab;
  border-radius: 10px;
}

.mobile-nav {
  display: none;
}

.toast {
  position: fixed;
  z-index: 50;
  right: 24px;
  bottom: 24px;
  max-width: min(360px, calc(100vw - 32px));
  padding: 13px 16px;
  color: white;
  font-size: 13px;
  background: var(--ink);
  border-radius: 11px;
  box-shadow: var(--shadow);
  animation: toast-in 180ms ease-out;
}

.access-page {
  display: grid;
  min-height: 100vh;
  padding: 32px 18px;
  place-items: center;
  background:
    radial-gradient(circle at 20% 10%, rgba(14, 138, 120, 0.13), transparent 34%),
    radial-gradient(circle at 85% 88%, rgba(14, 138, 120, 0.08), transparent 28%),
    var(--bg);
}

.access-card {
  width: min(480px, 100%);
  padding: 38px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.access-brand {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 34px;
}

.access-brand strong,
.access-brand span {
  display: block;
}

.access-brand strong {
  font-size: 18px;
}

.access-brand span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.07em;
}

.access-kicker {
  display: inline-flex;
  padding: 7px 10px;
  color: var(--accent-strong);
  font-size: 11px;
  font-weight: 700;
  background: var(--accent-soft);
  border-radius: 999px;
}

.access-card h1 {
  margin: 20px 0 8px;
  font-size: clamp(27px, 5vw, 38px);
  letter-spacing: -0.04em;
}

.access-card > p {
  margin: 0 0 25px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
}

.access-form {
  display: grid;
  gap: 14px;
}

.access-form label,
.admin-generate label {
  display: grid;
  gap: 7px;
}

.access-form label span,
.admin-generate label span {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 700;
}

.access-form input,
.admin-generate input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  color: var(--ink);
  background: #fbfdfd;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
}

.access-form input[name="code"] {
  font-weight: 760;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.access-form .button {
  min-height: 50px;
}

.form-message {
  display: none;
  margin-top: 13px;
  padding: 11px 13px;
  color: #8c3535;
  font-size: 12px;
  background: var(--bad-soft);
  border-radius: 9px;
}

.form-message.show {
  display: block;
}

.access-notes {
  display: grid;
  gap: 8px;
  margin-top: 24px;
  padding-top: 20px;
  color: var(--muted);
  font-size: 11px;
  border-top: 1px solid var(--line);
}

.access-notes span::before {
  content: "✓";
  margin-right: 8px;
  color: var(--good);
  font-weight: 800;
}

.loading-card {
  text-align: center;
}

.loading-card .brand-mark {
  margin: 0 auto;
}

.back-link {
  display: inline-flex;
  margin-top: 20px;
  color: var(--accent-strong);
  font-size: 12px;
  text-decoration: none;
}

.admin-page {
  width: min(1480px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 34px 60px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.admin-header .access-brand {
  margin: 0;
}

.admin-header > div:last-child {
  display: flex;
  gap: 8px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  margin-bottom: 20px;
}

.admin-card {
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.admin-card h2 {
  margin: 0 0 7px;
  font-size: 18px;
}

.admin-card > p,
.admin-title p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.admin-generate {
  display: grid;
  grid-template-columns: 120px 140px minmax(180px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-top: 22px;
}

.admin-generate .button {
  min-height: 50px;
}

.generated-box {
  margin-top: 18px;
  padding: 15px;
  background: var(--accent-soft);
  border-radius: 11px;
}

.generated-box > div {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 12px;
}

.generated-box textarea {
  width: 100%;
  min-height: 86px;
  padding: 10px;
  color: var(--ink);
  font: 700 13px/1.7 ui-monospace, Consolas, monospace;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  resize: vertical;
}

.summary-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  padding: 0;
  overflow: hidden;
  background: var(--line);
}

.summary-card span {
  display: grid;
  align-content: center;
  min-height: 140px;
  padding: 20px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  background: var(--surface);
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  font-size: 28px;
}

.table-card {
  margin-bottom: 20px;
}

.admin-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.table-wrap {
  overflow-x: auto;
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  white-space: nowrap;
}

.table-wrap th,
.table-wrap td {
  padding: 13px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.table-wrap th {
  color: var(--muted);
  font-weight: 650;
}

.table-wrap td strong,
.table-wrap td small {
  display: block;
}

.table-wrap td small {
  margin-top: 4px;
  color: var(--muted);
}

.status-pill {
  display: inline-flex;
  padding: 5px 8px;
  font-weight: 700;
  border-radius: 999px;
}

.status-pill.active {
  color: var(--good);
  background: var(--good-soft);
}

.status-pill.new {
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.status-pill.expired,
.status-pill.disabled {
  color: var(--bad);
  background: var(--bad-soft);
}

.table-actions {
  display: flex;
  gap: 12px;
}

.table-actions .danger-link,
.danger-link {
  color: var(--bad);
}

.empty-cell {
  padding: 38px !important;
  color: var(--muted);
  text-align: center !important;
}

@media (max-width: 900px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-generate {
    grid-template-columns: 1fr 1fr;
  }

  .admin-generate .wide,
  .admin-generate .button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .access-card {
    padding: 27px 20px;
    border-radius: 18px;
  }

  .admin-page {
    padding: 18px 12px 40px;
  }

  .admin-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-generate,
  .summary-card {
    grid-template-columns: 1fr;
  }

  .admin-generate label,
  .admin-generate .wide,
  .admin-generate .button {
    grid-column: 1;
  }

  .summary-card span {
    min-height: 96px;
  }
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 1080px) {
  :root {
    --sidebar: 204px;
  }

  .dashboard-grid,
  .progress-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .summary-panel {
    position: static;
  }

  .dashboard-grid .summary-panel {
    display: grid;
    grid-template-columns: auto 180px minmax(180px, 1fr);
    gap: 22px;
    align-items: center;
  }

  .summary-panel .mastery-wrap {
    padding: 0;
  }

  .summary-panel .metric-list {
    border-top: 0;
  }

  .summary-panel .recent-practice {
    grid-column: 1 / -1;
    margin-top: 0;
  }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
  }

  .sidebar,
  .topbar {
    display: none;
  }

  .mobile-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 58px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
  }

  .mobile-brand .brand {
    gap: 8px;
    padding: 0;
  }

  .mobile-brand .brand-mark {
    width: 32px;
    height: 32px;
    font-size: 18px;
    border-radius: 9px;
  }

  .mobile-brand .brand-subtitle {
    display: none;
  }

  .mobile-brand .brand-name {
    font-size: 14px;
  }

  .main {
    padding: 20px 16px calc(100px + env(safe-area-inset-bottom));
  }

  .page-head {
    align-items: flex-start;
    margin-bottom: 20px;
  }

  .page-head h1,
  .practice-intro h1 {
    font-size: 29px;
  }

  .page-head .belt-switch {
    display: none;
  }

  .practice-panel {
    padding: 26px 22px 28px;
    background-size: 26px 26px;
    border-radius: 16px;
  }

  .practice-kicker {
    margin-bottom: 12px;
  }

  .practice-panel::after {
    top: auto;
    bottom: 0;
    width: 100%;
    height: 6px;
  }

  .primary-actions .button {
    flex: 1 1 140px;
  }

  .module-row {
    grid-template-columns: 40px minmax(0, 1fr) 48px 24px;
    gap: 10px;
    min-height: 68px;
    padding: 10px 12px;
  }

  .module-row .progress-track {
    display: none;
  }

  .dashboard-grid .summary-panel {
    display: block;
  }

  .summary-panel .mastery-wrap {
    padding: 24px 0;
  }

  .summary-panel .metric-list {
    border-top: 1px solid var(--line);
  }

  .toolbar {
    align-items: stretch;
  }

  .search-field {
    flex-basis: 100%;
  }

  .select-control {
    flex: 1;
    min-width: 0;
  }

  .question-row {
    grid-template-columns: 38px minmax(0, 1fr);
    padding: 15px 12px;
  }

  .question-row > .button {
    grid-column: 2;
    justify-self: start;
  }

  .quiz-shell {
    max-width: none;
  }

  .quiz-top {
    margin-bottom: 16px;
  }

  .quiz-card {
    padding: 21px 16px;
    border-radius: 15px;
  }

  .quiz-title {
    margin-bottom: 24px;
    font-size: 20px;
  }

  .option-row {
    grid-template-columns: 30px minmax(0, 1fr) 20px;
    min-height: 58px;
    padding: 10px 11px;
    font-size: 13px;
  }

  .quiz-actions {
    align-items: stretch;
  }

  .quiz-actions > .button {
    padding: 0 12px;
  }

  .quiz-actions-right {
    flex: 1;
  }

  .quiz-actions-right .button {
    flex: 1;
  }

  .result-hero {
    padding: 28px 22px;
  }

  .score-line strong {
    font-size: 52px;
  }

  .review-row {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .review-row > .button {
    grid-column: 2;
    justify-self: start;
  }

  .stats-strip {
    grid-template-columns: 1fr;
  }

  .stat-cell {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .stat-cell:last-child {
    border-bottom: 0;
  }

  .module-stat-row {
    grid-template-columns: 104px minmax(0, 1fr) 52px;
    gap: 10px;
  }

  .mobile-nav {
    position: fixed;
    z-index: 40;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    min-height: calc(66px + env(safe-area-inset-bottom));
    padding: 5px 6px env(safe-area-inset-bottom);
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(16px);
  }

  .mobile-nav button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 660;
    background: transparent;
    border: 0;
  }

  .mobile-nav button.active {
    color: var(--accent);
  }

  .toast {
    right: 16px;
    bottom: calc(82px + env(safe-area-inset-bottom));
    left: 16px;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
.question-load-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 22px 0 6px;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 640px) {
  .question-load-more {
    flex-direction: column;
    gap: 10px;
  }
}
