/* ==========================================================================
   BIẾN MÀU SẮC & GIAO DIỆN SÁNG / TỐI (LIGHT & DARK THEME)
   ========================================================================== */
:root,
html[data-theme="light"] {
  color-scheme: light;
  --font-sans: "Be Vietnam Pro", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  --bg-page: #f5f7fb;
  --bg-page-accent: radial-gradient(900px 380px at 50% -120px, rgba(220, 38, 38, 0.08), transparent 70%);
  --bg-card: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-input: #ffffff;
  --bg-tabs: #f1f5f9;
  --bg-chip: #ffffff;
  --bg-chip-hover: #fff1f2;

  /* Khung Bước 2 nổi bật ở Light mode */
  --step2-bg: linear-gradient(135deg, #fff8f3 0%, #fff1f2 100%);
  --step2-border: #f97316;
  --step2-shadow: 0 8px 24px rgba(234, 88, 12, 0.1);
  --step2-warn-bg: #ffedd5;
  --step2-warn-border: #fdba74;
  --step2-warn-text: #b45309;

  --primary: #d91f26;
  --primary-hover: #ef232c;
  --primary-dark: #991b1b;
  --primary-soft: #fef2f2;
  --primary-border: #fecaca;

  --text-main: #0f172a;
  --text-secondary: #334155;
  --text-muted: #64748b;
  --text-faint: #94a3b8;

  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --table-head-bg: #1e293b;
  --table-head-prize-bg: #0f172a;
  --table-head-text: #f8fafc;
  --table-label-bg: #f8fafc;
  --table-zebra-bg: #fafbfd;
  --table-row-hover: #fff1f2;
  --table-label-hover: #ffe4e6;
  --table-db-bg: #fff5f5;
  --table-db-label-bg: #fee2e2;
  --table-checked-col: #fffbeb;

  --db-num-color: #d91f26;
  --tail-num-color: #b45309;

  --emerald: #059669;
  --emerald-soft: #ecfdf5;
  --emerald-border: #a7f3d0;
  --amber-text: #92400e;
  --amber-soft: #fffbeb;
  --amber-border: #fde68a;

  --shadow-card: 0 2px 6px rgba(15, 23, 42, 0.04), 0 12px 28px rgba(15, 23, 42, 0.06);
  --shadow-btn: 0 6px 18px rgba(217, 31, 38, 0.28);
  --shadow-btn-hover: 0 10px 26px rgba(239, 35, 44, 0.42);
  --shadow-win: 0 14px 36px rgba(217, 31, 38, 0.16);

  --radius-xl: 20px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-pill: 999px;
}

html[data-theme="dark"] {
  color-scheme: dark;

  --bg-page: #0b1120;
  --bg-page-accent: radial-gradient(900px 380px at 50% -120px, rgba(220, 38, 38, 0.16), transparent 70%);
  --bg-card: #151f32;
  --bg-subtle: #1a2740;
  --bg-input: #0f172a;
  --bg-tabs: #0f172a;
  --bg-chip: #1e2d47;
  --bg-chip-hover: #2b3f63;

  /* Khung Bước 2 nổi bật ở Dark mode */
  --step2-bg: linear-gradient(135deg, rgba(249, 115, 22, 0.12) 0%, rgba(225, 45, 57, 0.14) 100%);
  --step2-border: #fb923c;
  --step2-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  --step2-warn-bg: rgba(245, 158, 11, 0.15);
  --step2-warn-border: rgba(251, 191, 36, 0.38);
  --step2-warn-text: #fbbf24;

  --primary: #e12d39;
  --primary-hover: #f03e4a;
  --primary-dark: #991b1b;
  --primary-soft: rgba(225, 45, 57, 0.16);
  --primary-border: rgba(248, 113, 113, 0.38);

  --text-main: #f8fafc;
  --text-secondary: #e2e8f0;
  --text-muted: #94a3b8;
  --text-faint: #64748b;

  --border: #263552;
  --border-strong: #3a5078;

  --table-head-bg: #0f172a;
  --table-head-prize-bg: #090e1a;
  --table-head-text: #f8fafc;
  --table-label-bg: #19253b;
  --table-zebra-bg: #182338;
  --table-row-hover: #243452;
  --table-label-hover: #2c3f63;
  --table-db-bg: rgba(225, 45, 57, 0.13);
  --table-db-label-bg: rgba(225, 45, 57, 0.22);
  --table-checked-col: rgba(245, 158, 11, 0.09);

  --db-num-color: #ff6b75;
  --tail-num-color: #fbbf24;

  --emerald: #34d399;
  --emerald-soft: rgba(16, 185, 129, 0.14);
  --emerald-border: rgba(52, 211, 153, 0.32);
  --amber-text: #fcd34d;
  --amber-soft: rgba(245, 158, 11, 0.13);
  --amber-border: rgba(251, 191, 36, 0.32);

  --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.28), 0 16px 36px rgba(0, 0, 0, 0.32);
  --shadow-btn: 0 6px 20px rgba(225, 45, 57, 0.36);
  --shadow-btn-hover: 0 10px 28px rgba(240, 62, 74, 0.5);
  --shadow-win: 0 14px 36px rgba(0, 0, 0, 0.45);
}

/* ==========================================================================
   RESET & NỀN TẢNG TYPOGRAPHY
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  background-image: var(--bg-page-accent);
  background-repeat: no-repeat;
  color: var(--text-main);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 0.22s ease, color 0.22s ease;
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: 1020px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ==========================================================================
   HEADER MÀU ĐỎ TRÊN CÙNG
   ========================================================================== */
.site-header {
  background: linear-gradient(135deg, #9f1218 0%, #d91f26 55%, #b8171d 100%);
  color: #ffffff;
  padding: 10px 0;
  box-shadow: 0 4px 20px rgba(159, 18, 24, 0.24);
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

html[data-theme="dark"] .site-header {
  background: linear-gradient(135deg, #7f1016 0%, #b91c22 55%, #93141a 100%);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
}

/* Link logo ở giữa header - bấm/chuột phải là về trang chủ, không mở file PNG */
.header-logo-link {
  margin: 0 auto;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

/* Logo tách nền đặt ở giữa header - chỉ scale hình, không đổi chiều cao panel */
.header-logo {
  height: 110px;
  transform: scale(1.2);
  transform-origin: center;
  width: auto;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.25));
  align-self: center;
}

/* 3 dòng chữ bên trái dàn đều trên - dưới theo đúng zone đỉnh/đáy logo */
.brand-text {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.brand-text h1,
.brand-text p {
  margin: 0;
}

/* 3 chữ tagline 3 màu khác nhau, dấu "-" giữ màu trắng */
.tagline .tag-fast { color: #ffe600; font-weight: 700; }
.tagline .tag-easy { color: #00e5ff; font-weight: 700; }
.tagline .tag-accurate { color: #7cff6b; font-weight: 700; }
.tagline .tag-sep { color: #ffffff; font-weight: 500; }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-text h1 {
  margin: 0;
  font-size: 1.72rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1.15;
  color: #ffffff;
}

.brand-text p {
  margin: 4px 0 0;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.9);
}

.brand-text p.author {
  margin-top: 4px;
  font-weight: 600;
  color: #fde68a;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.vn-clock {
  font-size: 0.86rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.18);
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  color: #ffffff;
  backdrop-filter: blur(6px);
  white-space: nowrap;
  /* Đồng hồ cố định chiều rộng trên web, không co giãn khi số 1 hẹp hơn */
  min-width: 220px;
  text-align: center;
  flex-shrink: 0;
}

.theme-toggle-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.theme-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.28);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.22);
}

.theme-toggle-btn:active {
  transform: translateY(0);
}

html[data-theme="light"] .theme-toggle-btn .icon-sun {
  display: none;
}

html[data-theme="dark"] .theme-toggle-btn .icon-moon {
  display: none;
}

html[data-theme="dark"] .theme-toggle-btn .icon-sun {
  color: #fde68a;
}

/* ==========================================================================
   BỐ CỤC CHÍNH & KHỐI CARD
   ========================================================================== */
.main-content {
  flex: 1;
  padding-top: 26px;
  padding-bottom: 44px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  padding: 26px;
  transition: background-color 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

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

.card-header h2 {
  margin: 0;
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

.retention-tag {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
}

html[data-theme="dark"] .retention-tag {
  color: #fca5a5;
}

/* ==========================================================================
   LUỒNG 3 BƯỚC DÒ VÉ (BƯỚC 1 -> BƯỚC 2 NỔI BẬT -> BƯỚC 3)
   ========================================================================== */
.steps-flow {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.step-box {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.step-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 12px;
}

.step-2-header {
  align-items: flex-start;
  margin-bottom: 14px;
}

/* Số tròn to ở đầu mỗi bước (1, 2, 3) */
.step-number {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--table-head-bg);
  color: #ffffff;
  font-size: 1.08rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.18);
}

html[data-theme="dark"] .step-number {
  background: #334155;
  border: 1px solid #475569;
}

.step-number-highlight {
  width: 42px;
  height: 42px;
  font-size: 1.18rem;
  background: linear-gradient(135deg, #f97316 0%, #dc2626 100%) !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(220, 38, 38, 0.36);
}

.step-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--text-main);
  cursor: pointer;
}

.step-3-label-row {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.step-body {
  padding-left: 52px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* KHUNG BƯỚC 2 NỔI BẬT (VIỀN ĐỎ/CAM, NỀN KHÁC BIỆT, BÓNG NHẸ) */
.step-2-box {
  background: var(--step2-bg);
  border: 2px solid var(--step2-border);
  box-shadow: var(--step2-shadow);
  padding: 20px 22px;
  position: relative;
}

.step-2-box .step-body {
  padding-left: 56px;
}

.step-2-heading-group {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.step-2-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.step-2-icon {
  font-size: 1.25rem;
  line-height: 1;
}

.step-2-title {
  font-size: 1.15rem;
  font-weight: 900;
  color: var(--text-main);
  cursor: default;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.required-pill {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: var(--primary);
  color: #ffffff;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
}

.step-2-warning {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  align-self: flex-start;
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--step2-warn-text);
  background: var(--step2-warn-bg);
  border: 1px solid var(--step2-warn-border);
  padding: 6px 12px;
  border-radius: 10px;
}

/* Hiệu ứng nhấp nháy nhẹ 1 lần khi chưa chọn đài mà bấm KIỂM TRA */
@keyframes step2AttentionPulse {
  0% {
    transform: scale(1);
    box-shadow: var(--step2-shadow);
  }
  25% {
    transform: scale(1.014);
    border-color: #dc2626;
    box-shadow: 0 0 0 6px rgba(220, 38, 38, 0.25), 0 12px 28px rgba(220, 38, 38, 0.22);
  }
  60% {
    transform: scale(0.997);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.2);
  }
  100% {
    transform: scale(1);
    box-shadow: var(--step2-shadow);
  }
}

.step-2-box.is-flashing {
  animation: step2AttentionPulse 0.8s cubic-bezier(0.22, 1, 0.36, 1) 1;
}

/* Cảnh báo đỏ khi người dùng chưa chọn đài */
.no-station-alert {
  background: #fee2e2;
  border: 1.5px solid #ef4444;
  color: #b91c1c;
  font-size: 0.9rem;
  font-weight: 800;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 4px;
}

html[data-theme="dark"] .no-station-alert {
  background: rgba(239, 68, 68, 0.2);
  border-color: #f87171;
  color: #fecaca;
}

/* NÚT / CHIP CHỌN ĐÀI LỚN, DỄ BẤM */
.station-chips {
  display: flex;
  gap: 11px;
  flex-wrap: wrap;
}

.station-chip {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-chip);
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 9px 20px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  user-select: none;
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.station-chip:hover {
  background: var(--bg-chip-hover);
  color: var(--text-main);
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.1);
}

html[data-theme="dark"] .station-chip:hover {
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.36);
}

.station-chip:active {
  transform: translateY(0);
}

/* Đài đang chọn: nền đỏ đậm, chữ trắng, có dấu tick ✓ */
.station-chip.is-selected {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  border-color: #991b1b;
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(185, 28, 28, 0.36);
}

html[data-theme="dark"] .station-chip.is-selected {
  background: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  border-color: #ef4444;
  box-shadow: 0 6px 18px rgba(225, 45, 57, 0.45);
}

.station-chip.is-selected:hover {
  filter: brightness(1.08);
  color: #ffffff;
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(185, 28, 28, 0.48);
}

.chip-check-icon {
  font-weight: 900;
  font-size: 1rem;
  line-height: 1;
}

/* Ô INPUT NGÀY & SỐ VÉ */
.digit-counter {
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 3px 11px;
  border-radius: var(--radius-pill);
  transition: background-color 0.18s ease, color 0.18s ease;
}

.digit-counter.is-complete {
  background: var(--emerald-soft);
  color: var(--emerald);
  border-color: var(--emerald-border);
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 440px;
}

.input-wrap input {
  width: 100%;
  height: 50px;
  padding: 0 40px 0 16px;
  font-size: 1rem; /* >=16px chống tự zoom trên điện thoại */
  font-family: var(--font-sans);
  font-weight: 600;
  color: var(--text-main);
  background: var(--bg-input);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.input-wrap input:hover {
  border-color: var(--text-muted);
}

#drawDateInput {
  padding-right: 56px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
  cursor: pointer;
}

/* Nút lịch bên phải ô ngày: input date gốc trong suốt phủ lên icon để bấm là mở lịch */
.date-picker-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  color: var(--primary);
  background: var(--primary-soft);
  pointer-events: none;
  transition: background-color 0.18s ease, transform 0.18s ease;
}

.date-native-picker {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px !important;
  height: 38px !important;
  padding: 0 !important;
  margin: 0;
  border: none !important;
  opacity: 0;
  cursor: pointer;
  background: transparent !important;
  box-shadow: none !important;
}

.date-native-picker::-webkit-calendar-picker-indicator {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  cursor: pointer;
}

.date-wrap:hover .date-picker-btn {
  background: var(--bg-chip-hover);
  transform: translateY(-50%) scale(1.06);
}

#ticketNumberInput {
  font-weight: 800;
  letter-spacing: 0.14em;
  font-variant-numeric: tabular-nums;
  font-size: 1.15rem;
}

#ticketNumberInput::placeholder {
  font-weight: 400;
  letter-spacing: normal;
  font-size: 0.94rem;
  color: var(--text-faint);
}

.input-wrap input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(217, 31, 38, 0.15);
}

.icon-clear-btn {
  position: absolute;
  right: 10px;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 50%;
  background: var(--bg-tabs);
  color: var(--text-muted);
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  transition: background-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.icon-clear-btn:hover {
  background: var(--border-strong);
  color: var(--text-main);
  transform: scale(1.08);
}

.field-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* TÙY CHỌN KÝ HIỆU XSMB */
.mb-symbol-panel {
  margin-top: 8px;
  padding: 14px 16px;
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  border-radius: var(--radius-md);
}

.mb-symbol-title {
  display: block;
  font-size: 0.83rem;
  font-weight: 700;
  color: var(--amber-text);
  margin-bottom: 10px;
}

.mb-symbol-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.radio-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--amber-border);
  padding: 7px 14px;
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.radio-pill:hover {
  transform: translateY(-1px);
  border-color: #f59e0b;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.06);
}

.radio-pill input {
  accent-color: var(--primary);
  margin: 0;
}

.mb-code-input-wrap input {
  height: 38px;
  width: 185px;
  padding: 0 12px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
  text-transform: uppercase;
  border: 1px solid var(--amber-border);
  border-radius: var(--radius-pill);
  background: var(--bg-card);
}

.mb-code-input-wrap input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(217, 31, 38, 0.15);
}

/* ==========================================================================
   DÒNG XÁC NHẬN ĐÀI ĐANG DÒ & NÚT KIỂM TRA
   ========================================================================== */
.submit-row {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.active-station-confirm {
  margin: 0 0 2px;
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--primary-soft);
  border: 1px solid var(--primary-border);
  padding: 7px 18px;
  border-radius: var(--radius-pill);
  text-align: center;
}

.active-station-confirm strong {
  color: var(--db-num-color);
  font-weight: 800;
}

.btn-check {
  width: 100%;
  max-width: 360px;
  min-height: 54px;
  border: none;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #ef232c 0%, #c81920 100%);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 1.06rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  cursor: pointer;
  box-shadow: var(--shadow-btn);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s ease, filter 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.btn-check:hover:not(:disabled):not(.is-station-locked) {
  filter: brightness(1.09);
  transform: translateY(-2px);
  box-shadow: var(--shadow-btn-hover);
}

.btn-check:active:not(:disabled):not(.is-station-locked) {
  transform: translateY(0);
  filter: brightness(0.98);
}

/* Khi bỏ chọn hết đài hoặc trước giờ quay: nút mờ đi */
.btn-check:disabled,
.btn-check.is-station-locked {
  background: var(--border-strong);
  color: var(--text-muted);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.58;
  transform: none;
  filter: none;
}

.station-lock-hint {
  margin: 0;
  font-size: 0.83rem;
  font-weight: 600;
  color: var(--text-muted);
  text-align: center;
}

.lock-reason {
  margin: 0;
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--amber-text);
  text-align: center;
}

/* ==========================================================================
   KẾT QUẢ DÒ VÉ
   ========================================================================== */
.check-result-section {
  animation: fadeSlideIn 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

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

.result-box {
  border-radius: var(--radius-xl);
  padding: 24px;
  border: 1.5px solid var(--border);
  background: var(--bg-card);
  box-shadow: var(--shadow-card);
}

.result-box.is-win {
  background: linear-gradient(180deg, var(--amber-soft) 0%, var(--bg-card) 70%);
  border-color: #f59e0b;
  box-shadow: var(--shadow-win);
}

.result-box.is-lose {
  background: var(--bg-card);
  border-color: var(--border-strong);
}

.result-box.is-error,
.result-box.is-expired {
  background: var(--primary-soft);
  border-color: var(--primary-border);
}

.result-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
}

.is-win .result-badge {
  background: var(--amber-soft);
  color: var(--amber-text);
  border: 1px solid var(--amber-border);
}

.is-lose .result-badge {
  background: var(--bg-tabs);
  color: var(--text-secondary);
}

.is-error .result-badge,
.is-expired .result-badge {
  background: var(--primary-soft);
  color: var(--db-num-color);
  border: 1px solid var(--primary-border);
}

.result-ticket-summary {
  margin: 12px 0 6px;
  font-size: 1.02rem;
  color: var(--text-secondary);
}

.result-ticket-summary strong {
  color: var(--text-main);
}

.ticket-pill-num {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.1em;
  background: var(--primary);
  color: #ffffff;
  font-weight: 800;
  padding: 3px 11px;
  border-radius: 8px;
}

.win-total-block {
  margin: 16px 0;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #d91f26 0%, #991419 100%);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.win-total-label {
  font-size: 0.92rem;
  font-weight: 600;
  opacity: 0.95;
}

.win-total-amount {
  font-size: 1.58rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  color: #fde68a;
}

.win-total-words {
  width: 100%;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.9);
}

.win-breakdown {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.win-breakdown li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--amber-border);
  transition: transform 0.16s ease;
}

.win-breakdown li:hover {
  transform: translateX(3px);
}

.win-prize-name {
  font-weight: 800;
  color: var(--text-main);
}

.win-prize-detail {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.win-prize-money {
  font-weight: 800;
  color: var(--db-num-color);
  font-variant-numeric: tabular-nums;
}

.result-note {
  margin: 12px 0 0;
  font-size: 0.83rem;
  color: var(--text-muted);
}

/* ==========================================================================
   BẢNG KẾT QUẢ MỞ THƯỞNG
   ========================================================================== */
.results-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.results-title-block h2 {
  margin: 0;
  font-size: 1.22rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-main);
}

.results-subtitle {
  margin: 3px 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 600;
}

.status-banner {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 15px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  background: var(--bg-subtle);
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}

.status-banner[data-state="waiting"] {
  background: var(--amber-soft);
  border-color: var(--amber-border);
  color: var(--amber-text);
}

.status-banner[data-state="waiting"] .status-dot {
  background: #f59e0b;
}

.status-banner[data-state="live"] {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--db-num-color);
}

.status-banner[data-state="live"] .status-dot {
  background: #ef232c;
  box-shadow: 0 0 0 0 rgba(239, 35, 44, 0.7);
  animation: livePulse 1.4s infinite;
}

.status-banner[data-state="complete"] {
  background: var(--emerald-soft);
  border-color: var(--emerald-border);
  color: var(--emerald);
}

.status-banner[data-state="complete"] .status-dot {
  background: var(--emerald);
}

.status-banner[data-state="expired"] {
  background: var(--primary-soft);
  border-color: var(--primary-border);
  color: var(--db-num-color);
}

.status-banner[data-state="expired"] .status-dot {
  background: #ef232c;
}

@keyframes livePulse {
  0% {
    box-shadow: 0 0 0 0 rgba(239, 35, 44, 0.65);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(239, 35, 44, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(239, 35, 44, 0);
  }
}

.status-text-wrap {
  display: flex;
  flex-direction: column;
}

.status-label {
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.25;
}

.status-sub {
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  opacity: 0.92;
}

/* 3 TAB MIỀN NAM / MIỀN TRUNG / MIỀN BẮC */
.region-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: var(--bg-tabs);
  padding: 6px;
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
  border: 1px solid var(--border);
}

.region-tab {
  border: none;
  background: transparent;
  border-radius: var(--radius-md);
  padding: 11px 10px;
  font-family: var(--font-sans);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.region-tab:hover:not(.active) {
  background: var(--bg-chip-hover);
  color: var(--text-main);
  transform: translateY(-1px);
}

.region-tab.active {
  background: linear-gradient(135deg, var(--primary-hover) 0%, var(--primary) 100%);
  color: #ffffff;
  font-weight: 800;
  box-shadow: 0 4px 12px rgba(217, 31, 38, 0.3);
}

.region-tab.active:hover {
  filter: brightness(1.06);
  transform: translateY(-1px);
}

/* BẢNG KẾT QUẢ */
.table-viewport {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
}

.empty-draw-notice {
  padding: 30px 18px;
  text-align: center;
  background: var(--amber-soft);
  border-bottom: 1px solid var(--amber-border);
}

.empty-draw-notice h3 {
  margin: 0 0 6px;
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--amber-text);
}

.empty-draw-notice p {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--amber-text);
}

.lottery-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  min-width: 320px;
}

.lottery-table.cols-4 {
  min-width: 520px;
}

.lottery-table th,
.lottery-table td {
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
  padding: 12px 10px;
  text-align: center;
  vertical-align: middle;
  transition: background-color 0.15s ease;
}

.lottery-table th:last-child,
.lottery-table td:last-child {
  border-right: none;
}

.lottery-table tr:last-child td,
.lottery-table tr:last-child th {
  border-bottom: none;
}

.lottery-table thead th {
  background: var(--table-head-bg);
  color: var(--table-head-text);
  font-weight: 700;
  font-size: 0.94rem;
  padding: 13px 10px;
}

.lottery-table thead th.col-prize {
  width: 66px;
  background: var(--table-head-prize-bg);
  position: sticky;
  left: 0;
  z-index: 2;
}

.lottery-table thead th.is-checked-station {
  background: var(--primary);
  color: #ffffff;
}

.station-th-sub {
  display: block;
  font-size: 0.74rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.76);
  margin-top: 2px;
}

.lottery-table tbody th.prize-label-cell {
  width: 66px;
  background: var(--table-label-bg);
  color: var(--text-secondary);
  font-weight: 800;
  font-size: 0.85rem;
  position: sticky;
  left: 0;
  z-index: 1;
}

.lottery-table tbody tr:nth-child(even) td {
  background: var(--table-zebra-bg);
}

.lottery-table tbody td.is-checked-station {
  background: var(--table-checked-col);
}

.lottery-table tr.row-db th.prize-label-cell {
  background: var(--table-db-label-bg);
  color: var(--db-num-color);
  font-size: 0.92rem;
}

.lottery-table tr.row-db td {
  background: var(--table-db-bg);
}

.lottery-table tbody tr:hover td {
  background: var(--table-row-hover);
}

.lottery-table tbody tr:hover th.prize-label-cell {
  background: var(--table-label-hover);
  color: var(--db-num-color);
}

.prize-numbers {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  font-variant-numeric: tabular-nums;
}

.mb-table .prize-numbers {
  gap: 8px 20px;
}

.prize-num {
  display: inline-block;
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.04em;
  color: var(--text-main);
  padding: 2px 7px;
  border-radius: 6px;
  transition: background-color 0.15s ease, transform 0.15s ease;
}

.prize-num:hover {
  background: var(--bg-tabs);
  transform: scale(1.04);
}

.row-db .prize-num {
  font-size: 1.32rem;
  font-weight: 900;
  color: var(--db-num-color);
  letter-spacing: 0.06em;
}

.row-g8 .prize-num,
.mb-table .row-g7 .prize-num {
  font-size: 1.14rem;
  font-weight: 800;
  color: var(--tail-num-color);
}

.prize-num.is-hit {
  background: #fde68a;
  color: #991b1b;
  box-shadow: 0 0 0 2px #f59e0b;
  font-weight: 900;
}

.prize-empty {
  color: var(--text-faint);
  font-weight: 600;
  font-size: 0.9rem;
}

.prize-drawing {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--amber-text);
  background: var(--amber-soft);
  border: 1px solid var(--amber-border);
  padding: 2px 9px;
  border-radius: var(--radius-pill);
}

.ma-db-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}

.ma-db-chip {
  font-size: 0.82rem;
  font-weight: 700;
  background: var(--bg-tabs);
  color: var(--text-secondary);
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* ==========================================================================
   BẢNG THAM KHẢO CƠ CẤU GIẢI THƯỞNG
   ========================================================================== */
.prize-guide {
  padding: 18px 24px;
}

.prize-guide summary {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.18s ease;
}

.prize-guide summary:hover {
  color: var(--db-num-color);
}

.prize-guide-grid {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.prize-guide-col h3 {
  margin: 0 0 12px;
  font-size: 0.96rem;
  font-weight: 800;
  color: var(--db-num-color);
}

.prize-guide-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prize-guide-col li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.84rem;
  color: var(--text-secondary);
  padding-bottom: 7px;
  border-bottom: 1px dashed var(--border);
}

.prize-guide-col li strong {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  color: var(--text-main);
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer {
  padding: 18px 0 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.83rem;
}

.site-footer p {
  margin: 0;
}

/* ==========================================================================
   RESPONSIVE CHO ĐIỆN THOẠI & MÁY TÍNH BẢNG
   ========================================================================== */
@media (max-width: 780px) {
  .prize-guide-grid {
    grid-template-columns: 1fr;
    gap: 18px;
  }
}

@media (max-width: 600px) {
  .container {
    padding: 0 14px;
  }

  .site-header {
    padding: 14px 0;
  }

  .header-inner {
    flex-wrap: wrap;
    gap: 12px;
  }

  .brand-text h1 {
    font-size: 1.42rem;
  }

  .brand-text p {
    font-size: 0.8rem;
  }

  .header-logo {
    height: 84px;
    margin: 0 auto;
  }

  .header-actions {
    width: 100%;
    justify-content: space-between;
  }

  .vn-clock {
    font-size: 0.81rem;
    padding: 6px 12px;
  }

  .main-content {
    padding-top: 18px;
    gap: 18px;
  }

  .card {
    padding: 18px 14px;
    border-radius: 16px;
  }

  .step-box {
    padding: 15px 14px;
  }

  .step-2-box {
    padding: 16px 14px;
  }

  .step-body,
  .step-2-box .step-body {
    padding-left: 0;
  }

  .step-number {
    width: 34px;
    height: 34px;
    font-size: 0.98rem;
  }

  .step-number-highlight {
    width: 38px;
    height: 38px;
    font-size: 1.08rem;
  }

  .step-2-title {
    font-size: 1.04rem;
  }

  .step-2-warning {
    font-size: 0.81rem;
    padding: 6px 10px;
  }

  .input-wrap {
    max-width: 100%;
  }

  .station-chips {
    gap: 8px;
  }

  .station-chip {
    min-height: 42px;
    padding: 8px 15px;
    font-size: 0.88rem;
  }

  .active-station-confirm {
    font-size: 0.86rem;
    padding: 7px 14px;
  }

  .btn-check {
    max-width: 100%;
  }

  .region-tab {
    padding: 10px 6px;
    font-size: 0.88rem;
  }

  .lottery-table thead th.col-prize,
  .lottery-table tbody th.prize-label-cell {
    width: 48px;
    padding: 10px 4px;
    font-size: 0.78rem;
  }

  .lottery-table th,
  .lottery-table td {
    padding: 10px 6px;
  }

  .prize-num {
    font-size: 0.94rem;
    padding: 1px 4px;
  }

  .row-db .prize-num {
    font-size: 1.12rem;
  }

  .win-total-amount {
    font-size: 1.34rem;
  }
}

/* ============ Nut Lien he noi goc phai duoi ============ */
.contact-widget {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}
.contact-button {
  position: relative;
  width: 64px;
  height: 64px;
  border: none;
  border-radius: 50%;
  background: #567aff;
  color: #fff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  box-shadow: 0 4px 16px rgba(86, 122, 255, 0.45);
  animation: contact-bounce-in 0.6s ease both;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.contact-button:hover { transform: scale(1.07); box-shadow: 0 6px 22px rgba(86, 122, 255, 0.6); }
.contact-button:active { transform: scale(0.97); }
.contact-label { font-size: 11px; font-weight: 700; line-height: 1; }
.contact-close { display: none; font-size: 30px; line-height: 1; }
.contact-widget.open .contact-icon, .contact-widget.open .contact-label { display: none; }
.contact-widget.open .contact-close { display: block; }
/* Vong lan toa 2 giay */
.contact-pulse {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(86, 122, 255, 0.5);
  animation: contact-pulse 2s ease-out infinite;
  pointer-events: none;
}
@keyframes contact-pulse {
  0% { transform: scale(1); opacity: 0.7; }
  100% { transform: scale(1.7); opacity: 0; }
}
@keyframes contact-bounce-in {
  0% { opacity: 0; transform: scale(0.3); }
  60% { opacity: 1; transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}
.contact-panel {
  width: 300px;
  max-width: calc(100vw - 40px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.22);
  padding: 14px;
  animation: contact-panel-in 0.25s ease both;
}
@keyframes contact-panel-in {
  from { opacity: 0; transform: translateY(12px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.contact-panel-title { margin: 0 0 10px; font-weight: 800; font-size: 15px; color: #1a1a1a; }
.contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: 10px;
  text-decoration: none;
  color: #1a1a1a;
}
.contact-item:hover { background: #f0f0f0; }
.contact-item-icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.contact-icon-zalo { background: #0068ff; }
.contact-icon-fb { background: #1877f2; }
.contact-item-text { display: flex; flex-direction: column; }
.contact-item-text small { color: #666; font-size: 12px; }
[data-theme="dark"] .contact-panel { background: #1e1e1e; }
[data-theme="dark"] .contact-panel-title, [data-theme="dark"] .contact-item { color: #fff; }
[data-theme="dark"] .contact-item:hover { background: #2a2a2a; }
[data-theme="dark"] .contact-item-text small { color: #aaa; }

/* Mobile: nut Lien he nho hon nua */
@media (max-width: 600px) {
  .contact-widget { right: 14px; bottom: 14px; }
  .contact-button { width: 56px; height: 56px; }
  .contact-button .contact-icon { width: 22px; height: 22px; }
  .contact-label { font-size: 10px; }
  .contact-close { font-size: 26px; }
}
