/* 班级座位分配系统 */

:root {
  --bg: #eef2f7;
  --bg-accent: #e0e9f4;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;
  --primary: #2563eb;
  --primary-light: #dbeafe;
  --primary-hover: #1d4ed8;
  --accent: #7c3aed;
  --accent-light: #ede9fe;
  --accent-hover: #6d28d9;
  --male: #2563eb;
  --male-light: #eff6ff;
  --male-glow: rgba(37, 99, 235, 0.25);
  --female: #db2777;
  --female-light: #fdf2f8;
  --female-glow: rgba(219, 39, 119, 0.25);
  --male-only: #93c5fd;
  --female-only: #f9a8d4;
  --available: #ffffff;
  --success: #059669;
  --success-light: #d1fae5;
  --warning: #d97706;
  --warning-light: #fef3c7;
  --danger: #dc2626;
  --danger-light: #fee2e2;
  --floor: #f1f5f9;
  --podium: #334155;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.12);
  --radius: 14px;
  --radius-sm: 8px;
  --sidebar-w: 340px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(37, 99, 235, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 100% 100%, rgba(124, 58, 237, 0.06), transparent),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 1480px;
  margin: 0 auto;
  padding: 20px 24px 32px;
}

/* ── Header ── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
  flex-shrink: 0;
}

.logo svg {
  width: 26px;
  height: 26px;
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-top: 2px;
}

/* ── Stepper ── */
.stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 28px;
  padding: 0 12px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  transition: all 0.25s;
  cursor: default;
}

.step-item.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.step-item.done {
  background: var(--success-light);
  border-color: #6ee7b7;
  color: var(--success);
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.step-item.active .step-num {
  background: var(--primary);
  color: white;
}

.step-item.done .step-num {
  background: var(--success);
  color: white;
}

.step-label {
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

.step-line {
  flex: 1;
  max-width: 80px;
  height: 2px;
  background: var(--border);
  margin: 0 4px;
}

.step-line.done {
  background: var(--success);
}

@media (max-width: 640px) {
  .step-label { display: none; }
  .step-item { padding: 10px 14px; }
  .step-line { max-width: 32px; }
}

/* ── Step panels ── */
.step-panel {
  display: none;
  animation: fadeIn 0.3s ease;
}

.step-panel.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.step-content {
  max-width: 900px;
  margin: 0 auto;
}

.step-content-narrow {
  max-width: 640px;
}

.step-content-wide {
  max-width: 1480px;
}

.step-intro {
  text-align: center;
  margin-bottom: 24px;
}

.step-intro h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.step-intro p {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.step-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  padding-top: 8px;
}

.step-nav-compact {
  margin-top: 12px;
  padding-top: 0;
}

/* ── Step 1: student list ── */
.student-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  max-height: 240px;
  overflow-y: auto;
}

.student-list:not(:empty) + .empty-order,
.order-list:not(:empty) + .empty-order {
  display: none;
}

.student-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.student-list .student-name-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Step 2: student draw ── */
.shuffle-area {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 768px) {
  .shuffle-area { grid-template-columns: 1fr; }
}

.draw-card {
  background: linear-gradient(165deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.4s, box-shadow 0.4s;
  position: relative;
  overflow: hidden;
}

.draw-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 60%, rgba(124, 58, 237, 0.06), transparent 65%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s;
}

.draw-card.rolling::before,
.draw-card.revealing::before {
  opacity: 1;
}

.draw-card.rolling {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-light), 0 8px 32px rgba(124, 58, 237, 0.15);
}

.draw-card.revealing {
  border-color: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.25), 0 8px 40px rgba(245, 158, 11, 0.2);
}

.draw-card.done-highlight {
  border-color: var(--success);
  background: linear-gradient(160deg, #ffffff, var(--success-light));
}

.draw-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
  text-align: center;
}

.draw-student-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  margin-bottom: 20px;
  padding: 4px;
}

.draw-student-btn {
  padding: 10px 8px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  font-family: inherit;
  color: var(--text);
}

.draw-student-btn:hover:not(:disabled) {
  border-color: var(--primary);
  background: var(--primary-light);
}

.draw-student-btn.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary);
  font-weight: 700;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
  animation: selectedPulse 2s ease infinite;
}

@keyframes selectedPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15); }
  50% { box-shadow: 0 0 0 6px rgba(37, 99, 235, 0.08); }
}

.draw-picker-empty {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding: 16px 12px;
  background: var(--success-light);
  border: 1px dashed #6ee7b7;
  border-radius: var(--radius-sm);
  margin-bottom: 16px;
}

/* ── Slot machine ── */
.draw-player {
  position: relative;
  margin-bottom: 22px;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.draw-player-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(90deg, var(--accent-light), var(--primary-light));
  border: 1px solid #c4b5fd;
  padding: 6px 16px;
  border-radius: 999px;
  margin-bottom: 16px;
  animation: badgeSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes badgeSlideIn {
  from { opacity: 0; transform: translateY(-12px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.draw-player-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.06em;
}

.draw-player-name {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}

.slot-machine {
  position: relative;
  width: 100%;
  max-width: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.slot-glow {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 200px;
  height: 200px;
  transform: translate(-50%, -55%);
  background: radial-gradient(circle, rgba(124, 58, 237, 0.35) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}

.draw-card.rolling .slot-glow {
  opacity: 1;
  animation: glowPulse 1.2s ease-in-out infinite;
}

.draw-card.revealing .slot-glow {
  opacity: 1;
  background: radial-gradient(circle, rgba(245, 158, 11, 0.5) 0%, transparent 70%);
  animation: glowBurst 0.6s ease-out forwards;
}

@keyframes glowPulse {
  0%, 100% { transform: translate(-50%, -55%) scale(1); opacity: 0.6; }
  50% { transform: translate(-50%, -55%) scale(1.15); opacity: 1; }
}

@keyframes glowBurst {
  0% { transform: translate(-50%, -55%) scale(0.8); opacity: 0; }
  50% { transform: translate(-50%, -55%) scale(1.4); opacity: 1; }
  100% { transform: translate(-50%, -55%) scale(1.2); opacity: 0.5; }
}

.slot-ring {
  position: absolute;
  border-radius: 50%;
  border: 2px dashed transparent;
  pointer-events: none;
}

.slot-ring-outer {
  width: 260px;
  height: 260px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -58%);
  border-color: rgba(124, 58, 237, 0.15);
  opacity: 0;
  transition: opacity 0.3s;
}

.slot-ring-inner {
  width: 220px;
  height: 220px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -58%);
  border-color: rgba(37, 99, 235, 0.2);
  opacity: 0;
  transition: opacity 0.3s;
}

.draw-card.rolling .slot-ring-outer {
  opacity: 1;
  animation: ringSpin 3s linear infinite;
}

.draw-card.rolling .slot-ring-inner {
  opacity: 1;
  animation: ringSpin 2s linear infinite reverse;
}

.draw-card.decelerating .slot-ring-outer {
  opacity: 1;
  animation: ringSpin 6s linear infinite;
}

.draw-card.decelerating .slot-ring-inner {
  opacity: 1;
  animation: ringSpin 4s linear infinite reverse;
}

@keyframes ringSpin {
  from { transform: translate(-50%, -58%) rotate(0deg); }
  to { transform: translate(-50%, -58%) rotate(360deg); }
}

.slot-window {
  position: relative;
  width: 160px;
  height: 110px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 50%, #1e293b 100%);
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.5),
    0 0 0 3px #334155,
    0 0 0 5px #64748b,
    0 12px 32px rgba(15, 23, 42, 0.35);
  z-index: 1;
}

.draw-card.rolling .slot-window {
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.5),
    0 0 0 3px var(--accent),
    0 0 0 5px #a78bfa,
    0 0 24px rgba(124, 58, 237, 0.5),
    0 12px 32px rgba(15, 23, 42, 0.35);
}

.draw-card.revealing .slot-window {
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.5),
    0 0 0 3px #f59e0b,
    0 0 0 5px #fcd34d,
    0 0 32px rgba(245, 158, 11, 0.6),
    0 12px 32px rgba(15, 23, 42, 0.35);
  animation: windowReveal 0.5s ease;
}

@keyframes windowReveal {
  0%, 100% { transform: scale(1); }
  40% { transform: scale(1.06); }
}

.slot-shine {
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
  z-index: 3;
  pointer-events: none;
}

.draw-card.rolling .slot-shine {
  animation: shineSweep 1.5s ease-in-out infinite;
}

@keyframes shineSweep {
  0% { left: -100%; }
  100% { left: 200%; }
}

.slot-window::before,
.slot-window::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 28px;
  z-index: 2;
  pointer-events: none;
}

.slot-window::before {
  top: 0;
  background: linear-gradient(180deg, rgba(15,23,42,0.95), transparent);
}

.slot-window::after {
  bottom: 0;
  background: linear-gradient(0deg, rgba(15,23,42,0.95), transparent);
}

.slot-reel {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  justify-content: center;
  transition: transform 0.06s ease-out;
}

.slot-reel.tick {
  transform: translateY(-4px);
}

.slot-num {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 72px;
  font-size: 4.5rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  flex-shrink: 0;
  user-select: none;
}

.slot-num-prev,
.slot-num-next {
  font-size: 1.8rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.15);
  height: 19px;
  overflow: hidden;
}

.slot-num-current {
  background: linear-gradient(180deg, #fde68a 0%, #f59e0b 45%, #d97706 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 12px rgba(245, 158, 11, 0.5));
  transition: filter 0.15s, transform 0.1s;
}

.draw-card.rolling .slot-num-current {
  filter: drop-shadow(0 0 16px rgba(167, 139, 250, 0.8));
  animation: numFlicker 0.08s linear infinite;
}

.draw-card.decelerating .slot-num-current {
  animation: none;
  filter: drop-shadow(0 0 20px rgba(245, 158, 11, 0.7));
}

.draw-card.revealing .slot-num-current {
  animation: numReveal 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  -webkit-text-fill-color: transparent;
}

@keyframes numFlicker {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.04); opacity: 0.85; }
}

@keyframes numReveal {
  0% { transform: scale(0.5); opacity: 0; filter: blur(8px); }
  60% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; filter: drop-shadow(0 0 20px rgba(245, 158, 11, 0.9)); }
}

.slot-label {
  margin-top: 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.12em;
  z-index: 1;
}

/* Particles */
.draw-particles {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 0;
  height: 0;
  pointer-events: none;
  z-index: 10;
}

.particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: particleFly 0.9s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

@keyframes particleFly {
  0% {
    transform: translate(0, 0) rotate(0deg) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--x), var(--y)) rotate(var(--r)) scale(0);
    opacity: 0;
  }
}

/* Result banner */
.draw-result-banner {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border: 2px solid #f59e0b;
  padding: 10px 20px;
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.35);
  white-space: nowrap;
  opacity: 0;
  z-index: 5;
}

.draw-result-banner.show {
  animation: bannerPop 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

@keyframes bannerPop {
  0% { opacity: 0; transform: translateX(-50%) translateY(20px) scale(0.8); }
  100% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
}

.result-banner-num {
  font-size: 1.6rem;
  font-weight: 900;
  color: #d97706;
  line-height: 1;
}

.result-banner-text {
  font-size: 0.9rem;
  font-weight: 600;
  color: #92400e;
}

.draw-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.draw-btn-icon {
  font-size: 0.75em;
}

.btn-stop {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
  box-shadow: 0 2px 12px rgba(239, 68, 68, 0.4);
  position: relative;
  overflow: hidden;
}

.btn-stop:not(:disabled) {
  animation: stopPulse 1s ease infinite;
}

@keyframes stopPulse {
  0%, 100% { box-shadow: 0 2px 12px rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 2px 20px rgba(239, 68, 68, 0.7), 0 0 0 4px rgba(239, 68, 68, 0.15); }
}

.btn-stop:hover:not(:disabled) {
  background: linear-gradient(135deg, #dc2626, #b91c1c);
}

.draw-card.decelerating .btn-stop {
  animation: none;
  opacity: 0.6;
  cursor: wait;
}

.draw-status {
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
  min-height: 1.3em;
  line-height: 1.4;
  transition: color 0.3s;
}

.draw-status.rolling-text {
  color: var(--accent);
  font-weight: 600;
  animation: statusBlink 1s ease infinite;
}

@keyframes statusBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.draw-status.success {
  color: var(--success);
  font-weight: 600;
}

.order-list-records li {
  background: var(--surface);
  border: 1px solid var(--border);
  transition: transform 0.3s, box-shadow 0.3s;
}

.order-list-records li.record-new {
  animation: recordSlideIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-color: #fbbf24;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.2);
}

@keyframes recordSlideIn {
  from { opacity: 0; transform: translateX(-16px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

.order-list-records .record-order {
  font-size: 1.1rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--accent), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  min-width: 32px;
  text-align: center;
}

.order-panel {
  max-height: 520px;
  display: flex;
  flex-direction: column;
}

.order-list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
  max-height: 400px;
  overflow-y: auto;
  flex: 1;
}

.order-list-grid li {
  margin-bottom: 0;
}

/* ── Step 3: picking layout ── */
.picking-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 1024px) {
  .picking-layout { grid-template-columns: 1fr; }
}

.picking-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: sticky;
  top: 20px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}

/* ── Layout (legacy removed) ── */

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.panel-highlight {
  background: linear-gradient(160deg, #ffffff 0%, #f8fafc 100%);
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.panel-grow {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.panel-title {
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.title-icon {
  font-size: 1rem;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.student-count {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-light);
  padding: 3px 10px;
  border-radius: 999px;
}

.hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.4;
}

/* ── Current picker ── */
.current-picker {
  text-align: center;
  margin-bottom: 14px;
}

.picker-idle {
  padding: 20px 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border-strong);
}

.picker-icon {
  font-size: 2rem;
  opacity: 0.4;
  margin-bottom: 6px;
}

.picker-active {
  padding: 20px 16px;
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}

.picker-active.male {
  background: linear-gradient(135deg, var(--male-light), #dbeafe);
  border: 2px solid var(--male);
  box-shadow: 0 0 0 4px var(--male-glow);
}

.picker-active.female {
  background: linear-gradient(135deg, var(--female-light), #fce7f3);
  border: 2px solid var(--female);
  box-shadow: 0 0 0 4px var(--female-glow);
}

.picker-active.done {
  background: linear-gradient(135deg, var(--success-light), #a7f3d0);
  border: 2px solid var(--success);
}

.picker-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: white;
  margin: 0 auto 10px;
}

.picker-avatar.male { background: var(--male); }
.picker-avatar.female { background: var(--female); }
.picker-avatar.done { background: var(--success); font-size: 1.6rem; }

.picker-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.picker-name {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.picker-hint {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 6px;
}

.empty-state {
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* ── Progress ── */
.progress-wrap {
  margin-bottom: 14px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
}

/* ── Action buttons ── */
.action-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-buttons .btn-lg {
  grid-column: 1 / -1;
}

/* ── Import tabs ── */
.import-tabs {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 3px;
  margin-bottom: 14px;
  gap: 2px;
}

.import-tab {
  flex: 1;
  padding: 7px 0;
  border: none;
  background: transparent;
  border-radius: 6px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.import-tab:hover {
  color: var(--text-secondary);
}

.import-tab.active {
  background: var(--surface);
  color: var(--primary);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.import-pane {
  display: none;
}

.import-pane.active {
  display: block;
}

.import-pane textarea {
  width: 100%;
  height: 100px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  resize: vertical;
  margin-bottom: 10px;
  font-family: inherit;
  transition: border-color 0.15s;
}

.import-pane textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.add-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.add-form input,
.add-form select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  transition: border-color 0.15s;
}

.add-form input:focus,
.add-form select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 20px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  margin-bottom: 10px;
  background: var(--surface-2);
}

.drop-zone:hover,
.drop-zone.drag-over {
  border-color: var(--primary);
  background: var(--primary-light);
}

.drop-zone-icon {
  font-size: 1.8rem;
  margin-bottom: 6px;
}

.drop-zone p {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.drop-zone-sub {
  font-size: 0.78rem !important;
  color: var(--text-muted) !important;
  font-weight: 400 !important;
  margin-top: 2px;
}

.excel-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}

.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-icon { font-size: 0.85em; }

.btn-xl {
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 10px;
}

.btn-lg {
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 600;
}

.btn-sm {
  padding: 7px 12px;
  font-size: 0.8rem;
}

.btn-block { width: 100%; }

.btn-primary {
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover:not(:disabled) { background: var(--border); }

.btn-accent {
  background: var(--accent);
  color: white;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

.btn-accent:hover:not(:disabled) { background: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) { background: var(--surface-2); }

.btn-danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger-light);
}

.btn-danger:hover:not(:disabled) {
  background: var(--danger-light);
}

/* ── Order list ── */
.order-list {
  list-style: none;
  overflow-y: auto;
  flex: 1;
  max-height: 280px;
}

.empty-order {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 24px 0;
}

.order-list:not(:empty) + .empty-order {
  display: none;
}

.order-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 4px;
  font-size: 0.875rem;
  background: var(--surface-2);
  border: 1px solid transparent;
  transition: all 0.15s;
}

.order-list li.current {
  background: var(--warning-light);
  border-color: #fbbf24;
  font-weight: 600;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.2);
}

.order-list li.done {
  opacity: 0.45;
}

.order-list li.done .order-name {
  text-decoration: line-through;
}

.order-list .order-num {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--text-secondary);
}

.order-list li.current .order-num {
  background: var(--warning);
  color: white;
}

.order-list li.done .order-num {
  background: var(--success-light);
  color: var(--success);
}

.order-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.gender-badge {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 999px;
  font-weight: 600;
  flex-shrink: 0;
}

.gender-badge.male { background: var(--male-light); color: var(--male); }
.gender-badge.female { background: var(--female-light); color: var(--female); }

.order-list .remove-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.15s;
}

.order-list .remove-btn:hover {
  background: var(--danger-light);
  color: var(--danger);
}

/* ── Classroom ── */
.classroom-section {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.classroom-top {
  background: linear-gradient(180deg, var(--surface-2) 0%, var(--surface) 100%);
  padding: 20px 24px 0;
  display: flex;
  justify-content: center;
}

.podium {
  background: linear-gradient(180deg, #475569 0%, var(--podium) 100%);
  color: white;
  padding: 12px 56px;
  border-radius: 10px 10px 0 0;
  font-weight: 600;
  letter-spacing: 0.25em;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.1);
  font-size: 0.95rem;
}

.podium-icon { letter-spacing: 0; font-size: 1.1rem; }

.classroom-floor {
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 39px,
      rgba(203, 213, 225, 0.35) 39px,
      rgba(203, 213, 225, 0.35) 40px
    ),
    var(--floor);
  padding: 16px 24px 20px;
  flex: 1;
}

.col-labels {
  display: grid;
  grid-template-columns: 1fr 1fr 20px 1fr 1fr;
  gap: 10px;
  max-width: 760px;
  margin: 0 auto 10px;
  text-align: center;
}

.col-labels span:not(.aisle-gap) {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.classroom {
  display: grid;
  grid-template-columns: 1fr 1fr 20px 1fr 1fr;
  gap: 8px 10px;
  max-width: 760px;
  max-height: calc(100vh - 320px);
  overflow-y: auto;
  margin: 0 auto;
  padding: 4px 2px;
}

.aisle {
  grid-row: 1 / -1;
}

.table-wrapper {
  position: relative;
}

.table {
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: 10px;
  padding: 5px;
  display: flex;
  gap: 4px;
  transition: box-shadow 0.2s, transform 0.15s;
  box-shadow: var(--shadow-sm);
}

.table:hover {
  box-shadow: var(--shadow);
}

/* ── Seats ── */
.seat {
  flex: 1;
  min-height: 42px;
  border: 1.5px solid var(--border);
  border-radius: 7px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: default;
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  font-size: 0.72rem;
  padding: 3px 2px;
  text-align: center;
  word-break: break-all;
  position: relative;
}

.seat::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 3px;
  border-radius: 2px;
  background: var(--border);
  opacity: 0.5;
}

.seat.available {
  background: var(--available);
  cursor: pointer;
}

.seat.available:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--male-glow);
}

.seat.male-only {
  background: var(--male-light);
  border-color: var(--male-only);
  cursor: pointer;
}

.seat.male-only:hover {
  border-color: var(--male);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--male-glow);
}

.seat.female-only {
  background: var(--female-light);
  border-color: var(--female-only);
  cursor: pointer;
}

.seat.female-only:hover {
  border-color: var(--female);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px var(--female-glow);
}

.seat.occupied-male {
  background: linear-gradient(160deg, #3b82f6, var(--male));
  border-color: var(--male);
  color: white;
  cursor: default;
}

.seat.occupied-male::before { background: rgba(255,255,255,0.3); }

.seat.occupied-female {
  background: linear-gradient(160deg, #ec4899, var(--female));
  border-color: var(--female);
  color: white;
  cursor: default;
}

.seat.occupied-female::before { background: rgba(255,255,255,0.3); }

.seat.disabled {
  background: #e2e8f0;
  border-color: #cbd5e1;
  color: var(--text-muted);
  cursor: not-allowed;
  opacity: 0.55;
}

.seat .seat-pos {
  font-size: 0.58rem;
  opacity: 0.6;
  margin-top: 4px;
}

.seat .student-name {
  font-weight: 600;
  font-size: 0.76rem;
  line-height: 1.2;
}

.seat.occupied-male .student-name,
.seat.occupied-female .student-name {
  text-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

/* ── Footer ── */
.classroom-footer {
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
  margin-bottom: 14px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.dot.available { background: var(--available); }
.dot.male-only { background: var(--male-light); border-color: var(--male-only); }
.dot.female-only { background: var(--female-light); border-color: var(--female-only); }
.dot.occupied-male { background: var(--male); border-color: var(--male); }
.dot.occupied-female { background: var(--female); border-color: var(--female); }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

@media (max-width: 640px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

.stat-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  text-align: center;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.stat-card.highlight .stat-value { color: var(--primary); }

/* ── Animations ── */
@keyframes pickSuccess {
  0% { transform: scale(1); }
  40% { transform: scale(1.06) translateY(-3px); }
  100% { transform: scale(1); }
}

.seat.just-picked {
  animation: pickSuccess 0.45s ease;
}

/* ── Scrollbars ── */
.sidebar::-webkit-scrollbar,
.order-list::-webkit-scrollbar,
.classroom::-webkit-scrollbar {
  width: 5px;
}

.sidebar::-webkit-scrollbar-thumb,
.order-list::-webkit-scrollbar-thumb,
.classroom::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 999px;
}

/* ── Step 4: export ── */
.export-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  align-items: start;
}

@media (max-width: 900px) {
  .export-layout { grid-template-columns: 1fr; }
}

.export-preview-panel {
  overflow: auto;
}

.export-preview {
  background: #fff;
  padding: 28px 32px 24px;
  border-radius: 8px;
  max-width: 820px;
  margin: 0 auto;
}

.export-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 4px;
}

.export-meta {
  text-align: center;
  font-size: 0.8rem;
  color: #64748b;
  margin-bottom: 16px;
}

.export-podium {
  text-align: center;
  background: linear-gradient(180deg, #475569, #334155);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.3em;
  padding: 8px 0;
  border-radius: 6px 6px 0 0;
  margin-bottom: 12px;
  font-size: 0.9rem;
}

.export-col-labels {
  display: grid;
  grid-template-columns: 1fr 1fr 16px 1fr 1fr;
  gap: 6px;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: #64748b;
  margin-bottom: 6px;
}

.export-aisle {
  visibility: hidden;
}

.export-aisle-cell {
  min-height: 1px;
}

.export-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 16px 1fr 1fr;
  gap: 6px;
}

.export-table {
  background: #f1f5f9;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
  padding: 4px;
  display: flex;
  gap: 3px;
}

.export-seat {
  flex: 1;
  min-height: 36px;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2px;
  font-size: 0.65rem;
  line-height: 1.15;
  text-align: center;
  word-break: break-all;
}

.export-seat.empty {
  background: #fff;
  border: 1px dashed #cbd5e1;
  color: #94a3b8;
}

.export-seat.male {
  background: #2563eb;
  color: #fff;
  font-weight: 600;
}

.export-seat.female {
  background: #db2777;
  color: #fff;
  font-weight: 600;
}

.export-seat-pos {
  font-size: 0.55rem;
  opacity: 0.75;
}

.export-legend {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 14px;
  font-size: 0.75rem;
  color: #475569;
}

.dot-export {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 4px;
  vertical-align: middle;
}

.dot-export.male { background: #2563eb; }
.dot-export.female { background: #db2777; }

.export-tips {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
}

.export-tips li {
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  line-height: 1.4;
}

.export-tips li:last-child {
  border-bottom: none;
}

.export-status {
  margin-top: 12px;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  min-height: 1.2em;
}

.export-status.success {
  color: var(--success);
  font-weight: 600;
}

.export-status.error {
  color: var(--danger);
}
