/* ============================================================
   My Hometown Tour Exchange — styles.css
   Built on the Together Learning (TLC) Design System
   © 2022–2026 Together Learning. All rights reserved.
   ============================================================ */

/* ─── Brand Font: Leon Sans (bundled, self-hosted) ─── */
@font-face {
  font-family: 'Leon Sans';
  src: url('../assets/fonts/LeonSans-Thin.woff2') format('woff2');
  font-weight: 100; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Leon Sans';
  src: url('../assets/fonts/LeonSans-Light.otf') format('opentype');
  font-weight: 300; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Leon Sans';
  src: url('../assets/fonts/LeonSans-Regular.otf') format('opentype');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Leon Sans';
  src: url('../assets/fonts/LeonSans-Medium.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Leon Sans';
  src: url('../assets/fonts/LeonSans-Bold.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&display=swap');

:root {
  --navy:        #000052;
  --navy-dark:   #00003a;
  --navy-mid:    #000078;
  --white:       #ffffff;
  --green:       #27FF00;
  --teal:        #33eebb;
  --blue:        #449ddd;
  --silver:      #e8e8e8;

  --ink:         #0c0c3a;       /* text on white cards */
  --ink-soft:    #4a4a7a;       /* secondary text on white */
  --green-glow:  rgba(39,255,0,0.45);

  --font-sans: 'Leon Sans', 'Inter', 'Arial', sans-serif;
  --font-mono: 'Space Mono', 'Courier New', monospace;

  --radius-lg: 1.5rem;
  --radius-md: 1rem;
  --radius-sm: 0.5rem;
  --radius-full: 9999px;

  --shadow-md: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
  --shadow-card: 0 10px 40px rgba(0,0,8,0.35);
  --glow-green: 0 0 20px rgba(39,255,0,0.45), 0 0 60px rgba(39,255,0,0.15);

  --t-fast: 150ms ease;
  --t-base: 250ms ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--white);
  background: var(--navy);
  background-image:
    radial-gradient(1200px 600px at 80% -10%, rgba(68,157,221,0.16), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(51,238,187,0.12), transparent 60%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
a { color: var(--teal); }

/* ─── Decorative starfield ─── */
.starfield {
  position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden;
}
.starfield::before, .starfield::after {
  content: ""; position: absolute; inset: -50%;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(255,255,255,0.7), transparent),
    radial-gradient(1px 1px at 70% 60%, rgba(255,255,255,0.5), transparent),
    radial-gradient(1.5px 1.5px at 40% 80%, rgba(51,238,187,0.6), transparent),
    radial-gradient(1px 1px at 85% 25%, rgba(255,255,255,0.45), transparent),
    radial-gradient(1px 1px at 55% 15%, rgba(68,157,221,0.6), transparent);
  background-repeat: repeat; background-size: 360px 360px;
  opacity: 0.55;
}
.starfield::after { background-size: 520px 520px; opacity: 0.3; }

/* ─── Layout shell ─── */
.app {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  min-height: 100vh;
  max-width: 1280px; margin: 0 auto;
  padding: 0 1rem;
}

.site-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1.1rem 0.25rem; flex-wrap: wrap;
}
.site-header .brand { display: flex; align-items: center; gap: 0.65rem; min-width: 0; }
.site-header .brand img { height: 34px; width: auto; }
.site-header .brand .cohort {
  font-family: var(--font-mono); font-size: 0.62rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: rgba(255,255,255,0.45);
  border-left: 1px solid rgba(255,255,255,0.18); padding-left: 0.65rem; white-space: nowrap;
}
.header-links { display: flex; gap: 0.4rem; flex-wrap: wrap; }

.main { flex: 1; padding: 0.5rem 0 2.5rem; }

.view { opacity: 1; animation: fadeUp 0.4s ease; }
.view[hidden] { display: none !important; }
@keyframes fadeUp { from { transform: translateY(14px); } to { transform: none; } }

/* ─── Typography helpers ─── */
.label {
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--teal);
}
.mono { font-family: var(--font-mono); }
.muted { color: rgba(255,255,255,0.6); }
.text-green { color: var(--green); }
.text-teal { color: var(--teal); }
.text-blue { color: var(--blue); }

h1,h2,h3,h4 { line-height: 1.12; letter-spacing: -0.01em; }

/* ─── Hero ─── */
.hero {
  text-align: center; padding: 2rem 0 1rem;
}
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem; margin-bottom: 1.1rem;
  font-size: 0.7rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--navy); background: var(--green);
  padding: 0.4rem 0.9rem; border-radius: var(--radius-full);
  box-shadow: var(--glow-green);
}
.hero h1 {
  font-size: clamp(2.4rem, 9vw, 4.5rem); font-weight: 700;
  margin: 0 auto 0.7rem; max-width: 14ch;
}
.hero h1 .accent { color: var(--green); text-shadow: 0 0 24px rgba(39,255,0,0.4); }
.hero p.lede {
  max-width: 46ch; margin: 0 auto; font-size: 1.05rem; line-height: 1.65;
  color: rgba(255,255,255,0.78);
}
.hero .star {
  width: 64px; height: 64px; margin: 0 auto 1.2rem;
  filter: drop-shadow(0 0 18px rgba(39,255,0,0.45));
  animation: bob 4s ease-in-out infinite;
}
@keyframes bob { 0%,100%{transform:translateY(0) rotate(-4deg)} 50%{transform:translateY(-8px) rotate(4deg)} }

/* ─── Step cards grid ─── */
.steps {
  display: grid; grid-template-columns: 1fr; gap: 1rem; margin: 2rem auto 1rem; max-width: 980px;
}
.step-card {
  position: relative; text-align: left;
  background: var(--white); color: var(--ink);
  border-radius: var(--radius-lg); padding: 1.5rem 1.4rem 1.4rem;
  box-shadow: var(--shadow-card);
  border: 2px solid transparent;
  transition: transform var(--t-base), box-shadow var(--t-base), border-color var(--t-base);
  display: flex; flex-direction: column; gap: 0.5rem;
  cursor: pointer; width: 100%; font-family: inherit;
}
.step-card:hover, .step-card:focus-visible {
  transform: translateY(-4px); border-color: var(--green);
  box-shadow: var(--shadow-card), var(--glow-green); outline: none;
}
.step-card .step-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--radius-full);
  background: var(--navy); color: var(--green); font-weight: 700; font-size: 1.05rem;
  font-family: var(--font-mono);
}
.step-card h3 { font-size: 1.3rem; color: var(--navy); margin-top: 0.3rem; }
.step-card p { color: var(--ink-soft); font-size: 0.92rem; line-height: 1.5; }
.step-card .step-go {
  margin-top: auto; padding-top: 0.7rem; display: inline-flex; align-items: center; gap: 0.4rem;
  font-weight: 600; color: var(--navy); font-size: 0.9rem;
}
.step-card .step-go .arrow { transition: transform var(--t-fast); }
.step-card:hover .step-go .arrow { transform: translateX(4px); }

/* Locked state */
.step-card.locked { cursor: not-allowed; background: var(--silver); border-color: transparent; }
.step-card.locked:hover { transform: none; box-shadow: var(--shadow-card); border-color: transparent; }
.step-card.locked h3, .step-card.locked .step-go { color: #6a6a86; }
.step-card.locked p { color: #7c7c95; }
.step-card.locked .step-num { background: #b9b9cc; color: #fff; }
.lock-badge {
  position: absolute; top: 1rem; right: 1rem;
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  background: #d3d3e0; color: #5a5a7a; padding: 0.28rem 0.6rem; border-radius: var(--radius-full);
}
.done-badge {
  position: absolute; top: 1rem; right: 1rem;
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--navy); color: var(--green); padding: 0.28rem 0.6rem; border-radius: var(--radius-full);
}

/* ─── Buttons ─── */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  font-family: inherit; font-weight: 600; font-size: 0.95rem;
  padding: 0.85rem 1.4rem; border-radius: var(--radius-full); border: 2px solid transparent;
  min-height: 48px; line-height: 1; text-decoration: none;
  transition: transform var(--t-fast), box-shadow var(--t-base), background var(--t-base), color var(--t-base), border-color var(--t-base);
  overflow: hidden; user-select: none;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

.btn-primary { background: var(--green); color: var(--navy); }
.btn-primary:hover { box-shadow: var(--glow-green); }
.btn-secondary { background: var(--teal); color: var(--navy); }
.btn-secondary:hover { box-shadow: 0 0 20px rgba(51,238,187,0.5); }
.btn-dark { background: var(--navy); color: var(--white); border-color: rgba(255,255,255,0.15); }
.btn-dark:hover { border-color: var(--green); box-shadow: var(--glow-green); }
.btn-ghost { background: transparent; color: var(--white); border-color: rgba(255,255,255,0.28); }
.btn-ghost:hover { border-color: var(--green); color: var(--green); }
.btn-blue { background: var(--blue); color: var(--white); }
.btn-blue:hover { box-shadow: 0 0 20px rgba(68,157,221,0.5); }
.btn-sm { padding: 0.55rem 0.95rem; min-height: 40px; font-size: 0.82rem; }
.btn-lg { padding: 1.05rem 1.8rem; font-size: 1.08rem; min-height: 56px; }
.btn-block { width: 100%; }

/* press pulse ring */
.btn .ripple {
  position: absolute; border-radius: 50%; transform: scale(0);
  background: currentColor; opacity: 0.28; pointer-events: none;
  animation: ripple 600ms ease-out forwards;
}
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }

.btn-row { display: flex; flex-wrap: wrap; gap: 0.7rem; }
.btn-row.center { justify-content: center; }

/* secondary link buttons in hero */
.hero-actions { display: flex; flex-direction: column; gap: 0.7rem; max-width: 360px; margin: 2rem auto 1.2rem; }
.hero-actions .btn { width: 100%; }
.hero-sub-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; margin-top: 0.4rem; }

/* ─── Generic content card ─── */
.card {
  background: var(--white); color: var(--ink);
  border-radius: var(--radius-lg); padding: 1.6rem 1.4rem;
  box-shadow: var(--shadow-card); max-width: 640px; margin: 0 auto;
}
.card.wide { max-width: 920px; }
.card h2 { color: var(--navy); font-size: 1.7rem; margin-bottom: 0.3rem; }
.card .sub { color: var(--ink-soft); margin-bottom: 1.3rem; font-size: 0.95rem; }

.view-head { display: flex; align-items: center; gap: 0.8rem; margin: 0.5rem auto 1.4rem; max-width: 640px; }
.view-head.wide { max-width: 920px; }
.view-head .step-pill {
  font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase;
  background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.15);
  color: var(--teal); padding: 0.3rem 0.7rem; border-radius: var(--radius-full);
}
.back-link {
  display: inline-flex; align-items: center; gap: 0.4rem; background: none; border: none;
  color: rgba(255,255,255,0.7); font-size: 0.9rem; font-weight: 500; padding: 0.3rem 0;
}
.back-link:hover { color: var(--green); }

/* ─── Forms ─── */
.field { margin-bottom: 1.15rem; }
.field label.flabel {
  display: block; font-weight: 600; font-size: 0.9rem; color: var(--navy); margin-bottom: 0.4rem;
}
.field .hint { font-size: 0.78rem; color: var(--ink-soft); margin-top: 0.35rem; }
.field .hint.mono { font-family: var(--font-mono); font-size: 0.74rem; }
.input {
  width: 100%; font-family: inherit; font-size: 1rem; color: var(--ink);
  background: #f4f5fb; border: 2px solid #e0e1ee; border-radius: var(--radius-md);
  padding: 0.8rem 0.9rem; transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  min-height: 48px;
}
.input::placeholder { color: #9a9ab5; }
.input:focus { outline: none; border-color: var(--blue); background: #fff; box-shadow: 0 0 0 3px rgba(68,157,221,0.18); }
textarea.input { min-height: 120px; resize: vertical; line-height: 1.5; }
.input.is-error { border-color: #e0394b; background: #fff3f4; }
.field-error {
  display: none; margin-top: 0.4rem; font-size: 0.8rem; color: #c81e30; font-weight: 600;
}
.field-error::before { content: "⚠ "; }
.field.invalid .field-error { display: block; }

.char-counter { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-soft); text-align: right; margin-top: 0.35rem; }
.char-counter.ok { color: #14914f; }

/* ─── Help accordion ─── */
.help {
  border: 1px solid #e0e1ee; border-radius: var(--radius-md); margin-bottom: 1.3rem; overflow: hidden;
  background: #f8f9ff;
}
.help summary {
  list-style: none; cursor: pointer; padding: 0.85rem 1rem; font-weight: 600; color: var(--navy);
  display: flex; align-items: center; gap: 0.6rem; font-size: 0.92rem;
}
.help summary::-webkit-details-marker { display: none; }
.help summary .chev { margin-left: auto; transition: transform var(--t-base); color: var(--blue); }
.help[open] summary .chev { transform: rotate(180deg); }
.help .help-body { padding: 0 1rem 1rem; color: var(--ink-soft); font-size: 0.9rem; line-height: 1.6; }
.help .help-body ol { padding-left: 1.2rem; margin: 0.5rem 0; }
.help .help-body li { margin-bottom: 0.35rem; }
.help-shots { display: grid; grid-template-columns: repeat(3,1fr); gap: 0.6rem; margin-top: 0.8rem; }
.help-shot {
  aspect-ratio: 4/3; border-radius: var(--radius-sm); background: #eceefb;
  border: 1px dashed #c3c5dd; display: flex; align-items: center; justify-content: center;
  font-size: 0.68rem; color: #9a9ab5; text-align: center; padding: 0.4rem; overflow: hidden;
}
.help-shot img { width: 100%; height: 100%; object-fit: cover; }
.help-shot.filled { cursor: zoom-in; border-style: solid; border-color: #d3d6ee; padding: 0; }
.help-cap { font-size: 0.72rem; color: var(--ink-soft); margin-top: 0.5rem; }

/* video poster */
.video-poster {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0; cursor: pointer;
  background-size: cover; background-position: center; background-color: #000;
  display: flex; align-items: center; justify-content: center;
}
.video-poster::after { content: ""; position: absolute; inset: 0; background: rgba(0,0,20,0.35); transition: background var(--t-base); }
.video-poster:hover::after { background: rgba(0,0,20,0.15); }
.video-poster .play-btn {
  position: relative; z-index: 1; width: 76px; height: 76px; border-radius: 50%;
  background: var(--green); color: var(--navy); font-size: 1.7rem; display: flex; align-items: center; justify-content: center;
  padding-left: 5px; box-shadow: var(--glow-green); transition: transform var(--t-base);
}
.video-poster:hover .play-btn { transform: scale(1.08); }

/* lightbox for help screenshots */
.img-lightbox {
  position: fixed; inset: 0; z-index: 1200; background: rgba(0,0,14,0.88); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 1.5rem; cursor: zoom-out;
}
.img-lightbox img { max-width: 100%; max-height: 90vh; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); }
.img-lightbox .lb-close {
  position: absolute; top: 1rem; right: 1rem; width: 44px; height: 44px; border-radius: 50%; border: none;
  background: #fff; color: var(--navy); font-size: 1.4rem; cursor: pointer;
}

/* ─── Likert slider ─── */
.likert { margin-bottom: 1.6rem; }
.likert .q {
  font-size: 1rem; font-weight: 600; color: var(--navy); line-height: 1.45; margin-bottom: 0.2rem;
}
.likert .q .cat {
  display: inline-block; font-size: 0.6rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--white); padding: 0.18rem 0.5rem; border-radius: var(--radius-full); margin-bottom: 0.5rem;
}
.cat.storytelling { background: var(--blue); }
.cat.usability { background: var(--teal); color: var(--navy); }
.cat.effort { background: #7b5cff; }
.likert-control { display: flex; align-items: center; gap: 1rem; margin-top: 0.6rem; }
.likert-value {
  flex: 0 0 auto; width: 64px; height: 64px; border-radius: var(--radius-md);
  background: var(--navy); color: var(--green); font-family: var(--font-mono); font-weight: 700;
  font-size: 1.9rem; display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 0 0 2px rgba(39,255,0,0.3);
}
.likert-track { flex: 1; }
input[type=range].slider {
  -webkit-appearance: none; appearance: none; width: 100%; height: 10px; border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--blue), var(--teal), var(--green));
  outline: none; cursor: pointer;
}
input[type=range].slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 30px; height: 30px; border-radius: 50%;
  background: var(--white); border: 4px solid var(--navy); box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  cursor: pointer; transition: transform var(--t-fast);
}
input[type=range].slider::-webkit-slider-thumb:active { transform: scale(1.15); }
input[type=range].slider::-moz-range-thumb {
  width: 30px; height: 30px; border-radius: 50%; background: var(--white); border: 4px solid var(--navy);
  box-shadow: 0 2px 8px rgba(0,0,0,0.35); cursor: pointer;
}
.likert-scale-labels {
  display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--ink-soft);
  margin-top: 0.5rem; font-weight: 600;
}

/* ─── Identity confirm panel ─── */
.confirm-panel {
  background: #f4f6ff; border: 2px solid #e0e3f5; border-radius: var(--radius-md);
  padding: 1.2rem; text-align: center; margin: 1rem 0;
}
.confirm-panel .who {
  font-size: 1.5rem; font-weight: 700; color: var(--navy); margin: 0.4rem 0 0.2rem;
}
.confirm-panel .who-num { font-family: var(--font-mono); color: var(--blue); font-size: 0.85rem; }

/* ─── Alerts / toasts ─── */
.alert {
  border-radius: var(--radius-md); padding: 0.9rem 1.1rem; font-size: 0.92rem; font-weight: 500;
  margin: 0.5rem 0 1rem; display: flex; gap: 0.6rem; align-items: flex-start;
}
.alert .ico { flex: 0 0 auto; font-weight: 700; }
.alert-success { background: #e7fbe5; color: #0f7a2e; border: 1px solid #b6ecae; }
.alert-error { background: #fdeced; color: #b3192b; border: 1px solid #f3c0c5; }
.alert-info { background: #eaf4fd; color: #1c5d8f; border: 1px solid #bfdcf3; }
.alert-warn { background: #fff7e6; color: #8a5a00; border: 1px solid #f3dca6; }

.toast-wrap {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 2000; display: flex; flex-direction: column; gap: 0.5rem; width: min(92vw, 440px);
}
.toast {
  background: var(--navy); color: #fff; border: 1px solid var(--green);
  border-radius: var(--radius-md); padding: 0.9rem 1.1rem; box-shadow: var(--shadow-lg);
  font-size: 0.92rem; animation: toastIn 0.3s ease both; display: flex; gap: 0.6rem; align-items: center;
}
.toast.error { border-color: #ff5a6a; }
@keyframes toastIn { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* ─── Modals ─── */
.overlay {
  position: fixed; inset: 0; z-index: 1000; background: rgba(0,0,14,0.72);
  backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center;
  padding: 1rem; animation: fadeIn 0.2s ease both;
}
.overlay[hidden] { display: none !important; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--white); color: var(--ink); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); width: min(640px, 100%); max-height: 90vh; overflow: auto;
  position: relative; animation: modalIn 0.28s cubic-bezier(.2,.8,.3,1) both;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(24px) scale(.97); } to { opacity: 1; transform: none; } }
.modal-pad { padding: 1.8rem 1.6rem 1.6rem; }
.modal h2 { color: var(--navy); font-size: 1.6rem; margin-bottom: 0.7rem; }
.modal p { color: var(--ink-soft); line-height: 1.65; margin-bottom: 0.8rem; }
.modal .modal-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1.2rem; }
.modal-close {
  position: absolute; top: 0.85rem; right: 0.85rem; z-index: 2;
  width: 42px; height: 42px; border-radius: var(--radius-full); border: none;
  background: #eef0f8; color: var(--navy); font-size: 1.3rem; line-height: 1;
  display: flex; align-items: center; justify-content: center; transition: background var(--t-fast), transform var(--t-fast);
}
.modal-close:hover { background: var(--green); transform: rotate(90deg); }
.modal-logo { height: 30px; margin-bottom: 1rem; }

/* video modal */
.modal.video-modal { width: min(900px, 100%); background: var(--navy); color: #fff; }
.modal.video-modal .modal-pad { padding: 1.4rem; }
.modal.video-modal h2 { color: #fff; }
.video-frame { position: relative; aspect-ratio: 16/9; border-radius: var(--radius-md); overflow: hidden; background: #000; }
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* ─── Tour modal (near full-viewport) ─── */
.tour-overlay {
  position: fixed; inset: 0; z-index: 1100; background: rgba(0,0,14,0.92);
  display: flex; flex-direction: column; padding: 0;
}
.tour-overlay[hidden] { display: none !important; }
.tour-bar {
  display: flex; align-items: center; gap: 1rem; justify-content: space-between;
  padding: 0.7rem 1rem; background: var(--navy); border-bottom: 1px solid rgba(255,255,255,0.12);
  flex-wrap: wrap;
}
.tour-bar .tour-meta { min-width: 0; }
.tour-bar .tour-meta .tname { font-weight: 700; font-size: 1.05rem; color: #fff; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 56vw; }
.tour-bar .tour-meta .tby { font-size: 0.78rem; color: rgba(255,255,255,0.6); }
.tour-bar .tour-controls { display: flex; gap: 0.5rem; flex: 0 0 auto; }
.exit-tour-btn {
  background: var(--green); color: var(--navy); font-weight: 700; border: none;
  padding: 0.7rem 1.3rem; border-radius: var(--radius-full); min-height: 46px; font-size: 0.95rem;
  display: inline-flex; align-items: center; gap: 0.5rem;
  box-shadow: var(--glow-green); transition: transform var(--t-fast);
}
.exit-tour-btn:hover { transform: translateY(-2px); }
.tour-stage { flex: 1; position: relative; background: #05051e; }
.tour-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.tour-fallback {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1rem; text-align: center; padding: 2rem; color: rgba(255,255,255,0.85);
}
.tour-fallback .star { width: 56px; opacity: 0.8; animation: bob 4s ease-in-out infinite; }

/* ─── Leaderboards ─── */
.lb-grid { display: grid; grid-template-columns: 1fr; gap: 1.2rem; max-width: 960px; margin: 0 auto; }
.lb-card { background: var(--white); color: var(--ink); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); overflow: hidden; }
.lb-head {
  padding: 1rem 1.2rem; display: flex; align-items: center; gap: 0.6rem;
  border-bottom: 1px solid #eceefb;
}
.lb-head .lb-icon { width: 34px; height: 34px; border-radius: var(--radius-sm); display: grid; place-items: center; color: #fff; font-weight: 700; flex: 0 0 auto; }
.lb-head.storytelling .lb-icon { background: var(--blue); }
.lb-head.usability .lb-icon { background: var(--teal); color: var(--navy); }
.lb-head.effort .lb-icon { background: #7b5cff; }
.lb-head.reviewers .lb-icon { background: var(--navy); color: var(--green); }
.lb-head h3 { color: var(--navy); font-size: 1.15rem; }
.lb-head .lb-sub { font-size: 0.72rem; color: var(--ink-soft); }
.lb-list { display: flex; flex-direction: column; }
.lb-row {
  display: flex; align-items: center; gap: 0.8rem; padding: 0.85rem 1.2rem;
  border-bottom: 1px solid #f1f2fb; transition: background var(--t-fast);
}
.lb-row:last-child { border-bottom: none; }
.lb-row.clickable { cursor: pointer; }
.lb-row.clickable:hover { background: #f4f6ff; }
.lb-rank {
  flex: 0 0 auto; width: 30px; height: 30px; border-radius: var(--radius-full);
  display: grid; place-items: center; font-family: var(--font-mono); font-weight: 700; font-size: 0.85rem;
  background: #eef0f8; color: var(--ink-soft);
}
.lb-row:nth-child(1) .lb-rank { background: #ffe9a8; color: #8a6b00; }
.lb-row:nth-child(2) .lb-rank { background: #e3e6f0; color: #5a5a7a; }
.lb-row:nth-child(3) .lb-rank { background: #f6dcc0; color: #8a5a2a; }
.lb-main { flex: 1; min-width: 0; }
.lb-main .lb-title { font-weight: 700; color: var(--navy); font-size: 0.98rem; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-main .lb-by { font-size: 0.78rem; color: var(--ink-soft); }
.lb-score {
  flex: 0 0 auto; text-align: right;
}
.lb-score .num { font-family: var(--font-mono); font-weight: 700; font-size: 1.2rem; color: var(--navy); }
.lb-score .of { font-size: 0.68rem; color: var(--ink-soft); }
.lb-score .cnt { font-size: 0.68rem; color: var(--ink-soft); }
.lb-actions { display: flex; gap: 0.4rem; flex: 0 0 auto; }
.lb-empty { padding: 1.4rem 1.2rem; color: var(--ink-soft); font-size: 0.9rem; text-align: center; }

/* ─── Presentation reveal animation ─── */
.lb-card.pre-reveal { opacity: 0; transform: translateY(20px) scale(.985); }
.lb-card.reveal-in { opacity: 1; transform: none; transition: opacity .5s ease, transform .55s cubic-bezier(.2,.85,.3,1); }
.lb-row.pre-reveal { opacity: 0; transform: translateX(-16px); }
.lb-row.reveal-in { opacity: 1; transform: none; transition: opacity .45s ease, transform .5s cubic-bezier(.2,.85,.3,1); }
.lb-row.rank-1.reveal-in {
  background: linear-gradient(90deg, rgba(255,233,168,.55), rgba(255,233,168,0));
  box-shadow: inset 3px 0 0 #f0b400;
  animation: rankPop .6s cubic-bezier(.2,.9,.3,1);
}
@keyframes rankPop { 0%{transform:scale(.94)} 55%{transform:scale(1.035)} 100%{transform:scale(1)} }
.lb-row.flash { animation: rowFlash .7s ease; }
@keyframes rowFlash { 0%{box-shadow:inset 0 0 0 2px var(--green), 0 0 24px rgba(39,255,0,.4)} 100%{box-shadow:none} }

/* ─── Fireworks intro overlay ─── */
.lb-intro {
  position: fixed; inset: 0; z-index: 1300; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 45%, rgba(0,0,60,.82), rgba(0,0,18,.97));
  transition: opacity .45s ease;
}
.lb-intro.fade-out { opacity: 0; pointer-events: none; }
.lb-intro canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.lb-intro .intro-star { position: relative; z-index: 2; text-align: center; padding: 1rem; }
.lb-intro .intro-star img {
  width: clamp(130px, 22vw, 230px); height: auto; margin: 0 auto;
  filter: drop-shadow(0 0 34px rgba(39,255,0,.65)) drop-shadow(0 0 90px rgba(51,238,187,.35));
  animation: introStar 2.4s cubic-bezier(.2,.9,.3,1);
}
@keyframes introStar {
  0% { transform: scale(.2) rotate(-30deg); opacity: 0; }
  45% { transform: scale(1.12) rotate(6deg); opacity: 1; }
  70% { transform: scale(.98) rotate(-2deg); }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}
.lb-intro .intro-eyebrow {
  margin-top: 1.4rem; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.28em; text-transform: uppercase;
  color: var(--teal); opacity: 0; animation: introText .8s ease .7s forwards;
}
.lb-intro .intro-title {
  font-size: clamp(2rem, 7vw, 3.4rem); font-weight: 700; color: #fff; margin-top: .3rem;
  opacity: 0; animation: introText .8s ease 1s forwards; text-shadow: 0 0 30px rgba(39,255,0,.4);
}
@keyframes introText { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* ─── Auto-refresh progress bar ─── */
.lb-refresh {
  max-width: 960px; margin: 0 auto 1rem; display: flex; align-items: center; gap: .8rem;
  font-size: .72rem; color: rgba(255,255,255,.6); font-family: var(--font-mono); letter-spacing: .04em;
}
.lb-refresh .bar-track { flex: 1; height: 4px; border-radius: 9999px; background: rgba(255,255,255,.12); overflow: hidden; }
.lb-refresh .bar-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--green), var(--teal)); border-radius: 9999px; }
.lb-refresh .live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: livePulse 1.6s ease-in-out infinite; flex: 0 0 auto; }
@keyframes livePulse { 0%,100%{opacity:1} 50%{opacity:.35} }

.lb-tabs { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: center; margin: 0 auto 1.4rem; max-width: 960px; }
.lb-tab {
  background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.14); color: rgba(255,255,255,0.8);
  padding: 0.55rem 1rem; border-radius: var(--radius-full); font-weight: 600; font-size: 0.85rem;
}
.lb-tab.active { background: var(--green); color: var(--navy); border-color: var(--green); }

/* detail modal score chips */
.score-chips { display: flex; gap: 0.6rem; flex-wrap: wrap; margin: 1rem 0; }
.score-chip {
  flex: 1 1 30%; min-width: 90px; background: #f4f6ff; border-radius: var(--radius-md); padding: 0.8rem; text-align: center;
}
.score-chip .lab { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); }
.score-chip .val { font-family: var(--font-mono); font-weight: 700; font-size: 1.5rem; color: var(--navy); }
.comments-list { display: flex; flex-direction: column; gap: 0.6rem; margin-top: 0.5rem; max-height: 240px; overflow: auto; }
.comment-item { background: #f7f8ff; border-left: 3px solid var(--teal); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; padding: 0.7rem 0.9rem; font-size: 0.9rem; color: var(--ink); line-height: 1.5; }

/* ─── Footer ─── */
.site-footer {
  text-align: center; font-size: 0.62rem; color: rgba(255,255,255,0.4);
  letter-spacing: 0.06em; padding: 1.4rem 1rem 2rem; position: relative; z-index: 1;
}
.site-footer .footer-links { margin-bottom: 0.5rem; display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.site-footer .footer-links button {
  background: none; border: none; color: rgba(255,255,255,0.55); font-size: 0.72rem; font-weight: 500;
  letter-spacing: 0.04em;
}
.site-footer .footer-links button:hover { color: var(--green); }

/* ─── Backend status pill ─── */
.backend-pill {
  position: fixed; bottom: 12px; right: 12px; z-index: 1500;
  font-family: var(--font-mono); font-size: 0.6rem; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 0.35rem 0.7rem; border-radius: var(--radius-full);
  background: rgba(0,0,30,0.8); border: 1px solid rgba(255,255,255,0.18); color: rgba(255,255,255,0.6);
  display: flex; align-items: center; gap: 0.4rem; backdrop-filter: blur(4px);
}
.backend-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }
.backend-pill.live .dot { background: var(--green); box-shadow: 0 0 8px var(--green); }
.backend-pill.demo .dot { background: #ffb020; box-shadow: 0 0 8px #ffb020; }

/* ─── Skeleton / spinner ─── */
.spinner {
  width: 44px; height: 44px; border-radius: 50%; border: 4px solid rgba(255,255,255,0.2);
  border-top-color: var(--green); animation: spin 0.8s linear infinite; margin: 1.5rem auto;
}
.spinner.dark { border-color: rgba(0,0,40,0.15); border-top-color: var(--navy); }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-wrap { text-align: center; padding: 2rem 1rem; }
.loading-wrap p { color: var(--ink-soft); }

/* ─── Responsive ─── */
@media (min-width: 720px) {
  .app { padding: 0 1.5rem; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .hero-actions { flex-direction: row; flex-wrap: wrap; max-width: none; justify-content: center; }
  .hero-actions .btn { width: auto; flex: 0 0 auto; }
  .lb-grid { grid-template-columns: repeat(2, 1fr); }
  .lb-card.full { grid-column: 1 / -1; }
  .tour-bar .tour-meta .tname { max-width: none; }
}
@media (min-width: 1040px) {
  .lb-grid { grid-template-columns: repeat(3, 1fr); }
  .lb-card.reviewers-card { grid-column: 1 / -1; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .hero .star { animation: none; }
}
