/* ═══════════════════════════════════════════════════
   Motion Quiz Studio — Green Finance Edition
   Clean Light + Dark Mode
   ═══════════════════════════════════════════════════ */

/* ── Design Tokens ── */
:root {
  --bg-base: #F9FAFB;
  --bg-elevated: #F3F4F6;
  --bg-card: #FFFFFF;
  --bg-card-solid: #FFFFFF;
  --bg-input: #F3F4F6;
  --bg-hover: #F0FDF4;
  --bg-sidebar: #FFFFFF;

  --text-primary: #111827;
  --text-secondary: #6B7280;
  --text-muted: #9CA3AF;
  --text-inverse: #FFFFFF;

  --border-default: #E5E7EB;
  --border-hover: #D1D5DB;
  --border-active: rgba(20, 125, 100, 0.4);

  --accent: #147D64;
  --accent-2: #0D7377;
  --accent-light: #32A588;
  --accent-glow: rgba(20, 125, 100, 0.15);
  --gradient-accent: linear-gradient(135deg, #147D64 0%, #0D7377 100%);
  --gradient-accent-hover: linear-gradient(135deg, #32A588 0%, #147D64 100%);
  --gradient-bg: linear-gradient(160deg, #F9FAFB 0%, #F0FDF4 40%, #E6F4F1 100%);

  --success: #10B981;
  --success-bg: #E6F4F1;
  --warning: #FACC15;
  --warning-bg: #FEF9C3;
  --danger: #EF4444;
  --danger-bg: #FEF2F2;
  --info: #3B82F6;
  --info-bg: #EFF6FF;

  --gold: #EAB308;
  --gold-bg: #FEF9C3;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.05);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.08);
  --shadow-glow: 0 0 32px rgba(20, 125, 100, 0.08);

  --sidebar-width: 72px;
  --navbar-height: 56px;

  --font: "Inter", "SF Pro Display", "PingFang SC", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0, 0, 0.2, 1);
}

/* ── Dark Theme ── */
[data-theme="dark"] {
  --bg-base: #0a0e1a;
  --bg-elevated: #111527;
  --bg-card: rgba(22, 27, 48, 0.72);
  --bg-card-solid: #161b30;
  --bg-input: rgba(15, 18, 30, 0.65);
  --bg-hover: rgba(30, 36, 58, 0.8);
  --bg-sidebar: rgba(13, 16, 28, 0.85);

  --text-primary: #e8ecf4;
  --text-secondary: #8b93a8;
  --text-muted: #5a6278;
  --text-inverse: #0a0e1a;

  --border-default: rgba(255, 255, 255, 0.06);
  --border-hover: rgba(255, 255, 255, 0.12);
  --border-active: rgba(50, 165, 136, 0.4);

  --accent-glow: rgba(20, 125, 100, 0.25);
  --gradient-bg: linear-gradient(160deg, #0a0e1a 0%, #111527 40%, #0f1325 100%);

  --success-bg: rgba(16, 185, 129, 0.1);
  --warning-bg: rgba(250, 204, 21, 0.1);
  --danger-bg: rgba(239, 68, 68, 0.1);
  --info-bg: rgba(59, 130, 246, 0.1);
  --gold-bg: rgba(234, 179, 8, 0.1);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.5);
  --shadow-glow: 0 0 32px rgba(20, 125, 100, 0.12);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scrollbar-width: thin;
  scrollbar-color: #D1D5DB transparent;
}
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #D1D5DB; border-radius: 999px; }
::-webkit-scrollbar-thumb:hover { background: #9CA3AF; }

body {
  min-height: 100vh;
  color: var(--text-primary);
  background: var(--bg-base);
  background-image: var(--gradient-bg);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ── Ambient Background Orbs ── */
.bg-orbs {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
  animation: orbFloat 22s ease-in-out infinite;
  will-change: transform;
  opacity: 0.5;
}
.bg-orb-1 { width: 550px; height: 550px; background: rgba(20,125,100,0.06); top: -12%; left: -8%; animation-delay: 0s; }
.bg-orb-2 { width: 450px; height: 450px; background: rgba(13,115,119,0.05); top: 55%; right: -10%; animation-delay: -8s; }
.bg-orb-3 { width: 400px; height: 400px; background: rgba(50,165,136,0.04); bottom: -8%; left: 35%; animation-delay: -15s; }
.bg-orb-4 { width: 350px; height: 350px; background: rgba(250,204,21,0.03); top: 25%; left: 55%; animation-delay: -4s; }

@keyframes orbFloat {
  0%, 100% { transform: translate(0,0) scale(1); }
  25% { transform: translate(35px,-25px) scale(1.08); }
  50% { transform: translate(-15px,18px) scale(0.94); }
  75% { transform: translate(-28px,-15px) scale(1.04); }
}

/* ── Starfield ── */
#starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.star {
  position: absolute;
  border-radius: 50%;
  background: var(--accent-light);
  animation: twinkle var(--dur, 4s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  opacity: 0;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.1; }
  50% { opacity: 0.4; }
}

/* ═══════════════════════════════════════════════════
   APP SHELL LAYOUT
   ═══════════════════════════════════════════════════ */
#appShell {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  z-index: 200;
  width: var(--sidebar-width);
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 8px 16px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-default);
  backdrop-filter: blur(24px) saturate(1.8);
  -webkit-backdrop-filter: blur(24px) saturate(1.8);
  transition: transform .3s var(--ease);
}

.sidebar-logo {
  display: grid;
  width: 44px; height: 44px;
  place-items: center;
  margin-bottom: 24px;
  border-radius: 12px;
  background: var(--gradient-accent);
  color: #fff;
  font-size: 19px;
  font-weight: 900;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.sidebar-logo .logo-mark { display: none; }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  width: 100%;
}

.sidebar-item {
  display: grid;
  width: 100%;
  height: 48px;
  place-items: center;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0;
  font-family: var(--font);
  transition: all .2s var(--ease);
  position: relative;
}
.sidebar-item:hover {
  background: var(--bg-hover);
  color: var(--accent);
}
.sidebar-item.active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 4px 12px var(--accent-glow);
}
.sidebar-item.active::before { display: none; }

.sidebar-item[data-tooltip] {
  position: relative;
}
.sidebar-item[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 300;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  background: var(--text-primary);
  color: var(--text-inverse);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s var(--ease), transform .2s var(--ease);
  transform: translateY(-50%) translateX(-6px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.sidebar-item[data-tooltip]:hover::after {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.sidebar-icon {
  display: inline-flex;
  width: 24px;
  height: 24px;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.sidebar-user {
  display: grid;
  width: 40px; height: 40px;
  place-items: center;
  margin-bottom: 8px;
  border-radius: 10px;
  background: var(--gradient-accent);
  color: #fff;
  font-size: 14px;
  font-weight: 800;
}

.sidebar-user-info { display: none; }
.sidebar-user-name { display: none; }
.sidebar-user-role { display: none; }

.sidebar-footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding-top: 14px;
  border-top: 1px solid var(--border-default);
  width: 100%;
}

/* ── Quiz fullscreen: hide sidebar + navbar ── */
#appShell.quiz-fullscreen .sidebar { display: none; }
#appShell.quiz-fullscreen .navbar { display: none; }
#appShell.quiz-fullscreen .main-content { margin-left: 0; }
#appShell.quiz-fullscreen .quiz-layout { min-height: 100vh; padding: 12px; }
#appShell.quiz-fullscreen .quiz-main { max-height: 100vh; }
#appShell.quiz-fullscreen .quiz-sidebar { max-height: 100vh; }
#appShell.quiz-fullscreen .quiz-pose-panel { max-height: 100vh; }

/* ── MAIN CONTENT AREA ── */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── TOP NAVBAR ── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--navbar-height);
  background: rgba(255,255,255,0.8);
  border-bottom: 1px solid var(--border-default);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
}
[data-theme="dark"] .navbar {
  background: rgba(13,16,28,0.85);
}

.navbar::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 5%; right: 5%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-light), var(--accent), transparent);
  opacity: 0.3;
}

.navbar-container {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  padding: 0 24px;
}

.btn-back {
  display: none;
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border-default);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
}
.btn-back:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--bg-hover);
}

.navbar-brand {
  display: none;
  align-items: center;
  gap: 9px;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 800;
}
.navbar-brand .brand-mark {
  display: grid;
  width: 32px; height: 32px;
  place-items: center;
  border-radius: 8px;
  background: var(--gradient-accent);
  color: #fff;
  font-size: 14px;
  font-weight: 900;
}

.nav-tabs {
  display: none;
}

.navbar-menu {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}
.nav-user {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 5px 10px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}
.navbar-menu button { font-size: 12px; }

/* ═══════════════════════════════════════════════════
   BUTTONS
   ═══════════════════════════════════════════════════ */
.btn-primary, .btn-outline, .btn-ghost, .btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: all .25s var(--ease);
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  border-color: transparent;
  background: var(--gradient-accent);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}
.btn-primary:hover {
  background: var(--gradient-accent-hover);
  box-shadow: 0 6px 20px var(--accent-glow);
  transform: translateY(-2px);
}
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  opacity: 0.35;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.btn-outline {
  border-color: var(--border-hover);
  background: var(--bg-card);
  color: var(--text-primary);
}
.btn-outline:hover {
  border-color: var(--accent);
  background: var(--bg-hover);
  color: var(--accent);
  box-shadow: 0 0 16px rgba(20,125,100,0.06);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text-primary); }

.btn-danger {
  border-color: rgba(239,68,68,0.3);
  background: var(--danger-bg);
  color: var(--danger);
}
.btn-danger:hover {
  border-color: rgba(239,68,68,0.5);
  background: rgba(239,68,68,0.12);
}

.btn-sm { min-height: 30px; padding: 5px 12px; font-size: 12px; border-radius: var(--radius-sm); }
.btn-xs { min-height: 26px; padding: 3px 9px; font-size: 11px; border-radius: var(--radius-sm); }

.theme-toggle {
  width: 34px; height: 34px; padding: 0 !important;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; border-radius: var(--radius-sm) !important;
}

/* ═══════════════════════════════════════════════════
   VIEWS
   ═══════════════════════════════════════════════════ */
.view {
  display: none;
  animation: viewIn .35s var(--ease-out) both;
  padding: 0;
}
.view.active { display: block; }

@keyframes viewIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════
   LOGIN
   ═══════════════════════════════════════════════════ */
.login-shell {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  padding: 44px 40px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  box-shadow: var(--shadow-lg);
  animation: cardReveal .5s var(--ease-spring) both;
  transition: transform .3s var(--ease), opacity .3s var(--ease);
}
@keyframes cardReveal {
  from { opacity: 0; transform: translateY(28px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.login-card::before {
  content: "";
  position: absolute;
  top: 0; left: 12%; right: 12%;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent), var(--accent-light), transparent);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 32px;
}
.login-brand .brand-mark {
  display: grid;
  width: 44px; height: 44px;
  place-items: center;
  border-radius: 12px;
  background: var(--gradient-accent);
  color: #fff;
  font-size: 20px;
  font-weight: 900;
  flex-shrink: 0;
}
.login-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}
.login-subtitle {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 500;
}

.login-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 26px;
  padding: 4px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  background: var(--bg-input);
}
.login-tab {
  flex: 1;
  min-height: 36px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all .2s var(--ease);
}
.login-tab.active {
  background: var(--bg-card);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-field { display: flex; flex-direction: column; gap: 5px; }
.auth-field label { color: var(--text-secondary); font-size: 14px; font-weight: 500; }
.auth-field input {
  min-height: 48px;
  padding: 11px 15px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: all .25s var(--ease);
  width: 100%;
}
.auth-field input::placeholder { color: var(--text-muted); }
.auth-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20,125,100,0.1);
}
.auth-field.error input {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239,68,68,0.1);
  animation: inputShake .5s var(--ease);
}
@keyframes inputShake {
  0%, 100% { transform: translateX(0); }
  10%, 50%, 90% { transform: translateX(-4px); }
  30%, 70% { transform: translateX(4px); }
}
.password-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}
.password-wrapper input {
  padding-right: 44px;
}
.toggle-password {
  position: absolute;
  right: 4px; top: 50%;
  transform: translateY(-50%);
  width: 36px; height: 36px;
  border: 0; border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s;
}
.toggle-password:hover { color: var(--text-secondary); }
.auth-error { min-height: 18px; color: var(--danger); font-size: 13px; font-weight: 600; }
.auth-error.success { color: var(--success); }
.auth-submit {
  min-height: 50px;
  font-size: 16px;
  font-weight: 700;
  margin-top: 2px;
  border-radius: var(--radius);
  background: var(--gradient-accent);
  border: 0;
  color: #fff;
  cursor: pointer;
  transition: all .2s var(--ease);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.auth-submit:hover { opacity: 0.92; transform: translateY(-1px); box-shadow: 0 4px 20px var(--accent-glow); }
.auth-submit:active { transform: translateY(0) scale(0.98); }
.auth-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }
.submit-spinner { font-size: 18px; }
.auth-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 20px;
}
.auth-link {
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color .2s;
}
.auth-link:hover { color: var(--accent); }

/* ═══════════════════════════════════════════════════
   HOME PAGE
   ═══════════════════════════════════════════════════ */
.home-shell {
  max-width: 1080px;
  margin: 0 auto;
  padding: 40px 28px 64px;
}

.home-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 56px;
  align-items: center;
  min-height: 420px;
  padding: 10px 0 40px;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  padding: 5px 12px;
  border: 1px solid rgba(20,125,100,0.2);
  border-radius: 999px;
  background: var(--success-bg);
}
.hero-kicker::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: livePulse 2s ease-in-out infinite;
}
@keyframes livePulse {
  0%, 100% { box-shadow: 0 0 6px var(--success); }
  50% { box-shadow: 0 0 14px var(--success); }
}

.home-hero h1 {
  max-width: 520px;
  margin: 18px 0 20px;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.home-hero p {
  max-width: 460px;
  margin: 0;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1.7;
}
.hero-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 30px;
}

/* Hero stage illustration */
.hero-stage {
  position: relative;
  min-height: 400px;
  perspective: 1200px;
}
.stage-screen {
  position: absolute;
  inset: 0 0 20px 20px;
  overflow: hidden;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  background: linear-gradient(145deg, #0D7377, #147D64);
  box-shadow: var(--shadow-lg), 0 0 50px rgba(20,125,100,0.08);
  transform: rotateY(-3deg) rotateX(2deg);
  transition: transform .5s var(--ease-out);
}
.stage-screen:hover { transform: rotateY(0) rotateX(0); }

.stage-camera {
  position: absolute;
  left: 34px; top: 44px;
  width: 160px; height: 210px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.05);
}
.stage-camera::before {
  content: "LIVE";
  position: absolute;
  top: 10px; left: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(16,185,129,0.2);
  border: 1px solid rgba(16,185,129,0.3);
  color: #6ee7b7;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .05em;
  animation: livePulse 2s ease-in-out infinite;
}

.pose-head, .pose-body, .pose-arm {
  position: absolute;
  left: 50%;
  background: rgba(255,255,255,0.7);
  transform: translateX(-50%);
  box-shadow: 0 0 12px rgba(255,255,255,0.3);
}
.pose-head { top: 50px; width: 34px; height: 34px; border-radius: 50%; }
.pose-body { top: 90px; width: 10px; height: 80px; border-radius: 999px; }
.pose-arm { top: 92px; width: 72px; height: 9px; border-radius: 999px; }
.pose-arm-left { transform: translateX(-85%) rotate(-32deg); }
.pose-arm-right { transform: translateX(15%) rotate(30deg); }

.stage-question {
  position: absolute;
  right: 32px; top: 50px;
  width: 240px;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.15);
  backdrop-filter: blur(20px);
}
.stage-chip {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
}
.stage-line {
  height: 10px; width: 65%;
  margin-top: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
}
.stage-line.wide { width: 100%; margin-top: 16px; }
.stage-options {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 9px;
  margin-top: 22px;
}
.stage-options span {
  display: grid;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius);
  color: rgba(255,255,255,0.7);
  font-weight: 900;
  background: rgba(255,255,255,0.06);
  transition: all .2s var(--ease);
}
.stage-options .active {
  border-color: var(--warning);
  background: var(--warning);
  color: #111827;
  box-shadow: 0 0 16px rgba(250,204,21,0.3);
}
.stage-card {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 120px;
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-lg);
  background: rgba(255,255,255,0.1);
  backdrop-filter: blur(16px);
}
.stage-card span { color: rgba(255,255,255,0.6); font-size: 10px; font-weight: 800; }
.stage-card strong { font-size: 34px; font-weight: 900; line-height: 1; }
.score-card { right: 16px; bottom: 36px; }
.score-card strong { color: var(--warning); text-shadow: 0 0 18px rgba(250,204,21,0.3); }
.gesture-card { left: 0; bottom: 60px; }
.gesture-card strong { color: #fff; text-shadow: 0 0 18px rgba(255,255,255,0.2); }

/* Home stats */
.home-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 8px 0 30px;
}
.home-stats div {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 80px;
  padding: 20px 24px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  cursor: default;
  transition: all .3s var(--ease);
  overflow: hidden;
}
.home-stats div::after {
  content: "";
  position: absolute;
  top: 0; right: 0;
  width: 100px; height: 100px;
  border-radius: 50%;
  background: var(--success-bg);
  transform: translate(30%, -30%);
  pointer-events: none;
}
.home-stats div:hover {
  transform: translateY(-3px);
  border-color: var(--border-active);
  box-shadow: var(--shadow);
}
.home-stats strong {
  position: relative; z-index: 1;
  color: var(--accent);
  font-size: 28px; font-weight: 700;
}
.home-stats span {
  position: relative; z-index: 1;
  color: var(--text-primary);
  font-weight: 600; font-size: 15px;
}

/* User section */
#viewHome .user-section {
  max-width: none;
  padding: 26px 28px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  box-shadow: var(--shadow);
}
#viewHome .section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
}
#viewHome .section-head h3 { margin: 0; font-size: 18px; font-weight: 600; }
#viewHome .section-head p { margin: 3px 0 0; color: var(--text-secondary); font-size: 14px; }
.section-eyebrow { color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }

/* ═══════════════════════════════════════════════════
   USER CARDS
   ═══════════════════════════════════════════════════ */
.user-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
#viewHome .user-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.user-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 76px;
  padding: 14px 16px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  background: var(--bg-card);
  cursor: pointer;
  transition: all .3s var(--ease);
  overflow: hidden;
}
.user-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(20,125,100,0.04), rgba(50,165,136,0.02));
  opacity: 0;
  transition: opacity .3s var(--ease);
}
.user-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-active);
  box-shadow: var(--shadow);
}
.user-card:hover::before { opacity: 1; }
.user-card.selected {
  border-color: var(--accent);
  background: var(--success-bg);
  box-shadow: 0 0 0 3px rgba(20,125,100,0.1), 0 0 26px rgba(20,125,100,0.06);
}
.user-avatar {
  position: relative; z-index: 1;
  display: grid;
  width: 44px; height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border-radius: var(--radius);
  background: var(--gradient-accent);
  color: #fff;
  font-size: 19px; font-weight: 800;
}
.user-name {
  position: relative; z-index: 1;
  min-width: 0;
  overflow: hidden;
  color: var(--text-primary);
  font-size: 14px; font-weight: 600;
  text-overflow: ellipsis; white-space: nowrap;
}

/* ═══════════════════════════════════════════════════
   LIBRARY PAGE
   ═══════════════════════════════════════════════════ */
.library-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  max-width: 1080px;
  margin: 0 auto 20px;
  padding: 34px 24px 0;
}
.library-title h2 {
  margin: 0 0 5px;
  font-size: 28px; font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.library-title p { margin: 0; color: var(--text-secondary); }
.library-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.upload-hint {
  max-width: 1080px;
  margin: 0 auto 14px;
  padding: 0 24px;
  color: var(--gold);
  font-weight: 700;
}
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px 60px;
}
.library-group-tabs {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 2px;
}
.library-group-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  background: rgba(255,255,255,.9);
  color: var(--text-primary);
  font-weight: 800;
  cursor: pointer;
}
.library-group-tab span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 700;
}
.library-group-tab.active {
  border-color: var(--accent);
  background: var(--success-bg);
  color: var(--accent);
}
.category-card {
  position: relative;
  display: flex;
  gap: 16px;
  min-height: 160px;
  padding: 22px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  cursor: pointer;
  overflow: hidden;
  transition: all .35s var(--ease);
}
.category-card::after {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gradient-accent);
  opacity: 0;
  transition: opacity .35s var(--ease);
}
.category-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-active);
  box-shadow: var(--shadow);
}
.category-card:hover::after { opacity: 1; }
.category-card.selected {
  border-color: var(--accent);
  background: var(--success-bg);
  box-shadow: 0 0 0 3px rgba(20,125,100,0.1), var(--shadow);
}
.category-card.selected::after { opacity: 1; }

.cc-icon {
  display: grid;
  width: 56px; height: 56px;
  flex: 0 0 56px;
  place-items: center;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  background: var(--success-bg);
  color: var(--accent);
  font-size: 24px;
}
.cc-body { min-width: 0; flex: 1; }
.cc-name { margin: 0 0 7px; font-size: 18px; font-weight: 600; }
.cc-desc { flex: 1; margin: 0 0 12px; color: var(--text-secondary); font-size: 14px; line-height: 1.5; }
.cc-meta { display: flex; flex-wrap: wrap; gap: 7px; }
.cc-count, .cc-type, .badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 700;
}
.cc-count, .badge { background: var(--success-bg); color: var(--accent); }
.cc-type { background: var(--bg-input); color: var(--text-secondary); }
.cc-progress { margin-top: 12px; }
.cc-progress-bar {
  height: 5px;
  background: var(--bg-input);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 5px;
}
.cc-progress-fill {
  height: 100%;
  background: var(--gradient-accent);
  border-radius: 999px;
  transition: width .5s var(--ease);
}
.cc-progress-text { font-size: 12px; color: var(--text-secondary); font-weight: 600; }

/* ═══════════════════════════════════════════════════
   POSTURE PAGE
   ═══════════════════════════════════════════════════ */
.posture-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 420px;
  gap: 20px;
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}
.posture-camera { min-width: 0; }
.camera-box {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16/10;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  background: #050812;
  box-shadow: var(--shadow-lg);
}
.camera-box::before {
  content: "● LIVE";
  position: absolute;
  top: 12px; left: 12px;
  z-index: 3;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(16,185,129,0.3);
  color: var(--success);
  font-size: 10px; font-weight: 800;
  backdrop-filter: blur(6px);
}
.camera-box::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(20,125,100,0.015) 2px, rgba(20,125,100,0.015) 4px);
  z-index: 2;
  pointer-events: none;
}
.camera-box video, .camera-box canvas {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.camera-box canvas { z-index: 1; pointer-events: none; }

.zoom-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 46px;
  margin-top: 12px;
  padding: 10px 16px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  background: var(--bg-card);
}
.zoom-bar input[type="range"] {
  width: 140px; height: 5px;
  appearance: none;
  border-radius: 999px;
  background: var(--bg-input);
  cursor: pointer;
}
.zoom-bar input[type="range"]::-webkit-slider-thumb {
  width: 20px; height: 20px;
  appearance: none;
  border: 2px solid var(--accent);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 12px var(--accent-glow);
  cursor: pointer;
}
.zoom-label { color: var(--text-secondary); font-size: 14px; }
.zoom-value {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 48px;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  background: var(--success-bg);
  color: var(--accent);
  font-size: 12px; font-weight: 700;
}

.posture-controls {
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
}
.section-head h3 { margin: 0; font-size: 18px; font-weight: 600; }

.posture-mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin: 16px 0;
}
.pm-tab {
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px; font-weight: 600;
  transition: all .2s var(--ease);
}
.pm-tab:hover, .pm-tab.active {
  border-color: var(--accent);
  background: var(--success-bg);
  color: var(--accent);
}
.pm-reset {
  grid-column: 1 / -1;
  border-color: rgba(239,68,68,0.2);
  color: var(--danger);
}
.pm-reset:hover { border-color: rgba(239,68,68,0.4); background: var(--danger-bg); }
.pm-panel { display: none; }
.pm-panel.active { display: block; }
.pm-hint { margin: 0 0 14px; color: var(--text-secondary); font-size: 14px; }

.posture-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; }
.posture-card {
  display: flex;
  min-height: 175px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 12px 9px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  background: var(--bg-card);
  cursor: pointer;
  text-align: center;
  transition: all .3s var(--ease);
}
.posture-card:hover { transform: translateY(-2px); }
.posture-card.done {
  border-color: rgba(16,185,129,0.3);
  background: var(--success-bg);
  box-shadow: 0 0 18px rgba(16,185,129,0.06);
}
.posture-card.capturing {
  border-color: rgba(250,204,21,0.5);
  background: var(--warning-bg);
  box-shadow: 0 0 0 3px rgba(250,204,21,0.1), 0 0 26px rgba(250,204,21,0.06);
  animation: capturePulse 2s ease-in-out infinite;
}
@keyframes capturePulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(250,204,21,0.08); }
  50% { box-shadow: 0 0 0 7px rgba(250,204,21,0.14); }
}
.pc-label { color: var(--text-primary); font-size: 28px; font-weight: 700; line-height: 1; }
.pc-name, .pc-count { color: var(--text-secondary); font-size: 12px; font-weight: 600; }
.pc-instruction {
  min-height: 28px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--accent);
  font-size: 11px; font-weight: 700;
  line-height: 1.4;
}
.pc-bar { width: 100%; height: 5px; overflow: hidden; border-radius: 999px; background: var(--bg-input); }
.pc-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--gradient-accent);
  transition: width .3s var(--ease);
}
.posture-card.done .pc-fill { background: linear-gradient(90deg, var(--success), #6ee7b7); }

#captureInfo {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  background: var(--bg-input);
  text-align: center;
}
#captureInfo p { margin: 0; font-weight: 600; color: var(--text-secondary); }
#captureInfo .ci-hint { font-size: 12px; color: var(--text-muted); margin-top: 3px; }

.match-scores { display: flex; flex-direction: column; gap: 7px; }
.match-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  background: var(--bg-card);
  transition: all .2s var(--ease);
}
.match-row.match-hit {
  border-color: rgba(16,185,129,0.3);
  background: var(--success-bg);
}
.match-label { width: 32px; color: var(--text-primary); font-weight: 700; font-size: 14px; }
.match-bar { flex: 1; height: 20px; overflow: hidden; border-radius: 999px; background: var(--bg-input); }
.match-fill { height: 100%; border-radius: inherit; background: var(--text-muted); transition: width .2s ease; }
.match-hit .match-fill { background: linear-gradient(90deg, var(--accent), var(--accent-light)); }
.match-score, .match-samples { min-width: 40px; color: var(--text-secondary); font-size: 12px; font-weight: 700; text-align: right; }
.match-empty, .empty-state {
  display: grid;
  min-height: 100px;
  place-items: center;
  padding: 28px;
  color: var(--text-muted);
  text-align: center;
  font-weight: 600;
}

/* ═══════════════════════════════════════════════════
   QUIZ PAGE — Split Layout
   ═══════════════════════════════════════════════════ */
.quiz-layout {
  display: grid;
  grid-template-columns: 2fr 5fr 3fr;
  gap: 18px;
  min-height: calc(100vh - var(--navbar-height));
  padding: 18px;
}

.quiz-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: calc(100vh - var(--navbar-height) - 40px);
  overflow: visible;
  position: relative;
  transition: all 0.3s var(--ease);
}
.quiz-sidebar.collapsed {
  width: 48px !important;
  min-width: 48px !important;
  flex: 0 0 48px !important;
}
.quiz-sidebar.collapsed .quiz-sidebar-content {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.quiz-sidebar.collapsed .quiz-sidebar-toggle i {
  transform: rotate(180deg);
}
.quiz-layout:has(.quiz-sidebar.collapsed) {
  grid-template-columns: 48px 1fr 30%;
}
.quiz-sidebar-toggle {
  position: absolute;
  top: 12px;
  right: -14px;
  z-index: 10;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-default);
  border-radius: 50%;
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.2s var(--ease);
  box-shadow: var(--shadow-sm);
}
.quiz-sidebar-toggle:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.quiz-sidebar-toggle i {
  transition: transform 0.3s var(--ease);
}
.quiz-sidebar-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
  max-height: calc(100vh - var(--navbar-height) - 40px);
  transition: opacity 0.2s var(--ease), visibility 0.2s var(--ease);
}
.quiz-work-card {
  padding: 22px 20px;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  box-shadow: var(--shadow-sm);
}
.quiz-work-card h3 { margin: 0 0 18px; font-size: 16px; font-weight: 600; }
.quiz-work-card p { margin: 0 0 12px; font-size: 14px; font-weight: 500; }
.quiz-work-card p:last-child { margin-bottom: 0; }

.qs-numbers {
  display: grid;
  grid-template-columns: repeat(5, 40px);
  gap: 10px 14px;
}
.qs-num {
  width: 40px; height: 40px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px; font-weight: 700;
  transition: all .25s var(--ease);
}
.qs-num:hover { transform: translateY(-2px); border-color: var(--accent); background: var(--success-bg); }
.qs-num.current {
  border-color: var(--accent);
  background: var(--success-bg);
  color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20,125,100,0.1);
}
.qs-num.correct { border-color: var(--success); background: var(--success); color: #fff; }
.qs-num.incorrect { border-color: var(--danger); background: var(--danger); color: #fff; }

/* Quiz main — question area */
.quiz-main {
  min-height: calc(100vh - var(--navbar-height) - 40px);
  max-height: calc(100vh - var(--navbar-height) - 40px);
  overflow-y: auto;
  padding: 36px 44px 72px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--border-default);
}

.btn-exit-quiz {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 16px;
  border: 1.5px solid rgba(234,179,8,0.4);
  border-radius: var(--radius-sm);
  background: var(--gold-bg);
  color: var(--gold);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font);
  transition: all .2s var(--ease);
  white-space: nowrap;
  flex-shrink: 0;
}
.btn-exit-quiz:hover {
  background: rgba(234,179,8,0.15);
  color: var(--gold);
  border-color: rgba(234,179,8,0.6);
  box-shadow: 0 0 12px rgba(234,179,8,0.1);
}

.quiz-tools { display: flex; align-items: center; gap: 10px; margin-left: auto; flex-wrap: wrap; }

.answer-mode {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
}
.mode-btn {
  min-height: 32px;
  padding: 6px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px; font-weight: 700;
  transition: all .2s var(--ease);
}
.mode-btn.active {
  background: var(--bg-card);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.quiz-score-bar { display: none; }
.score-label { color: var(--text-muted); font-size: 12px; font-weight: 700; }
.score-value {
  min-width: 50px;
  color: var(--gold);
  font-size: 28px; font-weight: 700;
  line-height: 1;
  transition: transform .2s var(--ease-spring);
}
.score-value.pop { animation: scoreBounce .4s var(--ease-spring); }
@keyframes scoreBounce {
  0% { transform: scale(1); }
  50% { transform: scale(1.4); }
  100% { transform: scale(1); }
}
.streak-badge {
  display: none;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--warning-bg);
  color: #B45309;
  font-size: 11px; font-weight: 700;
  border: 1px solid rgba(250,204,21,0.2);
}
.quiz-title {
  margin: 4px 0 0;
  font-size: 24px; font-weight: 600;
  line-height: 1.55;
  color: var(--text-primary);
}
.answers {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  max-width: 720px;
  margin-top: 4px;
}
.tf-hint {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}
.multi-answer-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  max-width: 720px;
  margin: 16px 0 4px;
  padding: 16px 18px;
  border: 2px solid rgba(20,125,100,0.22);
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(20,125,100,0.10), rgba(59,130,246,0.08));
  box-shadow: 0 10px 26px rgba(20,125,100,0.10);
}
.multi-answer-label {
  flex: 0 0 auto;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 800;
}
.multi-answer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.multi-answer-chip {
  display: grid;
  min-width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 14px;
  background: var(--bg-card);
  border: 2px dashed var(--border-hover);
  color: var(--text-muted);
  font-size: 24px;
  font-weight: 900;
}
.multi-answer-chip.filled {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 18px rgba(20,125,100,0.22);
  animation: answerPop .25s var(--ease-spring);
}
.multi-answer-progress {
  margin-left: auto;
  color: var(--accent);
  font-size: 18px;
  font-weight: 900;
}
.btn-submit-multi {
  max-width: 720px;
  margin-top: 10px;
  min-height: 52px;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
}
.btn-submit-multi:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.answer {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 14px 18px;
  border: 2px solid var(--border-default);
  border-radius: var(--radius);
  background: var(--bg-card);
  color: var(--text-primary);
  cursor: pointer;
  transition: all .25s var(--ease);
  position: relative;
  overflow: hidden;
}
.answer:hover {
  border-color: var(--accent-light);
  background: var(--success-bg);
  box-shadow: 0 0 0 3px rgba(20,125,100,0.06);
  transform: translateX(3px);
}
.answer strong {
  display: grid;
  width: 40px; height: 40px;
  flex: 0 0 40px;
  place-items: center;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  font-size: 18px; font-weight: 700;
  transition: all .25s var(--ease);
}
.answer span { min-width: 0; font-size: 16px; }
.answer em {
  margin-left: auto;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text-muted);
  font-size: 10px; font-style: normal; font-weight: 700;
  white-space: nowrap;
}
.answer.active {
  border-color: var(--accent) !important;
  background: var(--success-bg) !important;
  box-shadow: 0 0 0 3px rgba(20,125,100,0.12) !important;
  animation: answerPop .3s var(--ease-spring);
}
.answer.active strong { background: var(--accent); color: #fff; }
.answer.correct {
  border-color: var(--success) !important;
  background: var(--success-bg) !important;
  box-shadow: 0 0 0 3px rgba(16,185,129,0.12), 0 0 24px rgba(16,185,129,0.06) !important;
}
.answer.correct strong { background: var(--success); color: #fff; }
.answer.wrong {
  border-color: var(--danger) !important;
  background: var(--danger-bg) !important;
  box-shadow: 0 0 0 3px rgba(239,68,68,0.12) !important;
  animation: shake .4s ease;
}
.answer.wrong strong { background: var(--danger); color: #fff; }

/* Answer feedback bar */
.answer-feedback {
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.6;
  animation: answerPop .3s var(--ease-spring);
}
.answer-feedback.correct {
  background: var(--success-bg);
  border: 1px solid rgba(16, 185, 129, 0.25);
  color: var(--success);
}
.answer-feedback.wrong {
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: var(--danger);
}
.feedback-picks {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.feedback-pick {
  display: inline-grid;
  min-width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 12px;
  background: currentColor;
  color: #fff;
  font-size: 20px;
  font-weight: 900;
}
.feedback-pick span {
  color: #fff;
}

@keyframes answerPop {
  from { transform: scale(0.96); }
  to { transform: scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

.quiz-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border-default);
}
.quiz-nav button { min-width: 100px; }
.quiz-nav-info { font-size: 14px; font-weight: 600; color: var(--text-secondary); min-width: 56px; text-align: center; }
.quiz-status { margin-top: 6px; }

.gesture-state {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 26px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 14px;
}
.gesture-state::before {
  content: "";
  width: 9px; height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
  animation: livePulse 2s ease-in-out infinite;
}

.countdown-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 12px;
}
.countdown-ring {
  display: grid;
  width: 62px; height: 62px;
  place-items: center;
  border: 3px solid var(--accent);
  border-radius: 50%;
  background: var(--success-bg);
  box-shadow: 0 0 24px var(--accent-glow);
  animation: countdownPulse 1s ease-in-out infinite;
}
@keyframes countdownPulse {
  0%, 100% { box-shadow: 0 0 16px rgba(20,125,100,0.08); }
  50% { box-shadow: 0 0 30px rgba(20,125,100,0.18); }
}
.countdown-num { font-size: 28px; font-weight: 700; color: var(--accent); }
.countdown-hint { font-weight: 600; font-size: 14px; color: var(--text-secondary); }

/* Quiz camera + stick figure panel */
.quiz-pose-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: calc(100vh - var(--navbar-height) - 40px);
  max-height: calc(100vh - var(--navbar-height) - 40px);
  overflow-y: auto;
}
.quiz-pose-panel .camera-box {
  width: min(520px, 31vw);
  min-width: 420px;
  aspect-ratio: 4/3;
  height: auto;
  flex: 0 0 auto;
  border-radius: var(--radius-lg);
}
#viewQuiz .quiz-camera {
  display: none;
}

/* ── Posture Recognition Indicator ── */
.posture-indicator {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  border-radius: 999px;
  background: rgba(0,0,0,0.8);
  border: 1px solid rgba(20,125,100,0.3);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 0 32px rgba(20,125,100,0.2), 0 8px 24px rgba(0,0,0,0.5);
  animation: piSlideUp .3s var(--ease-spring) both;
  white-space: nowrap;
}
@keyframes piSlideUp {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.pi-label {
  display: grid;
  width: 48px; height: 48px;
  flex: 0 0 48px;
  place-items: center;
  border-radius: 50%;
  background: var(--gradient-accent);
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  box-shadow: 0 0 24px var(--accent-glow);
  animation: piPulse 1.2s ease-in-out infinite;
}
@keyframes piPulse {
  0%, 100% { box-shadow: 0 0 18px var(--accent-glow); }
  50% { box-shadow: 0 0 36px var(--accent-glow), 0 0 60px rgba(20,125,100,0.2); }
}
.posture-indicator.stable .pi-label {
  background: var(--success);
  box-shadow: 0 0 24px rgba(16,185,129,0.4);
  animation: piStablePulse .4s ease-in-out infinite;
}
@keyframes piStablePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}
.posture-indicator.locked .pi-label {
  background: var(--warning);
  box-shadow: 0 0 36px rgba(250,204,21,0.5);
  animation: none;
}
.pi-action {
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}
.pi-capture-count {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(20,125,100,0.12);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.pi-bar-wrap {
  width: 100px; height: 6px;
  flex: 0 0 100px;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  overflow: hidden;
}
.pi-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--gradient-accent);
  transition: width .15s linear;
  width: 0%;
}
.pi-percent {
  min-width: 42px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 700;
  text-align: right;
}
.posture-indicator.stable .pi-percent { color: var(--success); }
.posture-indicator.locked .pi-percent { color: var(--warning); }

.grade-pop {
  position: fixed;
  top: 50%; left: 50%;
  z-index: 1200;
  display: none;
  flex-direction: column;
  align-items: center;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: gradePop .35s var(--ease-spring) both;
}
@keyframes gradePop {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}
.gp-card {
  min-width: min(460px, calc(100vw - 48px));
  padding: 28px 32px;
  border-radius: 24px;
  background: rgba(255,255,255,0.96);
  border: 2px solid currentColor;
  box-shadow: 0 24px 70px rgba(0,0,0,0.22);
  text-align: center;
}
[data-theme="dark"] .gp-card {
  background: rgba(17,21,39,0.96);
}
.gp-card > i {
  display: grid;
  width: 70px;
  height: 70px;
  place-items: center;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: currentColor;
  color: #fff;
  font-size: 34px;
}
.gp-card > i::before {
  color: #fff;
}
.gp-grade {
  display: block;
  color: var(--text-primary);
  font-size: 34px;
  font-weight: 900;
  line-height: 1.2;
}
.gp-picks {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 800;
}
.gp-picks > div {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
}
.gp-chip {
  display: inline-grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 14px;
  background: currentColor;
  color: #fff;
  font-size: 26px;
  font-weight: 900;
}
.gp-chip span {
  color: #fff;
}

/* System status bar */
.status-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
}
.status-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
}
.status-dot {
  width: 10px; height: 10px;
  flex: 0 0 10px;
  border-radius: 50%;
}
.status-dot.on { background: var(--success); box-shadow: 0 0 8px rgba(16,185,129,0.4); }
.status-dot.off { background: var(--danger); box-shadow: 0 0 8px rgba(239,68,68,0.4); }
.status-dot.warn { background: var(--warning); box-shadow: 0 0 8px rgba(250,204,21,0.4); }
.status-text { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.status-text strong { display: block; font-size: 11px; font-weight: 500; color: var(--text-muted); margin-bottom: 1px; }

/* ═══════════════════════════════════════════════════
   RESULT PAGE
   ═══════════════════════════════════════════════════ */
.result-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 44px 24px 64px;
  text-align: center;
}
.result-hero { margin-bottom: 26px; animation: resultHero .6s var(--ease-spring) both; }
@keyframes resultHero {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}
.result-icon {
  display: inline-grid;
  width: 80px; height: 80px;
  place-items: center;
  margin-bottom: 14px;
  border-radius: var(--radius-xl);
  background: var(--warning-bg);
  font-size: 42px;
  box-shadow: 0 0 32px rgba(250,204,21,0.1);
}
.result-hero h1 {
  margin: 0;
  font-size: 32px; font-weight: 700;
  color: var(--text-primary);
}
.rs-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.rs-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 108px;
  gap: 6px;
  padding: 16px 9px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  transition: all .3s var(--ease);
}
.rs-item:hover { transform: translateY(-3px); border-color: var(--border-active); }
.rs-val { font-size: 28px; font-weight: 700; line-height: 1; }
.rs-lbl { color: var(--text-secondary); font-size: 12px; font-weight: 600; }
.rs-perfect .rs-val { color: var(--gold); }
.rs-great .rs-val { color: var(--success); }
.rs-cool .rs-val { color: var(--accent); }
.rs-good .rs-val { color: var(--accent-light); }
.rs-wrong .rs-val { color: var(--danger); }

.rs-summary {
  display: grid;
  gap: 9px;
  margin-bottom: 22px;
  padding: 24px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-weight: 500;
}
.rs-big { color: var(--text-primary); font-size: 20px; font-weight: 600; }
.rs-big strong { color: var(--accent); font-size: 44px; font-weight: 700; }
.result-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════
   RESULT DETAIL
   ═══════════════════════════════════════════════════ */
.detail-container {
  max-width: 960px;
  margin: 0 auto;
  padding: 38px 24px 64px;
}
.detail-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.detail-header h2 {
  margin: 0 0 5px;
  font-size: 28px; font-weight: 700;
  color: var(--text-primary);
}
.detail-header p { margin: 0; color: var(--text-secondary); font-weight: 500; }
.detail-list { display: grid; gap: 12px; }
.detail-card {
  padding: 22px;
  border: 1px solid var(--border-default);
  border-left: 4px solid var(--border-default);
  border-radius: var(--radius);
  background: var(--bg-card);
  transition: all .3s var(--ease);
  animation: cardSlide .4s var(--ease-out) both;
  animation-delay: calc(var(--i, 0) * 50ms);
}
@keyframes cardSlide {
  from { opacity: 0; transform: translateX(-18px); }
  to { opacity: 1; transform: translateX(0); }
}
.detail-card.correct { border-left-color: var(--success); }
.detail-card.wrong { border-left-color: var(--danger); }
.detail-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.detail-index, .detail-status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  font-size: 12px; font-weight: 700;
}
.detail-index { background: var(--bg-input); color: var(--text-secondary); }
.detail-status { background: var(--danger-bg); color: var(--danger); }
.detail-card.correct .detail-status { background: var(--success-bg); color: var(--success); }
.detail-card h3 { margin: 0 0 14px; font-size: 16px; line-height: 1.6; }
.detail-answers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.detail-answers div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  background: var(--bg-card);
}
.detail-answers span { display: block; margin-bottom: 5px; color: var(--text-secondary); font-size: 12px; font-weight: 600; }
.detail-answers strong { display: inline-flex; min-width: 32px; height: 32px; align-items: center; justify-content: center; border-radius: var(--radius-sm); background: var(--bg-input); font-size: 16px; font-weight: 700; }
.detail-answers p { overflow: hidden; margin: 7px 0 0; color: var(--text-primary); font-size: 12px; font-weight: 500; text-overflow: ellipsis; white-space: nowrap; }

/* ═══════════════════════════════════════════════════
   SETTINGS PAGE
   ═══════════════════════════════════════════════════ */
.settings-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 38px 24px 64px;
}
.settings-container h2 {
  margin: 0 0 6px;
  font-size: 28px; font-weight: 700;
  color: var(--text-primary);
}
.settings-hint { margin: 0 0 24px; color: var(--text-secondary); }
.settings-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 20px 0; }
.sf-row {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 16px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  background: var(--bg-card);
  transition: all .3s var(--ease);
}
.sf-row:hover { border-color: var(--border-active); }
.sf-row label { color: var(--text-secondary); font-size: 12px; font-weight: 600; }
.sf-row input {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text-primary);
  font-weight: 600;
  outline: none;
  transition: all .25s var(--ease);
}
.sf-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20,125,100,0.1);
}

/* History */
.history-section { margin-top: 38px; }
.history-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.history-header h3 { margin: 0; font-size: 18px; font-weight: 600; }
.history-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
  padding: 20px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
}
.stat-item { display: flex; flex-direction: column; gap: 3px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--accent); }
.stat-label { color: var(--text-secondary); font-size: 12px; font-weight: 600; }
.grade-breakdown { display: grid; grid-template-columns: repeat(5, 1fr); gap: 9px; margin-bottom: 14px; }
.gb-item {
  display: flex;
  min-height: 78px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius);
  background: var(--bg-card);
  transition: all .3s var(--ease);
}
.gb-item:hover { transform: translateY(-2px); }
.gb-label { color: var(--text-muted); font-size: 10px; font-weight: 700; }
.gb-count { font-size: 26px; font-weight: 700; }
.gb-perfect .gb-count { color: var(--gold); }
.gb-wrong .gb-count { color: var(--danger); }

.history-list {
  overflow: hidden;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
}
.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-default);
  transition: background .2s var(--ease);
}
.history-item:last-child { border-bottom: none; }
.history-item:hover { background: var(--bg-hover); }
.history-status {
  display: grid;
  width: 36px; height: 36px;
  flex: 0 0 36px;
  place-items: center;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 15px;
}
.history-status.correct { background: var(--success-bg); color: var(--success); }
.history-status.incorrect { background: var(--danger-bg); color: var(--danger); }
.history-content { min-width: 0; flex: 1; }
.history-content h4 { overflow: hidden; margin: 0 0 7px; font-size: 14px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.history-answer { display: flex; flex-wrap: wrap; gap: 7px; }
.history-answer span { display: inline-flex; align-items: center; min-height: 22px; padding: 2px 7px; border-radius: var(--radius-sm); font-size: 11px; font-weight: 700; }
.history-answer .your { background: var(--success-bg); color: var(--accent); }
.history-answer .time { background: var(--bg-input); color: var(--text-secondary); }
.history-answer .correct { background: var(--success-bg); color: var(--success); }

/* ═══════════════════════════════════════════════════
   ADMIN PAGE
   ═══════════════════════════════════════════════════ */

.admin-container { max-width: 1280px; margin: 0 auto; padding: 32px 24px 64px; }
.admin-console { color: var(--text-primary); }
.admin-hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 18px; padding: 28px; border: 1px solid var(--border-default); border-radius: var(--radius-lg); background: linear-gradient(135deg, rgba(20,125,100,.10), rgba(255,255,255,.92)); box-shadow: var(--shadow-sm); }
.admin-kicker { display: inline-flex; margin-bottom: 8px; color: var(--accent); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.admin-hero h2 { margin: 0 0 8px; font-size: 30px; font-weight: 800; }
.admin-hero p { margin: 0; color: var(--text-secondary); font-size: 14px; }
.admin-import-btn { gap: 8px; white-space: nowrap; }
.admin-stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.admin-stat-card { min-height: 92px; padding: 18px 20px; border: 1px solid var(--border-default); border-radius: var(--radius-lg); background: var(--bg-card); box-shadow: var(--shadow-sm); }
.admin-stat-card span { display: block; color: var(--text-secondary); font-size: 13px; font-weight: 700; }
.admin-stat-card strong { display: block; margin-top: 8px; font-size: 30px; line-height: 1; color: var(--accent); }
.admin-grid-two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.admin-section { margin-bottom: 18px; padding: 22px; border: 1px solid var(--border-default); border-radius: var(--radius-lg); background: rgba(255,255,255,.92); box-shadow: var(--shadow-sm); }
.admin-section-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.admin-section-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; flex-wrap: wrap; }
.admin-section h3 { margin: 0 0 5px; font-size: 18px; font-weight: 800; }
.admin-section-head p { margin: 0; color: var(--text-secondary); font-size: 13px; }
.admin-import-status { font-size: 12px; font-weight: 700; }
.admin-table-wrap { overflow-x: auto; border: 1px solid var(--border-default); border-radius: var(--radius); }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; background: #fff; }
.admin-table th, .admin-table td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--border-default); vertical-align: middle; }
.admin-table th { color: var(--text-secondary); background: #f8fafc; font-size: 12px; font-weight: 800; }
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table tbody tr { transition: background .2s var(--ease); }
.admin-table tbody tr:hover td { background: var(--bg-hover); }
.admin-grid-single { grid-template-columns: 1fr; }
.admin-bank-cell { display: flex; align-items: center; gap: 12px; min-width: 260px; }
.admin-bank-icon { display: inline-flex; width: 42px; height: 42px; align-items: center; justify-content: center; border-radius: var(--radius); background: var(--success-bg); color: var(--accent); font-size: 18px; }
.admin-bank-cell strong { display: block; font-size: 15px; }
.admin-bank-cell small { display: block; margin-top: 3px; color: var(--text-secondary); font-size: 12px; }
.admin-actions-cell { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-tag { display: inline-flex; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.admin-tag.admin { background: var(--success-bg); color: var(--accent); }
.admin-tag.user { background: var(--bg-input); color: var(--text-secondary); }
.admin-assign { display: flex; flex-direction: column; gap: 16px; }
.assign-bank-select { display: grid; grid-template-columns: 80px 1fr; align-items: center; gap: 12px; }
.assign-bank-select label { color: var(--text-secondary); font-size: 14px; font-weight: 700; white-space: nowrap; }
.assign-bank-select select { min-height: 44px; padding: 9px 12px; border: 1px solid var(--border-default); border-radius: var(--radius); background: var(--bg-input); color: var(--text-primary); font-size: 14px; outline: none; }
.assign-bank-select select:focus { border-color: var(--accent); }
.assign-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.assign-status { color: var(--text-secondary); font-size: 12px; font-weight: 700; }
.admin-edit-overlay { position: fixed; inset: 0; z-index: 900; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(15,23,42,.36); backdrop-filter: blur(6px); }
.admin-edit-dialog { width: min(720px, 100%); padding: 24px; border: 1px solid var(--border-default); border-radius: var(--radius-lg); background: #fff; box-shadow: var(--shadow-lg); }
.admin-edit-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.admin-edit-head h3 { margin: 0 0 4px; font-size: 20px; }
.admin-edit-head p { margin: 0; color: var(--text-secondary); font-size: 13px; }
.admin-edit-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.admin-edit-grid label { display: grid; gap: 7px; color: var(--text-secondary); font-size: 13px; font-weight: 800; }
.admin-edit-grid input { min-height: 42px; padding: 9px 12px; border: 1px solid var(--border-default); border-radius: var(--radius-sm); color: var(--text-primary); font-size: 14px; }
.admin-edit-grid input[readonly] { background: var(--bg-input); color: var(--text-secondary); cursor: not-allowed; }
.admin-edit-grid .span-2 { grid-column: span 2; }
.admin-edit-preview { display: flex; align-items: center; gap: 12px; margin: 18px 0; padding: 16px; border: 1px solid var(--border-default); border-radius: var(--radius); background: var(--success-bg); }
.admin-edit-preview > span { display: inline-flex; width: 48px; height: 48px; align-items: center; justify-content: center; border-radius: var(--radius); background: #fff; color: var(--accent); font-size: 20px; }
.admin-edit-preview strong { display: block; font-size: 17px; }
.admin-edit-preview small { display: block; margin-top: 4px; color: var(--text-secondary); }
.admin-edit-actions { display: flex; justify-content: flex-end; gap: 10px; }
@media (max-width: 900px) { .admin-hero, .admin-section-head { flex-direction: column; align-items: stretch; } .admin-stats-grid, .admin-grid-two, .admin-edit-grid { grid-template-columns: 1fr; } .admin-edit-grid .span-2 { grid-column: auto; } }

.confetti-container {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  overflow: hidden;
}
.confetti-piece {
  position: absolute;
  top: -60px;
  width: 10px;
  height: 16px;
  border-radius: 3px;
  animation: confettiFall var(--fall-dur, 3s) var(--fall-delay, 0s) ease-in forwards;
}
@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
  80% { opacity: 1; }
  100% { transform: translateY(105vh) rotate(var(--rot, 720deg)) scale(.5); opacity: 0; }
}

/* ═══════════════════════════════════════════════════
   MODE SELECTION OVERLAY
   ═══════════════════════════════════════════════════ */
.mode-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: overlayIn .25s var(--ease-out);
}
@keyframes overlayIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.mode-dialog {
  width: 100%;
  max-width: 580px;
  padding: 40px 36px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  background: var(--bg-card);
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: dialogIn .35s var(--ease-spring);
}
@keyframes dialogIn {
  from { opacity: 0; transform: translateY(24px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.mode-dialog h2 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
}
.mode-dialog > p {
  margin: 0 0 28px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}

.confirm-dialog { max-width: 480px; }
.confirm-submit-text {
  margin: 0 0 24px;
  color: var(--text-primary);
  font-size: 15px;
  line-height: 1.7;
  text-align: left;
}
.confirm-submit-text strong { color: var(--gold); }
.confirm-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.mode-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 20px;
}

.mode-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 32px 22px;
  border: 2px solid var(--border-default);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  cursor: pointer;
  transition: all .3s var(--ease);
  text-align: center;
}
.mode-card:hover {
  border-color: var(--accent);
  background: var(--success-bg);
  transform: translateY(-4px);
  box-shadow: 0 0 30px rgba(20,125,100,0.08);
}
.mode-card:active { transform: translateY(-1px); }

.mode-icon {
  font-size: 48px;
  line-height: 1;
}
.mode-card h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
}
.mode-card p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
}
.mode-badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: var(--warning-bg);
  color: #B45309;
  border: 1px solid rgba(250,204,21,0.2);
}
.mode-badge.safe {
  background: var(--success-bg);
  color: var(--accent);
  border-color: rgba(20,125,100,0.2);
}

.mode-cancel {
  min-width: 100px;
}

/* Progress overlay */
.progress-dialog {
  position: relative;
  max-width: 500px;
  padding: 44px 40px 36px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
}

.progress-dialog h2 {
  margin: 0 auto 10px;
  text-align: center;
  font-size: 22px;
  font-weight: 700;
}
.progress-dialog > p {
  margin: 0 auto 36px;
  text-align: center;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.7;
  max-width: 380px;
}

.progress-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 22px;
  font-weight: 400;
  line-height: 1;
  transition: all .2s var(--ease);
  z-index: 1;
}
.progress-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.progress-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.progress-actions button {
  min-height: 44px;
  padding: 10px 28px;
  border-radius: var(--radius);
  border: 0;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font);
  transition: all .2s var(--ease);
}
.progress-action-primary {
  background: var(--gradient-accent);
  color: #fff;
  box-shadow: 0 4px 18px var(--accent-glow);
}
.progress-action-primary:hover {
  box-shadow: 0 6px 24px var(--accent-glow);
  transform: translateY(-1px);
}
.progress-action-danger {
  background: #dc2626;
  color: #fff;
  box-shadow: 0 4px 14px rgba(220,38,38,0.3);
}
.progress-action-danger:hover {
  background: #ef4444;
  box-shadow: 0 6px 20px rgba(239,68,68,0.35);
  transform: translateY(-1px);
}

/* Library card progress badges */
.cc-completion-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--success-bg);
  color: var(--success);
  font-size: 12px;
  font-weight: 700;
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .quiz-layout {
    grid-template-columns: 2fr 8fr;
  }
  .quiz-pose-panel { display: none; }
}
@media (max-width: 960px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .navbar-brand { display: flex; }
  .home-hero { grid-template-columns: 1fr; gap: 24px; }
  .hero-stage { min-height: 320px; }
  .posture-layout { grid-template-columns: 1fr; }
  .posture-controls { max-height: none; }
  .quiz-layout { grid-template-columns: 1fr; gap: 12px; }
  .quiz-sidebar { display: none; }
  .quiz-main { max-height: none; padding: 24px; }
  .quiz-pose-panel { display: none; }
}
@media (max-width: 640px) {
  .navbar-container { padding: 0 12px; gap: 8px; }
  .home-hero h1 { font-size: 28px; }
  .home-shell { padding: 20px 12px 40px; }
  .home-stats, .status-bar { grid-template-columns: 1fr 1fr; }
  .categories-grid, .user-grid { grid-template-columns: 1fr; }
  .posture-grid, .settings-form, .history-stats,
  .grade-breakdown, .detail-answers, .rs-grid { grid-template-columns: 1fr 1fr; }
  #appShell.quiz-fullscreen .quiz-layout { padding: 0; min-height: 100dvh; }
  .quiz-layout { padding: 0; gap: 0; min-height: 100dvh; }
  .quiz-main {
    min-height: 100dvh;
    max-height: none;
    padding: 0 14px 92px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    gap: 18px;
    background: #fff;
  }
  .quiz-header {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    margin: 0 -14px;
    padding: 12px 14px 10px;
    background: rgba(255,255,255,0.96);
    box-shadow: 0 1px 0 var(--border-default);
    backdrop-filter: blur(14px);
  }
  .quiz-header::before {
    content: "体感答题 — Motion Quiz";
    grid-column: 1 / -1;
    min-height: 42px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    border: 2px solid #111827;
    border-radius: 24px;
    color: #111827;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0;
  }
  .btn-exit-quiz {
    grid-column: 1;
    justify-self: start;
    min-height: 38px;
    padding: 6px 12px;
    border-radius: 12px;
    background: #fff8d7;
    border-color: #fde68a;
    color: #b7791f;
    font-size: 15px;
  }
  .quiz-badge, #quizBadge {
    grid-column: 2;
    justify-self: end;
    align-self: center;
    min-height: 38px;
    padding: 7px 12px;
    border-radius: 12px;
    background: var(--success-bg);
    color: var(--accent);
    font-size: 15px;
  }
  .quiz-tools { grid-column: 1 / -1; width: 100%; margin-left: 0; justify-content: center; }
  .answer-mode {
    width: min(210px, 66vw);
    flex: 0 1 auto;
    padding: 5px;
    border-radius: 16px;
    background: #f3f4f6;
    box-shadow: inset 0 0 0 1px #e5e7eb;
  }
  #btnGestureMode { display: none; }
  .mode-btn { flex: 1; min-height: 40px; border-radius: 12px; font-size: 14px; }
  .btn-pause { display: none; }
  .quiz-title {
    margin-top: 12px;
    padding-top: 14px;
    border-top: 1px solid #e5e7eb;
    color: #111827;
    font-size: clamp(20px, 5.6vw, 28px);
    font-weight: 800;
    line-height: 1.5;
  }
  .answers { gap: 12px; max-width: none; }
  .answer {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    align-items: center;
    min-height: 72px;
    padding: 12px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 16px;
    gap: 8px 12px;
    background: #fff;
    box-shadow: 0 3px 0 rgba(17,24,39,0.06);
    transform: none;
    touch-action: manipulation;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }
  .answer:hover { transform: none; }
  .answer strong {
    grid-row: span 2;
    width: 42px;
    height: 42px;
    flex-basis: 42px;
    border-radius: 10px;
    background: #f3f4f6;
    color: #111827;
    font-size: 21px;
    font-weight: 900;
  }
  .answer span {
    color: #111827;
    font-size: clamp(17px, 4.8vw, 22px);
    font-weight: 700;
    line-height: 1.35;
  }
  .answer em {
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    margin-left: 0;
    padding: 5px 9px;
    border-radius: 999px;
    background: #f5f5f5;
    color: #9ca3af;
    font-size: 10px;
    white-space: normal;
  }
  .answer.active,
  .answer.correct {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px rgba(20,125,100,0.10), 0 3px 0 rgba(20,125,100,0.10) !important;
  }
  .answer.wrong {
    box-shadow: 0 0 0 3px rgba(239,68,68,0.12), 0 3px 0 rgba(239,68,68,0.10) !important;
  }
  .multi-answer-panel { max-width: none; padding: 10px; flex-wrap: wrap; }
  .multi-answer-progress { margin-left: 0; }
  .btn-submit-multi { max-width: none; width: 100%; min-height: 44px; font-size: 14px; }
  .answer-feedback { margin-top: 8px; }
  .quiz-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    min-height: 74px;
    margin: 0;
    padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
    background: rgba(255,255,255,0.96);
    box-shadow: 0 -1px 0 var(--border-default);
    backdrop-filter: blur(14px);
  }
  .quiz-nav .btn-outline {
    width: auto;
    flex: 1;
    min-height: 46px;
    border-radius: 12px;
    color: #111827;
    font-size: 15px;
    font-weight: 800;
  }
  .quiz-nav-info {
    min-width: 62px;
    color: #6b7280;
    font-size: 16px;
    font-weight: 900;
    text-align: center;
  }
  .quiz-status { display: none; }
  .login-card { padding: 28px 20px; }
  .btn-primary, .btn-outline { width: 100%; }
  #appShell .quiz-main {
    padding: 0 12px 66px;
    gap: 9px;
  }
  #appShell .quiz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 12px 7px;
  }
  #appShell .quiz-header::before { display: none; }
  #appShell .btn-exit-quiz {
    width: auto;
    min-height: 32px;
    padding: 5px 9px;
    border-radius: 10px;
    font-size: 13px;
  }
  #appShell #quizBadge {
    min-height: 30px;
    padding: 5px 9px;
    border-radius: 999px;
    font-size: 12px;
  }
  #appShell .quiz-tools { display: none; }
  #appShell .quiz-title {
    margin-top: 7px;
    padding-top: 0;
    border-top: 0;
    font-size: clamp(17px, 4.8vw, 22px);
    line-height: 1.32;
    max-height: 5.3em;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  #appShell .answers {
    gap: 7px;
    max-width: none;
  }
  #appShell .answer {
    grid-template-columns: 38px minmax(0, 1fr);
    min-height: 50px;
    padding: 8px 10px;
    border-width: 1px;
    border-radius: 12px;
    gap: 6px 9px;
    box-shadow: 0 1px 0 rgba(17,24,39,0.04);
  }
  #appShell .answer strong {
    grid-row: auto;
    width: 32px;
    height: 32px;
    flex-basis: 32px;
    border-radius: 9px;
    font-size: 17px;
  }
  #appShell .answer span {
    font-size: clamp(15px, 4.15vw, 18px);
    line-height: 1.26;
  }
  #appShell .answer em { display: none; }
  #appShell .multi-answer-panel {
    padding: 8px;
    gap: 6px;
  }
  #appShell .btn-submit-multi {
    min-height: 38px;
    font-size: 13px;
  }
  #appShell .answer-feedback { margin-top: 4px; }
  #appShell .quiz-nav {
    min-height: 58px;
    padding: 7px 12px calc(7px + env(safe-area-inset-bottom));
  }
  #appShell .quiz-nav .btn-outline {
    min-height: 40px;
    border-radius: 10px;
    font-size: 14px;
  }
  #appShell .quiz-nav-info {
    min-width: 50px;
    font-size: 14px;
  }
}
/* ── Grouped History ── */
.history-day { margin-bottom: 16px; }
.history-day-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; background: var(--bg-card);
  border-radius: var(--radius); cursor: pointer;
  font-weight: 600; font-size: 15px; color: var(--text-primary);
  border: 1px solid var(--border-default);
  transition: background 0.2s;
}
.history-day-header:hover { background: var(--bg-hover); }
.history-day-header .day-count {
  margin-left: auto; font-size: 12px; color: var(--text-muted);
  font-weight: 500;
}
.history-day-body { display: none; margin-top: 8px; }
.history-day.open .history-day-body { display: block; }

.history-bank { margin-bottom: 8px; margin-left: 8px; }
.history-bank-header {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: var(--bg-input);
  border-radius: var(--radius-sm); cursor: pointer;
  font-size: 14px; font-weight: 500; color: var(--text-secondary);
  transition: background 0.2s;
}
.history-bank-header:hover { background: var(--bg-hover); }
.history-bank-header .bank-q-count {
  margin-left: auto; font-size: 12px; color: var(--text-muted);
  font-weight: 500;
}
.history-bank-body { display: none; }
.history-bank.open .history-bank-body { display: block; }

.history-q-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 12px 6px 24px; font-size: 14px;
  border-bottom: 1px solid var(--border-default);
}
.history-q-row:last-child { border-bottom: none; }
.history-q-status { font-size: 14px; min-width: 20px; text-align: center; }
.history-q-status.correct { color: var(--success); }
.history-q-status.wrong { color: var(--danger); }
.history-q-title { flex: 1; color: var(--text-primary); }
.history-q-choice { color: var(--text-muted); font-size: 12px; }
.history-q-time { color: var(--text-muted); font-size: 11px; min-width: 40px; text-align: right; }

/* ── Session History ── */
.history-container { max-width: 880px; margin: 0 auto; padding: 28px 0; }
.history-toolbar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px;
  margin-bottom: 24px;
}
.history-toolbar h2 { margin: 0; font-size: 22px; font-weight: 700; color: var(--text-primary); }
.history-filters { display: flex; gap: 10px; }
.filter-select {
  padding: 7px 28px 7px 12px; border-radius: var(--radius);
  border: 1px solid var(--border-default); background: var(--bg-card); color: var(--text-primary);
  font-size: 14px; font-weight: 500; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%236B7280'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}
.filter-select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }

.session-list { display: flex; flex-direction: column; gap: 14px; }
.session-card {
  background: var(--bg-card); border: 1px solid var(--border-default); border-radius: var(--radius);
  overflow: hidden; transition: box-shadow 0.2s;
}
.session-card:hover { box-shadow: var(--shadow); }
.session-card-header {
  display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto;
  align-items: center; gap: 6px 12px; padding: 16px 20px; cursor: pointer;
  user-select: none;
}
.session-bank-info { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 15px; color: var(--text-primary); }
.session-bank-icon { font-size: 16px; color: var(--accent); }
.session-score { font-size: 28px; font-weight: 700; grid-row: span 2; text-align: right; color: var(--accent); }
.session-meta {
  display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--text-muted); font-weight: 500;
}
.session-meta span { display: inline-flex; align-items: center; gap: 4px; }
.session-expand-icon { color: var(--text-muted); font-size: 13px; transition: transform 0.25s; justify-self: end; }
.session-card.open .session-expand-icon { transform: rotate(180deg); }

.session-card-body { display: none; border-top: 1px solid var(--border-default); }
.session-card.open .session-card-body { display: block; }
.session-questions { padding: 12px 20px; }
.session-q-row {
  display: flex; align-items: flex-start; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid var(--border-default);
}
.session-q-row:last-child { border-bottom: none; }
.session-q-status { font-size: 15px; min-width: 22px; text-align: center; padding-top: 1px; }
.session-q-row.correct .session-q-status { color: var(--success); }
.session-q-row.wrong .session-q-status { color: var(--danger); }
.session-q-content { flex: 1; min-width: 0; }
.session-q-title { font-weight: 500; font-size: 14px; color: var(--text-primary); display: block; margin-bottom: 4px; }
.session-q-answers { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; }
.session-q-your { color: var(--accent); font-weight: 600; }
.session-q-correct { color: var(--success); font-weight: 600; }
.session-q-grade {
  padding: 1px 6px; border-radius: var(--radius-sm); font-weight: 700; text-transform: uppercase;
  background: var(--bg-input); color: var(--text-muted);
}
.session-q-grade.grade-perfect { background: var(--success-bg); color: var(--success); }
.session-q-grade.grade-great { background: var(--success-bg); color: var(--success); }
.session-q-grade.grade-cool { background: var(--warning-bg); color: #B45309; }
.session-q-grade.grade-good { background: var(--bg-input); color: var(--text-secondary); }
.session-q-grade.grade-wrong { background: var(--danger-bg); color: var(--danger); }
.session-q-time { color: var(--text-muted); }

.session-actions {
  display: flex; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--border-default);
  background: var(--bg-hover);
}

.loading-spinner { text-align: center; padding: 24px; color: var(--text-muted); font-size: 14px; }
.empty-icon { font-size: 40px; color: var(--text-muted); display: block; margin-bottom: 12px; opacity: 0.5; }

@media (max-width: 480px) {
  .home-hero h1 { font-size: 24px; }
  .hero-stage { display: none; }
  .posture-grid, .history-stats, .grade-breakdown,
  .detail-answers, .rs-grid { grid-template-columns: 1fr; }
  .session-card-header { padding: 12px 14px; }
  .session-score { font-size: 22px; }
  .history-toolbar { flex-direction: column; align-items: flex-start; }
}
.admin-bank-groups { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 16px; }
.admin-group-card { position: relative; display: flex; align-items: stretch; border: 1px solid var(--border-default); border-radius: var(--radius); background: #fff; overflow: hidden; box-shadow: var(--shadow-sm); }
.admin-group-card.active { border-color: var(--accent); background: var(--success-bg); box-shadow: 0 0 0 3px rgba(20,125,100,.10), var(--shadow-sm); }
.admin-group-main { flex: 1; display: grid; grid-template-columns: 44px 1fr; grid-template-rows: auto auto; column-gap: 12px; min-height: 92px; padding: 16px; border: 0; background: transparent; text-align: left; cursor: pointer; }
.admin-group-icon { grid-row: span 2; display: grid; width: 44px; height: 44px; place-items: center; border-radius: var(--radius); background: var(--success-bg); color: var(--accent); font-size: 18px; }
.admin-group-main strong { align-self: end; font-size: 16px; color: var(--text-primary); }
.admin-group-main small { align-self: start; color: var(--text-secondary); font-size: 12px; font-weight: 700; }
.admin-group-actions { display: flex; flex-direction: column; gap: 6px; padding: 10px 10px 10px 0; justify-content: center; }
.admin-bank-board { border: 1px solid var(--border-default); border-radius: var(--radius); background: #fff; padding: 18px; }
.admin-board-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.admin-board-head h4 { margin: 0 0 4px; font-size: 18px; }
.admin-board-head p { margin: 0; color: var(--text-secondary); font-size: 13px; font-weight: 700; }
.admin-bank-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.admin-bank-card { display: flex; flex-direction: column; gap: 14px; min-height: 190px; padding: 18px; border: 1px solid var(--border-default); border-radius: var(--radius); background: var(--bg-card); }
.admin-bank-card-top { display: flex; gap: 13px; min-width: 0; }
.admin-bank-card-top h4 { margin: 0 0 6px; font-size: 17px; }
.admin-bank-card-top p { margin: 0; color: var(--text-secondary); font-size: 13px; line-height: 1.45; }
.admin-bank-card-meta { display: flex; flex-wrap: wrap; gap: 8px; margin-top: auto; }
.admin-bank-card-meta > span { display: inline-flex; min-height: 24px; align-items: center; padding: 3px 9px; border-radius: var(--radius-sm); background: var(--bg-input); color: var(--text-secondary); font-size: 12px; font-weight: 800; }
.admin-bank-card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-tag.muted { background: var(--bg-input); color: var(--text-secondary); }
.admin-group-card.collapsed + .admin-bank-board { display: none; }
.admin-import-inline { box-shadow: 0 10px 24px rgba(20,125,100,.18); }
.admin-add-group-form { display: flex; align-items: center; gap: 10px; margin: -2px 0 14px; padding: 12px; border: 1px solid var(--border-default); border-radius: var(--radius); background: var(--success-bg); }
.admin-add-group-form input { flex: 1; min-height: 40px; padding: 8px 12px; border: 1px solid var(--border-default); border-radius: var(--radius-sm); font-size: 14px; outline: none; }
.admin-add-group-form input:focus { border-color: var(--accent); }
.admin-bank-board[hidden] { display: none !important; }
