/* Hajj Quiz — shared styles. Touch-friendly. */
:root {
  --bg: #0c1024;
  --card: #1b2046;
  --card2: #252b5b;
  --text: #f4f4f8;
  --muted: #8a90b8;
  --accent: #f4c430;
  --green: #2ecc71;
  --red: #e74c3c;
  --blue: #3498db;
  --mina: #e67e22;
  --arafat: #27ae60;
  --muzdalifa: #9b59b6;
  --jamarat: #e74c3c;
  --ihram: #3498db;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none;
}
button { font-family: inherit; cursor: pointer; }

/* ─── Landing ────────────────────────────────────────────── */
.landing { padding: 32px 24px; max-width: 920px; margin: 0 auto; }
.landing h1 { font-size: 48px; margin: 0 0 8px; letter-spacing: 0.5px; }
.landing h2 { margin: 32px 0 12px; font-size: 22px; color: var(--muted); font-weight: 600; }
.sub { color: var(--muted); margin: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.card {
  background: var(--card); border-radius: 14px; padding: 22px 18px;
  text-decoration: none; color: var(--text); font-weight: 700; font-size: 22px;
  display: flex; flex-direction: column; gap: 4px; min-height: 110px;
  transition: transform 80ms ease;
}
.card:active { transform: scale(0.97); }
.card small { font-weight: 400; font-size: 13px; color: var(--muted); }
.card.station.mina { border-left: 6px solid var(--mina); }
.card.station.arafat { border-left: 6px solid var(--arafat); }
.card.station.muzdalifa { border-left: 6px solid var(--muzdalifa); }
.card.station.jamarat { border-left: 6px solid var(--jamarat); }
.card.station.ihram { border-left: 6px solid var(--ihram); }
.card.teacher { border-left: 6px solid var(--accent); }
.card.display { border-left: 6px solid var(--green); }

/* ─── Station view ───────────────────────────────────────── */
.station-view {
  display: flex; flex-direction: column;
  min-height: 100vh;
}
.station-header {
  padding: 12px 18px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
  background: rgba(0,0,0,0.25);
  position: sticky; top: 0; z-index: 10;
}
.station-name { font-size: 24px; font-weight: 800; letter-spacing: 0.5px; }
.station-name .pip { display: inline-block; width: 14px; height: 14px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.station-name.mina .pip { background: var(--mina); }
.station-name.arafat .pip { background: var(--arafat); }
.station-name.muzdalifa .pip { background: var(--muzdalifa); }
.station-name.jamarat .pip { background: var(--jamarat); }
.station-name.ihram .pip { background: var(--ihram); }
.progress { color: var(--muted); font-weight: 600; }

.station-body { flex: 1; padding: 16px 18px 24px; display: flex; flex-direction: column; gap: 16px; }
.placeholder {
  margin-top: 30vh; text-align: center; color: var(--muted); font-size: 20px;
}

.class-picker { display: flex; flex-direction: column; gap: 10px; }
.class-picker .heading { font-size: 28px; font-weight: 800; margin-bottom: 8px; }
.class-btn {
  background: var(--card2); color: var(--text);
  border: 0; padding: 22px; border-radius: 14px;
  font-size: 26px; font-weight: 700; text-align: left;
}
.class-btn small { display: block; color: var(--muted); font-weight: 500; font-size: 14px; margin-top: 4px; }

.student-spotlight {
  background: linear-gradient(135deg, var(--accent), #f6a40b);
  color: #1a1308; border-radius: 18px; padding: 14px 18px;
  font-size: 22px; font-weight: 800;
}
.student-spotlight small { font-weight: 500; font-size: 13px; opacity: 0.7; display: block; }

.question-card {
  background: var(--card); border-radius: 16px; padding: 22px;
  font-size: 24px; line-height: 1.35; font-weight: 600;
}
.options { display: grid; gap: 10px; }
.option {
  background: var(--card2); color: var(--text); border: 2px solid transparent;
  padding: 18px 20px; border-radius: 14px;
  font-size: 22px; font-weight: 600; text-align: left;
}
.option:active { transform: scale(0.98); }
.option.correct { background: var(--green); color: #06210f; border-color: #21d469; }
.option.wrong { background: var(--red); color: #2a0606; border-color: #f1655a; }
.option.locked { opacity: 0.6; pointer-events: none; }
.option.selected { border-color: var(--accent); }

.tj-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.btn-correct, .btn-wrong, .btn-next, .btn-submit, .btn-secondary, .btn-danger {
  border: 0; border-radius: 14px; font-size: 22px; font-weight: 700;
  padding: 20px; color: white;
}
.btn-correct { background: var(--green); color: #06210f; }
.btn-wrong { background: var(--red); }
.btn-next { background: var(--blue); width: 100%; }
.btn-secondary { background: var(--card2); }
.btn-danger { background: var(--red); }
.btn-submit { background: var(--accent); color: #1a1308; }

.answer-note {
  background: rgba(255,255,255,0.05);
  padding: 14px; border-radius: 10px;
  font-size: 16px; color: var(--muted); line-height: 1.4;
}
.answer-note strong { color: var(--text); }

.toolbar { display: flex; gap: 10px; margin-top: 8px; }
.toolbar > * { flex: 1; padding: 14px; font-size: 16px; }

.multi-select { display: grid; gap: 8px; }
.multi-option {
  background: var(--card2); padding: 16px 18px; border-radius: 12px;
  font-size: 19px; display: flex; align-items: center; gap: 12px;
  border: 2px solid transparent;
}
.multi-option.ticked { border-color: var(--green); background: rgba(46,204,113,0.15); }
.multi-option .check { width: 24px; height: 24px; border-radius: 6px; background: var(--bg); display: inline-block; }
.multi-option.ticked .check { background: var(--green); }

/* ─── Game stations ───────────────────────────────────────── */
.game-card { background: var(--card); border-radius: 16px; padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.counter { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.counter .label { font-size: 18px; color: var(--muted); }
.counter .value { font-size: 42px; font-weight: 800; }
.counter .btns { display: flex; gap: 8px; }
.counter button { width: 56px; height: 56px; border-radius: 50%; font-size: 28px; font-weight: 800; background: var(--card2); color: var(--text); border: 0; }
.live-pct { font-size: 56px; font-weight: 800; text-align: center; color: var(--accent); }

.student-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.student-row {
  background: var(--card2); padding: 12px 14px; border-radius: 10px;
  display: flex; align-items: center; gap: 10px;
}
.student-row .name { flex: 1; font-size: 16px; }
.student-row input { width: 64px; padding: 8px; font-size: 18px; text-align: center; border-radius: 8px; border: 0; background: var(--bg); color: var(--text); }

/* ─── Teacher / Admin view ───────────────────────────────── */
.teacher-view { max-width: 920px; margin: 0 auto; padding: 24px 18px 60px; }
.teacher-view h1 { font-size: 32px; margin: 0 0 16px; }
.teacher-view h2 { font-size: 22px; margin-top: 28px; color: var(--accent); }
.attendance-class { background: var(--card); padding: 16px; border-radius: 14px; margin-bottom: 14px; }
.attendance-class .title { font-size: 20px; font-weight: 700; margin-bottom: 10px; }
.attendance-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 8px; }
.attendance-item {
  background: var(--card2); padding: 10px 12px; border-radius: 10px;
  font-size: 16px; display: flex; align-items: center; gap: 10px;
  cursor: pointer;
}
.attendance-item.absent { opacity: 0.45; text-decoration: line-through; }

/* ─── Display / leaderboard ───────────────────────────────── */
.display-view { padding: 32px; max-width: 1600px; margin: 0 auto; }
.display-view h1 { font-size: 64px; margin: 0 0 12px; text-align: center; letter-spacing: 1px; }
.display-view .ticker { text-align: center; color: var(--muted); margin-bottom: 28px; font-size: 22px; }
.lb { display: grid; grid-template-columns: 60px 1fr 1fr 1fr 1fr 1fr 1fr 140px; gap: 6px; }
.lb .h, .lb .row > div { padding: 16px 12px; border-radius: 8px; font-size: 20px; }
.lb .h { color: var(--muted); font-size: 14px; text-transform: uppercase; letter-spacing: 1px; }
.lb .row { display: contents; }
.lb .row > div { background: var(--card); }
.lb .row.rank-1 > div { background: linear-gradient(135deg, var(--accent), #f0a000); color: #1a1308; font-weight: 800; }
.lb .row.rank-2 > div { background: #c0c8d0; color: #15171a; font-weight: 700; }
.lb .row.rank-3 > div { background: #c69060; color: #1a0c00; font-weight: 700; }
.lb .total { font-size: 26px; font-weight: 800; text-align: center; }
.lb .station-cell { text-align: center; }
.lb .station-cell.empty { color: var(--muted); font-style: italic; }
.lb .rank { font-size: 26px; font-weight: 800; text-align: center; }
.lb .name { font-size: 26px; font-weight: 700; }

@media (max-width: 900px) {
  .lb { grid-template-columns: 1fr; }
  .lb .h { display: none; }
}

/* ─── v2: AI-judged answer input ───────────────────────────── */
.answer-input {
  width: 100%; box-sizing: border-box;
  padding: 18px; margin-top: 16px;
  font-size: 22px; line-height: 1.4;
  border-radius: 14px; border: 2px solid var(--card2);
  background: var(--bg); color: var(--text);
  font-family: inherit; resize: vertical;
  -webkit-appearance: none;
}
.answer-input:focus { outline: none; border-color: var(--accent); }
.btn-submit { margin-top: 12px; }

.conf-badge {
  display: inline-block; padding: 2px 8px; margin-left: 6px;
  border-radius: 999px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px;
}
.conf-high { background: #1e6f3a; color: #cdf7d6; }
.conf-medium { background: #8a6612; color: #ffe6a8; }
.conf-low { background: #6f1e1e; color: #ffcfcf; }

/* ─── v2: leaderboard — 5 proportional bars (podium style) ──── */
#lb { display: flex; flex-direction: column; align-items: center; }

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 24px;
  width: 100%;
  max-width: 1400px;
}
.podium-col {
  flex: 1 1 0;
  max-width: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.podium-head {
  width: 100%;
  background: rgba(0,0,0,0.28);
  border-radius: 14px;
  padding: 16px 8px;
  text-align: center;
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.podium-medal {
  font-size: 48px;
  line-height: 1;
  margin: -24px 0 -10px;
  z-index: 2;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.4));
}
.podium-medal.num {
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  background: var(--card2);
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  filter: none;
}

.podium-block {
  width: 100%;
  background: rgba(255,255,255,0.13);
  border-radius: 14px;
  padding: 32px 8px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  transition: height 0.8s cubic-bezier(.22,1,.36,1);
}
.podium-pts { font-size: 44px; font-weight: 800; color: #fff; }
.podium-pts span { font-size: 24px; font-weight: 700; margin-left: 3px; }
.podium-sub { font-size: 18px; color: rgba(255,255,255,0.7); margin-top: 6px; }

/* Leader — gold and bigger */
.podium-col.rank-1 .podium-head {
  background: rgba(244,196,48,0.28);
  color: var(--accent);
  font-size: 30px;
}
.podium-col.rank-1 .podium-block {
  background: linear-gradient(180deg, rgba(244,196,48,0.32), rgba(244,196,48,0.15));
  box-shadow: 0 10px 36px rgba(244,196,48,0.30);
}
.podium-col.rank-1 .podium-pts { font-size: 52px; }

.podium-col.rank-2 .podium-block { background: linear-gradient(180deg, rgba(200,208,216,0.26), rgba(200,208,216,0.12)); }
.podium-col.rank-3 .podium-block { background: linear-gradient(180deg, rgba(198,144,96,0.26), rgba(198,144,96,0.12)); }

@media (max-width: 1000px) {
  .podium { gap: 10px; }
  .podium-head { font-size: 16px; padding: 10px 4px; }
  .podium-col.rank-1 .podium-head { font-size: 17px; }
  .podium-pts { font-size: 28px; }
  .podium-col.rank-1 .podium-pts { font-size: 32px; }
  .podium-sub { font-size: 13px; }
  .podium-medal { font-size: 34px; }
}

/* ─── v2: leaderboard audio toggle ─────────────────────────── */
.audio-toggle {
  position: fixed;
  top: 18px; right: 22px;
  background: rgba(255,255,255,0.10);
  color: #fff;
  border: 0;
  font-size: 22px;
  padding: 10px 14px;
  border-radius: 999px;
  cursor: pointer;
  z-index: 100;
  transition: background 0.2s, transform 0.2s;
  backdrop-filter: blur(6px);
}
.audio-toggle:hover { background: rgba(255,255,255,0.20); }
.audio-toggle.off { opacity: 0.55; }
.audio-toggle.attention {
  background: var(--accent); color: #1a1308; font-weight: 700;
  animation: audio-pulse 1.6s ease-in-out infinite;
}
@keyframes audio-pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.06); } }

/* ─── v2: back + recap UI on station ───────────────────────── */
.btn-back {
  background: transparent;
  color: var(--muted);
  border: 1.5px solid var(--card2);
  padding: 12px 18px;
  border-radius: 12px;
  font-size: 16px;
  cursor: pointer;
  margin-top: 12px;
  width: 100%;
}
.btn-back:hover { color: var(--text); border-color: var(--accent); }

.recap-heading { font-size: 22px; font-weight: 800; margin: 8px 0 14px; }
.recap-list { display: flex; flex-direction: column; gap: 10px; }
.recap-item {
  background: var(--card);
  border-radius: 12px;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px 14px;
  align-items: center;
}
.recap-item .verdict { font-size: 22px; text-align: center; }
.recap-item.correct { border-left: 4px solid var(--green); }
.recap-item.wrong { border-left: 4px solid var(--red); }
.recap-item .who { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.recap-item .q { font-size: 15px; font-weight: 600; margin: 2px 0; }
.recap-item .a { font-size: 14px; color: var(--muted); }
.recap-item .a b { color: var(--text); font-weight: 600; }
.recap-edit {
  background: var(--card2); color: var(--text);
  border: 0; padding: 8px 14px; border-radius: 8px; font-size: 14px; cursor: pointer;
}
.recap-edit:hover { background: var(--accent); color: #1a1308; }

/* ─── v2: per-station breakdown under each podium bar ──────── */
.podium-stations {
  width: 100%;
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ps-row {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 15px;
}
.ps-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.ps-name { color: rgba(255,255,255,0.78); text-align: left; }
.ps-val { font-weight: 800; color: #fff; }
.ps-row.empty { opacity: 0.4; }
.ps-row.empty .ps-val { color: var(--muted); font-weight: 600; }

.ps-row.st-mina .ps-dot { background: var(--mina); }
.ps-row.st-arafat .ps-dot { background: var(--arafat); }
.ps-row.st-muzdalifa .ps-dot { background: var(--muzdalifa); }
.ps-row.st-jamarat .ps-dot { background: var(--jamarat); }
.ps-row.st-ihram .ps-dot { background: var(--ihram); }

/* Leader column: station rows sit on the dark page bg (below the gold bar),
   so they keep the same light styling as the other columns. */

@media (max-width: 1000px) {
  .ps-row { font-size: 11px; padding: 3px 6px; gap: 5px; grid-template-columns: 9px 1fr auto; }
  .ps-dot { width: 7px; height: 7px; }
}
