/* QuizOpus Global Design System — Liquid Glass v2 */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;800&family=Noto+Sans+JP:wght@400;500;600;800&display=swap');

/* モバイルダブルタップズーム防止 */
*, *::before, *::after { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

:root {
  /* Color Palette */
  --bg-dark: #020617;
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --glass-bg: rgba(30, 41, 59, 0.65);
  --glass-bg-elevated: rgba(30, 41, 59, 0.85);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-hover: rgba(255, 255, 255, 0.16);
  --glass-highlight: rgba(255, 255, 255, 0.06);
  --glass-blur: 20px;
  --glass-blur-heavy: 28px;

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-glow: rgba(59, 130, 246, 0.35);
  --accent: #fbbf24;
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.3);
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.3);
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.3);

  /* Typography */
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-faint: #64748b;
  --font-family: 'Inter', 'Noto Sans JP', -apple-system, sans-serif;

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-pill: 9999px;

  /* Shadows — Colored & Layered */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(255,255,255,0.03);
  --shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(255,255,255,0.04);
  --shadow-lg: 0 12px 40px -8px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(255,255,255,0.05);
  --shadow-xl: 0 24px 60px -12px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255,255,255,0.04);
  --shadow-glow: 0 0 20px var(--primary-glow), 0 4px 16px rgba(0,0,0,0.2);
  --shadow-glow-danger: 0 0 20px var(--danger-glow), 0 4px 16px rgba(0,0,0,0.2);
  --shadow-glow-success: 0 0 20px var(--success-glow), 0 4px 16px rgba(0,0,0,0.2);

  /* Motion */
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --smooth: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

/* Base resets & typography */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: var(--font-family);
  background:
    radial-gradient(ellipse 80% 50% at 20% 0%, rgba(59, 130, 246, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse 60% 40% at 80% 100%, rgba(139, 92, 246, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse 100% 100% at 50% 50%, var(--bg-primary) 0%, var(--bg-dark) 100%);
  background-attachment: fixed;
  color: var(--text-main);
  margin: 0;
  padding: 0;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 600;
  color: var(--text-main);
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Buttons */
.btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.12);
  transition: transform 0.5s var(--spring), box-shadow 0.4s var(--smooth), filter 0.3s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  position: relative;
  overflow: hidden;
  font-family: var(--font-family);
  letter-spacing: 0.01em;
}
.btn::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0.03) 40%, transparent 100%);
  pointer-events: none;
}
.btn:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: var(--shadow-glow);
  filter: brightness(1.08);
}
.btn:active {
  transform: translateY(0) scale(0.97);
  box-shadow: var(--shadow-sm);
  transition-duration: 0.1s;
  filter: brightness(0.95);
}
.btn:disabled {
  opacity: 0.4; cursor: not-allowed; transform: none;
  filter: grayscale(0.4) brightness(0.8);
  box-shadow: none;
}
.btn.secondary {
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-border);
  box-shadow: none;
  backdrop-filter: blur(8px);
}
.btn.secondary::after { display: none; }
.btn.secondary:hover {
  background: rgba(255,255,255,0.1);
  border-color: var(--glass-border-hover);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(59,130,246,0.4), 0 0 20px rgba(59,130,246,0.15); }

.btn.danger { background: linear-gradient(135deg, #f87171, var(--danger)); }
.btn.danger:hover { box-shadow: var(--shadow-glow-danger); }

.btn.success { background: linear-gradient(135deg, #34d399, var(--success)); }
.btn.success:hover { box-shadow: var(--shadow-glow-success); }

/* Inputs */
input[type="text"], input[type="password"], input[type="number"], input[type="email"], select {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  width: 100%;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.35s var(--smooth), background 0.35s var(--smooth), box-shadow 0.35s var(--smooth);
  font-family: var(--font-family);
}
input[type="text"]:hover, input[type="password"]:hover,
input[type="number"]:hover, input[type="email"]:hover, select:hover {
  border-color: var(--glass-border-hover);
  background: rgba(15, 23, 42, 0.7);
}
input:focus, select:focus {
  border-color: var(--primary);
  background: rgba(15, 23, 42, 0.85);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12), 0 0 24px rgba(59, 130, 246, 0.08), inset 0 0 0 1px rgba(59, 130, 246, 0.1);
}
input::placeholder { color: var(--text-faint); transition: color 0.25s, transform 0.25s; }
input:focus::placeholder { color: #64748b; transform: translateX(4px); }
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: color 0.25s;
}
label i { color: var(--primary); margin-right: 3px; }

/* Glassmorphic Panels / Cards */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow-lg);
  padding: 24px;
  transition: border-color 0.3s var(--smooth), box-shadow 0.3s var(--smooth), transform 0.3s var(--smooth);
  position: relative;
}
.glass-panel::before {
  content: ''; position: absolute; top: -1px; left: 10%; right: 10%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
  border-radius: 1px; pointer-events: none;
}
.glass-panel:hover {
  border-color: var(--glass-border-hover);
}

/* Badges / Status Pills */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.badge.primary { background: rgba(59,130,246,0.15); color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }
.badge.success { background: rgba(16,185,129,0.15); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.badge.danger { background: rgba(239,68,68,0.15); color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
.badge.warning { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.badge.muted { background: rgba(148,163,184,0.1); color: #94a3b8; border: 1px solid rgba(148,163,184,0.2); }

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  background: rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(8px);
}
table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}
table th {
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.7));
  color: var(--text-muted);
  font-weight: 600;
  padding: 12px 16px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 11px;
  border-bottom: 1px solid rgba(59, 130, 246, 0.1);
  position: sticky; top: 0; z-index: 2;
}
table td {
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}
table tbody tr {
  transition: background 0.25s var(--smooth);
}
table tbody tr:hover {
  background: rgba(59, 130, 246, 0.06);
}
table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.015);
}
table tbody tr:nth-child(even):hover {
  background: rgba(59, 130, 246, 0.06);
}

/* Modal Error Overlay */
.error-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.error-dialog {
  background: var(--bg-secondary);
  border: 2px solid var(--danger);
  border-radius: var(--radius-lg);
  padding: 32px;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 0 40px rgba(239, 68, 68, 0.3);
}
.error-dialog h2 { color: #f87171; margin-bottom: 12px; }
.error-dialog p { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; line-height: 1.6; }

/* Icon Grids & Responsive Snap Grids */
.snap-grid {
  display: grid;
  gap: 16px;
}

/* Base: Mobile (For narrow screens) */
.snap-grid {
  grid-template-columns: repeat(2, 1fr);
}

/* Tablet (Medium) */
@media (min-width: 600px) {
  .snap-grid {
    grid-template-columns: repeat(5, 1fr);
  }
}

/* Small Desktop (Large) */
@media (min-width: 1024px) {
  .snap-grid {
    grid-template-columns: repeat(8, 1fr);
  }
}

/* Wide Desktop (X-Large) */
@media (min-width: 1280px) {
  .snap-grid {
    grid-template-columns: repeat(10, 1fr);
  }
}

/* Icon text helpers */
i.icon-text { margin-right: 6px; }
.card-icon-header {
  font-size: 32px;
  color: var(--primary);
  margin-bottom: 12px;
}
.stat-card.glass-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 24px;
}



/* Progress Bar */
.progress-bar-wrap {
  background: rgba(15,23,42,0.6); border-radius: var(--radius-sm);
  overflow: hidden; height: 6px; margin: 12px 0;
  border: 1px solid var(--glass-border);
}
.progress-bar-inner {
  height: 100%; background: linear-gradient(90deg, var(--primary), #60a5fa);
  width: 0%; transition: width 0.3s; border-radius: var(--radius-sm);
}

/* Select (native fallback arrow) */
select {
  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 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

/* ========= Custom Dropdown ========= */
.custom-dropdown {
  position: relative;
  width: 100%;
}
.custom-dropdown .cd-trigger {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 12px 14px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-size: 14px; font-family: var(--font-family);
  cursor: pointer;
  transition: all 0.25s ease;
  box-sizing: border-box;
  user-select: none;
}
.custom-dropdown .cd-trigger:hover {
  border-color: rgba(255,255,255,0.2);
  background: rgba(15, 23, 42, 0.75);
}
.custom-dropdown.open .cd-trigger {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15), 0 0 20px rgba(59, 130, 246, 0.08);
  background: rgba(15, 23, 42, 0.9);
}
.custom-dropdown .cd-trigger .cd-placeholder {
  color: #475569;
}
.custom-dropdown .cd-trigger .cd-arrow {
  width: 16px; height: 16px; flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  color: #64748b;
}
.custom-dropdown.open .cd-trigger .cd-arrow {
  transform: rotate(180deg);
  color: var(--primary);
}

.custom-dropdown .cd-menu {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  background: #1e293b;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-md);
  box-shadow: 0 16px 48px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.04);
  z-index: 200;
  max-height: 0; overflow: hidden;
  opacity: 0; transform: translateY(-4px);
  transition: max-height 0.3s cubic-bezier(0.22, 1, 0.36, 1),
              opacity 0.2s ease,
              transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  pointer-events: none;
}
.custom-dropdown.open .cd-menu {
  max-height: 260px; overflow-y: auto;
  opacity: 1; transform: translateY(0);
  pointer-events: auto;
}

.custom-dropdown .cd-search {
  position: sticky; top: 0; z-index: 1;
  padding: 8px 10px;
  background: #1e293b;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.custom-dropdown .cd-search input {
  width: 100%; padding: 8px 12px;
  background: rgba(15,23,42,0.8);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  color: var(--text-main); font-size: 13px;
  font-family: var(--font-family);
  outline: none; box-sizing: border-box;
}
.custom-dropdown .cd-search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}
.custom-dropdown .cd-search input::placeholder { color: #475569; }

.custom-dropdown .cd-option {
  padding: 10px 14px;
  font-size: 14px; color: #cbd5e1;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex; align-items: center; gap: 8px;
}
.custom-dropdown .cd-option:hover {
  background: rgba(59, 130, 246, 0.12);
  color: white;
}
.custom-dropdown .cd-option.selected {
  background: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
  font-weight: 600;
}
.custom-dropdown .cd-option.selected::before {
  content: '✓'; font-size: 12px; color: #3b82f6;
  width: 16px; text-align: center; flex-shrink: 0;
}
.custom-dropdown .cd-option:not(.selected)::before {
  content: ''; width: 16px; flex-shrink: 0;
}
.custom-dropdown .cd-option.hidden { display: none; }
.custom-dropdown .cd-no-match {
  padding: 16px; text-align: center; font-size: 13px; color: #64748b;
}

/* Scrollbar inside dropdown */
.custom-dropdown .cd-menu::-webkit-scrollbar { width: 6px; }
.custom-dropdown .cd-menu::-webkit-scrollbar-track { background: transparent; }
.custom-dropdown .cd-menu::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1); border-radius: 3px;
}
.custom-dropdown .cd-menu::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.2);
}


/* File Upload Zone */
.file-upload-zone {
  border: 2px dashed var(--glass-border); border-radius: var(--radius-md);
  padding: 24px; text-align: center; cursor: pointer;
  transition: all 0.2s; background: rgba(15,23,42,0.4);
}
.file-upload-zone:hover { border-color: var(--primary); background: rgba(59,130,246,0.05); }
.file-upload-zone.active { border-color: var(--primary); background: rgba(59,130,246,0.1); }
.file-upload-zone i { font-size: 28px; color: var(--text-muted); margin-bottom: 8px; display: block; }
.file-upload-zone .file-label { font-size: 13px; color: var(--text-muted); font-weight: 600; }
.file-upload-zone .file-name { font-size: 12px; color: var(--primary); margin-top: 8px; font-weight: 600; display: none; }
.file-upload-zone input[type="file"] { display: none; }

/* ID Copy Badge */
.id-copy-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: var(--radius-md);
  background: rgba(15,23,42,0.6); border: 1px solid var(--glass-border);
  font-family: 'Courier New', monospace; font-size: 13px; font-weight: 600;
  color: var(--text-muted); cursor: pointer; transition: all 0.2s;
  margin-left: auto; white-space: nowrap;
}
.id-copy-badge:hover { border-color: var(--primary); color: var(--text-main); }
.id-copy-badge i { color: var(--primary); }

/* Status message */
.status-msg { display: none; padding: 12px; border-radius: var(--radius-md); font-size: 13px; text-align: center; margin-top: 12px; }

/* CSV status */
.csv-status { font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.csv-status.ready { color: #34d399; }
.csv-status.notready { color: #f87171; }

/* ===== Custom Checkbox ===== */
input[type="checkbox"] {
  appearance: none; -webkit-appearance: none; -moz-appearance: none;
  width: 20px; height: 20px; flex-shrink: 0;
  background: rgba(15, 23, 42, 0.6);
  border: 1.5px solid var(--glass-border);
  border-radius: 5px; cursor: pointer;
  position: relative; transition: all 0.2s;
  vertical-align: middle;
  display: inline-flex; align-items: center; justify-content: center;
}
input[type="checkbox"]:hover {
  border-color: var(--primary);
  background: rgba(59,130,246,0.1);
}
input[type="checkbox"]:checked {
  background: var(--primary);
  border-color: var(--primary);
}
input[type="checkbox"]:checked::after {
  content: '\f00c';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  font-size: 11px;
  color: white;
  position: absolute;
}
input[type="checkbox"]:focus-visible {
  box-shadow: 0 0 0 3px rgba(59,130,246,0.3);
  outline: none;
}

/* ===== Custom Select (Enhanced) ===== */
select {
  cursor: pointer;
}
select option {
  background: var(--bg-secondary);
  color: var(--text-main);
  padding: 8px;
}

/* ===== Custom Number Input Spinner ===== */
input[type="number"] {
  -moz-appearance: textfield !important;
  appearance: textfield !important;
}
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none !important;
  appearance: none !important;
  margin: 0 !important;
}
.number-spinner-wrap {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center !important;
  background: rgba(15,23,42,0.6);
  border: 1.5px solid var(--glass-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  max-width: 160px;
  height: 48px;
  box-shadow: var(--shadow-sm);
}
.number-spinner-btn {
  background: rgba(255,255,255,0.03);
  border: none;
  color: var(--text-main);
  width: 48px;
  height: 100%;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 16px;
  padding: 0;
}
.number-spinner-btn:hover {
  background: rgba(255,255,255,0.1);
  color: var(--primary);
}
.number-spinner-btn:active {
  background: rgba(59,130,246,0.2);
}
.number-spinner-wrap input[type="number"] {
  flex: 1;
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  text-align: center;
  padding: 0 !important;
  width: 60px;
  height: 100%;
  font-size: 18px;
  font-weight: 800;
  box-shadow: none !important;
  color: var(--primary);
}

/* ============================
   Public Pages - Shared Styles
   ============================ */
.page-wrapper {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 32px 24px; min-height: 100vh;
}
.page-container {
  width: 100%; max-width: 520px;
  animation: fadeSlideUp 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.page-container.wide { max-width: 900px; }
.page-container.full { max-width: 100%; }

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

.page-logo {
  text-align: center; margin-bottom: 32px;
}
.page-logo .logo-icon {
  font-size: 44px; margin-bottom: 10px; display: block;
  background: linear-gradient(135deg, #60a5fa, #8b5cf6, #ec4899);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  animation: fadeSlideUp 0.5s var(--smooth);
  filter: drop-shadow(0 2px 8px rgba(99, 102, 241, 0.3));
}
.page-logo h1 {
  font-size: 24px; font-weight: 800; letter-spacing: 0.3px;
  animation: fadeSlideUp 0.6s var(--smooth) 0.08s both;
}
.page-logo .logo-sub {
  color: var(--text-muted); font-size: 13px; margin-top: 6px; font-weight: 500;
  animation: fadeSlideUp 0.6s var(--smooth) 0.16s both;
}

.page-card {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border); border-radius: var(--radius-lg);
  padding: 28px; box-shadow: var(--shadow-lg);
  position: relative;
  animation: fadeSlideUp 0.7s var(--smooth) 0.12s both;
}
.page-card::before {
  content: ''; position: absolute; top: -1px; left: 15%; right: 15%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(59,130,246,0.45), rgba(139,92,246,0.4), transparent);
  border-radius: 2px;
}

.page-input {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-md);
  border: 1px solid var(--glass-border); background: rgba(15,23,42,0.5);
  color: var(--text-main); font-size: 14px; font-family: var(--font-family);
  outline: none; transition: border-color 0.3s var(--smooth), background 0.3s var(--smooth), box-shadow 0.3s var(--smooth); box-sizing: border-box;
}
.page-input:hover { border-color: var(--glass-border-hover); background: rgba(15,23,42,0.65); }
.page-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,0.12), 0 0 24px rgba(59,130,246,0.08); }
.page-input::placeholder { color: var(--text-faint); }

.page-btn {
  width: 100%; padding: 14px; border-radius: var(--radius-md); border: none;
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white; font-size: 15px; font-weight: 600; cursor: pointer;
  font-family: var(--font-family);
  transition: transform 0.5s var(--spring), box-shadow 0.4s var(--smooth), filter 0.3s;
  box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.12);
  position: relative; overflow: hidden;
}
.page-btn::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(255,255,255,0.15) 0%, rgba(255,255,255,0.03) 40%, transparent 100%);
  pointer-events: none;
}
.page-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-glow); filter: brightness(1.08); }
.page-btn:active { transform: translateY(0) scale(0.97); box-shadow: var(--shadow-sm); transition-duration: 0.1s; filter: brightness(0.95); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; box-shadow: none; filter: grayscale(0.4); }
.page-btn.danger {
  background: linear-gradient(135deg, #f87171, var(--danger));
}
.page-btn.danger:hover { box-shadow: var(--shadow-glow-danger); }

.page-footer {
  text-align: center; margin-top: 40px; padding-top: 20px;
  border-top: 1px solid rgba(255,255,255,0.04);
  font-size: 11px; color: rgba(148,163,184,0.4); font-weight: 500;
  letter-spacing: 0.03em;
}

.page-disabled {
  text-align: center; padding: 40px 28px; color: var(--text-muted);
}
.page-disabled i { font-size: 40px; display: block; margin-bottom: 16px; color: var(--text-muted); opacity: 0.6; }
.page-disabled h2 { font-size: 18px; margin-bottom: 12px; color: var(--text-main); font-weight: 700; }
.page-disabled p { font-size: 14px; line-height: 1.6; }

/* Result Success Card */
.result-card { text-align: center; }
.result-title { color: #34d399; margin-bottom: 16px; font-size: 20px; font-weight: 700; }
.result-title i { margin-right: 4px; }
.result-desc { margin-bottom: 24px; color: var(--text-muted); font-size: 14px; line-height: 1.7; }

/* Textarea */
textarea {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  width: 100%;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.3s var(--smooth), background 0.3s var(--smooth), box-shadow 0.3s var(--smooth);
  font-family: var(--font-family);
  resize: vertical;
  min-height: 80px;
}
textarea:hover {
  border-color: var(--glass-border-hover);
  background: rgba(15, 23, 42, 0.65);
}
textarea:focus {
  border-color: var(--primary);
  background: rgba(15, 23, 42, 0.85);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12), 0 0 24px rgba(59, 130, 246, 0.08), inset 0 0 0 1px rgba(59, 130, 246, 0.1);
}
textarea::placeholder { color: var(--text-faint); }

.page-msg {
  margin-top: 16px; padding: 12px 16px; border-radius: var(--radius-md);
  font-size: 14px; text-align: center; display: none; line-height: 1.5;
}
.page-msg.error { background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.2); color: #f87171; }
.page-msg.success { background: rgba(16,185,129,0.1); border: 1px solid rgba(16,185,129,0.2); color: #34d399; }
.page-msg.info { background: rgba(59,130,246,0.1); border: 1px solid rgba(59,130,246,0.2); color: #60a5fa; }

/* ============================
   Fixed Header (Internal Pages)
   ============================ */
.fixed-header {
  position: fixed; top: 0; left: 0; right: 0;
  background: var(--glass-bg-elevated);
  backdrop-filter: blur(var(--glass-blur-heavy)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--glass-blur-heavy)) saturate(180%);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 12px 20px;
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center;
  z-index: 100;
  box-shadow: 0 1px 32px rgba(0,0,0,0.25), 0 0 0 1px rgba(255,255,255,0.03);
}
.fixed-header::after {
  content: ''; position: absolute; bottom: -1px; left: 0; right: 0;
  height: 1px; background: linear-gradient(90deg, transparent 5%, rgba(59,130,246,0.35) 30%, rgba(139,92,246,0.3) 70%, transparent 95%);
}
.fixed-header .header-left,
.fixed-header .header-right { display: flex; align-items: center; min-width: 0; }
.fixed-header .header-right { justify-content: flex-end; }
.fixed-header .header-center {
  display: flex; align-items: center; justify-content: center; gap: 12px;
}
.fixed-header h1 {
  font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
@media (max-width: 600px) {
  .fixed-header { padding: 8px 12px; gap: 6px; grid-template-columns: auto 1fr auto; }
  .fixed-header h1 { font-size: 14px; }
  .fixed-header .header-center { gap: 6px; }
  .q-badge { padding: 4px 10px; font-size: 13px; }
  .answer-badge { font-size: 18px; }
  .progress-text { font-size: 11px; }
  .back-nav-btn { font-size: 13px; padding: 6px 10px; }
  .counter { font-size: 11px; padding: 4px 10px; }
}
/* ============================
   Answer Sheet Preview Overlay
   ============================ */
.preview-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.9); backdrop-filter: blur(10px);
  z-index: 10000; display: none; overflow-y: auto; padding: 24px;
}
.preview-overlay.show { display: block; animation: fadeIn 0.3s; }
.preview-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px;
}
.preview-header h2 { color: white; font-size: 18px; }
.preview-close {
  background: var(--bg-secondary); border: 1px solid var(--glass-border);
  color: var(--text-main); padding: 8px 16px; border-radius: var(--radius-md);
  cursor: pointer; font-size: 14px; font-weight: 600; transition: all 0.2s;
}
.preview-close:hover { background: #334155; }

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

/* ============================
   Slide Panel Menu
   ============================ */

/* Trigger button */
.menu-trigger {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.06); border: 1px solid var(--glass-border);
  color: var(--text-main); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all 0.25s ease;
  backdrop-filter: blur(8px);
}
.menu-trigger:hover {
  background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.2);
  box-shadow: 0 0 16px rgba(59,130,246,0.15);
}
.menu-trigger .trigger-icon {
  display: flex; flex-direction: column; gap: 4px;
  width: 18px; transition: all 0.3s ease;
}
.menu-trigger .trigger-icon span {
  display: block; height: 2px; background: var(--text-main);
  border-radius: 2px; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.menu-trigger .trigger-icon span:nth-child(2) { width: 12px; margin-left: auto; }

/* Backdrop */
.menu-backdrop {
  position: fixed; inset: 0; background: rgba(2,6,23,0.6);
  backdrop-filter: blur(4px); z-index: 999;
  opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.menu-backdrop.active { opacity: 1; pointer-events: auto; }

/* Panel */
.menu-panel {
  position: fixed; top: 0; right: -320px; bottom: 0;
  width: 300px; max-width: 85vw; z-index: 1000;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  border-left: 1px solid rgba(255,255,255,0.08);
  box-shadow: -8px 0 32px rgba(0,0,0,0.4);
  display: flex; flex-direction: column;
  transition: right 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  overflow-y: auto;
}
.menu-panel.open { right: 0; }

/* Close button */
.menu-panel-close {
  position: absolute; top: 16px; right: 16px;
  width: 32px; height: 32px; border-radius: 50%;
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-muted); font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.2s;
}
.menu-panel-close:hover { background: rgba(239,68,68,0.15); color: #f87171; border-color: rgba(239,68,68,0.3); }

/* Profile section */
.menu-profile {
  padding: 28px 24px 20px; text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.menu-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 12px; font-size: 22px; color: white;
  box-shadow: 0 4px 12px rgba(59,130,246,0.3);
}
.menu-profile-name {
  font-size: 16px; font-weight: 700; color: var(--text-main);
  margin-bottom: 6px;
}
.menu-role-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 14px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600;
}
.menu-role-badge.admin {
  background: linear-gradient(135deg, rgba(251,191,36,0.15), rgba(251,191,36,0.08));
  color: #fbbf24; border: 1px solid rgba(251,191,36,0.25);
}
.menu-role-badge.scorer {
  background: rgba(59,130,246,0.12); color: #60a5fa;
  border: 1px solid rgba(59,130,246,0.25);
}

/* Sections */
.menu-section {
  padding: 12px 16px 4px;
}
.menu-section-label {
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 1.5px;
  padding: 0 8px; margin-bottom: 4px;
}

/* Menu items */
.menu-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px; margin: 2px 0;
  border-radius: var(--radius-md);
  color: var(--text-main); font-size: 14px; font-weight: 500;
  cursor: pointer; border: none; background: transparent;
  width: 100%; text-align: left;
  transition: all 0.2s ease; position: relative;
}
.menu-item:hover {
  background: rgba(255,255,255,0.06);
}
.menu-item:active { transform: scale(0.98); }
.menu-item i {
  width: 20px; text-align: center; font-size: 15px; color: var(--text-muted);
  transition: color 0.2s;
}
.menu-item:hover i { color: #60a5fa; }
.menu-item.danger { color: #f87171; }
.menu-item.danger i { color: #f87171; }
.menu-item.danger:hover { background: rgba(239,68,68,0.08); }
.menu-item.warn { color: #fbbf24; }
.menu-item.warn i { color: #fbbf24; }
.menu-item.warn:hover { background: rgba(251,191,36,0.08); }

/* Divider */
.menu-divider {
  height: 1px; background: rgba(255,255,255,0.06);
  margin: 8px 16px;
}

/* Footer */
.menu-footer {
  margin-top: auto; padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.menu-item:focus-visible {
  outline: none; box-shadow: 0 0 0 2px rgba(59,130,246,0.5);
}

/* ============================
   Back Navigation Button
   ============================ */
.back-nav-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px; border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1);
  color: var(--text-muted); font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all 0.2s ease;
  text-decoration: none;
}
.back-nav-btn:hover {
  background: rgba(255,255,255,0.1); color: var(--text-main);
  border-color: rgba(255,255,255,0.2);
}
.back-nav-btn i { font-size: 12px; }

/* ============================
   Unified Loading Spinner
   ============================ */
.loading-state {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 12px; padding: 60px 20px;
  color: var(--text-muted); font-size: 14px; font-weight: 600;
}
.loading-state i { font-size: 24px; color: var(--primary); }

/* ============================
   Toast Notifications
   ============================ */
.toast-container {
  position: fixed; top: 20px; right: 20px; z-index: 99999;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 20px; border-radius: 12px;
  font-size: 13px; font-weight: 600; font-family: var(--font-family);
  color: white; pointer-events: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  backdrop-filter: blur(12px);
  transform: translateX(120%); opacity: 0;
  transition: all 0.35s cubic-bezier(0.21, 1.02, 0.73, 1);
}
.toast.show { transform: translateX(0); opacity: 1; }
.toast.hide { transform: translateX(120%); opacity: 0; }
.toast i { font-size: 16px; flex-shrink: 0; }
.toast-success { background: linear-gradient(135deg, rgba(16,185,129,0.95), rgba(5,150,105,0.95)); }
.toast-error { background: linear-gradient(135deg, rgba(239,68,68,0.95), rgba(220,38,38,0.95)); }
.toast-info { background: linear-gradient(135deg, rgba(59,130,246,0.95), rgba(37,99,235,0.95)); }

/* ============================
   Confirm Dialog
   ============================ */
.confirm-overlay {
  position: fixed; inset: 0; z-index: 99998;
  background: rgba(15,23,42,0.8); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.2s ease;
}
.confirm-dialog {
  width: 90%; max-width: 360px; padding: 28px; text-align: center;
  animation: scaleIn 0.25s cubic-bezier(0.21, 1.02, 0.73, 1);
}
.confirm-icon {
  color: #ef4444; font-size: 36px; margin-bottom: 16px; display: block;
}
.confirm-message {
  margin-bottom: 24px; font-size: 15px; font-weight: 600;
  line-height: 1.6; color: var(--text-main);
}
.confirm-actions {
  display: flex; gap: 12px;
}
.confirm-actions .btn { flex: 1; }

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ============================
   Custom Toggle Switch (Liquid Glass)
   ============================ */
.toggle-switch {
  position: relative; display: inline-block;
  width: 48px; height: 26px; flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-slider {
  position: absolute; inset: 0; cursor: pointer;
  background: rgba(15, 23, 42, 0.4); border-radius: 26px;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.05);
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toggle-slider::before {
  content: ''; position: absolute;
  height: 20px; width: 20px; left: 3px; bottom: 3px;
  background: #cbd5e1; border-radius: 50%;
  transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 2px 5px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.4);
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--primary);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1), inset 0 0 0 1px rgba(255,255,255,0.2), 0 0 12px rgba(59,130,246,0.3);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(22px);
  background: #ffffff;
}

.toggle-switch input:focus-visible + .toggle-slider {
  outline: 2px solid var(--primary); outline-offset: 2px;
}
/* 
   ============================
   Custom Checkbox (Liquid Glass)
   ============================ 
*/
.custom-checkbox {
  position: relative; display: inline-flex; align-items: flex-start;
  cursor: pointer; user-select: none; gap: 10px;
  font-size: 14px; font-weight: 500; color: var(--text-main);
  line-height: 1.4;
}
.custom-checkbox input { position: absolute; opacity: 0; width: 0; height: 0; }
.checkbox-mark {
  position: relative;
  width: 20px; height: 20px; border-radius: 6px;
  border: 1px solid rgba(255,255,255,0.15);
  background: rgba(15, 23, 42, 0.4);
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(255,255,255,0.05);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  flex-shrink: 0; margin-top: -1px;
}
.custom-checkbox:hover .checkbox-mark {
  border-color: rgba(255,255,255,0.3);
  background: rgba(30, 41, 59, 0.6);
}
.checkbox-svg {
  width: 14px; height: 14px;
  fill: none;
  stroke: white;
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 20;
  stroke-dashoffset: 20;
  opacity: 0;
  transition: stroke-dashoffset 0.4s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s;
}

.custom-checkbox input:checked ~ .checkbox-mark {
  background: var(--primary);
  border-color: transparent;
  box-shadow: inset 0 2px 4px rgba(0,0,0,0.1), inset 0 0 0 1px rgba(255,255,255,0.2), 0 0 12px rgba(59,130,246,0.3);
  transform: scale(1.05);
}
.custom-checkbox input:checked ~ .checkbox-mark .checkbox-svg {
  stroke-dashoffset: 0;
  opacity: 1;
}
.custom-checkbox input:focus-visible ~ .checkbox-mark {
  outline: 2px solid var(--primary); outline-offset: 2px;
}

/* ============================
   Custom Select
   ============================ */
.custom-select {
  appearance: none; -webkit-appearance: none;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: var(--text-main); padding: 10px 36px 10px 14px;
  border-radius: 10px; font-size: 14px; font-weight: 500;
  font-family: var(--font-family); cursor: pointer;
  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='%2394a3b8' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  transition: all 0.2s ease; outline: none;
}
.custom-select:hover { border-color: rgba(255,255,255,0.25); }
.custom-select:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(99,102,241,0.3); }

/* ============================
   Status Badges
   ============================ */
.status-badge {
  padding: 4px 12px; border-radius: 9999px;
  font-size: 12px; font-weight: 700;
  display: inline-flex; align-items: center; gap: 4px;
}
.status-badge.open {
  background: rgba(16,185,129,0.15); color: #34d399;
  border: 1px solid rgba(16,185,129,0.3);
}
.status-badge.closed {
  background: rgba(239,68,68,0.15); color: #f87171;
  border: 1px solid rgba(239,68,68,0.3);
}
.status-badge.pending {
  background: rgba(251,191,36,0.15); color: #fbbf24;
  border: 1px solid rgba(251,191,36,0.3);
}

/* ============================
   Responsive: Toast on mobile
   ============================ */
@media (max-width: 600px) {
  .toast-container { top: 12px; right: 12px; left: 12px; }
  .toast { transform: translateY(-40px); }
  .toast.show { transform: translateY(0); }
  .toast.hide { transform: translateY(-40px); }
}

/* ============================
   Index Page Components
   ============================ */
.password-field-wrap {
  position: relative; margin-bottom: 8px;
}
.password-field-wrap input { margin-bottom: 0; padding-right: 40px; }
.password-toggle {
  position: absolute; right: 16px; top: 16px;
  cursor: pointer; color: #94a3b8;
}
.magic-icon { color: #fbbf24; }

.success-icon {
  font-size: 56px; margin-bottom: 16px; color: #4ade80;
}
.success-title { margin-bottom: 8px; }
.success-desc {
  margin-bottom: 24px; font-size: 14px; color: #94a3b8;
}
.credential-panel {
  background: rgba(15, 23, 42, 0.8); padding: 16px; border-radius: 12px;
  margin-bottom: 24px; text-align: left;
  border: 1px solid rgba(255,255,255,0.1);
}
.credential-row {
  display: flex; gap: 8px; flex-wrap: nowrap;
}
.credential-row:not(:last-child) { margin-bottom: 16px; }
.credential-row input {
  margin-bottom: 0; min-width: 0; flex: 1; font-size: 13px;
}
.credential-row .btn {
  width: auto; padding: 8px 12px; font-size: 12px;
  flex-shrink: 0; min-width: 0;
}
.credential-row .btn.master { background: #f59e0b; }
.credential-row .btn.standard { background: #2563eb; }
.crown-icon { color: #fbbf24; }

.warning-box {
  font-size: 12px; color: #fca5a5; margin-bottom: 16px;
  line-height: 1.5; background: rgba(239,68,68,0.1);
  padding: 12px; border-radius: 8px;
  border: 1px solid rgba(239,68,68,0.2);
}
.import-desc {
  font-size: 12px; color: #94a3b8; margin-bottom: 20px;
  line-height: 1.5; text-align: center;
}
.section-heading {
  margin-bottom: 16px; text-align: center;
}

/* ============================
   Admin Page Utilities
   ============================ */
.link-btn-sm {
  padding: 6px 12px !important; font-size: 12px !important;
}
.count-badge {
  background: rgba(59,130,246,0.15); color: #60a5fa;
  padding: 4px 12px; border-radius: 20px;
  font-size: 12px; font-weight: 700;
  border: 1px solid rgba(59,130,246,0.3);
}
.info-hint {
  font-size: 12px; color: var(--text-muted); margin-top: 6px;
}
.desc-text {
  font-size: 13px; color: var(--text-muted); margin-bottom: 16px;
}
.desc-text-centered {
  font-size: 13px; color: var(--text-muted); margin-bottom: 16px;
  line-height: 1.6;
}
.format-box {
  font-size: 12px; color: var(--text-muted); margin-bottom: 16px;
  background: rgba(15,23,42,0.5); padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
}
.format-box-title {
  margin-bottom: 6px; font-weight: 700;
}
.code-highlight { color: #60a5fa; }
.flex-row { display: flex; gap: 8px; align-items: center; }
.flex-row-spread {
  display: flex; align-items: center;
  justify-content: space-between;
  margin-bottom: 16px; flex-wrap: wrap; gap: 8px;
}
.flex-col-row {
  display: flex; gap: 16px; flex-wrap: wrap; align-items: flex-start;
}
.flex-grow { flex: 1; min-width: 250px; }
.mt-sm { margin-top: 8px; }
.mt-md { margin-top: 16px; }
.mt-lg { margin-top: 20px; }
.mb-zero { margin-bottom: 0; }

.stat-done { color: #26a641; }
.stat-conflict { color: #f85149; }

.danger-zone {
  border: 2px solid rgba(239,68,68,0.3) !important;
}
.danger-title { color: #f87171; }

/* Save / Processing Overlay */
.save-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,0.85); backdrop-filter: blur(8px);
  z-index: 9999; flex-direction: column;
  align-items: center; justify-content: center; color: white;
}
.save-overlay-icon {
  margin-bottom: 20px; color: var(--primary);
}
.save-overlay-title {
  margin-bottom: 20px; font-size: 24px; letter-spacing: 0.05em;
}
.progress-bar-outer {
  width: 80%; max-width: 500px; height: 12px;
  background: rgba(255,255,255,0.1); border-radius: 6px;
  overflow: hidden; box-shadow: inset 0 1px 3px rgba(0,0,0,0.5);
}
.progress-bar-fill {
  width: 0%; height: 100%; transition: width 0.3s ease;
}
.save-overlay-status {
  color: var(--text-muted); margin-top: 16px;
  font-size: 16px; font-weight: 600;
}

/* Date Picker Overlay */
.dt-overlay {
  display: none; position: fixed; inset: 0; z-index: 9998;
}
.hidden-canvas { display: none; }
.time-colon { font-weight: 700; }
.time-icon { color: var(--text-muted); }

.analytics-threshold-row {
  margin-bottom: 12px; font-size: 13px; color: var(--text-muted);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.name-input-flex {
  display: flex; gap: 12px; align-items: center;
}
.name-input-flex input { flex: 1; }

/* Model Answer Grid */
.model-grid {
  display: grid; gap: 8px;
}

/* Legend Dot Colors */
.legend-done { background: #26a641; }
.legend-conflict { background: #f85149; }
.legend-scoring { background: #1f6feb; }
.legend-pending { background: rgba(255,255,255,0.08); }

/* Entry Config Panel */
.config-panel {
  padding: 16px 18px; background: rgba(15,23,42,0.5);
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
}
.config-panel + .config-panel { margin-top: 16px; }
.config-row {
  display: flex; align-items: center; gap: 14px; margin-bottom: 16px;
}
.config-row .config-panel { margin-bottom: 0; }
.config-row.config-locked { opacity: 0.5; pointer-events: none; position: relative; }
.config-row.config-locked .lock-reason { pointer-events: auto; }
.lock-reason {
  position: absolute; bottom: -18px; left: 0; right: 0;
  font-size: 11px; color: #f59e0b; display: flex; align-items: center; gap: 4px;
  opacity: 1;
}
.toggle-info { flex: 1; }
.toggle-info-title { font-weight: 600; font-size: 14px; }
.toggle-info-desc { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.period-heading {
  font-size: 13px; font-weight: 600; margin-bottom: 12px;
}
.period-heading i { color: var(--primary); margin-right: 6px; }
.period-hint {
  font-size: 11px; color: var(--text-muted); font-weight: 400; margin-left: 6px;
}
.period-grid {
  display: grid; grid-template-columns: 1fr auto 1fr;
  gap: 8px; align-items: end;
}
.period-label {
  font-size: 11px; color: var(--text-muted);
  display: block; margin-bottom: 4px;
}
.period-label i { font-size: 9px; margin-right: 4px; }
.period-label .icon-start { color: #34d399; }
.period-label .icon-end { color: #f87171; }
.period-arrow {
  padding-bottom: 10px; color: var(--text-muted); font-size: 14px;
}

/* ============================================
   Loading Skeleton Shimmer
   ============================================ */
.skeleton {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.04) 25%,
    rgba(255,255,255,0.08) 50%,
    rgba(255,255,255,0.04) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite ease-in-out;
  border-radius: var(--radius-sm);
}
.skeleton-text {
  height: 14px; margin-bottom: 10px; width: 80%;
}
.skeleton-text.short { width: 50%; }
.skeleton-text.xs { width: 30%; }
.skeleton-title {
  height: 20px; margin-bottom: 14px; width: 60%;
}
.skeleton-avatar {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
}
.skeleton-card {
  height: 80px; border-radius: var(--radius-md);
}
.skeleton-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 0;
}
@keyframes skeleton-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* ============================================
   Offline / Connection Status Banner
   ============================================ */
.offline-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 99999;
  background: linear-gradient(135deg, #dc2626, #b91c1c);
  color: white; text-align: center; padding: 10px 16px;
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transform: translateY(-100%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 20px rgba(220,38,38,0.4);
}
.offline-banner.visible { transform: translateY(0); }
.offline-banner i { animation: pulse-icon 2s infinite; }
@keyframes pulse-icon { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }

.online-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 99999;
  background: linear-gradient(135deg, #059669, #047857);
  color: white; text-align: center; padding: 10px 16px;
  font-size: 13px; font-weight: 600;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transform: translateY(-100%);
  transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 4px 20px rgba(5,150,105,0.4);
}
.online-banner.visible { transform: translateY(0); }

/* ============================================
   Keyboard Shortcuts Help Modal
   ============================================ */
.kbd-modal-backdrop {
  position: fixed; inset: 0; z-index: 99990;
  background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s ease;
}
.kbd-modal-backdrop.visible { opacity: 1; pointer-events: auto; }
.kbd-modal {
  background: var(--bg-secondary); border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg); padding: 28px 32px;
  width: 100%; max-width: 420px; box-shadow: 0 25px 60px rgba(0,0,0,0.5);
  transform: scale(0.95); transition: transform 0.2s ease;
}
.kbd-modal-backdrop.visible .kbd-modal { transform: scale(1); }
.kbd-modal h3 {
  font-size: 16px; font-weight: 700; margin-bottom: 20px;
  display: flex; align-items: center; gap: 8px;
}
.kbd-modal h3 i { color: var(--primary); }
.kbd-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 13px; color: var(--text-muted);
}
.kbd-row:last-child { border-bottom: none; }
kbd {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 28px; height: 26px; padding: 0 8px;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
  border-radius: 6px; font-size: 12px; font-weight: 700;
  font-family: 'Inter', monospace; color: var(--text-main);
  box-shadow: 0 2px 0 rgba(0,0,0,0.3);
}

/* ============================================
   Onboarding Checklist
   ============================================ */
.onboarding-panel {
  background: linear-gradient(145deg, rgba(59,130,246,0.08), rgba(139,92,246,0.05));
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: var(--radius-lg); padding: 24px; margin-bottom: 24px;
}
.onboarding-panel h3 {
  font-size: 15px; font-weight: 700; margin-bottom: 4px;
  display: flex; align-items: center; gap: 8px;
}
.onboarding-panel h3 i { color: var(--primary); }
.onboarding-desc {
  font-size: 12px; color: var(--text-muted); margin-bottom: 16px;
}
.onboarding-progress {
  height: 6px; background: rgba(255,255,255,0.06); border-radius: 3px;
  overflow: hidden; margin-bottom: 16px;
}
.onboarding-progress-bar {
  height: 100%; background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  border-radius: 3px; transition: width 0.5s ease;
}
.onboarding-steps { list-style: none; padding: 0; margin: 0; }
.onboarding-step {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 13px; color: var(--text-muted);
  transition: all 0.2s ease; cursor: default;
}
.onboarding-step:hover { background: rgba(255,255,255,0.03); }
.onboarding-step.done { color: var(--success); }
.onboarding-step .step-icon {
  width: 24px; height: 24px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid rgba(255,255,255,0.15); font-size: 11px;
  flex-shrink: 0; transition: all 0.3s ease;
}
.onboarding-step.done .step-icon {
  background: var(--success); border-color: var(--success); color: white;
}
.onboarding-step .step-label { flex: 1; }
.onboarding-step .step-action {
  font-size: 11px; color: var(--primary); font-weight: 600; cursor: pointer;
}
.onboarding-step .step-action:hover { text-decoration: underline; }
.onboarding-dismiss {
  display: block; text-align: center; font-size: 12px;
  color: var(--text-muted); margin-top: 12px; cursor: pointer;
  transition: color 0.2s;
}
.onboarding-dismiss:hover { color: var(--text-main); }

/* ============================================
   Staggered Reveal Animation System
   ============================================ */
@keyframes staggerFadeUp {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes staggerFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

[data-stagger] > * {
  opacity: 0;
  animation: staggerFadeUp 0.5s var(--smooth) forwards;
}
[data-stagger] > *:nth-child(1)  { animation-delay: 0.03s; }
[data-stagger] > *:nth-child(2)  { animation-delay: 0.06s; }
[data-stagger] > *:nth-child(3)  { animation-delay: 0.09s; }
[data-stagger] > *:nth-child(4)  { animation-delay: 0.12s; }
[data-stagger] > *:nth-child(5)  { animation-delay: 0.15s; }
[data-stagger] > *:nth-child(6)  { animation-delay: 0.18s; }
[data-stagger] > *:nth-child(7)  { animation-delay: 0.21s; }
[data-stagger] > *:nth-child(8)  { animation-delay: 0.24s; }
[data-stagger] > *:nth-child(9)  { animation-delay: 0.27s; }
[data-stagger] > *:nth-child(10) { animation-delay: 0.30s; }
[data-stagger] > *:nth-child(n+11) { animation-delay: 0.33s; }

/* ============================================
   Microinteraction Utilities
   ============================================ */
/* Glow card — adds hover glow border effect */
.glow-card {
  transition: border-color 0.3s var(--smooth), box-shadow 0.3s var(--smooth), transform 0.4s var(--spring);
}
.glow-card:hover {
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 0 24px rgba(59, 130, 246, 0.08), var(--shadow-md);
  transform: translateY(-2px);
}

/* Float up on hover */
.hover-float {
  transition: transform 0.4s var(--spring), box-shadow 0.3s var(--smooth);
}
.hover-float:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

/* Pulse dot for live indicators */
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success);
  animation: pulseDot 2s ease infinite;
  flex-shrink: 0;
}

/* ============================================
   Custom Scrollbar (Webkit)
   ============================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.08);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* Firefox scrollbar */
* {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.08) transparent;
}

/* Selection */
::selection {
  background: rgba(59, 130, 246, 0.3);
  color: #f1f5f9;
}

/* Number Input Group (stepper) */
.number-input-group {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.number-btn {
  width: 36px;
  height: 36px;
  background: var(--bg-secondary);
  border: none;
  color: var(--text-main);
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.number-btn:hover { background: var(--glass-border); }
.number-btn:active { background: var(--primary); color: #fff; }
.number-input {
  width: 60px;
  text-align: center;
  border: none;
  border-left: 1px solid var(--glass-border);
  border-right: 1px solid var(--glass-border);
  background: var(--bg-dark);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 600;
  padding: 6px 0;
  appearance: textfield;
}
.number-input::-webkit-outer-spin-button,
.number-input::-webkit-inner-spin-button { appearance: none; margin: 0; }
