:root {
  --primary: #d946ef;
  --primary-dark: #c026d3;
  --lotus-red: #e11d48;
  --lotus-pink: #f43f5e;
  --accent-gold: #f59e0b;
  --accent-silver: #94a3b8;
  --accent-bronze: #b45309;
  --bg-gradient: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #31103f 100%);
  --card-bg: rgba(30, 41, 59, 0.75);
  --card-border: rgba(255, 255, 255, 0.1);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.35), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --glow-gold: 0 0 25px rgba(245, 158, 11, 0.45);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Be Vietnam Pro', 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-gradient);
  background-attachment: fixed;
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

/* Header */
.header-section {
  text-align: center;
  padding: 24px 16px 36px;
  position: relative;
}

.header-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 4px 16px rgba(225, 29, 72, 0.4);
  border: 1.5px solid rgba(254, 240, 138, 0.6);
  transition: transform 0.25s ease;
  background: #fff;
}

.header-brand-logo:hover {
  transform: scale(1.08) rotate(-3deg);
}

.header-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 9999px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.25s ease;
  border: none;
}

.history-action-btn {
  background: rgba(99, 102, 241, 0.15);
  color: #c7d2fe;
  border: 1px solid rgba(99, 102, 241, 0.35);
}

.history-action-btn:hover {
  background: #6366f1;
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

.donate-action-btn {
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.25), rgba(245, 158, 11, 0.2));
  color: #fbcfe8;
  border: 1px solid rgba(225, 29, 72, 0.45);
}

.donate-action-btn:hover {
  background: linear-gradient(135deg, #e11d48, #f59e0b);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(225, 29, 72, 0.5);
}

.header-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(225, 29, 72, 0.2);
  border: 1px solid rgba(225, 29, 72, 0.4);
  color: #fda4af;
  padding: 6px 16px;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0;
  letter-spacing: 0.5px;
}

.header-title {
  font-size: clamp(1.45rem, 4.5vw, 2.3rem);
  font-weight: 800;
  background: linear-gradient(to right, #ffffff 10%, #fda4af 60%, #fde047 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  line-height: 1.25;
}

.header-subtitle {
  color: #cbd5e1;
  font-size: clamp(0.88rem, 2.2vw, 1.1rem);
  max-width: 720px;
  margin: 0 auto 16px;
}

.rule-pill {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(10px);
  border: 1px dashed rgba(255, 255, 255, 0.2);
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 0.86rem;
  color: #cbd5e1;
  line-height: 1.4;
}

.rule-title {
  color: #fef08a;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rule-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.8rem;
}

.rule-chip.reaction {
  background: rgba(244, 63, 94, 0.15);
  color: #fda4af;
  border: 1px solid rgba(244, 63, 94, 0.3);
}

.rule-chip.share {
  background: rgba(59, 130, 246, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 32px;
}

.kpi-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
  transition: transform 0.2s, border-color 0.2s;
}

.kpi-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.25);
}

.kpi-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  flex-shrink: 0;
}

.kpi-icon.rose { background: rgba(244, 63, 94, 0.2); color: #fb7185; }
.kpi-icon.yellow { background: rgba(245, 158, 11, 0.2); color: #fbbf24; }
.kpi-icon.blue { background: rgba(59, 130, 246, 0.2); color: #60a5fa; }
.kpi-icon.green { background: rgba(16, 185, 129, 0.2); color: #34d399; }
.kpi-icon.purple { background: rgba(168, 85, 247, 0.2); color: #c084fc; }

.kpi-info {
  min-width: 0;
}

.kpi-info .kpi-value {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-info .kpi-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.2;
  margin-top: 3px;
}

/* Podium Section */
.podium-container {
  margin-bottom: 36px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 8px;
}

.section-heading h2 {
  font-size: 1.35rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.podium {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  align-items: end;
}

.podium-slot {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  padding: 22px 16px;
  text-align: center;
  position: relative;
  box-shadow: var(--shadow);
  border: 1px solid var(--card-border);
  transition: transform 0.3s;
  cursor: pointer;
}

.podium-slot:hover {
  transform: translateY(-5px);
}

.podium-slot.rank-1 {
  order: 2;
  border-color: rgba(245, 158, 11, 0.65);
  box-shadow: var(--glow-gold);
  background: linear-gradient(180deg, rgba(245, 158, 11, 0.18) 0%, rgba(30, 41, 59, 0.9) 100%);
  padding-bottom: 28px;
}

.podium-slot.rank-2 {
  order: 1;
  border-color: rgba(148, 163, 184, 0.5);
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.12) 0%, rgba(30, 41, 59, 0.9) 100%);
}

.podium-slot.rank-3 {
  order: 3;
  border-color: rgba(180, 83, 9, 0.5);
  background: linear-gradient(180deg, rgba(180, 83, 9, 0.12) 0%, rgba(30, 41, 59, 0.9) 100%);
}

.podium-crown {
  font-size: 2rem;
  margin-bottom: -6px;
  display: block;
}

.podium-avatar-wrap {
  position: relative;
  width: 105px;
  height: 105px;
  margin: 0 auto 12px;
}

.rank-1 .podium-avatar-wrap {
  width: 125px;
  height: 125px;
}

.podium-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.3);
}

.rank-1 .podium-avatar { border-color: #f59e0b; border-width: 4px; }
.rank-2 .podium-avatar { border-color: #cbd5e1; }
.rank-3 .podium-avatar { border-color: #d97706; }

.podium-rank-badge {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
}

.rank-1 .podium-rank-badge { background: #f59e0b; color: #000; }
.rank-2 .podium-rank-badge { background: #cbd5e1; color: #000; }
.rank-3 .podium-rank-badge { background: #b45309; color: #fff; }

.podium-name {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 3px;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.podium-sbd {
  display: inline-block;
  background: rgba(255, 255, 255, 0.12);
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  color: #fda4af;
  font-weight: 700;
  margin-bottom: 4px;
}

.podium-unit {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  height: 38px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.podium-score {
  font-size: 1.5rem;
  font-weight: 800;
  color: #fef08a;
  line-height: 1.1;
}

.podium-score-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.podium-stats {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 0.78rem;
  color: #cbd5e1;
}

/* Controls Bar */
.controls-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 22px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.search-box {
  flex: 1 1 260px;
  position: relative;
}

.search-box input {
  width: 100%;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 10px 14px 10px 40px;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus {
  border-color: var(--lotus-pink);
}

.search-box i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.custom-select {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  outline: none;
  cursor: pointer;
  max-width: 220px;
}

.custom-select option {
  background: #1e293b;
  color: #fff;
}

.btn {
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
  min-height: 40px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--lotus-pink), var(--lotus-red));
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(1.1);
}

.btn-outline {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.15);
}

.view-toggle {
  display: inline-flex;
  background: rgba(15, 23, 42, 0.6);
  border-radius: var(--radius-sm);
  padding: 3px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.view-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  min-height: 34px;
}

.view-btn.active {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

/* Leaderboard Table */
.table-wrapper {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

th {
  background: rgba(15, 23, 42, 0.85);
  padding: 14px 16px;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--card-border);
}

td {
  padding: 14px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.92rem;
  vertical-align: middle;
}

tr:hover td {
  background: rgba(255, 255, 255, 0.03);
}

.rank-pill {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.88rem;
  background: rgba(255, 255, 255, 0.1);
  color: #cbd5e1;
}

.rank-pill.gold { background: #f59e0b; color: #000; box-shadow: 0 0 10px rgba(245, 158, 11, 0.5); }
.rank-pill.silver { background: #cbd5e1; color: #000; }
.rank-pill.bronze { background: #b45309; color: #fff; }

.candidate-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.candidate-thumb {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.candidate-thumb:hover {
  transform: scale(1.08);
}

.candidate-name-wrap .name {
  font-weight: 700;
  color: #fff;
  font-size: 0.95rem;
}

.candidate-name-wrap .dob {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.unit-tag {
  display: inline-block;
  background: rgba(255, 255, 255, 0.06);
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 0.82rem;
  color: #cbd5e1;
}

.score-badge {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fef08a;
}

.metric-cell {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 600;
}

.metric-cell.reaction { color: #fb7185; }
.metric-cell.share { color: #60a5fa; }
.metric-cell.comment { color: #34d399; }

.mobile-btn-suffix {
  display: none;
}

/* Grid Cards View */
.grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.contestant-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  transition: transform 0.25s, border-color 0.25s;
}

.contestant-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.25);
}

.card-img-wrap {
  position: relative;
  height: 310px;
  overflow: hidden;
  cursor: pointer;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s;
}

.contestant-card:hover .card-img {
  transform: scale(1.04);
}

.card-rank-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.8rem;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(6px);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.card-sbd-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(225, 29, 72, 0.9);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: #fff;
}

.card-body {
  padding: 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.card-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
}

.card-unit {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.card-score-box {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-score-value {
  font-size: 1.35rem;
  font-weight: 800;
  color: #fef08a;
}

.card-metrics {
  display: flex;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.82rem;
}

/* ==========================================================================
   MODAL OVERLAY (UNIVERSAL BASE)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 15, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  overscroll-behavior: none;
  touch-action: none;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* ==========================================================================
   CONTESTANT DETAIL MODAL (DESKTOP)
   ========================================================================== */
.modal-box {
  background: #182234;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 24px;
  max-width: 940px;
  width: 100%;
  height: min(88vh, 720px);
  max-height: 90vh;
  overflow: hidden;
  display: grid;
  grid-template-columns: 430px 1fr;
  box-shadow: 0 25px 65px -10px rgba(0, 0, 0, 0.8), 0 0 35px rgba(225, 29, 72, 0.15);
  position: relative;
  overscroll-behavior: contain;
  touch-action: pan-y;
  animation: modalScaleUp 0.28s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.modal-handle-bar {
  display: none;
}

.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  z-index: 25;
  transition: all 0.2s ease;
}

.modal-close-btn:hover {
  background: #ef4444;
  color: #fff;
  transform: scale(1.08) rotate(90deg);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.5);
}

.modal-img-side {
  background: #080c16;
  position: relative;
  overflow: hidden;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-img-side img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #080c16;
  display: block;
  transition: transform 0.5s ease;
}

.modal-img-side:hover img {
  transform: scale(1.03);
}

.modal-content-side {
  padding: 30px 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  height: 100%;
  box-sizing: border-box;
}

.modal-pill-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.modal-chip-sbd {
  position: static;
  display: inline-flex;
  align-items: center;
  background: linear-gradient(135deg, var(--lotus-pink), var(--lotus-red));
  color: #fff;
  font-weight: 800;
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.82rem;
  letter-spacing: 0.5px;
  box-shadow: 0 3px 10px rgba(225, 29, 72, 0.4);
}

.modal-chip-rank {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.45);
  color: #fef08a;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 9999px;
  font-size: 0.8rem;
}

.modal-candidate-name {
  font-size: 1.7rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.25;
  margin: 0 0 6px 0;
  letter-spacing: 0.3px;
}

.modal-meta-tags {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.85rem;
}

.meta-tag-unit {
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.06);
  padding: 3px 10px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.meta-tag-dob {
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.modal-featured-score {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(225, 29, 72, 0.16));
  border: 1.5px solid rgba(245, 158, 11, 0.4);
  border-radius: 14px;
  padding: 12px 18px;
  margin-bottom: 0;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
}

.score-sub-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fde047;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}

.modal-score-rank {
  font-size: 1.6rem;
  font-weight: 900;
  color: #fda4af;
  line-height: 1.2;
}

.modal-block-title {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: #f1f5f9;
  display: flex;
  align-items: center;
  gap: 7px;
}

.modal-quote {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-left: 4px solid var(--lotus-pink);
  padding: 12px 16px;
  border-radius: 0 12px 12px 0;
  font-style: italic;
  font-size: 0.92rem;
  color: #e2e8f0;
  max-height: 130px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  line-height: 1.6;
}

.modal-breakdown-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.breakdown-item {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 8px 12px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.85rem;
  transition: border-color 0.2s;
}

.breakdown-item:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.breakdown-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #cbd5e1;
}

.breakdown-pts {
  color: #fde047;
  font-size: 0.78rem;
  font-weight: 600;
}

.modal-action-box {
  margin-top: auto;
  padding-top: 14px;
}

.modal-fb-action-btn {
  width: 100%;
  justify-content: center;
  text-decoration: none;
  background: linear-gradient(135deg, #1877f2, #0d5cb6);
  box-shadow: 0 4px 18px rgba(24, 119, 242, 0.45);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 13px 20px;
  border-radius: 12px;
  transition: all 0.25s ease;
}

.modal-fb-action-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(24, 119, 242, 0.6);
  filter: brightness(1.1);
}

/* Floating Action Cluster */
.fab-cluster {
  position: fixed;
  bottom: 24px;
  right: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 99;
}

.fab-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  color: #fff;
  position: relative;
  transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.fab-btn:hover {
  transform: translateY(-3px) scale(1.08);
}

.fab-history {
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  border: 1.5px solid rgba(167, 139, 250, 0.5);
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.45);
}

.fab-history:hover {
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.7);
}

.fab-donate {
  background: linear-gradient(135deg, #e11d48, #f59e0b);
  border: 1.5px solid rgba(254, 240, 138, 0.5);
  box-shadow: 0 6px 20px rgba(225, 29, 72, 0.5);
}

.fab-donate:hover {
  box-shadow: 0 8px 26px rgba(225, 29, 72, 0.75);
}

.fab-badge-text {
  position: absolute;
  top: -8px;
  right: -6px;
  background: #f43f5e;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 9999px;
  border: 1.5px solid #111827;
  white-space: nowrap;
  letter-spacing: 0.3px;
  animation: pulseBadge 2.2s infinite;
}

@keyframes pulseBadge {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); box-shadow: 0 0 12px rgba(244, 63, 94, 0.85); }
}

.fab-tooltip {
  position: absolute;
  right: 58px;
  background: rgba(15, 23, 42, 0.95);
  color: #f1f5f9;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transform: translateX(10px);
  transition: all 0.2s ease;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.fab-btn:hover .fab-tooltip {
  opacity: 1;
  transform: translateX(0);
}

/* Back to top button */
.back-to-top {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(30, 41, 59, 0.95);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(15px);
  transition: all 0.25s ease;
}

.back-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--lotus-pink);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(225, 29, 72, 0.5);
}

/* ==========================================================================
   DONATE MODAL
   ========================================================================== */
.donate-modal-box {
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  max-width: 620px;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.75), 0 0 35px rgba(225, 29, 72, 0.2);
  position: relative;
  animation: modalScaleUp 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes modalScaleUp {
  from { opacity: 0; transform: scale(0.92) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.donate-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  color: #f1f5f9;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 25;
  transition: all 0.2s ease;
}

.donate-close-btn:hover {
  background: #ef4444;
  color: #fff;
  transform: scale(1.08) rotate(90deg);
  box-shadow: 0 4px 15px rgba(239, 68, 68, 0.5);
}

.donate-modal-header {
  padding: 24px 24px 14px;
  background: linear-gradient(135deg, rgba(225, 29, 72, 0.16), rgba(245, 158, 11, 0.1));
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.donate-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(225, 29, 72, 0.2);
  color: #fda4af;
  border: 1px solid rgba(225, 29, 72, 0.4);
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.donate-title {
  font-size: 1.38rem;
  font-weight: 800;
  color: #fff;
  margin: 0 0 6px 0;
  line-height: 1.3;
}

.donate-author-info {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.donate-author-info .author-name {
  color: #fef08a;
  font-weight: 700;
}

.donate-author-info .author-sub {
  color: #94a3b8;
}

.donate-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.donate-letter-card {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px 18px;
  font-size: 0.92rem;
  line-height: 1.65;
  color: #cbd5e1;
}

.donate-salutation {
  font-weight: 600;
  color: #f1f5f9;
  margin-bottom: 10px;
}

.donate-letter-card p {
  margin-bottom: 10px;
}

.donate-letter-card p strong {
  color: #fef08a;
}

.donate-letter-card p em {
  color: #fda4af;
  font-style: normal;
  font-weight: 600;
}

.donate-closing {
  font-weight: 600;
  color: #38bdf8 !important;
  margin-bottom: 0 !important;
}

.donate-qr-wrapper {
  display: flex;
  align-items: center;
  gap: 20px;
  background: linear-gradient(135deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.95));
  border: 1px solid rgba(245, 158, 11, 0.25);
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.donate-qr-frame {
  flex-shrink: 0;
  text-align: center;
}

.donate-qr-image {
  width: 170px;
  height: 170px;
  object-fit: contain;
  border-radius: 12px;
  background: #ffffff;
  padding: 6px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
  display: block;
}

.qr-scan-guide {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-top: 6px;
  font-weight: 500;
}

.donate-qr-meta {
  flex: 1;
}

.qr-meta-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fde047;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.qr-meta-text {
  font-size: 0.85rem;
  color: #cbd5e1;
  line-height: 1.5;
  margin-bottom: 10px;
}

.qr-note-tag {
  background: rgba(225, 29, 72, 0.12);
  border: 1px dashed rgba(225, 29, 72, 0.35);
  color: #fda4af;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
}

.qr-note-tag span {
  color: #fef08a;
  font-weight: 700;
}

.donate-modal-footer {
  padding: 16px 24px 20px;
  background: #131b2e;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.btn-donate-dismiss {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.88rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 44px;
}

.btn-donate-dismiss:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.btn-donate-confirm {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.88rem;
  background: linear-gradient(135deg, var(--lotus-pink), var(--lotus-red));
  border: none;
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(225, 29, 72, 0.4);
  min-height: 44px;
}

.btn-donate-confirm:hover {
  filter: brightness(1.15);
  transform: translateY(-2px);
}

/* ==========================================================================
   HISTORY MODAL (SLIDESHOW)
   ========================================================================== */
.history-modal-box {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  max-width: 960px;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 25px 60px -10px rgba(0, 0, 0, 0.8), 0 0 35px rgba(99, 102, 241, 0.25);
  position: relative;
  animation: modalScaleUp 0.3s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.history-close-btn {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid rgba(255, 255, 255, 0.25);
  color: #f1f5f9;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 30;
  transition: all 0.2s ease;
}

.history-close-btn:hover {
  background: #ef4444;
  color: #fff;
  transform: scale(1.08) rotate(90deg);
}

.history-container {
  display: grid;
  grid-template-columns: 1.05fr 1.2fr;
  min-height: 520px;
  max-height: 85vh;
  overflow: hidden;
}

.history-media-panel {
  background: #090d16;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.history-img-wrapper {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

#historySlideImg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease;
}

.history-tag {
  position: absolute;
  bottom: 16px;
  left: 16px;
  background: rgba(15, 23, 42, 0.88);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fde047;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 9999px;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
}

.history-content-panel {
  padding: 30px 28px 22px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  background: #111827;
}

.history-top-meta {
  margin-bottom: 14px;
  padding-right: 36px;
}

.history-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(99, 102, 241, 0.18);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.35);
  padding: 4px 12px;
  border-radius: 9999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.history-title {
  font-size: 1.38rem;
  font-weight: 800;
  color: #fff;
  line-height: 1.35;
  margin: 0;
  background: linear-gradient(135deg, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.history-text-scroll {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 6px;
  margin-bottom: 16px;
  font-size: 0.94rem;
  line-height: 1.7;
  color: #cbd5e1;
}

.history-text-scroll p {
  margin-bottom: 12px;
}

.history-text-scroll p:last-child {
  margin-bottom: 0;
}

.history-bottom-bar {
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.history-nav-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.history-arrow-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.2s ease;
  min-height: 42px;
}

.history-arrow-btn:hover {
  background: rgba(99, 102, 241, 0.3);
  border-color: rgba(99, 102, 241, 0.6);
  color: #a5b4fc;
}

.history-counter-pill {
  font-size: 0.9rem;
  font-weight: 700;
  color: #fde047;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  padding: 4px 14px;
  border-radius: 9999px;
  letter-spacing: 0.5px;
}

.history-pagination-dots {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.history-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
  transition: all 0.25s ease;
}

.history-dot.active {
  width: 24px;
  border-radius: 9999px;
  background: #6366f1;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.6);
}

/* ==========================================================================
   30-SECOND HISTORY INVITATION TOAST
   ========================================================================== */
.history-invite-toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  max-width: 410px;
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(99, 102, 241, 0.45);
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6), 0 0 25px rgba(99, 102, 241, 0.3);
  display: flex;
  gap: 14px;
  align-items: flex-start;
  z-index: 98;
  opacity: 0;
  visibility: hidden;
  transform: translateY(30px) scale(0.95);
  transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.history-invite-toast.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

.toast-close-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 1.05rem;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.toast-close-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.toast-visual {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #4f46e5, #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.45);
}

.toast-content {
  flex: 1;
  padding-right: 16px;
}

.toast-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: #a5b4fc;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.toast-title {
  font-size: 0.98rem;
  font-weight: 700;
  color: #fff;
  margin: 0 0 4px 0;
}

.toast-desc {
  font-size: 0.82rem;
  color: #cbd5e1;
  line-height: 1.45;
  margin: 0 0 10px 0;
}

.toast-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 3px 12px rgba(99, 102, 241, 0.4);
}

.toast-btn-primary:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

/* Footer */
footer {
  text-align: center;
  padding: 28px 16px;
  color: var(--text-muted);
  font-size: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  margin-top: 40px;
}

/* ===================================================
   MOBILE & TABLET RESPONSIVE STYLES
   =================================================== */

@media (max-width: 1024px) {
  .container {
    padding: 20px 16px 50px;
  }

  .kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .kpi-card:nth-child(4),
  .kpi-card:nth-child(5) {
    grid-column: span 1;
  }
}

@media (max-width: 768px) {
  /* Prevent horizontal overflow on entire document */
  html, body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    width: 100% !important;
    position: relative;
  }

  *, *::before, *::after {
    box-sizing: border-box !important;
  }

  .container {
    padding: 14px 12px calc(50px + env(safe-area-inset-bottom, 0px));
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    box-sizing: border-box;
  }

  /* Header Section */
  .header-section {
    padding: 12px 4px 18px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .header-badge {
    font-size: 0.75rem;
    padding: 4px 12px;
    margin-bottom: 8px;
    gap: 6px;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-title {
    font-size: clamp(1.25rem, 5vw, 1.75rem);
    letter-spacing: 0.2px;
    margin-bottom: 6px;
    line-height: 1.25;
    word-break: break-word;
  }

  .header-subtitle {
    font-size: 0.82rem;
    line-height: 1.35;
    margin-bottom: 10px;
  }

  .rule-pill {
    padding: 6px 10px;
    font-size: 0.76rem;
    gap: 6px;
    max-width: 100%;
    box-sizing: border-box;
  }

  .rule-title {
    font-size: 0.76rem;
  }

  .rule-chip {
    font-size: 0.72rem;
    padding: 2px 7px;
  }

  /* KPI Grid: Perfectly Balanced 2 Hero Cards + 3 Metric Cards */
  .kpi-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 22px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .kpi-card {
    min-width: 0;
    box-sizing: border-box;
  }

  /* Row 1: Top 2 Hero Stats */
  .kpi-card:nth-child(1),
  .kpi-card:nth-child(2) {
    grid-column: span 3;
    padding: 12px 10px;
    border-radius: 14px;
    gap: 8px;
  }

  .kpi-card:nth-child(1) .kpi-icon,
  .kpi-card:nth-child(2) .kpi-icon {
    width: 36px;
    height: 36px;
    font-size: 1.1rem;
    border-radius: 10px;
  }

  .kpi-card:nth-child(1) .kpi-info .kpi-value,
  .kpi-card:nth-child(2) .kpi-info .kpi-value {
    font-size: 1.3rem;
    font-weight: 800;
  }

  .kpi-card:nth-child(1) .kpi-info .kpi-label,
  .kpi-card:nth-child(2) .kpi-info .kpi-label {
    font-size: 0.7rem;
  }

  /* Row 2: 3 Engagement Metrics (Like, Share, Comment) */
  .kpi-card:nth-child(3),
  .kpi-card:nth-child(4),
  .kpi-card:nth-child(5) {
    grid-column: span 2;
    padding: 10px 4px;
    border-radius: 12px;
    flex-direction: column;
    text-align: center;
    gap: 3px;
    justify-content: center;
  }

  .kpi-card:nth-child(3) .kpi-icon,
  .kpi-card:nth-child(4) .kpi-icon,
  .kpi-card:nth-child(5) .kpi-icon {
    width: 26px;
    height: 26px;
    font-size: 0.8rem;
    border-radius: 7px;
    margin: 0 auto;
  }

  .kpi-card:nth-child(3) .kpi-info .kpi-value,
  .kpi-card:nth-child(4) .kpi-info .kpi-value,
  .kpi-card:nth-child(5) .kpi-info .kpi-value {
    font-size: 1.05rem;
    font-weight: 800;
    line-height: 1.1;
  }

  .kpi-card:nth-child(3) .kpi-info .kpi-label,
  .kpi-card:nth-child(4) .kpi-info .kpi-label,
  .kpi-card:nth-child(5) .kpi-info .kpi-label {
    font-size: 0.64rem;
    line-height: 1.1;
  }

  /* ===================================================
     PODIUM TOP 3: 1 HERO WINNER CARD + 2 RUNNER-UP CARDS
     (100% Fit Width, Không Bị Chen Chúc, Không Lòi Ra Ngoài)
     =================================================== */
  .podium-container {
    margin-bottom: 24px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    overflow: hidden;
  }

  .section-heading {
    width: 100%;
    margin-bottom: 12px;
  }

  .section-heading h2 {
    font-size: 1.15rem;
  }

  .section-heading span#lastUpdated {
    font-size: 0.74rem;
  }

  .podium {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
    margin-top: 6px;
    align-items: stretch;
    box-sizing: border-box !important;
  }

  .podium-slot {
    min-width: 0 !important; /* CRITICAL: Prevents CSS Grid item blowout */
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    transition: transform 0.2s;
  }

  .podium-slot:active {
    transform: scale(0.98);
  }

  /* --- RANK 1: FULL-WIDTH ROYAL WINNER CARD (SPAN 2 COLUMNS) --- */
  .podium-slot.rank-1 {
    grid-column: span 2 !important;
    order: 1 !important;
    padding: 18px 14px 20px !important;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.22) 0%, rgba(30, 41, 59, 0.95) 100%) !important;
    border: 1.5px solid rgba(245, 158, 11, 0.65) !important;
    box-shadow: 0 0 25px rgba(245, 158, 11, 0.35) !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
  }

  .rank-1 .podium-crown {
    font-size: 2rem !important;
    margin-bottom: -4px;
    display: block;
    animation: crownFloat 2.5s ease-in-out infinite;
  }

  @keyframes crownFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-4px); }
  }

  .rank-1 .podium-avatar-wrap {
    width: 86px !important;
    height: 86px !important;
    margin: 0 auto 10px !important;
    position: relative;
  }

  .rank-1 .podium-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: top center;
    border: 3.5px solid #f59e0b !important;
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.6);
  }

  .rank-1 .podium-rank-badge {
    width: 26px !important;
    height: 26px !important;
    font-size: 0.85rem !important;
    font-weight: 800;
    bottom: -4px;
    background: #f59e0b !important;
    color: #000 !important;
  }

  .rank-1 .podium-sbd {
    font-size: 0.78rem !important;
    font-weight: 700;
    padding: 2px 10px;
    margin-bottom: 4px;
    background: rgba(225, 29, 72, 0.25) !important;
    border: 1px solid rgba(225, 29, 72, 0.5);
    color: #fda4af !important;
    border-radius: 999px;
  }

  .rank-1 .podium-name {
    font-size: 1.15rem !important;
    font-weight: 800;
    color: #fff;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .rank-1 .podium-unit {
    font-size: 0.8rem !important;
    color: #cbd5e1;
    margin-bottom: 8px;
    height: auto !important;
    line-height: 1.3;
    -webkit-line-clamp: unset !important;
  }

  .rank-1 .podium-score {
    font-size: 1.6rem !important;
    font-weight: 800;
    color: #fef08a !important;
    line-height: 1.1;
    text-shadow: 0 0 16px rgba(254, 240, 138, 0.45);
  }

  .rank-1 .podium-score-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .rank-1 .podium-stats {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 10px;
    width: 100%;
    flex-wrap: wrap;
  }

  .rank-1 .podium-stats span {
    background: rgba(15, 23, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.1);
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 0.76rem;
    font-weight: 600;
    color: #f8fafc;
  }

  /* --- RANK 2 & RANK 3: BALANCED 50% - 50% SIDE-BY-SIDE DUO --- */
  .podium-slot.rank-2 {
    grid-column: span 1 !important;
    order: 2 !important;
    padding: 14px 10px 16px !important;
    border-radius: 16px;
    border: 1px solid rgba(148, 163, 184, 0.45) !important;
    background: linear-gradient(180deg, rgba(148, 163, 184, 0.15) 0%, rgba(30, 41, 59, 0.95) 100%) !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .podium-slot.rank-3 {
    grid-column: span 1 !important;
    order: 3 !important;
    padding: 14px 10px 16px !important;
    border-radius: 16px;
    border: 1px solid rgba(180, 83, 9, 0.45) !important;
    background: linear-gradient(180deg, rgba(180, 83, 9, 0.15) 0%, rgba(30, 41, 59, 0.95) 100%) !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  .podium-slot.rank-2 .podium-crown,
  .podium-slot.rank-3 .podium-crown {
    font-size: 1.4rem !important;
    margin-bottom: -2px;
    display: block;
  }

  .podium-slot.rank-2 .podium-avatar-wrap,
  .podium-slot.rank-3 .podium-avatar-wrap {
    width: 66px !important;
    height: 66px !important;
    margin: 0 auto 8px;
    position: relative;
  }

  .podium-slot.rank-2 .podium-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: top center;
    border: 2.5px solid #cbd5e1;
  }

  .podium-slot.rank-3 .podium-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    object-position: top center;
    border: 2.5px solid #d97706;
  }

  .podium-slot.rank-2 .podium-rank-badge {
    width: 22px !important;
    height: 22px !important;
    font-size: 0.75rem !important;
    font-weight: 800;
    bottom: -3px;
    background: #cbd5e1 !important;
    color: #000 !important;
  }

  .podium-slot.rank-3 .podium-rank-badge {
    width: 22px !important;
    height: 22px !important;
    font-size: 0.75rem !important;
    font-weight: 800;
    bottom: -3px;
    background: #b45309 !important;
    color: #fff !important;
  }

  .podium-slot.rank-2 .podium-sbd,
  .podium-slot.rank-3 .podium-sbd {
    font-size: 0.7rem !important;
    font-weight: 700;
    padding: 1px 7px;
    margin-bottom: 3px;
    background: rgba(255, 255, 255, 0.1);
    color: #fda4af;
    border-radius: 999px;
  }

  .podium-slot.rank-2 .podium-name,
  .podium-slot.rank-3 .podium-name {
    font-size: 0.88rem !important;
    font-weight: 700;
    color: #fff;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .podium-slot.rank-2 .podium-unit,
  .podium-slot.rank-3 .podium-unit {
    font-size: 0.7rem !important;
    color: var(--text-muted);
    height: 32px !important;
    line-height: 1.25;
    margin-bottom: 6px;
    -webkit-line-clamp: 2;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .podium-slot.rank-2 .podium-score,
  .podium-slot.rank-3 .podium-score {
    font-size: 1.22rem !important;
    font-weight: 800;
    color: #fef08a;
    line-height: 1.1;
  }

  .podium-slot.rank-2 .podium-score-label,
  .podium-slot.rank-3 .podium-score-label {
    font-size: 0.65rem;
    color: var(--text-muted);
  }

  .podium-slot.rank-2 .podium-stats,
  .podium-slot.rank-3 .podium-stats {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 3px 5px;
    margin-top: 6px;
    font-size: 0.68rem;
  }

  .podium-slot.rank-2 .podium-stats span,
  .podium-slot.rank-3 .podium-stats span {
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 5px;
  }

  /* Controls Card on Mobile */
  .controls-card {
    padding: 12px;
    gap: 10px;
    border-radius: 16px;
    margin-bottom: 18px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .search-box {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .search-box input {
    /* 16px font-size prevents iOS Safari auto-zoom on focus */
    font-size: 16px;
    padding: 10px 14px 10px 38px;
    border-radius: 10px;
    width: 100%;
    box-sizing: border-box;
  }

  .search-box i {
    left: 13px;
    font-size: 0.88rem;
  }

  /* Symmetrical 2x2 grid for filters & controls */
  .filter-group {
    width: 100%;
    max-width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    box-sizing: border-box;
  }

  .custom-select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    /* 16px prevents iOS Safari auto-zoom */
    font-size: 16px;
    padding: 8px 10px;
    border-radius: 10px;
    height: 40px;
    box-sizing: border-box;
  }

  .view-toggle {
    display: inline-flex !important;
    width: 100%;
    min-width: 0;
    border-radius: 10px;
    padding: 2px;
    height: 40px;
    box-sizing: border-box;
  }

  .view-toggle .view-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    min-height: 36px;
    border-radius: 8px;
  }

  #btnExportCSV {
    width: 100%;
    min-width: 0;
    height: 40px;
    min-height: 40px;
    font-size: 0.82rem;
    border-radius: 10px;
    padding: 0 10px;
    box-sizing: border-box;
  }

  /* Transform Table to Native-Feeling Mobile Cards */
  .table-wrapper {
    background: transparent;
    border: none;
    box-shadow: none;
    border-radius: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
    box-sizing: border-box;
  }

  table, thead, tbody, th, td, tr {
    display: block;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  thead {
    display: none;
  }

  tbody tr {
    background: var(--card-bg);
    backdrop-filter: blur(14px);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    margin-bottom: 12px;
    padding: 14px;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
    display: flex;
    flex-direction: column;
    gap: 10px;
    transition: transform 0.15s ease, border-color 0.15s ease;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  tbody tr:active {
    transform: scale(0.99);
    border-color: rgba(244, 63, 94, 0.35);
  }

  tbody td {
    padding: 0;
    border: none;
    text-align: left !important;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  /* Desktop-only elements hidden on mobile */
  .desktop-sbd,
  .desktop-metric,
  .desktop-score {
    display: none !important;
  }

  /* Card Top Row: Rank & SBD on left, Score on right */
  tr td:nth-child(1) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    order: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 9px;
    width: 100%;
    box-sizing: border-box;
  }

  .rank-pill {
    width: 28px;
    height: 28px;
    font-size: 0.84rem;
  }

  .mobile-sbd-tag {
    display: inline-flex !important;
    align-items: center;
    background: rgba(225, 29, 72, 0.18);
    border: 1px solid rgba(225, 29, 72, 0.4);
    color: #fda4af;
    font-size: 0.82rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 999px;
  }

  .mobile-score-box {
    display: flex !important;
    align-items: baseline;
    gap: 4px;
    text-align: right;
  }

  /* Card Middle Row: Candidate Avatar & Identity */
  tr td:nth-child(3) {
    order: 2;
    width: 100%;
    box-sizing: border-box;
  }

  .candidate-cell {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    min-width: 0;
  }

  .candidate-thumb {
    width: 62px;
    height: 62px;
    border-radius: 12px;
    object-fit: cover;
    object-position: top center;
    border: 2px solid rgba(255, 255, 255, 0.22);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
  }

  .candidate-name-wrap {
    min-width: 0;
    flex: 1;
  }

  .candidate-name-wrap .name {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    line-height: 1.25;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .candidate-name-wrap .dob {
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 5px;
  }

  /* Card Unit Row */
  tr td:nth-child(4) {
    order: 3;
    padding-top: 2px;
    width: 100%;
    box-sizing: border-box;
  }

  .unit-tag {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 0.78rem;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    border: 1px solid rgba(255, 255, 255, 0.08);
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Card Action Row: Stats bar + Action button */
  tr td.action-cell {
    order: 4;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 6px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    width: 100%;
    box-sizing: border-box;
  }

  .mobile-summary-pills {
    display: flex !important;
    justify-content: space-around;
    align-items: center;
    width: 100%;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 12px;
    padding: 7px 10px;
    box-sizing: border-box;
  }

  .mobile-summary-pills .metric-cell {
    font-size: 0.8rem;
    font-weight: 600;
  }

  tr td.action-cell .btn {
    width: 100%;
    min-height: 38px;
    font-size: 0.84rem;
    font-weight: 600;
    border-radius: 10px;
    background: rgba(225, 29, 72, 0.14);
    border: 1px solid rgba(225, 29, 72, 0.35);
    color: #fda4af;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 2px;
    transition: all 0.2s;
    box-sizing: border-box;
  }

  tr td.action-cell .btn:active {
    background: rgba(225, 29, 72, 0.3);
    transform: scale(0.98);
  }

  .mobile-btn-suffix {
    display: inline;
  }

  /* Grid Cards View on Mobile (2 Columns) */
  .grid-container {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .contestant-card {
    border-radius: 14px;
    border: 1px solid var(--card-border);
    min-width: 0;
    box-sizing: border-box;
  }

  .card-img-wrap {
    aspect-ratio: 3 / 4;
    height: auto;
    max-height: 230px;
    position: relative;
    width: 100%;
  }

  .card-img {
    width: 100%;
    height: 100%;
    object-position: top center;
  }

  .card-rank-badge {
    top: 6px;
    left: 6px;
    padding: 2px 7px;
    font-size: 0.72rem;
  }

  .card-sbd-badge {
    top: 6px;
    right: 6px;
    padding: 2px 7px;
    font-size: 0.72rem;
  }

  .card-body {
    padding: 10px 8px;
    width: 100%;
    box-sizing: border-box;
  }

  .card-name {
    font-size: 0.88rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
    max-width: 100%;
  }

  .card-unit {
    font-size: 0.7rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 6px;
    color: var(--text-muted);
    max-width: 100%;
  }

  .card-score-box {
    padding: 5px 8px;
    margin-bottom: 8px;
    border-radius: 8px;
  }

  .card-score-value {
    font-size: 1.05rem;
  }

  .card-metrics {
    font-size: 0.72rem;
    gap: 2px;
    padding-top: 6px;
  }

  /* ==========================================================================
     MOBILE MODAL ARCHITECTURE (FULL-HEIGHT BOTTOM SHEETS WITH NO SCROLL BLEED)
     ========================================================================== */
  
  /* Body Lock when any Modal is Open */
  body.modal-open {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    overflow: hidden !important;
    touch-action: none !important;
  }

  /* Universal Modal Overlay on Mobile */
  .modal-overlay {
    padding: 0;
    align-items: flex-end;
    max-width: 100vw;
    box-sizing: border-box;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
  }

  /* 1. CONTESTANT DETAIL MODAL (MOBILE) */
  .modal-box {
    width: 100%;
    max-width: 100%;
    height: 92vh;
    height: calc(100dvh - 24px);
    max-height: 94vh;
    border-radius: 24px 24px 0 0;
    border-bottom: none;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    box-shadow: 0 -10px 45px rgba(0, 0, 0, 0.9);
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    box-sizing: border-box;
    overscroll-behavior: contain;
    touch-action: pan-y;
    grid-template-columns: 1fr;
    position: relative;
  }

  @keyframes modalSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  .modal-handle-bar {
    display: block;
    width: 44px;
    height: 5px;
    background: rgba(255, 255, 255, 0.55);
    border-radius: 9999px;
    position: sticky;
    top: 8px;
    margin: 8px auto -13px auto;
    z-index: 45;
    cursor: pointer;
    flex-shrink: 0;
  }

  .modal-close-btn {
    position: sticky;
    top: 12px;
    right: 14px;
    align-self: flex-end;
    margin-right: 14px;
    margin-top: 6px;
    margin-bottom: -48px;
    width: 42px;
    height: 42px;
    font-size: 1.15rem;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    z-index: 50;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    flex-shrink: 0;
  }

  .modal-img-side {
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    flex-shrink: 0;
    background: #080c16;
    position: relative;
    overflow: hidden;
    display: block;
  }

  .modal-img-side img {
    width: 100%;
    height: auto;
    max-height: none;
    object-fit: contain;
    display: block;
    margin: 0 auto;
  }

  .modal-content-side {
    padding: 20px 18px calc(32px + env(safe-area-inset-bottom, 0px));
    flex: none;
    min-height: 0;
    height: auto;
    overflow: visible;
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
  }

  .modal-candidate-name {
    font-size: 1.45rem;
    font-weight: 800;
    color: #fff;
    margin: 4px 0 6px 0;
  }

  .modal-meta-tags {
    gap: 8px;
    font-size: 0.82rem;
  }

  .modal-content-side .card-score-box {
    padding: 12px 14px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.16), rgba(225, 29, 72, 0.16));
    border: 1.5px solid rgba(245, 158, 11, 0.35);
    margin-bottom: 0;
  }

  #modalScore {
    font-size: 1.6rem;
    font-weight: 900;
  }

  .modal-score-rank {
    font-size: 1.45rem;
    font-weight: 900;
  }

  .modal-quote {
    font-size: 0.86rem;
    line-height: 1.6;
    padding: 10px 14px;
    max-height: 120px;
    border-radius: 0 10px 10px 0;
    overscroll-behavior: contain;
  }

  .modal-breakdown-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .breakdown-item {
    padding: 8px 10px;
    font-size: 0.8rem;
    border-radius: 8px;
  }

  .modal-fb-action-btn {
    font-size: 0.92rem;
    padding: 13px 18px;
    border-radius: 12px;
    min-height: 46px;
    box-shadow: 0 6px 20px rgba(225, 29, 72, 0.45);
    width: 100%;
    box-sizing: border-box;
  }

  /* 2. HISTORY MODAL (MOBILE) */
  .history-modal-box {
    width: 100%;
    max-width: 100%;
    height: 92vh;
    height: calc(100dvh - 24px);
    max-height: 94vh;
    border-radius: 24px 24px 0 0;
    border-bottom: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-sizing: border-box;
    overscroll-behavior: contain;
    touch-action: pan-y;
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .history-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    grid-template-columns: none;
    grid-template-rows: none;
  }

  .history-media-panel {
    height: 230px;
    min-height: 200px;
    max-height: 240px;
    flex-shrink: 0;
    width: 100%;
    position: relative;
    overflow: hidden;
    background: #080c16;
  }

  #historySlideImg {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
  }

  .history-tag {
    bottom: 12px;
    left: 14px;
    font-size: 0.78rem;
    padding: 5px 12px;
  }

  .history-close-btn {
    top: 12px;
    right: 14px;
    width: 42px;
    height: 42px;
    font-size: 1.15rem;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    z-index: 40;
  }

  .history-content-panel {
    flex: 1;
    min-height: 0;
    padding: 16px 18px calc(16px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #111827;
    box-sizing: border-box;
  }

  .history-top-meta {
    margin-bottom: 8px;
    padding-right: 0;
    flex-shrink: 0;
  }

  .history-badge {
    font-size: 0.72rem;
    padding: 3px 10px;
    margin-bottom: 6px;
  }

  .history-title {
    font-size: 1.22rem;
    font-weight: 800;
    line-height: 1.35;
  }

  .history-text-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    font-size: 0.94rem;
    line-height: 1.7;
    color: #e2e8f0;
    margin-bottom: 12px;
    padding-right: 4px;
  }

  .history-text-scroll p {
    margin-bottom: 10px;
  }

  .history-bottom-bar {
    flex-shrink: 0;
    padding-top: 10px;
    gap: 10px;
  }

  .history-arrow-btn {
    padding: 9px 16px;
    font-size: 0.85rem;
    min-height: 42px;
  }

  .history-counter-pill {
    font-size: 0.85rem;
    padding: 4px 12px;
  }

  /* 3. DONATE MODAL (MOBILE) */
  .donate-modal-box {
    max-width: 100%;
    width: 100%;
    height: 92vh;
    height: calc(100dvh - 24px);
    max-height: 94vh;
    border-radius: 24px 24px 0 0;
    border-bottom: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    overscroll-behavior: contain;
    touch-action: pan-y;
    animation: modalSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .donate-close-btn {
    top: 12px;
    right: 14px;
    width: 42px;
    height: 42px;
    font-size: 1.15rem;
    background: rgba(15, 23, 42, 0.88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    z-index: 40;
  }

  .donate-modal-header {
    flex-shrink: 0;
    padding: 16px 18px 10px;
  }

  .donate-title {
    font-size: 1.18rem;
  }

  .donate-modal-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding: 14px 18px;
    gap: 14px;
  }

  .donate-letter-card {
    padding: 12px 14px;
    font-size: 0.86rem;
    line-height: 1.55;
  }

  .donate-qr-wrapper {
    flex-direction: column;
    text-align: center;
    padding: 14px;
    gap: 10px;
  }

  .donate-qr-image {
    width: 150px;
    height: 150px;
    margin: 0 auto;
  }

  .qr-meta-title {
    justify-content: center;
    font-size: 0.95rem;
  }

  .qr-meta-text {
    font-size: 0.8rem;
    margin-bottom: 8px;
  }

  .donate-modal-footer {
    flex-shrink: 0;
    padding: 12px 18px calc(14px + env(safe-area-inset-bottom, 0px));
    flex-direction: column-reverse;
    gap: 8px;
  }

  .btn-donate-dismiss,
  .btn-donate-confirm {
    width: 100%;
    justify-content: center;
    font-size: 0.85rem;
    padding: 11px 14px;
    min-height: 44px;
  }

  /* 4. HEADER & DOCK ON MOBILE */
  .header-top-bar {
    justify-content: center;
    gap: 10px;
  }

  .brand-wrap {
    justify-content: center;
    width: 100%;
  }

  .header-nav-actions {
    justify-content: center;
    width: 100%;
    gap: 8px;
  }

  .nav-action-btn {
    font-size: 0.78rem;
    padding: 7px 12px;
    flex: 1;
    justify-content: center;
    min-height: 38px;
  }

  .fab-cluster {
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    right: 12px;
    gap: 9px;
  }

  .fab-btn {
    width: 44px;
    height: 44px;
    font-size: 1.05rem;
  }

  .fab-tooltip {
    display: none;
  }

  .back-to-top {
    width: 40px;
    height: 40px;
    font-size: 0.95rem;
  }

  .history-invite-toast {
    bottom: calc(75px + env(safe-area-inset-bottom, 0px));
    left: 10px;
    right: 10px;
    max-width: none;
    padding: 12px 14px;
    box-sizing: border-box;
    gap: 10px;
  }

  .toast-visual {
    width: 38px;
    height: 38px;
    font-size: 1.1rem;
    border-radius: 10px;
  }

  .toast-title {
    font-size: 0.92rem;
  }

  .toast-desc {
    font-size: 0.78rem;
    margin-bottom: 8px;
  }

  .toast-btn-primary {
    padding: 6px 12px;
    font-size: 0.78rem;
  }

  /* Footer on Mobile */
  footer {
    padding: 20px 12px calc(24px + env(safe-area-inset-bottom, 0px));
    font-size: 0.78rem;
    margin-top: 30px;
    width: 100%;
    box-sizing: border-box;
  }
}

/* Extra small devices (<= 360px) */
@media (max-width: 360px) {
  .header-title {
    font-size: 1.25rem;
  }

  .kpi-card:nth-child(1) .kpi-info .kpi-value,
  .kpi-card:nth-child(2) .kpi-info .kpi-value {
    font-size: 1.2rem;
  }

  .podium {
    gap: 8px;
  }

  .podium-slot.rank-2,
  .podium-slot.rank-3 {
    padding: 12px 6px;
  }

  .podium-slot.rank-2 .podium-avatar-wrap,
  .podium-slot.rank-3 .podium-avatar-wrap {
    width: 56px;
    height: 56px;
  }

  .grid-container {
    grid-template-columns: 1fr;
  }

  .card-img-wrap {
    aspect-ratio: 4 / 5;
    max-height: 320px;
  }
}
