/* Góc Học Tập Tổ 4 — Thiết kế & phát triển bởi Phạm Anh Quân */
:root {

  --bg-canvas: #f4f7fc;
  --surface-solid: #ffffff;
  --surface-glass: rgba(255, 255, 255, 0.78);
  --surface-glass-strong: rgba(255, 255, 255, 0.92);
  --surface-subtle: #edf2fb;
  --ink-primary: #0f172a;
  --ink-secondary: #334155;
  --ink-muted: #5a697e;

  --brand-cobalt: #2563eb;
  --brand-cobalt-dark: #1d4ed8;
  --brand-sky: #0ea5e9;
  --brand-cobalt-soft: rgba(37, 99, 235, 0.11);

  --accent-coral: #ff5a36;
  --accent-coral-dark: #e04624;
  --accent-coral-soft: rgba(255, 90, 54, 0.12);

  --semantic-mint: #059669;
  --semantic-mint-soft: rgba(5, 150, 105, 0.13);
  --semantic-rose: #e11d48;
  --semantic-rose-soft: rgba(225, 29, 72, 0.12);
  --semantic-amber: #d97706;
  --semantic-amber-soft: rgba(217, 119, 6, 0.13);

  --border-glass: rgba(255, 255, 255, 0.78);
  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.15);
  --shadow-float:
    0 18px 42px -12px rgba(15, 23, 42, 0.09),
    0 4px 12px -2px rgba(15, 23, 42, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
  --shadow-hover:
    0 24px 54px -10px rgba(37, 99, 235, 0.16),
    0 8px 20px -4px rgba(15, 23, 42, 0.07);

  --font-sans: "Be Vietnam Pro", "Segoe UI", "Cambria Math", "Segoe UI Symbol", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "Cambria Math", ui-monospace, monospace;

  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-std: cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--ink-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

code, .mono-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

code {
  background: var(--brand-cobalt-soft);
  color: var(--brand-cobalt);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.88em;
}

:focus-visible {
  outline: 2.5px solid var(--brand-cobalt);
  outline-offset: 2px;
}

.container {
  width: min(1220px, calc(100% - 32px));
  margin-inline: auto;
}

.ambient-stage {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.aurora-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  opacity: 0.46;
  transform: translate3d(0, 0, 0);
}

.orb-1 {
  width: 560px;
  height: 560px;
  top: -160px;
  right: -120px;
  background: radial-gradient(circle, #60a5fa 0%, #38bdf8 48%, transparent 72%);
  animation: floatOrb1 22s ease-in-out infinite alternate;
}

.orb-2 {
  width: 480px;
  height: 480px;
  bottom: -140px;
  left: -120px;
  background: radial-gradient(circle, #fb923c 0%, #f472b6 50%, transparent 74%);
  animation: floatOrb2 26s ease-in-out infinite alternate;
}

.orb-3 {
  width: 400px;
  height: 400px;
  top: 42%;
  left: 44%;
  background: radial-gradient(circle, #34d399 0%, #2dd4bf 50%, transparent 72%);
  opacity: 0.3;
  animation: floatOrb3 20s ease-in-out infinite alternate;
}

.grid-pattern {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border-subtle) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-subtle) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 25%, #000 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 25%, #000 30%, transparent 100%);
}

@keyframes floatOrb1 {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(-48px, 36px, 0) scale(1.08); }
}
@keyframes floatOrb2 {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(52px, -42px, 0) scale(1.1); }
}
@keyframes floatOrb3 {
  0% { transform: translate3d(-30px, 20px, 0) scale(0.95); }
  100% { transform: translate3d(34px, -28px, 0) scale(1.06); }
}

.fx-canvas {
  position: fixed;
  inset: 0;
  z-index: 120;
  pointer-events: none;
}

.glass-bar {
  background: var(--surface-glass-strong);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--border-subtle);
}

.glass-panel {
  background: var(--surface-glass);
  backdrop-filter: blur(14px) saturate(150%);
  -webkit-backdrop-filter: blur(14px) saturate(150%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
}

.glass-card {
  position: relative;
  background: var(--surface-glass-strong);
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-float);
}

@supports not (backdrop-filter: blur(1px)) {
  .glass-bar, .glass-panel, .glass-card { background: var(--surface-solid); }
}

.top-nav {
  position: sticky;
  top: 0;
  z-index: 60;
  height: 70px;
  display: flex;
  align-items: center;
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand-logo {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--ink-primary);
  font-size: 0.98rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.brand-logo strong { font-weight: 800; color: var(--brand-cobalt); }
.brand-mark { display: inline-flex; transition: transform 220ms var(--ease-spring); }
.brand-logo:hover .brand-mark { transform: rotate(-6deg) scale(1.06); }

.nav-tabs {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  background: var(--surface-subtle);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
}

.nav-indicator {
  position: absolute;
  top: 5px;
  left: 0;
  height: calc(100% - 10px);
  border-radius: var(--radius-pill);
  background: var(--surface-solid);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.08);
  transition: transform 320ms var(--ease-out-expo), width 320ms var(--ease-out-expo);
  pointer-events: none;
  z-index: 0;
}

.nav-tab {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  cursor: pointer;
  white-space: nowrap;
  transition: color 180ms var(--ease-std);
}
.nav-tab:hover { color: var(--ink-primary); }
.nav-tab.active { color: var(--brand-cobalt); }

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-coral);
  display: inline-block;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.streak-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  background: var(--accent-coral-soft);
  color: var(--accent-coral);
  font-weight: 700;
  font-size: 0.86rem;
  font-family: var(--font-mono);
}

.user-menu {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 5px;
  border-radius: var(--radius-pill);
  background: var(--surface-solid);
  border: 1px solid var(--border-subtle);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.05);
}

.user-pill-btn {
  font-family: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms, transform 160ms var(--ease-spring);
}
.user-pill-btn:hover {
  border-color: var(--brand-cobalt);
  transform: translateY(-1px);
}
.edit-hint-icon {
  color: var(--ink-muted);
  margin-left: 2px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-cobalt);
  color: #fff;
  font-size: 0.76rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.user-avatar.is-admin { background: var(--accent-coral); }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

.user-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  max-width: 102px;
}
.user-meta strong {
  font-size: 0.8rem;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.role-tag { font-size: 0.68rem; font-weight: 700; color: var(--brand-cobalt); }
.role-tag.is-admin { color: var(--accent-coral); }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  border: 1px solid var(--border-subtle);
  background: var(--surface-solid);
  color: var(--ink-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 160ms var(--ease-spring), color 160ms;
}
.icon-btn:hover { color: var(--brand-cobalt); transform: translateY(-1px); }
.icon-btn:active { transform: scale(0.94); }

.icon-xs { width: 14px; height: 14px; }
.icon-sm { width: 17px; height: 17px; }
.icon-md { width: 20px; height: 20px; }
.icon-lg { width: 26px; height: 26px; }
.icon-xl { width: 42px; height: 42px; }

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 13px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 160ms var(--ease-spring), background-color 160ms, color 160ms, opacity 160ms;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 12px 24px -6px rgba(37, 99, 235, 0.35);
  opacity: 0;
  transition: opacity 220ms var(--ease-std);
  pointer-events: none;
}

.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:hover:not(:disabled)::after { opacity: 1; }
.btn:active:not(:disabled) { transform: scale(0.96); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--brand-cobalt); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-cobalt-dark); }

.btn-accent { background: var(--accent-coral); color: #fff; }
.btn-accent::after { box-shadow: 0 12px 24px -6px rgba(255, 90, 54, 0.38); }
.btn-accent:hover:not(:disabled) { background: var(--accent-coral-dark); }

.btn-secondary {
  background: var(--surface-solid);
  color: var(--ink-primary);
  border-color: var(--border-strong);
}
.btn-secondary::after { box-shadow: 0 10px 20px -6px rgba(15, 23, 42, 0.12); }

.btn-ghost { background: transparent; color: var(--ink-secondary); }
.btn-ghost::after { display: none; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-subtle); color: var(--ink-primary); }

.btn-xs { padding: 6px 10px; font-size: 0.8rem; border-radius: 9px; }
.btn-sm { padding: 8px 14px; font-size: 0.86rem; border-radius: 11px; }
.btn-lg { padding: 13px 24px; font-size: 0.98rem; border-radius: 15px; }
.btn-full { width: 100%; }

.app-main { padding-top: 32px; padding-bottom: 84px; }
.view-section { animation: viewEnter 340ms var(--ease-out-expo) both; }
@keyframes viewEnter {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.mb-0 { margin-bottom: 0 !important; }
.mb-xs { margin-bottom: 6px; }
.mb-md { margin-bottom: 18px; }

.hero-grid {
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  gap: 44px;
  align-items: center;
  padding: 20px 0 56px;
}
.hero-grid.hero-single {
  grid-template-columns: 1fr;
  max-width: 820px;
  padding: 24px 0 42px;
}

.hero-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  background: var(--surface-solid);
  border: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-secondary);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
  margin-bottom: 18px;
}

.pill-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--semantic-mint);
  box-shadow: 0 0 0 4px var(--semantic-mint-soft);
}

.hero-title {
  margin: 0 0 18px;
  font-size: clamp(2.1rem, 4vw, 3.25rem);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.hero-lead {
  margin: 0 0 28px;
  font-size: 1.04rem;
  color: var(--ink-muted);
  max-width: 58ch;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 32px;
}

.hero-metrics {
  display: inline-flex;
  align-items: center;
  gap: 22px;
  padding: 14px 22px;
  background: var(--surface-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-float);
}

.metric-item strong {
  display: block;
  font-size: 1.32rem;
  font-weight: 800;
  font-family: var(--font-mono);
  line-height: 1.2;
}
.metric-item span { font-size: 0.8rem; color: var(--ink-muted); font-weight: 500; }
.metric-divider { width: 1px; height: 30px; background: var(--border-strong); }

.modes-section, .featured-section { margin-top: 44px; }
.section-head { margin-bottom: 22px; }
.section-title { margin: 0 0 6px; font-size: 1.55rem; font-weight: 800; letter-spacing: -0.02em; }
.section-sub { margin: 0; color: var(--ink-muted); font-size: 0.96rem; }

.modes-bento { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }

.mode-card {
  position: relative;
  padding: 26px;
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-float);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: transform 240ms var(--ease-out-expo), border-color 200ms;
}
.mode-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: var(--shadow-hover);
  opacity: 0;
  transition: opacity 240ms var(--ease-std);
  pointer-events: none;
}
.mode-card:hover { transform: translateY(-6px); border-color: var(--brand-cobalt); }
.mode-card:hover::after { opacity: 1; }
.mode-card:active { transform: translateY(-2px) scale(0.985); }

.mode-icon-wrap { width: 52px; height: 52px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; margin-bottom: 18px; }
.mode-practice .mode-icon-wrap { background: var(--semantic-mint-soft); color: var(--semantic-mint); }
.mode-test .mode-icon-wrap { background: var(--brand-cobalt-soft); color: var(--brand-cobalt); }
.mode-exam .mode-icon-wrap { background: var(--accent-coral-soft); color: var(--accent-coral); }

.mode-card h3 { margin: 0 0 8px; font-size: 1.18rem; font-weight: 800; }
.mode-card p { margin: 0 0 18px; font-size: 0.92rem; color: var(--ink-muted); flex: 1; }
.mode-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.mode-tags span { padding: 4px 10px; border-radius: 8px; background: var(--surface-subtle); color: var(--ink-secondary); font-size: 0.78rem; font-weight: 600; }
.mode-action { display: inline-flex; align-items: center; gap: 4px; font-size: 0.9rem; font-weight: 700; color: var(--brand-cobalt); }

.deck-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; }

.deck-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px;
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-float);
  transition: transform 220ms var(--ease-out-expo), border-color 180ms;
}
.deck-card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: var(--shadow-hover);
  opacity: 0;
  transition: opacity 220ms var(--ease-std);
  pointer-events: none;
}
.deck-card:hover { transform: translateY(-4px); border-color: var(--brand-cobalt); }
.deck-card:hover::after { opacity: 1; }

.deck-top-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.deck-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.part3-badge { padding: 3px 9px; border-radius: var(--radius-pill); font-size: 0.7rem; font-weight: 800; background: var(--semantic-mint-soft); color: var(--semantic-mint); }
.subject-badge { padding: 4px 11px; border-radius: var(--radius-pill); font-size: 0.76rem; font-weight: 700; background: var(--brand-cobalt-soft); color: var(--brand-cobalt); }
.subject-badge.is-assigned { background: var(--accent-coral-soft); color: var(--accent-coral); }
.deck-count { font-family: var(--font-mono); font-size: 0.78rem; font-weight: 600; color: var(--ink-muted); }

.deck-card h3 { margin: 0 0 8px; font-size: 1.08rem; font-weight: 800; line-height: 1.35; }
.deck-card p { margin: 0 0 18px; font-size: 0.88rem; color: var(--ink-muted); flex: 1; }
.deck-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 14px; border-top: 1px solid var(--border-subtle); }
.deck-btn-group { display: flex; gap: 6px; }

.page-header { margin-bottom: 24px; }
.page-title { margin: 0 0 6px; font-size: clamp(1.55rem, 3vw, 2.05rem); font-weight: 900; letter-spacing: -0.025em; }
.page-sub { margin: 0; color: var(--ink-muted); }
.header-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface-solid);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 8px 14px;
  flex: 1;
  min-width: 240px;
  color: var(--ink-muted);
}
.search-box input { border: none; background: transparent; color: var(--ink-primary); font-family: inherit; font-size: 0.92rem; width: 100%; outline: none; }

.subject-chips, .review-filter-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.chip {
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border-subtle);
  background: var(--surface-solid);
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 140ms var(--ease-spring), background-color 160ms, color 160ms;
}
.chip:hover { border-color: var(--brand-cobalt); color: var(--brand-cobalt); }
.chip.active { background: var(--brand-cobalt); border-color: var(--brand-cobalt); color: #fff; }

.mistakes-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  margin-bottom: 22px;
  border-left: 4px solid var(--accent-coral);
  flex-wrap: wrap;
}
.mistakes-info { display: flex; align-items: center; gap: 14px; }
.mistakes-icon { width: 44px; height: 44px; border-radius: 13px; background: var(--accent-coral-soft); color: var(--accent-coral); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.mistakes-info h3 { margin: 0 0 2px; font-size: 1rem; }
.mistakes-info p { margin: 0; font-size: 0.88rem; color: var(--ink-muted); }
.mistakes-actions { display: flex; gap: 8px; }

.sync-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  background: var(--surface-solid);
  border: 1px solid var(--border-subtle);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--semantic-mint);
}

.lb-filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 280px;
  flex: 1;
}
.lb-filter-group select { max-width: 340px; }

.podium-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}

.podium-card {
  position: relative;
  padding: 22px;
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
  border: 1.5px solid var(--border-subtle);
  box-shadow: var(--shadow-float);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.podium-card.rank-1 {
  border-color: #f59e0b;
  background: linear-gradient(180deg, #fffbeb 0%, #ffffff 65%);
}
.podium-card.rank-2 { border-color: #94a3b8; }
.podium-card.rank-3 { border-color: #d97706; }

.podium-rank {
  font-size: 1.5rem;
  line-height: 1;
}
.podium-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--brand-cobalt);
  color: #fff;
  font-size: 1.15rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 3px solid var(--surface-solid);
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.12);
}
.podium-avatar img { width: 100%; height: 100%; object-fit: cover; }
.podium-name { font-size: 1.04rem; font-weight: 800; }
.podium-deck { font-size: 0.78rem; color: var(--ink-muted); max-width: 24ch; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.podium-score { font-family: var(--font-mono); font-size: 1.35rem; font-weight: 900; color: var(--brand-cobalt); }
.podium-time { font-family: var(--font-mono); font-size: 0.82rem; font-weight: 700; color: var(--ink-secondary); }

.lb-table-wrap { padding: 18px; }
.lb-table-scroll { overflow-x: auto; }

.lb-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.lb-table th {
  text-align: left;
  padding: 12px 14px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--ink-muted);
  border-bottom: 1.5px solid var(--border-subtle);
}
.lb-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.lb-table tr:last-child td { border-bottom: none; }
.lb-table tr.is-me { background: var(--brand-cobalt-soft); }

.lb-user-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}
.lb-mini-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--brand-cobalt);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.lb-mini-avatar img { width: 100%; height: 100%; object-fit: cover; }

.lb-rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--surface-subtle);
  font-family: var(--font-mono);
  font-weight: 800;
}
.lb-rank-badge.top1 { background: #fef3c7; color: #b45309; }
.lb-rank-badge.top2 { background: #e2e8f0; color: #334155; }
.lb-rank-badge.top3 { background: #ffedd5; color: #c2410c; }

.lb-score-cell { font-family: var(--font-mono); font-weight: 900; color: var(--brand-cobalt); font-size: 1rem; }
.lb-time-cell { font-family: var(--font-mono); font-weight: 700; color: var(--ink-secondary); }

.card-title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.card-title-row h2 { margin: 0; font-size: 1.04rem; font-weight: 800; display: inline-flex; align-items: center; gap: 8px; }
.format-list { font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600; color: var(--ink-muted); }

.admin-timing-box {
  padding: 14px;
  border-radius: 14px;
  background: var(--brand-cobalt-soft);
  border: 1.5px solid rgba(37, 99, 235, 0.22);
  margin-bottom: 14px;
}
.timing-note {
  margin: 8px 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--brand-cobalt-dark);
}

.dropzone {
  position: relative;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-solid);
  padding: 24px 20px;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 180ms, background-color 180ms, transform 180ms var(--ease-spring);
  margin-bottom: 16px;
}
.dropzone:hover, .dropzone.drag-over { border-color: var(--brand-cobalt); background: var(--brand-cobalt-soft); }
.dropzone.drag-over { transform: scale(1.01); }

.scan-beam {
  position: absolute;
  left: 0; right: 0; top: 0; height: 4px;
  background: linear-gradient(90deg, transparent, var(--brand-cobalt), var(--accent-coral), transparent);
  box-shadow: 0 0 18px var(--brand-cobalt);
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}
.dropzone.scanning .scan-beam { opacity: 1; animation: scanSweep 1.3s ease-in-out infinite alternate; }
@keyframes scanSweep { from { transform: translateY(0); } to { transform: translateY(150px); } }

.drop-icon-stack { display: flex; justify-content: center; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.doc-pill { padding: 4px 9px; border-radius: 7px; font-family: var(--font-mono); font-size: 0.72rem; font-weight: 700; color: #fff; }
.p-pdf { background: #ef4444; } .p-doc { background: #2563eb; } .p-xls { background: #059669; } .p-ppt { background: #ea580c; } .p-img { background: #7c3aed; }
.drop-title { margin: 0 0 4px; font-size: 0.94rem; }
.drop-hint { margin: 0; font-size: 0.8rem; color: var(--ink-muted); }
.dropzone-files { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 12px; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border-radius: 10px; background: var(--surface-subtle); border: 1px solid var(--border-subtle); font-size: 0.8rem; font-weight: 600; }

.field-label { display: block; font-size: 0.82rem; font-weight: 700; color: var(--ink-secondary); margin-bottom: 6px; }
.field-group { margin-bottom: 12px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: 1.2fr 0.8fr 1fr; gap: 10px; }

input[type="text"], input[type="number"], input[type="password"], input[type="url"], select, textarea {
  width: 100%;
  padding: 10px 13px;
  border-radius: 11px;
  border: 1.5px solid var(--border-subtle);
  background: var(--surface-solid);
  color: var(--ink-primary);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 160ms;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-cobalt); }
textarea { resize: vertical; line-height: 1.55; }

.text-meta { display: flex; align-items: center; gap: 10px; font-size: 0.78rem; color: var(--ink-muted); }
.link-btn { border: none; background: none; color: var(--brand-cobalt); font-family: inherit; font-weight: 700; font-size: 0.78rem; cursor: pointer; padding: 0; }

.eng-btn { display: inline-flex; align-items: center; gap: 5px; padding: 6px 11px; border: none; border-radius: 8px; background: transparent; color: var(--ink-muted); font-family: inherit; font-size: 0.78rem; font-weight: 700; cursor: pointer; }
.eng-btn.active { background: var(--surface-solid); color: var(--brand-cobalt); box-shadow: 0 2px 6px rgba(15, 23, 42, 0.08); }

.pipeline-tracker { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: 12px; background: var(--surface-subtle); margin-bottom: 14px; }
.pipeline-step { display: flex; align-items: center; gap: 10px; font-size: 0.84rem; font-weight: 600; color: var(--ink-muted); }
.step-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); transition: transform 200ms var(--ease-spring), background-color 200ms; }
.pipeline-step.active { color: var(--brand-cobalt); }
.pipeline-step.active .step-dot { background: var(--brand-cobalt); transform: scale(1.25); }
.pipeline-step.done { color: var(--semantic-mint); }
.pipeline-step.done .step-dot { background: var(--semantic-mint); }

.output-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--border-subtle); margin-bottom: 14px; flex-wrap: wrap; }
.output-tabs { display: inline-flex; gap: 6px; }
.out-tab { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 10px; border: 1px solid var(--border-subtle); background: var(--surface-solid); color: var(--ink-secondary); font-family: inherit; font-size: 0.84rem; font-weight: 700; cursor: pointer; }
.out-tab.active { background: var(--brand-cobalt); border-color: var(--brand-cobalt); color: #fff; }

.json-status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: var(--radius-pill); font-size: 0.78rem; font-weight: 700; }
.json-status.valid { background: var(--semantic-mint-soft); color: var(--semantic-mint); }
.json-status.invalid { background: var(--semantic-rose-soft); color: var(--semantic-rose); }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.output-pane { flex: 1; display: flex; flex-direction: column; }
.visual-preview-list { display: flex; flex-direction: column; gap: 12px; max-height: 490px; overflow-y: auto; padding-right: 4px; }
.vp-card { padding: 15px; border-radius: 14px; background: var(--surface-solid); border: 1px solid var(--border-subtle); }
.vp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.vp-num { font-family: var(--font-mono); font-size: 0.78rem; font-weight: 700; color: var(--brand-cobalt); }
.vp-q-input { font-weight: 700; margin-bottom: 10px; }
.vp-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 8px; }
.vp-opt-row { display: flex; align-items: center; gap: 6px; }
.vp-opt-pick { width: 28px; height: 28px; border-radius: 8px; border: 1.5px solid var(--border-strong); background: var(--surface-subtle); color: var(--ink-secondary); font-weight: 800; font-size: 0.78rem; cursor: pointer; flex-shrink: 0; }
.vp-opt-pick.correct { background: var(--semantic-mint); border-color: var(--semantic-mint); color: #fff; }
.vp-exp-input { font-size: 0.82rem; padding: 7px 10px; }

.vp-type-badge { padding: 3px 9px; border-radius: 8px; font-size: 0.72rem; font-weight: 700; background: var(--brand-cobalt-soft); color: var(--brand-cobalt); }
.vp-type-badge.tf { background: var(--semantic-amber-soft); color: var(--semantic-amber); }
.vp-type-badge.sa { background: var(--semantic-mint-soft); color: var(--semantic-mint); }

.vp-tf-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 8px; }
.vp-tf-row { display: flex; align-items: center; gap: 6px; }
.vp-tf-toggle { padding: 6px 10px; border-radius: 8px; border: 1.5px solid var(--border-strong); background: var(--surface-subtle); font-family: inherit; font-size: 0.76rem; font-weight: 800; cursor: pointer; flex-shrink: 0; }
.vp-tf-toggle.is-true { background: var(--semantic-mint); border-color: var(--semantic-mint); color: #fff; }
.vp-tf-toggle.is-false { background: var(--accent-coral); border-color: var(--accent-coral); color: #fff; }

.json-toolbar { display: flex; gap: 6px; margin-bottom: 8px; flex-wrap: wrap; }
.json-editor { flex: 1; min-height: 430px; font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.55; background: #0f172a; color: #e2e8f0; border-color: #1e293b; tab-size: 2; }
.json-error-box { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--semantic-rose-soft); color: var(--semantic-rose); font-size: 0.82rem; font-weight: 600; }

.output-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--border-subtle); flex-wrap: wrap; }
.add-q-group { display: flex; gap: 6px; flex-wrap: wrap; }
.output-footer-right { display: flex; gap: 8px; flex-wrap: wrap; }

.quiz-topbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 18px; margin-bottom: 12px; flex-wrap: wrap; }
.quiz-meta { display: flex; align-items: center; gap: 12px; }
.quiz-mode-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }

.mode-pill { padding: 2px 9px; border-radius: var(--radius-pill); font-size: 0.74rem; font-weight: 800; background: var(--brand-cobalt-soft); color: var(--brand-cobalt); }
.mode-pill.practice { background: var(--semantic-mint-soft); color: var(--semantic-mint); }
.mode-pill.exam { background: var(--accent-coral-soft); color: var(--accent-coral); }
.quiz-subject-label { font-size: 0.78rem; font-weight: 600; color: var(--ink-muted); }
.focus-warning-pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: var(--radius-pill); background: var(--semantic-rose-soft); color: var(--semantic-rose); font-size: 0.74rem; font-weight: 700; }
.quiz-deck-title { margin: 0; font-size: 1.08rem; font-weight: 800; }
.quiz-telemetry { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.combo-badge { display: inline-flex; align-items: center; gap: 5px; padding: 6px 12px; border-radius: var(--radius-pill); background: var(--accent-coral); color: #fff; font-size: 0.84rem; font-weight: 800; animation: popIn 280ms var(--ease-spring); }
.timer-pill { display: inline-flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 12px; background: var(--surface-solid); border: 1.5px solid var(--border-subtle); font-weight: 700; font-size: 0.94rem; }
.timer-pill.warning { border-color: var(--semantic-rose); background: var(--semantic-rose-soft); color: var(--semantic-rose); }

.quiz-progress-track { height: 7px; border-radius: var(--radius-pill); background: var(--surface-subtle); overflow: hidden; margin-bottom: 20px; }
.quiz-progress-fill { height: 100%; width: 100%; background: linear-gradient(90deg, var(--brand-cobalt), var(--brand-sky)); transform-origin: left center; transform: scaleX(0); transition: transform 320ms var(--ease-out-expo); }

.quiz-arena-grid { display: grid; grid-template-columns: 1fr 290px; gap: 20px; align-items: start; }
.question-card { padding: 28px; }
.q-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.q-number-group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.q-index-badge { padding: 5px 12px; border-radius: 10px; background: var(--ink-primary); color: var(--surface-solid); font-family: var(--font-mono); font-size: 0.82rem; font-weight: 700; }
.q-diff-badge, .q-topic-badge { padding: 4px 10px; border-radius: 9px; font-size: 0.78rem; font-weight: 700; background: var(--surface-subtle); color: var(--ink-secondary); }

.q-head-actions { display: flex; align-items: center; gap: 8px; }
.ask-help-chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 10px; border: 1.5px solid var(--brand-cobalt); background: var(--brand-cobalt-soft); color: var(--brand-cobalt); font-family: inherit; font-size: 0.82rem; font-weight: 700; cursor: pointer; transition: transform 150ms var(--ease-spring), background-color 160ms, color 160ms; }
.ask-help-chip:hover { background: var(--brand-cobalt); color: #fff; transform: translateY(-1px); }

.flag-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 10px; border: 1.5px solid var(--border-subtle); background: var(--surface-solid); color: var(--ink-muted); font-family: inherit; font-size: 0.82rem; font-weight: 700; cursor: pointer; }
.flag-btn:hover { border-color: var(--semantic-amber); color: var(--semantic-amber); }
.flag-btn.flagged { border-color: var(--semantic-amber); background: var(--semantic-amber-soft); color: var(--semantic-amber); }

.q-prompt { margin: 0 0 24px; font-size: 1.24rem; font-weight: 700; line-height: 1.52; }
.options-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }

.option-btn {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 15px 18px;
  border-radius: 15px;
  border: 2px solid var(--border-subtle);
  background: var(--surface-solid);
  color: var(--ink-primary);
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: transform 160ms var(--ease-spring), border-color 160ms, background-color 160ms;
}
.option-btn:hover:not(:disabled) { border-color: var(--brand-cobalt); transform: translateX(4px); }
.option-btn:active:not(:disabled) { transform: scale(0.985); }

.option-letter { width: 34px; height: 34px; border-radius: 10px; background: var(--surface-subtle); color: var(--ink-secondary); font-family: var(--font-mono); font-weight: 800; font-size: 0.9rem; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.option-text { flex: 1; line-height: 1.45; }

.option-btn.selected { border-color: var(--brand-cobalt); background: var(--brand-cobalt-soft); }
.option-btn.selected .option-letter { background: var(--brand-cobalt); color: #fff; }
.option-btn.correct { border-color: var(--semantic-mint); background: var(--semantic-mint-soft); }
.option-btn.correct .option-letter { background: var(--semantic-mint); color: #fff; }
.option-btn.wrong { border-color: var(--semantic-rose); background: var(--semantic-rose-soft); animation: microShake 360ms ease; }
.option-btn.wrong .option-letter { background: var(--semantic-rose); color: #fff; }

.tf-list { display: flex; flex-direction: column; gap: 10px; }
.tf-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 16px; border-radius: 14px; border: 1.5px solid var(--border-subtle); background: var(--surface-solid); }
.tf-row.is-correct { border-color: var(--semantic-mint); background: var(--semantic-mint-soft); }
.tf-row.is-wrong { border-color: var(--semantic-rose); background: var(--semantic-rose-soft); }
.tf-stmt { display: flex; align-items: baseline; gap: 8px; flex: 1; font-size: 0.96rem; font-weight: 600; line-height: 1.48; }
.tf-letter { font-family: var(--font-mono); font-weight: 800; color: var(--brand-cobalt); }
.tf-actions { display: inline-flex; gap: 6px; flex-shrink: 0; }
.tf-pill { padding: 7px 14px; border-radius: 10px; border: 1.5px solid var(--border-strong); background: var(--surface-subtle); color: var(--ink-secondary); font-family: inherit; font-size: 0.84rem; font-weight: 700; cursor: pointer; transition: transform 140ms var(--ease-spring), background-color 160ms, color 160ms; }
.tf-pill:hover:not(:disabled) { border-color: var(--brand-cobalt); transform: translateY(-1px); }
.tf-pill.active-true { background: var(--semantic-mint); border-color: var(--semantic-mint); color: #fff; }
.tf-pill.active-false { background: var(--accent-coral); border-color: var(--accent-coral); color: #fff; }
.tf-pill.right-ans { box-shadow: 0 0 0 2px var(--semantic-mint); }

.sa-box { display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: 16px; background: var(--surface-solid); border: 1.5px solid var(--border-subtle); }
.sa-box.is-correct { border-color: var(--semantic-mint); background: var(--semantic-mint-soft); }
.sa-box.is-wrong { border-color: var(--semantic-rose); background: var(--semantic-rose-soft); }
.sa-input-row { display: flex; gap: 10px; align-items: center; }
.sa-input-row input { flex: 1; font-size: 1.05rem; font-weight: 700; padding: 12px 15px; }
.sa-right-reveal { font-size: 0.9rem; font-weight: 700; color: var(--semantic-mint); }
.practice-confirm-row { display: flex; justify-content: flex-end; margin-top: 6px; }

.explanation-box { padding: 16px 18px; border-radius: 14px; background: var(--brand-cobalt-soft); border-left: 4px solid var(--brand-cobalt); margin-bottom: 20px; animation: viewEnter 240ms var(--ease-out-expo); }
.exp-head { display: inline-flex; align-items: center; gap: 7px; font-size: 0.86rem; font-weight: 800; color: var(--brand-cobalt); margin-bottom: 6px; }
.explanation-box p { margin: 0; font-size: 0.92rem; }

.q-card-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 18px; border-top: 1px solid var(--border-subtle); flex-wrap: wrap; }
.kbd-hint { font-size: 0.78rem; color: var(--ink-muted); }
kbd { display: inline-block; padding: 2px 6px; border-radius: 5px; border: 1px solid var(--border-strong); background: var(--surface-subtle); font-family: var(--font-mono); font-size: 0.74rem; font-weight: 700; }

.quiz-sidebar { padding: 20px; position: sticky; top: 90px; }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.sidebar-head h3 { margin: 0; font-size: 0.96rem; font-weight: 800; }
.palette-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 16px; }
.pal-btn { position: relative; height: 38px; border-radius: 10px; border: 1.5px solid var(--border-subtle); background: var(--surface-solid); color: var(--ink-secondary); font-family: var(--font-mono); font-size: 0.84rem; font-weight: 700; cursor: pointer; transition: transform 140ms var(--ease-spring), border-color 140ms; }
.pal-btn:hover { transform: translateY(-2px); border-color: var(--brand-cobalt); }
.pal-btn.current { border-color: var(--brand-cobalt); box-shadow: 0 0 0 3px var(--brand-cobalt-soft); color: var(--brand-cobalt); }
.pal-btn.answered { background: var(--brand-cobalt); border-color: var(--brand-cobalt); color: #fff; }
.pal-btn.is-correct { background: var(--semantic-mint); border-color: var(--semantic-mint); color: #fff; }
.pal-btn.is-wrong { background: var(--semantic-rose); border-color: var(--semantic-rose); color: #fff; }
.pal-btn.flagged::after { content: ""; position: absolute; top: -3px; right: -3px; width: 10px; height: 10px; border-radius: 50%; background: var(--semantic-amber); border: 2px solid var(--surface-solid); }
.palette-legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 0.76rem; color: var(--ink-muted); }
.palette-part-title { font-size: 0.74rem; font-weight: 800; color: var(--ink-muted); text-transform: uppercase; letter-spacing: 0.03em; margin: 10px 0 6px; }
.palette-part-title:first-child { margin-top: 0; }
.palette-legend span { display: inline-flex; align-items: center; gap: 5px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.dot-current { border: 2px solid var(--brand-cobalt); }
.dot-answered { background: var(--brand-cobalt); }
.dot-flagged { background: var(--semantic-amber); }

.result-hero { display: grid; grid-template-columns: 220px 1fr; gap: 32px; align-items: center; padding: 32px; margin-bottom: 24px; }
.result-ring-wrap { position: relative; width: 180px; height: 180px; margin-inline: auto; }
.score-ring { transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--surface-subtle); stroke-width: 13; }
.ring-progress { fill: none; stroke: var(--brand-cobalt); stroke-width: 13; stroke-linecap: round; transition: stroke-dashoffset 1100ms var(--ease-out-expo); }
.ring-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-center strong { font-size: 2.6rem; font-weight: 900; line-height: 1; }
.ring-center span { font-size: 0.78rem; color: var(--ink-muted); margin-top: 4px; }
.result-verdict-pill { display: inline-block; padding: 5px 13px; border-radius: var(--radius-pill); background: var(--semantic-mint-soft); color: var(--semantic-mint); font-size: 0.82rem; font-weight: 800; margin-bottom: 10px; }
.result-title { margin: 0 0 6px; font-size: 1.75rem; font-weight: 900; }
.result-sub { margin: 0 0 20px; color: var(--ink-muted); }
.result-stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.r-stat { padding: 12px 14px; border-radius: 14px; background: var(--surface-solid); border: 1px solid var(--border-subtle); }
.r-stat strong { display: block; font-size: 1.35rem; font-weight: 800; }
.r-stat span { font-size: 0.78rem; color: var(--ink-muted); font-weight: 600; }
.r-stat.good strong { color: var(--semantic-mint); } .r-stat.bad strong { color: var(--semantic-rose); } .r-stat.info strong { color: var(--brand-cobalt); } .r-stat.flame strong { color: var(--accent-coral); }
.result-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.analytics-card { padding: 24px; margin-bottom: 26px; }
.analytics-card h2 { margin: 0 0 16px; font-size: 1.15rem; font-weight: 800; }
.topic-bars { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.topic-bar-item { padding: 12px 14px; border-radius: 13px; background: var(--surface-solid); border: 1px solid var(--border-subtle); }
.topic-bar-head { display: flex; justify-content: space-between; font-size: 0.86rem; font-weight: 700; margin-bottom: 8px; }
.topic-track { height: 8px; border-radius: var(--radius-pill); background: var(--surface-subtle); overflow: hidden; }
.topic-fill { height: 100%; border-radius: inherit; background: var(--brand-cobalt); transform-origin: left center; transition: transform 650ms var(--ease-out-expo); }

.review-list { display: flex; flex-direction: column; gap: 14px; }
.review-item { padding: 20px; border-radius: var(--radius-md); background: var(--surface-solid); border: 1.5px solid var(--border-subtle); }
.review-item.is-correct { border-left: 5px solid var(--semantic-mint); }
.review-item.is-wrong { border-left: 5px solid var(--semantic-rose); }
.review-q-title { margin: 0 0 12px; font-size: 1.02rem; font-weight: 700; }
.review-answers { display: flex; gap: 12px; flex-wrap: wrap; font-size: 0.88rem; margin-bottom: 10px; }
.ans-pill { padding: 4px 11px; border-radius: 8px; font-weight: 700; }
.ans-pill.right { background: var(--semantic-mint-soft); color: var(--semantic-mint); }
.ans-pill.wrong { background: var(--semantic-rose-soft); color: var(--semantic-rose); }
.review-exp { margin: 0; font-size: 0.88rem; color: var(--ink-muted); background: var(--surface-subtle); padding: 10px 13px; border-radius: 10px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 22px; }
.kpi-card { padding: 20px; }
.kpi-label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--ink-muted); margin-bottom: 6px; }
.kpi-value { font-size: 1.8rem; font-weight: 900; }
.history-list-wrap { padding: 24px; }
.history-list-wrap h2 { margin: 0 0 16px; font-size: 1.15rem; font-weight: 800; }
.history-list { display: flex; flex-direction: column; gap: 10px; }
.hist-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 18px; border-radius: 14px; background: var(--surface-solid); border: 1px solid var(--border-subtle); flex-wrap: wrap; }
.hist-row-title { font-weight: 700; font-size: 0.96rem; }
.hist-row-meta { font-size: 0.8rem; color: var(--ink-muted); }
.hist-score-badge { font-family: var(--font-mono); font-size: 1.15rem; font-weight: 900; color: var(--brand-cobalt); }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(15, 23, 42, 0.5); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn 180ms ease; }
.modal-card { width: min(560px, 100%); padding: 26px; background: #ffffff; backdrop-filter: none; -webkit-backdrop-filter: none; animation: modalPop 260ms var(--ease-out-expo); }
.auth-card { width: min(460px, 100%); }

.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.modal-subject-tag { display: inline-block; font-size: 0.76rem; font-weight: 700; color: var(--brand-cobalt); margin-bottom: 4px; }
.modal-head h2 { margin: 0; font-size: 1.28rem; font-weight: 800; }
.modal-desc { margin: 0 0 18px; font-size: 0.9rem; color: var(--ink-muted); }

.modal-modes { display: flex; flex-direction: column; gap: 10px; margin-bottom: 18px; }
.modal-mode-opt { display: flex; align-items: center; gap: 14px; padding: 13px 15px; border-radius: 14px; border: 2px solid var(--border-subtle); background: var(--surface-solid); cursor: pointer; transition: border-color 160ms, background-color 160ms; }
.modal-mode-opt:hover { border-color: var(--brand-cobalt); }
.modal-mode-opt.selected { border-color: var(--brand-cobalt); background: var(--brand-cobalt-soft); }
.modal-mode-opt strong { display: block; font-size: 0.94rem; }
.modal-mode-opt span { font-size: 0.8rem; color: var(--ink-muted); }

.modal-options-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: center; margin-bottom: 22px; }
.assigned-time-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 13px;
  border-radius: 11px;
  background: var(--surface-subtle);
  border: 1.5px solid var(--border-strong);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink-primary);
  width: 100%;
}

.checkbox-col { display: flex; flex-direction: column; gap: 8px; margin-bottom: 0; }
.toggle-check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.86rem; font-weight: 600; cursor: pointer; }
.toggle-check input { width: 16px; height: 16px; accent-color: var(--brand-cobalt); }
.modal-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

.auth-error { padding: 10px 12px; border-radius: 10px; background: var(--semantic-rose-soft); color: var(--semantic-rose); font-size: 0.84rem; font-weight: 600; margin-bottom: 12px; }

.profile-preview-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px;
  border-radius: 14px;
  background: var(--surface-subtle);
  margin-bottom: 16px;
}
.profile-avatar-large {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--brand-cobalt);
  color: #fff;
  font-size: 1.45rem;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
  border: 3px solid var(--surface-solid);
  box-shadow: 0 6px 16px rgba(15, 23, 42, 0.12);
}
.profile-avatar-large.is-admin { background: var(--accent-coral); }
.profile-avatar-large img { width: 100%; height: 100%; object-fit: cover; }
.profile-upload-col { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }

.avatar-presets {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.avatar-preset-btn {
  height: 52px;
  border-radius: 14px;
  border: 2px solid transparent;
  background: var(--surface-solid);
  padding: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
  transition: transform 150ms var(--ease-spring), box-shadow 150ms, border-color 150ms;
}
.avatar-preset-btn svg {
  width: 30px;
  height: 30px;
  display: block;
}
.avatar-preset-btn:hover { transform: translateY(-2px) scale(1.04); }
.avatar-preset-btn.selected {
  border-color: var(--ink-primary);
  box-shadow: 0 0 0 3px var(--brand-cobalt-soft);
}

.user-avatar svg,
.podium-avatar svg,
.lb-mini-avatar svg,
.profile-avatar-large svg {
  width: 68%;
  height: 68%;
  display: block;
}

.chat-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 85;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 20px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: linear-gradient(135deg, var(--brand-cobalt), #0284c7);
  color: #fff;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 16px 36px -6px rgba(37, 99, 235, 0.5);
  transition: transform 200ms var(--ease-spring), opacity 180ms;
}
.chat-fab:hover { transform: translateY(-3px) scale(1.03); }
.chat-fab:active { transform: scale(0.95); }
.chat-fab-ring { position: absolute; inset: -4px; border-radius: inherit; border: 2px solid var(--brand-cobalt); opacity: 0.45; animation: fabPulse 2.6s ease-out infinite; pointer-events: none; }
@keyframes fabPulse { 0% { transform: scale(1); opacity: 0.5; } 100% { transform: scale(1.16); opacity: 0; } }

.tutor-drawer {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 95;
  width: min(430px, calc(100vw - 28px));
  height: min(630px, calc(100vh - 104px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  background: rgba(255, 255, 255, 0.97);
  animation: tutorSlideIn 280ms var(--ease-out-expo);
}
@keyframes tutorSlideIn { from { opacity: 0; transform: translateY(20px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

.tutor-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border-subtle); background: var(--surface-solid); }
.tutor-title-wrap { display: flex; align-items: center; gap: 10px; }
.tutor-avatar { width: 36px; height: 36px; border-radius: 12px; background: linear-gradient(135deg, var(--brand-cobalt), var(--accent-coral)); color: #fff; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.tutor-head h2 { margin: 0; font-size: 0.96rem; font-weight: 800; }
.tutor-status { font-size: 0.72rem; font-weight: 600; color: var(--semantic-mint); }
.tutor-head-btns { display: flex; gap: 5px; }

.tutor-context-bar { padding: 10px 14px; background: var(--surface-subtle); border-bottom: 1px solid var(--border-subtle); }
.tutor-ctx-row { display: flex; align-items: center; gap: 8px; color: var(--brand-cobalt); }
.tutor-ctx-row select { padding: 6px 10px; font-size: 0.8rem; font-weight: 700; border-radius: 9px; }
.tutor-active-q { margin-top: 7px; padding: 7px 10px; border-radius: 8px; background: var(--surface-solid); border-left: 3px solid var(--accent-coral); font-size: 0.78rem; line-height: 1.45; color: var(--ink-secondary); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.tutor-messages { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.chat-msg { max-width: 88%; padding: 11px 14px; border-radius: 15px; font-size: 0.88rem; line-height: 1.52; white-space: pre-wrap; animation: viewEnter 200ms var(--ease-out-expo); }
.chat-msg.reply { align-self: flex-start; background: var(--surface-solid); border: 1px solid var(--border-subtle); border-bottom-left-radius: 5px; color: var(--ink-primary); }
.chat-msg.user { align-self: flex-end; background: var(--brand-cobalt); color: #fff; border-bottom-right-radius: 5px; }

.typing-dots { display: inline-flex; gap: 5px; align-items: center; padding: 4px 2px; }
.typing-dots span { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-cobalt); animation: dotBounce 1.1s infinite ease-in-out; }
.typing-dots span:nth-child(2) { animation-delay: 0.16s; }
.typing-dots span:nth-child(3) { animation-delay: 0.32s; }
@keyframes dotBounce { 0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; } 40% { transform: scale(1); opacity: 1; } }

.tutor-quick-prompts { display: flex; gap: 6px; padding: 8px 12px; overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--border-subtle); background: var(--surface-subtle); }
.tutor-quick-prompts::-webkit-scrollbar { display: none; }
.qp-chip { flex-shrink: 0; padding: 5px 10px; border-radius: var(--radius-pill); border: 1px solid var(--border-subtle); background: var(--surface-solid); color: var(--ink-secondary); font-family: inherit; font-size: 0.75rem; font-weight: 700; cursor: pointer; }
.qp-chip:hover { border-color: var(--brand-cobalt); color: var(--brand-cobalt); }

.tutor-composer { display: flex; gap: 8px; padding: 10px 12px; background: var(--surface-solid); border-top: 1px solid var(--border-subtle); }
.tutor-composer input { flex: 1; padding: 9px 12px; font-size: 0.86rem; }

.toast-container { position: fixed; top: 84px; right: 22px; z-index: 140; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { display: inline-flex; align-items: center; gap: 10px; padding: 12px 18px; border-radius: 14px; background: var(--ink-primary); color: var(--surface-solid); font-size: 0.88rem; font-weight: 600; box-shadow: 0 14px 32px rgba(15, 23, 42, 0.24); pointer-events: auto; animation: toastIn 260ms var(--ease-out-expo); }
.toast.success { background: var(--semantic-mint); color: #fff; }
.toast.error { background: var(--semantic-rose); color: #fff; }
.toast.info { background: var(--brand-cobalt); color: #fff; }

.empty-state { text-align: center; padding: 52px 24px; color: var(--ink-muted); }
.empty-state.compact { padding: 36px 18px; }
.empty-state h3 { margin: 14px 0 6px; color: var(--ink-primary); }
.empty-state p { margin: 0 0 18px; max-width: 44ch; margin-inline: auto; font-size: 0.9rem; }

@keyframes microShake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 55% { transform: translateX(5px); } 80% { transform: translateX(-3px); } }
@keyframes popIn { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalPop { from { opacity: 0; transform: translateY(14px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; gap: 32px; padding-top: 8px; }
  .modes-bento, .podium-grid { grid-template-columns: 1fr; }
  .quiz-arena-grid { grid-template-columns: 1fr; }
  .quiz-sidebar { position: static; }
  .result-hero { grid-template-columns: 1fr; text-align: center; }
  .result-actions { justify-content: center; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .top-nav { height: auto; padding: 10px 0; }
  .nav-inner { flex-wrap: wrap; }
  .nav-tabs { order: 3; width: 100%; overflow-x: auto; justify-content: space-between; }
  .nav-tab { padding: 7px 10px; font-size: 0.8rem; }
  .user-meta { display: none; }
  .mini-options, .vp-opts, .form-grid-2, .form-grid-3, .modal-options-row { grid-template-columns: 1fr; }
  .result-stats-row { grid-template-columns: repeat(2, 1fr); }
  .question-card { padding: 20px; }
  .kbd-hint { display: none; }
  .hero-metrics { width: 100%; justify-content: space-around; gap: 12px; }
  .tf-row { flex-direction: column; align-items: stretch; }
  .tf-actions { justify-content: flex-end; }
  .sa-input-row { flex-direction: column; align-items: stretch; }
  .chat-fab { right: 14px; bottom: 14px; padding: 11px 15px; }
  .tutor-drawer { right: 10px; bottom: 10px; width: calc(100vw - 20px); height: calc(100vh - 90px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto !important; }
  .aurora-orb, .glass-specular, .floating-badge, .scan-beam, .chat-fab-ring {
    animation: none !important;
    transform: none !important;
  }
}

.az-stepper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 20px;
  margin-bottom: 22px;
}

.az-step {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  border: none;
  background: transparent;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 12px;
  color: var(--ink-muted);
  transition: background-color 160ms, color 160ms;
}
.az-step:hover { background: var(--surface-subtle); }
.az-step.active { color: var(--brand-cobalt); }
.az-step.done { color: var(--semantic-mint); }

.az-step-num {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-subtle);
  color: var(--ink-secondary);
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 0.88rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.az-step.active .az-step-num { background: var(--brand-cobalt); color: #fff; }
.az-step.done .az-step-num { background: var(--semantic-mint); color: #fff; }

.az-step-text strong { display: block; font-size: 0.9rem; font-weight: 800; line-height: 1.2; }
.az-step-text span { font-size: 0.76rem; color: var(--ink-muted); }

.az-step-line {
  flex: 1;
  height: 2px;
  background: var(--border-subtle);
  min-width: 24px;
}

.az-upload-card {
  max-width: 860px;
  margin-inline: auto;
  padding: 26px;
}

.az-source-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.az-src-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  border-radius: 11px;
  border: 1.5px solid var(--border-subtle);
  background: var(--surface-solid);
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
}
.az-src-tab.active {
  border-color: var(--brand-cobalt);
  background: var(--brand-cobalt-soft);
  color: var(--brand-cobalt);
}

.az-dropzone {
  padding: 40px 24px;
}
.az-upload-circle {
  width: 60px;
  height: 60px;
  border-radius: 18px;
  background: var(--brand-cobalt-soft);
  color: var(--brand-cobalt);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}
.az-drop-main { margin: 0 0 6px; font-size: 1.05rem; }
.az-quick-links { display: flex; justify-content: center; margin-top: 8px; }

.az-manual-box {
  text-align: center;
  padding: 36px 20px;
  border-radius: 16px;
  background: var(--surface-subtle);
}
.az-manual-box h3 { margin: 0 0 8px; font-size: 1.15rem; }
.az-manual-box p { margin: 0 0 18px; color: var(--ink-muted); max-width: 52ch; margin-inline: auto; font-size: 0.92rem; }

.az-step1-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}
.az-foot-hint { font-size: 0.84rem; color: var(--ink-muted); }

.az-review-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 18px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.az-summary-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.az-stat-pill {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--surface-solid);
  border: 1px solid var(--border-subtle);
  font-size: 0.82rem;
  font-weight: 700;
}
.az-stat-pill.p1 { color: var(--brand-cobalt); }
.az-stat-pill.p2 { color: var(--semantic-amber); }
.az-stat-pill.p3 { color: var(--semantic-mint); }
.az-review-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.az-step2-grid {
  display: grid;
  grid-template-columns: 1fr 290px;
  gap: 20px;
  align-items: start;
}
.az-step2-main { padding: 20px; }
.az-q-list { max-height: 68vh; }

.az-step2-side {
  padding: 20px;
  position: sticky;
  top: 90px;
}
.az-step2-side h3 { margin: 0 0 12px; font-size: 0.96rem; font-weight: 800; }
.az-nav-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 7px;
  margin-bottom: 18px;
}
.az-add-section {
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  margin-bottom: 18px;
}
.az-add-stack { display: flex; flex-direction: column; gap: 7px; }
.az-side-actions { display: flex; flex-direction: column; gap: 8px; }

.az-settings-card {
  max-width: 780px;
  margin-inline: auto;
  padding: 28px;
}
.az-settings-head { margin-bottom: 22px; }
.az-settings-head h2 { margin: 0 0 4px; font-size: 1.35rem; font-weight: 900; }
.az-settings-head p { margin: 0; color: var(--ink-muted); font-size: 0.92rem; }

.az-time-presets { display: flex; gap: 8px; align-items: center; }
.az-time-presets input { width: 92px; flex-shrink: 0; font-family: var(--font-mono); font-weight: 800; }
.az-time-chips { display: flex; gap: 5px; flex-wrap: wrap; }

.az-publish-summary {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--brand-cobalt-soft);
  border-left: 4px solid var(--brand-cobalt);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-primary);
}

.az-settings-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}
.az-publish-btns { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 960px) {
  .az-stepper { flex-direction: column; align-items: stretch; }
  .az-step-line { display: none; }
  .az-step2-grid { grid-template-columns: 1fr; }
  .az-step2-side { position: static; }
}

.az-json-guide {
  margin-top: 18px;
  padding: 22px 24px;
}
.az-json-guide-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.az-json-guide-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--ink-primary);
  margin: 0 0 4px;
}
.az-json-guide-sub {
  margin: 0;
  font-size: 0.86rem;
  color: var(--ink-secondary);
}
.az-json-guide-sub code,
.az-json-pills code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(37, 99, 235, 0.08);
  color: var(--brand-cobalt);
}
.az-json-guide-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.az-json-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.az-json-pre {
  margin: 0;
  padding: 16px 18px;
  border-radius: 14px;
  background: #0f172a;
  color: #e2e8f0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  line-height: 1.55;
  max-height: 300px;
  overflow: auto;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.members-card {
  max-width: 620px;
  width: 94vw;
}
.members-sub {
  margin: 0 0 14px;
  font-size: 0.86rem;
  color: var(--ink-secondary);
}
.members-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 56vh;
  overflow-y: auto;
  padding-right: 4px;
}
.member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border-subtle);
}
.member-info {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 170px;
}
.member-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.member-user-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.member-handle {
  font-size: 0.78rem;
  font-family: var(--font-mono);
  color: var(--ink-muted);
}
.member-role-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(100, 116, 139, 0.12);
  color: var(--ink-secondary);
}
.member-role-badge.leader {
  background: rgba(245, 158, 11, 0.16);
  color: #b45309;
}
.member-role-badge.admin {
  background: rgba(37, 99, 235, 0.14);
  color: var(--brand-cobalt);
}
.member-edit-form {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}
.member-nick-input {
  flex: 1;
  min-width: 0;
  padding: 7px 11px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: #fff;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-primary);
}
.member-nick-input:focus {
  outline: none;
  border-color: var(--brand-cobalt);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
@media (max-width: 560px) {
  .member-row {
    flex-direction: column;
    align-items: stretch;
  }
}


.hist-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.hist-tabs {
  display: inline-flex;
  background: var(--surface-subtle);
  padding: 4px;
  border-radius: 12px;
  gap: 4px;
}
.hist-tab {
  border: none;
  background: transparent;
  padding: 8px 16px;
  border-radius: 9px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--ink-secondary);
  cursor: pointer;
  transition: all 160ms var(--ease-out-expo);
}
.hist-tab.active {
  background: #fff;
  color: var(--brand-cobalt);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}
.hist-filter-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hist-filter-right select {
  padding: 7px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: #fff;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--ink-primary);
}
.hist-row-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.hist-member-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--brand-cobalt);
}
.attempt-card {
  max-width: 780px;
  width: 95vw;
}
.attempt-meta-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.attempt-meta-chip {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--surface-subtle);
  color: var(--ink-primary);
}
.attempt-meta-chip.score {
  background: rgba(37, 99, 235, 0.12);
  color: var(--brand-cobalt);
}
.attempt-review-scroll {
  max-height: 58vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-right: 4px;
}


.modal-card { max-height: 92vh; max-height: 92dvh; overflow-y: auto; }
.lb-table { min-width: 720px; }
.nav-tabs { scrollbar-width: none; }
.nav-tabs::-webkit-scrollbar { display: none; }
.hist-row > div:first-child { min-width: 0; }
.hist-row-title { overflow-wrap: anywhere; }

@media (max-width: 760px) {
  .container { width: calc(100% - 24px); }
  .page-header.row-between { flex-direction: column; align-items: stretch; gap: 12px; }
  .header-tools { width: 100%; }
  .header-tools .btn { flex: 1 1 auto; justify-content: center; }
  .filter-bar { flex-direction: column; align-items: stretch; gap: 10px; }
  .subject-chips { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; scrollbar-width: none; }
  .subject-chips::-webkit-scrollbar { display: none; }
  .subject-chips .chip { flex-shrink: 0; }
  .deck-grid { grid-template-columns: 1fr; }
  .lb-table-wrap { padding: 12px; }
  .podium-card { padding: 16px; }
  .history-list-wrap { padding: 16px; }
  .hist-row { flex-direction: column; align-items: stretch; }
  .hist-row-right { justify-content: space-between; flex-wrap: wrap; }
  .hist-toolbar { flex-direction: column; align-items: stretch; }
  .hist-tabs { display: flex; }
  .hist-tab { flex: 1; padding: 9px 8px; }
  .hist-filter-right { flex-wrap: wrap; }
  .hist-filter-right select { flex: 1; min-width: 0; }
  .modal-card { padding: 18px; border-radius: 20px; }
  .modal-footer { flex-wrap: wrap; gap: 8px; }
  .modal-footer .btn { flex: 1 1 auto; justify-content: center; }
  .attempt-review-scroll, .members-list { max-height: 60vh; max-height: 60dvh; }
  .member-info { min-width: 0; }
  .az-upload-card, .az-json-guide { padding: 16px; }
  .az-json-guide-actions { width: 100%; }
  .az-json-guide-actions .btn { flex: 1 1 auto; justify-content: center; }
  .az-json-pre { font-size: 0.74rem; max-height: 220px; }
  .az-source-tabs { flex-direction: column; }
  .az-step1-footer { flex-direction: column; align-items: stretch; }
  .az-publish-btns { flex-direction: column; }
  .az-publish-btns .btn, .az-step1-footer .btn { width: 100%; justify-content: center; }
  .quiz-topbar { flex-wrap: wrap; gap: 10px; }
  .option-btn { padding: 14px; }
  .option-btn:hover:not(:disabled) { transform: none; }
  .tutor-drawer { height: calc(100vh - 90px); height: calc(100dvh - 90px); }
  .toast-container { top: auto; bottom: 78px; right: 12px; left: 12px; align-items: stretch; }
  .nav-actions { gap: 6px; }
  .streak-pill { padding: 5px 9px; }
}

@media (max-width: 480px) {
  .brand-logo { font-size: 0; gap: 0; }
  .hero-title { font-size: clamp(1.7rem, 8vw, 2.2rem); }
  .kpi-grid { gap: 10px; }
  .result-stats-row { gap: 10px; }
  .palette-grid { gap: 6px; }
}

@media (hover: none) and (pointer: coarse) {
  .btn, .chip, .icon-btn, .nav-tab, .hist-tab, .qp-chip { min-height: 40px; }
  input, select, textarea { font-size: 16px; }
  .mode-card:hover, .btn:hover:not(:disabled), .icon-btn:hover { transform: none; }
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 26px 16px 34px;
  font-size: 0.84rem;
  color: var(--ink-muted);
}
.site-footer strong { color: var(--brand-cobalt); font-weight: 800; }
.site-footer-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--ink-muted); opacity: 0.5; }

@media (max-width: 760px) {
  .search-box { width: 100%; min-width: 0; flex: none; }
  .search-box input { min-width: 0; }
  .lb-filter-group { min-width: 0; width: 100%; flex-wrap: wrap; gap: 6px; }
  .lb-filter-group select { max-width: none; flex: 1 1 100%; min-width: 0; }
  .hist-filter-right { width: 100%; }
  .hist-filter-right select { flex: 1 1 100%; }
  .hist-filter-right .btn { width: 100%; justify-content: center; }
  .modal-backdrop { padding: 10px; }
  .modal-desc { margin-bottom: 12px; }
  .modal-mode-opt { padding: 10px 12px; gap: 10px; }
  .modal-options-row { gap: 10px; margin-bottom: 14px; }
  .modal-footer { position: sticky; bottom: -18px; background: #fff; padding: 10px 0 2px; margin-top: 4px; }
}
