/*
┌──────────────────────────────┐
│  HELLO, KEVINg.              │
│                              │
│  FANCY SEEING YOU HERE.      │
└──────────────────────────────┘
*/

/* site.css — base layout + components (theme colours come from CSS variables) */

:root{
  --bg0: #0b0b14;
  --bg1: #150a24;
  --card: rgba(8, 8, 14, 0.78);
  --cardBorder: rgba(255,255,255,0.12);
  --text: rgba(255,255,255,0.92);
  --muted: rgba(255,255,255,0.70);

  --accent: #ff2d95;   /* pink */
  --accent2: #36ff87;  /* green */
  --gold: var(--pine);
  --danger: #ff3b3b;

  --shadow: 0 18px 60px rgba(0,0,0,0.55);
  --radius: 18px;
  --pad: 18px;

  --scanOpacity: 0.08;     /* CRT scanlines intensity */
  --grainOpacity: 0.06;    /* noise intensity */
  --glowOpacity: 0.45;     /* outer glow intensity */
}

/* reset-ish */
*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 800px at 20% 0%, var(--bg1), var(--bg0));
  overflow-x:hidden;
}

/* Minimal layout: one centered column */
.page{
  min-height:100%;
  display:flex;
  align-items:flex-start;
  justify-content:center;
  padding: 28px 16px 48px;
  position:relative;
}

/* Twinkly lights strip (pure CSS) */
.page::before{
  content:"";
  position:fixed;
  top:0; left:0; right:0;
  height:54px;
  pointer-events:none;
  background:
    radial-gradient(circle at 12px 28px, rgba(255, 45, 149, 0.95) 0 5px, transparent 6px) 0 0/64px 54px,
    radial-gradient(circle at 32px 18px, rgba(54, 255, 135, 0.95) 0 5px, transparent 6px) 0 0/64px 54px,
    radial-gradient(circle at 52px 30px, rgba(255, 211, 77, 0.95) 0 5px, transparent 6px) 0 0/64px 54px,
    linear-gradient(to bottom, rgba(0,0,0,0.65), rgba(0,0,0,0));
  filter: drop-shadow(0 0 10px rgba(255,45,149,0.35)) drop-shadow(0 0 10px rgba(54,255,135,0.25));
  opacity: 0.95;
}

/* Make lights gently twinkle (respects reduced motion) */
@media (prefers-reduced-motion: no-preference){
  .page::before{
    animation: twinkle 2.4s ease-in-out infinite;
  }
  @keyframes twinkle{
    0%,100%{ opacity:0.90; }
    50%{ opacity:1.00; }
  }
}

/* CRT scanlines + grain overlays (subtle) */
.page::after{
  content:"";
  position:fixed;
  inset:0;
  pointer-events:none;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(255,255,255,var(--scanOpacity)) 0px,
      rgba(255,255,255,var(--scanOpacity)) 1px,
      rgba(0,0,0,0) 2px,
      rgba(0,0,0,0) 6px
    ),
    radial-gradient(900px 600px at 70% 15%, rgba(255,45,149,0.12), transparent 55%),
    radial-gradient(800px 520px at 25% 85%, rgba(54,255,135,0.10), transparent 55%);
  mix-blend-mode: overlay;
}

/* Main content card */
.card{
  position: relative;
  z-index: 5;
  width:min(820px, 100%);
  background: var(--card);
  border: 1px solid var(--cardBorder);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(16px, 2.5vw, 22px);
  position:relative;
  isolation:isolate;
}

/* Tinsel-ish border effect around the card */
.card::before{
  content:"";
  position:absolute;
  inset:-3px;
  border-radius: calc(var(--radius) + 3px);
  pointer-events:none;
  background:
    linear-gradient(90deg,
      rgba(255,211,77,0.95),
      rgba(255,255,255,0.75),
      rgba(255,45,149,0.85),
      rgba(54,255,135,0.85),
      rgba(255,211,77,0.95)
    );
  filter: blur(0.2px);
  opacity: 0.55;
  z-index:-1;
}

/* Gentle outer glow */
.card::after{
  content:"";
  position:absolute;
  inset:-24px;
  border-radius: calc(var(--radius) + 24px);
  pointer-events:none;
  background:
    radial-gradient(300px 220px at 20% 15%, rgba(255,45,149,var(--glowOpacity)), transparent 65%),
    radial-gradient(280px 220px at 80% 20%, rgba(54,255,135,0.25), transparent 65%),
    radial-gradient(260px 220px at 50% 95%, rgba(255,211,77,0.18), transparent 70%);
  z-index:-2;
}

/* Typography */
h1,h2,h3{ margin:0 0 10px 0; line-height:1.15; }
h1{ font-size: clamp(22px, 2.6vw, 30px); letter-spacing:0.2px; }
h2{ font-size: clamp(18px, 2.2vw, 24px); }
p{ margin: 10px 0; color: var(--muted); }
.small{ font-size: 13px; color: var(--muted); }
/* Tiebreaker instructions */
.tb-instructions{
  font-size: 22px;
  line-height: 1.35;
}

hr{ border:0; border-top:1px solid rgba(255,255,255,0.12); margin: 14px 0; }

/* Form controls */
label{ display:block; margin: 12px 0 6px; color: var(--muted); font-weight:600; font-size: 13px; }
input[type="text"], select, textarea{
  width:100%;
  padding: 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.16);
  background: rgba(0,0,0,0.35);
  color: var(--text);
  outline: none;
}
input[type="text"]:focus, select:focus, textarea:focus{
  border-color: rgba(255,45,149,0.65);
  box-shadow: 0 0 0 3px rgba(255,45,149,0.16);
}

/* Buttons */
.actions{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top: 14px;
}
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.16);
  background: transparent;
  color: var(--text);
  text-decoration:none;
  cursor:pointer;
  user-select:none;
}
.btn:hover{ border-color: rgba(255,255,255,0.24); background: rgba(255,255,255,0.08); }
.btn:active{ transform: translateY(1px); }

.btn.primary{
  border: 0;
  background: linear-gradient(90deg, rgba(255,45,149,0.95), rgba(54,255,135,0.90));
  color: #0b0612;
  font-weight: 800;
}
.btn.primary:hover{ filter: brightness(1.04); }

.btn.danger{
  border: 0;
  background: linear-gradient(90deg, rgba(255,59,59,0.95), rgba(255,45,149,0.85));
  color: #12060a;
  font-weight: 800;
}

/* Red danger button (used for timeup + continue flows) */
.btn--danger{
  background: #b91c1c;
  border-color: #b91c1c;
  color: #ffffff;
}
.btn--danger:hover{
  /*filter: brightness(1.05);*/
  background: #b91c1c;
  border-color: #b91c1c;
  color: #ffffff;
}

/* Soft button variants (leaderboard) */
.btn.btn--soft-pink{
  background: rgba(255, 80, 120, 0.14);
  border-color: rgba(255, 80, 120, 0.28);
}
.btn.btn--soft-pink:hover{
  background: rgba(255, 80, 120, 0.20);
  border-color: rgba(255, 80, 120, 0.38);
}

.btn.btn--soft-green{
  background: rgba(80, 220, 140, 0.14);
  border-color: rgba(80, 220, 140, 0.28);
}
.btn.btn--soft-green:hover{
  background: rgba(80, 220, 140, 0.20);
  border-color: rgba(80, 220, 140, 0.38);
}

.btn.btn--soft-grey{
  background: rgba(255,255,255,0.14);
  border-color: rgba(255,255,255,0.28);
}
.btn.btn--soft-grey:hover{
  background: rgba(255,255,255,0.20);
  border-color: rgba(255,255,255,0.28);
}

.badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 0;
  background: rgba(0,0,0,0.15);
  font-size: 13px;
  color: var(--muted);
}


/* Round 1 submitted score badge */
.score-badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.15);
  font-size: 16px;
  color: var(--muted);
}
.score-gold{ color: var(--pine); }

/* Tables */
table{ width:100%; border-collapse: collapse; margin-top: 10px; }
th, td{ text-align:left; padding: 10px 10px; border-bottom: 1px solid rgba(255,255,255,0.10); }
th{ color: rgba(255,255,255,0.78); font-size: 13px; letter-spacing: 0.4px; text-transform: uppercase; }
tr:hover td{ background: rgba(255,255,255,0.03); }

/* Alerts */
.alert{
  border: 1px solid rgba(255,59,59,0.35);
  background: rgba(255,59,59,0.10);
  padding: 10px 12px;
  border-radius: 12px;
  color: var(--text);
  margin-top: 10px;
}

/* Compact alert variant (used for "Pick an answer first") */
.alert.alert--compact{
  padding: 6px 10px;
  font-size: 13px;
  line-height: 1.2;
  border-radius: 10px;
  margin-bottom: 16px;
}

/* leaderboard table */

.table-wrap { overflow-x: auto; }

.table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.table th, .table td { padding: 10px; border-bottom: 1px solid rgba(255,255,255,0.12); text-align: left; }
.table th { font-weight: 700; }
.table tbody tr:hover td { background: rgba(255,255,255,0.04); }


/* leaderboard extras */

.select {
  padding: 10px 12px;
  border-radius: 12px;
  border: 0;
  background: rgba(0,0,0,0.18);
  color: var(--text);
  min-width: 260px;
}
.select:focus { outline: none; border-color: rgba(255,255,255,0.32); }

/* ROUND1_COMPONENTS_V1 — consolidated Round 1 layout + options (single source of truth) */

.h1{
  margin: 0 0 10px 0;
  line-height: 1.15;
  font-size: clamp(22px, 2.6vw, 30px);
  letter-spacing: 0.2px;
  font-weight: 900;
}

.panel{
  border:1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(0,0,0,0.12);
}

.q-title{
  font-size: 20px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 12px;

  /* Reserve at least two lines so the card height is stable */
  line-height: 1.25;
  min-height: calc(1.25em * 2);
}

/* Options + image grid */
.r1-grid{
  display:grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 14px;
  align-items: stretch;
  margin-top: 10px;
}

@media (max-width: 720px){
  .r1-grid{ grid-template-columns: 1fr; }
}

@media (max-width: 720px){
  /* Mobile: stop pinning the actions row to the bottom */
  .r1-left{
    height: auto;
    padding-bottom: 0;
  }

  /* Force a real gap between error + buttons */
  .r1-left .r1-actions{
    margin-top: 14px !important;
  }

  .alert.alert--compact{
    margin-bottom: 14px !important;
  }
}

@media (max-width: 720px){
  /* Mobile: let actions flow below errors so nothing overlaps */
  .r1-left{ padding-bottom: 0; }
  .r1-left .r1-actions{ margin-top: 22px; }
}

/* Left column: stretch to image height and pin actions to bottom */
.r1-left{
  display: flex;
  flex-direction: column;
  height: 100%;
  padding-bottom: 18px;
}
.r1-left .r1-actions{
  margin-top: auto;
}
/* Options list */
.option-list{
  display:grid;
  gap: 10px;
}

/* Option rows (label wrapping input + text) */
.option-row{
  display:flex;
  gap: 12px;
  align-items:center;
  cursor:pointer;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.10);   /* lighter baseline (big change) */
  transition: background 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.option-row:hover{
  background: rgba(0,0,0,0.16);
}

.option-radio{
  transform: scale(1.15);
  margin: 0;
}

.option-text{
  display:flex;
  gap: 10px;
  align-items:baseline;
}

.option-letter{
  color: var(--pine, var(--gold));
  font-weight: 900;
}

.option-body{
  color: var(--text);
}

/* Selected state (warm gold, no mint) */
.option-row:has(input:checked){
  background: rgba(0,0,0,0.20);
  border-color: rgba(215,162,26,0.65);
  box-shadow: 0 0 0 3px rgba(215,162,26,0.20);
}

/* Fallback if :has() isn’t supported */
.option-row input:checked + .option-text{
  padding: 2px 0;
}

/* Cross-browser selected state (Safari-safe) */
.option-row.is-checked{
  background: rgba(0,0,0,0.20);
  border-color: rgba(215,162,26,0.65);
  box-shadow: 0 0 0 3px rgba(215,162,26,0.20);
}

/* Actions row */
.r1-actions{
  align-items:center;
  margin-top: 14px;
}


/* Keep Q12 height stable: prevent actions row wrapping due to longer button label */
.actions.r1-actions{
  flex-wrap: nowrap;
  align-items: center;
}

/* Push answered pill to the right and stop it wrapping */
.actions.r1-actions .mini-badge{
  margin-left: auto;
  white-space: nowrap;
}
.mini-badge{
  display:inline-flex;
  align-items:center;
  gap:6px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(0,0,0,0.10);
  color: var(--muted);
  font-size: 12px;
}

/* Signed-in line */
.meta-right{
  margin-top: 10px;
  display:flex;
  justify-content:flex-end;
  font-size: 12px;
  color: var(--muted);
}

.meta-strong{ color: var(--text); font-weight: 800; }

/* Image panel */
.r1-aside{
  position: static;
  top: 24px;
}

@media (max-width: 720px){
  .r1-aside{ position: static; top: auto; }
}

/* Square image frame to keep layout stable across questions */
.r1-imgframe{
  aspect-ratio: 1 / 1;
  width: 100%;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
}

.r1-img{
  width: 100%;
  height: 100%;
  display:block;
  object-fit: cover;
  object-position: center;
}


.r1-img.placeholder{
  width: 100%;
  height: 100%;

  min-height: 240px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  text-align:center;
  padding: 18px;
  color: var(--muted);
}

.ph-title{ font-weight: 900; color: var(--text); margin-bottom: 6px; }
.ph-sub{ color: var(--muted); }

/* END ROUND1_COMPONENTS_V1 */

/* ROUND2_COMPONENTS_V1 — Round 2 layout (no inline styles) */
.r2-badges{
  display:flex;
  justify-content:space-between;
  gap:10px;
  margin-top: 10px;
  margin-bottom: 12px;
  flex-wrap:wrap;
}

.r2-grid{
  display:grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 14px;
  align-items: stretch; /* match Round 1 feel */
}

/* Make the form panel feel like Round 1: actions sit at the bottom */
.r2-form-panel{
  display:flex;
  flex-direction:column;
}
.r2-form-panel form{
  display:flex;
  flex-direction:column;
  flex:1;
}
.r2-form-panel .r2-actions{
  margin-top:auto;
}

@media (max-width: 720px){
  .r2-grid{ grid-template-columns: 1fr; }
}

/* Keep the image visible while typing (desktop) */
.r2-image-panel{
  position: sticky;
  top: 24px;
  align-self: start;
}
@media (max-width: 720px){
  .r2-image-panel{ position: static; top: auto; }
}

.r2-imglabel{
  display:inline-flex;
  margin-bottom: 10px;
}

.r2-imgframe{
  width: 85%;
  margin: 0 auto;
  aspect-ratio: 1 / 1;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.14);
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}

.r2-img{
  width: 100%;
  height: 100%;
  display:block;
  object-fit: cover;
}

.r2-actions{
  margin-top: 14px;
  display:flex;
  align-items:center;
  gap: 10px;
}
.r2-actions .mini-badge{
  margin-left:auto;
}
.r2-hint{
  margin-top: 10px;
  text-align:center;
  opacity: 0.9;
  font-size: 1.15rem;
  font-weight: 700;
  text-decoration: underline;
}

/* Round 2: keep the save hint subtle */
.r2-savehint{
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
}

.r2-note{
  margin-top: 12px;
}

/* ROUND2_FORM_POLISH_V1 — make inputs feel like questions */
.r2-form-panel label{
  display:block;
  font-weight: 900;
  font-size: 16px;
  margin: 8px 0 6px;
}
.r2-form-panel input[type="text"],
.r2-form-panel input{
  height: 46px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.35);
  box-shadow: none;
}
.r2-form-panel input + label{
  margin-top: 14px;
}
/* END ROUND2_FORM_POLISH_V1 */

/* END ROUND2_COMPONENTS_V1 */

/* R2_EXPAND_IMAGE_V1 — click-to-expand modal (full-screen, above theme trim) */
.r2-imgbtn{
  display:block;
  width:100%;
  padding:0;
  border:0;
  background:transparent;
  cursor:zoom-in;
}
.r2-imgbtn:focus{
  outline: none;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.22);
  border-radius: 18px;
}

/* Full-screen overlay */
.imgmodal{
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: none;
}
.imgmodal.open{
  display: flex;
  align-items: center;
  justify-content: center;
}

.imgmodal-backdrop{
  position:absolute;
  inset:0;
  background: rgba(0,0,0,0.78);
}

.imgmodal-dialog{
  position: relative;
  z-index: 1;
  width: min(96vw, 1200px);
  height: min(92vh, 1200px);
  padding: 0;
  border-radius: 18px;
  border: 1px solid rgba(255,255,255,0.18);
  background: transparent;
  box-shadow: 0 18px 55px rgba(0,0,0,0.60);
  overflow: hidden;
  display:flex;
  align-items:center;
  justify-content:center;
}

.imgmodal-img{
  width: 100%;
  height: 100%;
  display:block;
  object-fit: contain; /* show the whole image, biggest possible */
}

/* Close button overlays the image (no wasted row) */
.imgmodal-close{
  position:absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  padding: 8px 10px;
  border-radius: 12px;
  border: 0;
  background: rgba(0,0,0,0.45);
  color: rgba(255,255,255,0.92);
  font-weight: 800;
}
.imgmodal-close:hover{
  background: rgba(0,0,0,0.60);
  border-color: rgba(255,255,255,0.30);
}

/* Make sure the Christmas fur/trim can’t sit above the modal */
body.imgmodal-open::before,
body.imgmodal-open::after,
body.imgmodal-open .page::before,
body.imgmodal-open .page::after,
body.imgmodal-open .card::before,
body.imgmodal-open .card::after{
  pointer-events: none !important;
  z-index: 0 !important;
}
/* END R2_EXPAND_IMAGE_V1 */

/* ROUND_TIMER_CSS */
/* Final: grid-aligned timer pill beside H1 (desktop).
   Mobile: timer sits on its own row ABOVE the title (right-aligned) to avoid wrap issues. */

.h1-row{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  gap:0.5rem 0.75rem;
  align-items:start;
  margin:0 0 10px 0;
}

.h1-row .h1{
  margin:0;
  min-width:0; /* allow wrapping without overflow */
}

/* Timer pill (inline beside H1) */
.round-timer.round-timer--inline{
  display:inline-flex;
  align-items:center;
  justify-content:flex-end;
  justify-self:end;
  align-self:start;
  white-space:nowrap;
  font-variant-numeric:tabular-nums; /* prevents mm:ss width jitter */
  border-radius:999px;
  padding:6px 10px;
  border:1px solid rgba(255,255,255,0.18);
  background:rgba(0,0,0,0.18);
  backdrop-filter:blur(6px);
  -webkit-backdrop-filter:blur(6px);
}

/* Left side: "Time left 12:34" */
.round-timer.round-timer--inline .round-timer__left{
  display:inline-flex;
  align-items:baseline;
  gap:6px;
}

/* Right side: "Round 1" / label */
.round-timer.round-timer--inline .round-timer__right{
  margin-left:10px;
  opacity:0.75;
}

/* Make the label clearly visible on desktop too (but not shouty) */
.round-timer.round-timer--inline .round-timer__label{
  font-size:13px;
  line-height:1;
  font-weight:600;
  opacity:0.92;
}

.round-timer.round-timer--inline .round-timer__meta{
  font-size:13px;
  line-height:1;
  font-weight:600;
  opacity:0.80;
}

.round-timer.round-timer--inline .round-timer__value{
  font-size:14px;
  font-weight:800;
  line-height:1;
}

/* Optional urgency hook (safe even if JS never applies it) */
.round-timer.is-urgent{
  border-color:rgba(255,255,255,0.32);
  background:rgba(0,0,0,0.28);
}

/* Mobile: timer ABOVE title, right-aligned (prevents H1 wrap ugliness) */
@media (max-width:560px){
  .h1-row{
    grid-template-columns:1fr;
    gap:0.75rem 0.6rem;
  }

  /* Put timer on row 1, title on row 2 */
  .round-timer.round-timer--inline{
    grid-row:1;
    justify-self:end;
    align-self:start;
  }

  .h1-row .h1{
    grid-row:2;
  }

  /* On phones, drop the "Round 1/2" meta for a cleaner pill */
  .round-timer.round-timer--inline .round-timer__right{
    display:none;
  }
}

/* Tiny phones: slightly tighter pill padding */
@media (max-width:360px){
  .round-timer.round-timer--inline{
    padding:6px 9px;
  }
}

/* ROUND1_ALERT_COMPACT — make the "Pick an answer first" box smaller (Round 1 only) */
.r1-grid .alert{
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.15;
  margin-top: 8px !important; /* beats inline margin-top in template */
  margin-bottom: 0;
}
