/* ============================================================
   Premium Minimalist Design System
============================================================ */
:root {
  /* Colors — Navy + Cyan Design System */
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-elevated: #1e293b;
  --surface-hover: #334155;
  --border: #334155;
  --border-light: #475569;
  --text: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;
  --accent: #06b6d4;
  --accent-dim: rgba(6, 182, 212, 0.15);
  --accent-hover: #22d3ee;
  --accent-glow: rgba(6, 182, 212, 0.25);
  --success: #10b981;
  --success-dim: rgba(16, 185, 129, 0.12);
  --danger: #ef4444;
  --danger-dim: rgba(239, 68, 68, 0.12);
  --warning: #f59e0b;
  --warning-dim: rgba(245, 158, 11, 0.12);

  /* Typography */
  --font: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
  --font-mono: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Spacing */
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
  --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.2);
  --shadow-lg: 0 4px 16px rgba(0,0,0,0.5), 0 8px 32px rgba(0,0,0,0.3);

  /* Transitions */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fast: 150ms var(--ease);
  --normal: 250ms var(--ease);
}

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

html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  letter-spacing: -0.01em;
  overflow-x: hidden;
}

/* ============================================================
   Animated Background
============================================================ */
#bg-canvas {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: 0.7;
}

.bg-orb {
  position: fixed; border-radius: 50%; pointer-events: none; z-index: 0;
  filter: blur(100px); opacity: 0.12;
}
.bg-orb.o1 {
  width: 500px; height: 500px;
  background: radial-gradient(circle, var(--accent), transparent);
  top: -150px; right: -100px;
  animation: orbFloat1 18s ease-in-out infinite;
}
.bg-orb.o2 {
  width: 400px; height: 400px;
  background: radial-gradient(circle, #22d3ee, transparent);
  bottom: -120px; left: -80px;
  animation: orbFloat2 22s ease-in-out infinite;
}
.bg-orb.o3 {
  width: 300px; height: 300px;
  background: radial-gradient(circle, #22c55e, transparent);
  top: 45%; left: 40%;
  animation: orbFloat3 20s ease-in-out infinite;
}
@keyframes orbFloat1 {
  0%,100%{transform:translate(0,0) scale(1)}
  25%{transform:translate(-60px,40px) scale(1.15)}
  50%{transform:translate(-30px,-20px) scale(0.9)}
  75%{transform:translate(40px,-30px) scale(1.1)}
}
@keyframes orbFloat2 {
  0%,100%{transform:translate(0,0) scale(1)}
  33%{transform:translate(50px,-30px) scale(1.2)}
  66%{transform:translate(-20px,40px) scale(0.85)}
}
@keyframes orbFloat3 {
  0%,100%{transform:translate(0,0) scale(1)}
  50%{transform:translate(-40px,-20px) scale(1.2)}
}

/* ============================================================
   Layout
============================================================ */
#app {
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 24px;
  min-height: 100vh;
  display: flex;
  gap: 20px;
}

/* ============================================================
   Sidebar
============================================================ */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: sticky;
  top: 20px;
  align-self: flex-start;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px 16px 16px;
  text-align: left;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}

.sidebar-logo {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--accent), #22d3ee, var(--accent));
  background-size: 200% 200%;
  animation: logoShine 3s ease-in-out infinite;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
  font-weight: 700;
  flex-shrink: 0;
  box-shadow: 0 0 20px var(--accent-dim);
}
@keyframes logoShine {
  0%,100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.sidebar-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.sidebar-subtitle {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.nav-menu {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.875rem;
  font-family: var(--font);
  font-weight: 500;
  transition: all var(--fast);
  text-align: left;
  width: 100%;
  position: relative;
  letter-spacing: -0.01em;
}

.nav-item:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-item .nav-icon {
  font-size: 1.05rem;
  width: 24px;
  text-align: center;
  flex-shrink: 0;
  line-height: 1;
}

.nav-item .nav-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 20px;
  text-align: center;
  line-height: 1.4;
}

.nav-online {
  margin-top: 4px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.nav-online .online-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--success);
  flex-shrink: 0;
  position: relative;
}

.nav-online .online-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: rgba(34,197,94,0.25);
  animation: onlinePulse 2.5s ease-in-out infinite;
}

@keyframes onlinePulse {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.8); opacity: 0; }
}

.nav-user {
  margin-top: 4px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text);
}

/* Main content */
.main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ============================================================
   Header
============================================================ */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 20px;
  position: sticky;
  top: 20px;
  z-index: 100;
  min-height: 52px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-left h1 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.header-left h1 span {
  color: var(--text);
}

.header-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.header-back { display: none; }
.header-back.show { display: flex; }

.menu-toggle { display: none; }

/* ============================================================
   Buttons
============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-elevated);
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: var(--font);
  font-weight: 500;
  transition: all var(--fast);
  white-space: nowrap;
  letter-spacing: -0.01em;
  line-height: 1.4;
}

.btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-light);
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #0891b2);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  position: relative;
  overflow: hidden;
}
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0; left: -120%;
  width: 80%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
  transition: left 0.5s ease;
}
.btn-primary:hover::after { left: 120%; }
.btn-primary:hover {
  box-shadow: 0 4px 20px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-success {
  color: var(--success);
  border-color: rgba(34,197,94,0.25);
  background: var(--success-dim);
}

.btn-success:hover {
  background: rgba(34,197,94,0.18);
  border-color: rgba(34,197,94,0.4);
}

.btn-danger {
  color: var(--danger);
  border-color: rgba(239,68,68,0.25);
  background: var(--danger-dim);
}

.btn-danger:hover {
  background: rgba(239,68,68,0.18);
  border-color: rgba(239,68,68,0.4);
}

.btn-sm { padding: 5px 12px; font-size: 0.8rem; border-radius: 6px; }
.btn-lg { padding: 12px 24px; font-size: 0.95rem; border-radius: var(--radius); }

.btn:disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ============================================================
   Section Header
============================================================ */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text), #22d3ee);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ============================================================
   Bank Cards Grid
============================================================ */
.bank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.bank-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  cursor: pointer;
  transition: all var(--normal);
  position: relative;
  overflow: hidden;
}
.bank-card::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.015), transparent);
  transition: left 0.6s ease;
}
.bank-card:hover::after { left: 120%; }
.bank-card:hover {
  border-color: var(--accent);
  background: var(--surface-elevated);
  transform: translateY(-3px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5), 0 0 60px var(--accent-dim);
}

.bank-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 14px;
}

.bank-card-icon {
  font-size: 1.8rem;
  line-height: 1;
}

.bank-card-name {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.4;
  word-break: break-word;
  letter-spacing: -0.01em;
}

.bank-card-stats {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.stat-chip {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-weight: 500;
}

.stat-chip.single { color: #22d3ee; border-color: rgba(34,211,238,0.2); background: rgba(34,211,238,0.08); }
.stat-chip.multi { color: #a78bfa; border-color: rgba(167,139,250,0.2); background: rgba(167,139,250,0.08); }
.stat-chip.judge { color: #f472b6; border-color: rgba(244,114,182,0.2); background: rgba(244,114,182,0.08); }

.bank-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 16px;
  flex-wrap: wrap;
}

/* Rename inline */
.rename-input {
  width: 100%;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--accent);
  background: var(--surface-elevated);
  color: var(--text);
  font-size: 0.9rem;
  font-family: var(--font);
  margin-top: 10px;
  outline: none;
  transition: border var(--fast);
}

.rename-input:focus {
  border-color: var(--accent-hover);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.rename-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

/* ============================================================
   Import Zone
============================================================ */
.import-zone {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  text-align: center;
  cursor: pointer;
  transition: all var(--normal);
  background: var(--surface);
}

.import-zone:hover,
.import-zone.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.import-zone-icon {
  font-size: 2.5rem;
  margin-bottom: 14px;
  opacity: 0.8;
}

.import-zone-text {
  font-size: 0.95rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

.import-zone-text strong {
  color: var(--accent);
  font-weight: 600;
}

/* ============================================================
   Empty State
============================================================ */
.empty-state {
  text-align: center;
  padding: 60px 24px;
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

/* ============================================================
   Filter Bar
============================================================ */
.filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  align-items: center;
}

.filter-chip {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--fast);
  font-family: var(--font);
  font-weight: 500;
}

.filter-chip.active,
.filter-chip:hover {
  background: var(--accent-dim);
  border-color: rgba(6,182,212,0.3);
  color: var(--accent);
}

.filter-chip.active {
  background: var(--accent-dim);
  font-weight: 600;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
  font-family: var(--font);
  transition: all var(--fast);
  letter-spacing: -0.01em;
  outline: none;
}

.search-input::placeholder { color: var(--text-tertiary); }

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.filter-select {
  padding: 8px 30px 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--fast);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%238e8e98' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  outline: none;
  font-weight: 500;
}

.filter-select:hover { border-color: var(--border-light); }
.filter-select:focus { border-color: var(--accent); }

.filter-select option {
  background: var(--surface-elevated);
  color: var(--text);
}

/* Mode toggle */
.mode-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  border: 1px solid var(--border-light);
  background: var(--surface);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--fast);
  font-family: var(--font);
  font-weight: 500;
}

.mode-toggle-btn:hover {
  border-color: rgba(6,182,212,0.4);
  color: #22d3ee;
}

.mode-toggle-btn.mode-jump {
  border-color: rgba(6,182,212,0.4);
  color: var(--accent);
}

/* ============================================================
   Question Card
============================================================ */
.question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  margin-bottom: 16px;
  animation: fadeSlideIn 0.35s var(--ease);
  transition: border-color var(--normal), box-shadow var(--normal);
}
.question-card:hover {
  border-color: rgba(6,182,212,0.2);
  box-shadow: 0 0 40px rgba(6,182,212,0.04);
}

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

.jump-highlight {
  animation: jumpGlow 0.6s ease-out 3;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--accent-dim) !important;
}

@keyframes jumpGlow {
  0%, 100% { box-shadow: 0 0 0 3px var(--accent-dim); }
  50% { box-shadow: 0 0 0 8px rgba(6,182,212,0.2); }
}

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

.question-type {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.type-single { background: rgba(34,211,238,0.15); color: #22d3ee; }
.type-multi  { background: rgba(167,139,250,0.12); color: #a78bfa; }
.type-judge  { background: rgba(244,114,182,0.12); color: #f472b6; }

.question-number {
  color: var(--text-tertiary);
  font-size: 0.85rem;
  font-family: var(--font-mono);
}

.question-title {
  font-size: 1.05rem;
  line-height: 1.7;
  margin-bottom: 20px;
  font-weight: 500;
}

/* Options */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text);
  cursor: pointer;
  transition: all var(--fast);
  text-align: left;
  font-size: 0.95rem;
  font-family: var(--font);
  font-weight: 500;
}

.option-btn:hover {
  background: var(--surface-hover);
  border-color: var(--border-light);
}

.option-btn.selected {
  border-color: var(--accent);
  background: var(--accent-dim);
  color: var(--accent);
}

.option-btn.correct {
  border-color: var(--success);
  background: var(--success-dim);
}

.option-btn.wrong {
  border-color: var(--danger);
  background: var(--danger-dim);
}

.option-btn.show-correct {
  border-color: rgba(34,197,94,0.3);
  background: rgba(34,197,94,0.06);
}

.option-btn:disabled {
  pointer-events: none;
  opacity: 0.75;
}

.option-label {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
  font-family: var(--font-mono);
  transition: all var(--fast);
}

.option-btn.selected .option-label {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.option-btn.correct .option-label {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}

.option-btn.wrong .option-label {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}

@keyframes correctPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* ============================================================
   Quiz Controls
============================================================ */
.quiz-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

/* ============================================================
   Progress
============================================================ */
.progress-wrap {
  margin-bottom: 24px;
}

.progress-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.progress-bar {
  height: 5px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #22d3ee, var(--accent));
  background-size: 200% 100%;
  border-radius: 3px;
  transition: width 0.5s var(--ease);
  animation: progressShimmer 2s linear infinite;
  position: relative;
}
.progress-fill::after {
  content: '';
  position: absolute;
  top: 0; right: 0; width: 30px; height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4));
  border-radius: 3px;
}
@keyframes progressShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: 0% 0; }
}

/* ============================================================
   Results
============================================================ */
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.result-card {
  text-align: center;
  padding: 24px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.result-card .value {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.result-card .label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 6px;
  font-weight: 500;
}

.result-card.accent1 .value { color: #22d3ee; }
.result-card.accent2 .value { color: #a78bfa; }
.result-card.accent3 .value { color: #f472b6; }
.result-card.success .value  { color: var(--success); }
.result-card.danger .value   { color: var(--danger); }

/* Wrong answer review */
.wrong-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 12px;
  transition: border var(--fast);
}

.wrong-item:hover { border-color: var(--border-light); }

.wrong-item .correct-answer {
  color: var(--success);
  font-weight: 600;
  margin-top: 8px;
  font-size: 0.9rem;
}

.wrong-item .your-answer {
  color: var(--danger);
  margin-top: 4px;
  font-size: 0.9rem;
}

/* ============================================================
   Toast
============================================================ */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.88rem;
  font-weight: 500;
  animation: toastIn 0.3s var(--ease);
  box-shadow: var(--shadow-lg);
  pointer-events: auto;
  letter-spacing: -0.01em;
}

.toast.success { border-color: rgba(34,197,94,0.3); }
.toast.error   { border-color: rgba(239,68,68,0.3); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(40px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ============================================================
   Modal
============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s var(--ease);
}

.modal {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 28px;
  max-width: 560px;
  width: 92%;
  max-height: 82vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal h3 {
  margin-bottom: 16px;
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ============================================================
   History Table
============================================================ */
.history-table {
  width: 100%;
  border-collapse: collapse;
}

.history-table th, .history-table td {
  padding: 10px 14px;
  text-align: center;
  border-bottom: 1px solid var(--border);
  font-size: 0.85rem;
}

.history-table th {
  color: var(--text-secondary);
  font-weight: 600;
  background: var(--surface);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.history-table tbody tr {
  transition: background var(--fast);
}

.history-table tbody tr:hover {
  background: var(--surface-hover);
}

/* ============================================================
   Export Menu
============================================================ */
.export-menu {
  position: absolute;
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  z-index: 200;
  box-shadow: var(--shadow-lg);
  margin-top: 6px;
  min-width: 200px;
}

.export-menu button {
  display: block;
  width: 100%;
  padding: 10px 18px;
  border: none;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font-size: 0.85rem;
  font-family: var(--font);
  text-align: left;
  white-space: nowrap;
  transition: background var(--fast);
  font-weight: 500;
}

.export-menu button:hover { background: var(--surface-hover); }
.export-menu button:not(:last-child) { border-bottom: 1px solid var(--border); }

/* ============================================================
   Tab Switcher
============================================================ */
.tab-bar {
  display: flex;
  gap: 0;
  margin-bottom: 20px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.tab-btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.88rem;
  font-family: var(--font);
  font-weight: 500;
  transition: all var(--fast);
}

.tab-btn.active {
  background: var(--surface-elevated);
  color: var(--text);
  font-weight: 600;
}

.tab-btn:not(:last-child) { border-right: 1px solid var(--border); }

/* ============================================================
   Confetti
============================================================ */
.confetti-piece {
  position: fixed;
  z-index: 9998;
  pointer-events: none;
  animation: confettiFall 1.8s ease-out forwards;
}

@keyframes confettiFall {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

/* ============================================================
   Scrollbar
============================================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}

/* ============================================================
   Responsive
============================================================ */
@media (max-width: 768px) {
  #app {
    padding: 0;
    max-width: 100%;
    overflow-x: hidden;
    flex-direction: column;
    gap: 0;
  }

  body {
    -webkit-text-size-adjust: 100%;
    touch-action: manipulation;
    overflow-x: hidden;
  }

  /* Sidebar → top hamburger */
  .sidebar {
    position: fixed !important;
    top: 0; left: 0; right: 0; bottom: auto !important;
    z-index: 9999;
    width: 100% !important;
    height: auto !important;
    max-height: none;
    flex-shrink: 0;
    display: block !important;
    padding: 0; margin: 0;
    align-self: auto;
    background: var(--surface-elevated);
    border-bottom: 1px solid var(--border);
    border-radius: 0;
    transition: transform 0.3s var(--ease), visibility 0.3s;
  }

  .sidebar.collapsed {
    transform: translateY(-100%);
    pointer-events: none;
    visibility: hidden;
  }

  .sidebar-header { display: none !important; }

  .menu-toggle {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    color: var(--text);
    font-size: 1.2rem;
    cursor: pointer;
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 10000;
    border-radius: var(--radius-sm);
  }

  .nav-online {
    display: flex !important;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    font-size: 0.7rem;
    color: var(--text-tertiary);
    background: transparent;
    border-top: 1px solid var(--border);
    border-radius: 0;
  }

  .nav-online .online-dot { width: 6px; height: 6px; }

  .nav-menu {
    display: flex !important;
    flex-direction: row !important;
    width: 100%;
    padding: 6px 8px;
    gap: 4px;
    background: transparent;
    border: none;
    border-radius: 0;
    flex-wrap: wrap;
  }

  .nav-item {
    flex: 1 1 auto;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 4px 6px;
    font-size: 0.62rem;
    border-radius: 10px;
    border: none !important;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    position: relative;
  }

  .nav-item.active {
    background: var(--accent-dim) !important;
    color: var(--accent);
  }

  .nav-item .nav-icon { font-size: 1.1rem; display: block; }
  .nav-item .nav-badge {
    position: absolute;
    top: 3px;
    right: 8px;
    font-size: 0.55rem;
    padding: 0 4px;
    min-width: 14px;
  }

  /* Main */
  .main-wrap {
    width: 100% !important;
    padding: 48px 10px 10px 10px !important;
    min-height: 100vh;
    flex: none;
  }

  .header {
    padding: 10px 12px;
    top: 8px;
    flex-wrap: wrap;
    gap: 8px;
    border-radius: var(--radius);
  }

  .header-left { flex: 1; min-width: 0; }
  .header-left h1 { font-size: 0.9rem; }
  .header-right { flex-wrap: wrap; gap: 4px; }
  .header-right .btn { padding: 5px 8px; font-size: 0.7rem; border-radius: 6px; }

  /* Bank cards */
  .bank-grid { grid-template-columns: 1fr; gap: 10px; }
  .bank-card { padding: 18px; }
  .bank-card-name { font-size: 0.95rem; }
  .bank-card-stats { gap: 6px; }
  .bank-card-stats .stat-chip { font-size: 0.7rem; padding: 3px 8px; }
  .bank-card-actions { gap: 4px; }
  .bank-card-actions .btn { padding: 5px 10px; font-size: 0.72rem; }

  /* Import */
  .import-zone { padding: 28px 16px; }
  .import-zone-text { font-size: 0.85rem; }

  /* Filter bar */
  .filter-bar { flex-wrap: wrap; gap: 6px; }
  .filter-bar .search-input { width: 100%; min-width: 0; font-size: 16px; padding: 10px 14px; }
  .filter-chip { padding: 8px 14px; font-size: 0.8rem; min-height: 38px; }
  .filter-select {
    -webkit-appearance: auto !important;
    appearance: auto !important;
    background-image: none !important;
    padding: 8px 8px !important;
    font-size: 16px !important;
    min-height: 40px;
  }
  .mode-toggle-btn { padding: 8px 12px; font-size: 0.78rem; gap: 2px; min-height: 38px; }
  .mode-toggle-btn .mode-arrow { display: none; }

  /* Question */
  .question-card { padding: 16px; margin-bottom: 12px; }
  .question-title { font-size: 0.92rem; line-height: 1.6; word-break: break-word; }
  .question-meta { gap: 6px; }
  .question-type { font-size: 0.7rem; padding: 3px 8px; }
  .option-btn { padding: 14px 12px; gap: 10px; font-size: 0.88rem; min-height: 48px; }
  .option-btn .option-label { width: 28px; height: 28px; font-size: 0.75rem; }
  .option-btn span:not(.option-label) { word-break: break-word; min-width: 0; }

  /* Buttons general mobile */
  .btn { padding: 10px 14px; font-size: 0.82rem; min-height: 38px; }
  .btn-sm { padding: 8px 12px; min-height: 34px; }

  /* Progress */
  .progress-wrap { margin-bottom: 16px; }

  /* Quiz controls */
  .quiz-controls { flex-direction: column; gap: 8px; }
  .quiz-controls > div { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }

  /* Results */
  .result-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .result-card { padding: 16px 8px; }
  .result-card .value { font-size: 1.6rem; }
  .result-card .label { font-size: 0.7rem; }

  /* Wrong items */
  .wrong-item { padding: 14px 16px; }
  .wrong-item > div { word-break: break-word; }

  /* History */
  .history-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .history-table { min-width: 560px; }
  .history-table th, .history-table td { padding: 6px 8px; font-size: 0.75rem; }

  /* Export */
  .export-menu { right: 0; }

  /* Modal */
  .modal { width: 95%; padding: 20px; max-height: 85vh; }

  /* Section header */
  .section-title { font-size: 1.05rem; -webkit-text-fill-color: var(--text); }
  .section-header { gap: 8px; }

  /* Empty */
  .empty-state { padding: 40px 16px; }
  .empty-state-icon { font-size: 2.5rem; }
}
