/* ── Reset & tokens ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0A0A0A;
  --surface:   #141414;
  --surface2:  #1E1E1E;
  --border:    #2A2A2A;
  --orange:    #E87722;
  --gold:      #F4A024;
  --white:     #FFFFFF;
  --muted:     #888888;
  --correct:   #22C55E;
  --wrong:     #EF4444;
  --grad:      linear-gradient(135deg, #E87722 0%, #F4A024 100%);
  --radius:    16px;
  --shadow:    0 4px 24px rgba(232, 119, 34, 0.15);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--white);
  min-height: 100vh;
  min-height: -webkit-fill-available;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ── Layout ─────────────────────────────────────────────────────────────────── */
.page {
  min-height: 100vh;
  min-height: -webkit-fill-available;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 20px 40px;
}

.container {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

/* ── Home page ──────────────────────────────────────────────────────────────── */
.home-page {
  min-height: 100vh;
  min-height: -webkit-fill-available;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 24px 36px;
}

.home-logo-img {
  display: block;
  height: 200px;
  width: auto;
  margin: 0 auto;
}

.home-challenge {
  font-size: 2.2rem;
  font-weight: 900;
  color: var(--white);
  text-align: center;
  letter-spacing: -0.5px;
  line-height: 1.2;
  margin: 4px 0 36px;
  max-width: 620px;
}

.home-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  width: 100%;
  max-width: 860px;
  margin-bottom: 32px;
}

.home-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 2px solid var(--orange);
  border-radius: 20px;
  padding: 36px 20px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  min-height: 220px;
  text-align: center;
}

.home-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 0 32px rgba(232, 119, 34, 0.35), 0 12px 40px rgba(0, 0, 0, 0.5);
  background: var(--surface2);
}

.home-card:active { transform: scale(0.97); }

.home-card-emoji {
  font-size: 3.2rem;
  margin-bottom: 16px;
  line-height: 1;
}

.home-card-title {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--white);
  margin-bottom: 10px;
  line-height: 1.2;
}

.home-card-sub {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--orange);
  line-height: 1.3;
}

.home-tagline {
  font-size: 0.78rem;
  color: var(--gold);
  text-align: center;
  opacity: 0.8;
  letter-spacing: 0.3px;
}

@media (max-width: 600px) {
  .home-grid { grid-template-columns: 1fr; }
  .home-card {
    min-height: unset;
    flex-direction: row;
    justify-content: flex-start;
    gap: 20px;
    padding: 22px 24px;
  }
  .home-card-emoji { margin-bottom: 0; font-size: 2.4rem; }
  .home-card-title { margin-bottom: 4px; font-size: 1.15rem; text-align: left; }
  .home-card-sub   { text-align: left; }
  .home-challenge  { font-size: 1.65rem; }
  .home-logo-img   { height: 120px; }
}

/* ── Buttons ────────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 28px;
  border-radius: 50px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: transform 0.12s ease, opacity 0.12s ease, box-shadow 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  text-decoration: none;
  letter-spacing: 0.2px;
  min-height: 54px;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--grad);
  color: #fff;
  box-shadow: 0 4px 20px rgba(232, 119, 34, 0.35);
  width: 100%;
}

.btn-primary:hover { box-shadow: 0 6px 28px rgba(232, 119, 34, 0.5); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--border);
  width: 100%;
}

.btn-ghost:hover { border-color: var(--orange); color: var(--orange); }

.btn-sm {
  padding: 10px 20px;
  font-size: 0.9rem;
  min-height: 44px;
}

/* ── Global progress bar (fixed at top, shared by survey + quiz) ─────────────── */
.gp-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: var(--surface2);
  z-index: 200;
}
.gp-fill {
  height: 100%;
  background: var(--grad);
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Survey screens ──────────────────────────────────────────────────────────── */
.surv-page {
  padding-top: 4px;
  min-height: 100svh;
  min-height: 100vh;
  align-items: stretch;
}

.surv-container {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  padding: 20px 20px 48px;
  display: flex;
  flex-direction: column;
  min-height: calc(100svh - 4px);
  min-height: calc(100vh - 4px);
}

.surv-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  margin-bottom: 36px;
}

.surv-step-label {
  font-size: 0.75rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.5px;
}

.surv-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.surv-screen-hidden { display: none !important; }

.surv-q {
  font-size: 1.55rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--white);
  margin-bottom: 32px;
}

.surv-opts {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.surv-opt {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 16px;
  padding: 18px 22px;
  font-size: 1.02rem;
  font-weight: 600;
  color: var(--white);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.12s, background 0.12s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
  font-family: inherit;
  min-height: 62px;
}

.surv-opt:hover:not(:disabled) { border-color: var(--orange); }
.surv-opt:active:not(:disabled) { transform: scale(0.98); }

.surv-opt.surv-opt-selected {
  border-color: var(--orange);
  background: rgba(232, 119, 34, 0.12);
  color: var(--orange);
}

.surv-ethnicity-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 24px;
}

.surv-text {
  font-size: 1rem;
  padding: 18px 20px;
}

.surv-pnts-btn { justify-content: flex-start; }

.surv-pnts-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}

.surv-opt.surv-opt-selected .surv-pnts-dot {
  background: var(--orange);
  border-color: var(--orange);
}

.surv-skip-wrap {
  text-align: center;
  margin-top: 12px;
}

.surv-skip {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 8px;
  text-decoration: underline;
  font-family: inherit;
}

.surv-back {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 0 0 16px 0;
  font-family: inherit;
  display: inline-block;
  align-self: flex-start;
  -webkit-tap-highlight-color: transparent;
}
.surv-back:hover { color: var(--text); }

/* Screen transition animations */
@keyframes survExit {
  to { opacity: 0; transform: translateX(-28px); }
}
@keyframes survEnter {
  from { opacity: 0; transform: translateX(28px); }
}

.surv-exit  { animation: survExit  0.24s ease forwards; }
.surv-enter { animation: survEnter 0.30s ease both; }

/* ── Quiz page ──────────────────────────────────────────────────────────────── */
.quiz-page { padding-top: 4px; }

.quiz-header {
  width: 100%;
  padding: 16px 0 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.quiz-step-label {
  flex: 1;
  text-align: center;
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.3px;
}


.back-btn {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  font-size: 1.1rem;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s, color 0.15s;
}

.back-btn:hover { border-color: var(--orange); color: var(--orange); }

.topic-pill {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--gold);
  white-space: nowrap;
}

.question-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  margin-top: 24px;
  width: 100%;
}

.question-num {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 12px;
}

.question-text {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--white);
}

.options-list {
  display: grid;
  gap: 12px;
  margin-top: 28px;
  width: 100%;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
  text-align: left;
  width: 100%;
  color: var(--white);
  font-size: 0.95rem;
  line-height: 1.4;
  min-height: 58px;
}

.option-btn:hover:not(:disabled) {
  border-color: var(--orange);
  background: rgba(232, 119, 34, 0.06);
}

.option-btn:active:not(:disabled) { transform: scale(0.98); }

.option-letter {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--surface2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--muted);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.option-btn.selected .option-letter {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
}

.option-btn.correct {
  border-color: var(--correct);
  background: rgba(34, 197, 94, 0.08);
}

.option-btn.correct .option-letter {
  background: var(--correct);
  border-color: var(--correct);
  color: #fff;
}

.option-btn.wrong {
  border-color: var(--wrong);
  background: rgba(239, 68, 68, 0.08);
}

.option-btn.wrong .option-letter {
  background: var(--wrong);
  border-color: var(--wrong);
  color: #fff;
}

.option-btn:disabled { cursor: default; }

.feedback-box {
  margin-top: 16px;
  padding: 16px 18px;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.5;
  display: none;
}

.feedback-box.show { display: flex; gap: 12px; align-items: flex-start; }

.feedback-box.correct-fb {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
}

.feedback-box.wrong-fb {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.feedback-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }

.next-wrap {
  margin-top: 20px;
  width: 100%;
}

/* ── Score page ─────────────────────────────────────────────────────────────── */
.score-page {
  text-align: center;
  padding-top: 40px;
}

.badge-wrap {
  position: relative;
  display: inline-block;
  margin-bottom: 32px;
}

.badge-ring {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  position: relative;
}

.badge-ring::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: var(--grad);
  z-index: -1;
}

.badge-ring::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--bg);
  z-index: -1;
}

.badge-score {
  font-size: 3rem;
  font-weight: 900;
  line-height: 1;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.badge-denom {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 600;
}

.badge-glow {
  position: absolute;
  inset: -20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(232,119,34,0.25) 0%, transparent 70%);
  pointer-events: none;
  animation: pulse 2.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50%       { opacity: 1;   transform: scale(1.05); }
}

.badge-label {
  font-size: 1.5rem;
  font-weight: 800;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

.badge-msg {
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 280px;
  margin: 0 auto 32px;
}

.score-breakdown {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 32px;
}

.breakdown-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 50px;
  padding: 8px 18px;
  font-size: 0.82rem;
  font-weight: 600;
}

.breakdown-pill .num { font-size: 1.1rem; font-weight: 800; }
.breakdown-pill .num.green { color: var(--correct); }
.breakdown-pill .num.red   { color: var(--wrong); }

/* ── Survey page ────────────────────────────────────────────────────────────── */
.survey-header {
  text-align: center;
  padding: 40px 0 24px;
}

.survey-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.survey-sub {
  font-size: 0.9rem;
  color: var(--muted);
}

.survey-form { width: 100%; }

.form-group {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}

.form-label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 14px;
  display: block;
}

.form-question {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 16px;
}

.radio-group { display: grid; gap: 10px; }

.radio-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.radio-option:hover { border-color: var(--orange); }

.radio-option input[type="radio"] { display: none; }

.radio-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.15s;
}

.radio-dot::after {
  content: '';
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--orange);
  opacity: 0;
  transition: opacity 0.15s;
}

.radio-option.checked {
  border-color: var(--orange);
  background: rgba(232, 119, 34, 0.07);
}

.radio-option.checked .radio-dot { border-color: var(--orange); }
.radio-option.checked .radio-dot::after { opacity: 1; }

.radio-label { font-size: 0.93rem; font-weight: 500; }

.text-input {
  width: 100%;
  background: var(--surface2);
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--white);
  font-size: 0.95rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  resize: none;
}

.text-input:focus { border-color: var(--orange); }
.text-input::placeholder { color: var(--muted); }

.skip-link {
  text-align: center;
  margin-top: 12px;
}

.skip-link button {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 0.85rem;
  cursor: pointer;
  padding: 8px;
  text-decoration: underline;
  font-family: inherit;
}

/* ── Social page ────────────────────────────────────────────────────────────── */
.social-header {
  text-align: center;
  padding: 40px 0 28px;
}

.social-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.social-sub {
  font-size: 0.9rem;
  color: var(--muted);
}

.qr-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  margin-bottom: 32px;
}

.qr-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 10px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.qr-placeholder {
  width: 100%;
  aspect-ratio: 1;
  background: var(--surface2);
  border: 2px dashed var(--border);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 0.65rem;
  text-align: center;
  padding: 8px;
  line-height: 1.4;
}

.qr-icon { font-size: 1.6rem; }

.qr-platform {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--white);
}

.qr-handle {
  font-size: 0.7rem;
  color: var(--muted);
}

.play-again-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Admin page ─────────────────────────────────────────────────────────────── */
.admin-page {
  min-height: 100vh;
  background: var(--bg);
  padding: 0 20px 60px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  gap: 16px;
}

.admin-title {
  font-size: 1.2rem;
  font-weight: 800;
}

.admin-title span { color: var(--orange); }

.admin-login {
  max-width: 360px;
  margin: 80px auto;
  text-align: center;
}

.admin-login-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.admin-login-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.password-input {
  width: 100%;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 14px;
  padding: 14px 16px;
  color: var(--white);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
  margin-bottom: 16px;
  text-align: center;
  letter-spacing: 2px;
}

.password-input:focus { border-color: var(--orange); }

.error-msg {
  color: var(--wrong);
  font-size: 0.85rem;
  margin-top: -8px;
  margin-bottom: 12px;
  min-height: 20px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}

.stat-num {
  font-size: 1.8rem;
  font-weight: 900;
  background: var(--grad);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 0.72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  min-width: 700px;
}

thead { background: var(--surface2); }

th {
  padding: 12px 16px;
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  white-space: nowrap;
}

td {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  color: var(--white);
  vertical-align: middle;
}

tr:hover td { background: rgba(255,255,255,0.02); }

.score-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--surface2);
  border-radius: 50px;
  padding: 3px 10px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--gold);
}

.topic-chip {
  display: inline-block;
  background: rgba(232,119,34,0.12);
  color: var(--orange);
  border-radius: 50px;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  white-space: nowrap;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}

.empty-icon { font-size: 3rem; margin-bottom: 12px; }

/* ── Page transitions ───────────────────────────────────────────────────────── */
.page { animation: fadeUp 0.35s ease both; }

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

/* ── Utility ────────────────────────────────────────────────────────────────── */
.mt-8  { margin-top:  8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.text-center { text-align: center; }
.text-muted  { color: var(--muted); }
.text-orange { color: var(--orange); }
.text-gold   { color: var(--gold); }

.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ── Responsive tweaks ──────────────────────────────────────────────────────── */
@media (max-width: 380px) {
  .logo-name { font-size: 1.35rem; }
  .question-text { font-size: 1rem; }
  .qr-grid { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .qr-card { padding: 12px 6px; }
  .qr-platform { font-size: 0.7rem; }
  .stats-row { grid-template-columns: repeat(3, 1fr); gap: 8px; }
}

@media (min-width: 600px) {
  .logo-name { font-size: 1.9rem; }
  .question-text { font-size: 1.15rem; }
  .badge-ring { width: 180px; height: 180px; }
  .badge-score { font-size: 3.5rem; }
}
