:root {
  --tt-red: #fe2c55;
  --tt-cyan: #25f4ee;
  --bg: #000000;
  --bg2: #121212;
  --ink: #ffffff;
  --muted: #a8a8a8;
  --accent: #fe2c55;
  --accent2: #25f4ee;
  --card: rgba(255, 255, 255, 0.06);
  --line: rgba(255, 255, 255, 0.12);
  --good: #25f4ee;
  --warn: #ffd36a;
  --font-display: "Anton", Impact, sans-serif;
  --font-ui: "Syne", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(1000px 640px at 85% -8%, rgba(254, 44, 85, 0.28), transparent 55%),
    radial-gradient(900px 560px at 8% 108%, rgba(37, 244, 238, 0.22), transparent 52%),
    linear-gradient(180deg, #000 0%, #0a0a0a 48%, #000 100%);
  background-color: var(--bg);
  overflow-x: hidden;
}

.noise {
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}
.glow {
  pointer-events: none;
  position: fixed;
  inset: auto -20% -30% -20%;
  height: 50vh;
  background: linear-gradient(transparent, rgba(254, 44, 85, 0.14));
  filter: blur(30px);
  z-index: 0;
}

/* iPhone TikTok FYP backdrop */
.fyp {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  display: grid;
  place-items: center;
  opacity: 0.28;
  transition: opacity 420ms ease;
  background: #000;
}
body.diving .fyp { opacity: 1; }
body.diving .glow { opacity: 0.2; }
body.bursting .fyp { opacity: 1; }
body.diving .noise { opacity: 0.03; }

.phone-shell {
  position: relative;
  width: min(420px, 92vw);
  height: min(860px, 96vh);
  border-radius: 42px;
  overflow: hidden;
  background: #000;
  border: 3px solid #2a2a2a;
  box-shadow:
    0 0 0 1px rgba(37, 244, 238, 0.25),
    0 0 0 2px rgba(254, 44, 85, 0.2),
    0 30px 90px rgba(0,0,0,0.65),
    0 0 80px rgba(254, 44, 85, 0.12),
    0 0 80px rgba(37, 244, 238, 0.1);
  transform: scale(1.02);
}
body.diving .phone-shell {
  width: min(480px, 100vw);
  height: 100vh;
  border-radius: 0;
  border: 0;
  box-shadow: none;
  transform: none;
}
@media (min-width: 900px) {
  body.diving .phone-shell {
    width: min(430px, 46vw);
    height: min(900px, 94vh);
    border-radius: 44px;
    border: 3px solid #222;
    box-shadow:
      0 0 0 1px rgba(37, 244, 238, 0.35),
      0 0 0 2px rgba(254, 44, 85, 0.28),
      0 40px 120px rgba(0,0,0,0.7);
  }
}
.phone-notch {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 118px;
  height: 28px;
  border-radius: 20px;
  background: #0a0a0a;
  z-index: 6;
}
body.diving .phone-notch { top: 8px; }
.phone-status {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  padding: 14px 22px 0;
  font-family: var(--font-ui);
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
}
.phone-status-right { letter-spacing: 0.04em; opacity: 0.9; }
.phone-tabs {
  position: absolute;
  top: 44px;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  justify-content: center;
  gap: 1.4rem;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 1.02rem;
  color: rgba(255,255,255,0.55);
  text-shadow: 0 1px 8px rgba(0,0,0,0.55);
}
.phone-tabs .live {
  color: #fff;
  position: relative;
}
.phone-tabs .live::after {
  content: "";
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: -6px;
  height: 2px;
  background: #fff;
  border-radius: 2px;
}
.phone-stage {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: #000;
}
.phone-home {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  width: 128px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255,255,255,0.85);
  z-index: 6;
}

.fyp-track {
  will-change: transform;
  transform: translate3d(0, 0, 0);
}
.fyp-card {
  position: relative;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  display: grid;
  align-items: end;
  color: #fff;
  isolation: isolate;
}
@media (min-width: 900px) {
  body.diving .fyp-card { height: min(900px, 94vh); }
}
.fyp-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.35) 0%, transparent 18%, transparent 55%, rgba(0,0,0,0.78) 100%);
  z-index: 1;
}
.fyp-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(255,255,255,0.012) 2px 3px);
  z-index: 2;
  opacity: 0.35;
  mix-blend-mode: soft-light;
}
.fyp-bg {
  position: absolute;
  inset: -6%;
  background-size: cover;
  background-position: center;
  filter: saturate(1.2) contrast(1.08);
  transform: scale(1.06);
  z-index: 0;
  animation: fypDrift 7s ease-in-out infinite alternate;
}
@keyframes fypDrift {
  from { transform: scale(1.06) translateY(0); }
  to { transform: scale(1.12) translateY(-3%); }
}
.fyp-meta {
  position: relative;
  z-index: 3;
  width: min(280px, calc(100% - 5rem));
  margin: 0 0 4.8rem 0.9rem;
  text-shadow: 0 2px 12px rgba(0,0,0,0.65);
}
.fyp-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-ui);
  font-weight: 800;
  font-size: 0.92rem;
  margin-bottom: 0.4rem;
}
.fyp-avatar {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 999px;
  border: 2px solid #fff;
  background: linear-gradient(135deg, var(--tt-red), var(--tt-cyan));
}
.fyp-caption {
  font-family: var(--font-ui);
  font-size: 0.88rem;
  line-height: 1.35;
  max-width: 16rem;
  opacity: 0.96;
}
.fyp-sound {
  margin-top: 0.65rem;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  opacity: 0.9;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  animation: soundMarquee 8s linear infinite;
}
@keyframes soundMarquee {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(-8%); }
}
.fyp-rail {
  position: absolute;
  right: 0.55rem;
  bottom: 4.6rem;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  align-items: center;
}
.fyp-rail span {
  display: grid;
  place-items: center;
  width: 2.55rem;
  height: 2.55rem;
  border-radius: 999px;
  background: transparent;
  font-size: 1.2rem;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.55));
}
.fyp-ico {
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: #fff;
}
.fyp-ico.like { color: var(--tt-red); }
.fyp-ico.like::before { content: "♥"; }
.fyp-ico.chat::before { content: "○"; font-size: 1.15rem; }
.fyp-ico.share::before { content: "↗"; }
.fyp-ico.spin::before { content: "♫"; color: var(--tt-cyan); }
.fyp-rail small {
  margin-top: -0.65rem;
  font-family: var(--font-ui);
  font-size: 0.68rem;
  font-weight: 700;
  opacity: 0.95;
}
.fyp-progress {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: auto;
  height: 2px;
  border-radius: 0;
  background: rgba(255,255,255,0.18);
  z-index: 4;
  overflow: hidden;
}
.fyp-progress i {
  display: block;
  height: 100%;
  width: 38%;
  background: linear-gradient(90deg, var(--tt-cyan), var(--tt-red));
  animation: fypBar 5.5s linear infinite;
}
@keyframes fypBar {
  from { transform: translateX(-100%); }
  to { transform: translateX(280%); }
}
.fyp-veil {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.55) 0%, transparent 28%, transparent 72%, rgba(0,0,0,0.55) 100%),
    linear-gradient(180deg, rgba(0,0,0,0.35) 0%, transparent 30%, rgba(0,0,0,0.55) 100%);
  z-index: 4;
  transition: background 420ms ease, opacity 420ms ease;
}
body.diving .fyp-veil {
  background:
    linear-gradient(90deg, rgba(0,0,0,0.62) 0%, transparent 22%, transparent 78%, rgba(0,0,0,0.62) 100%),
    linear-gradient(180deg, rgba(0,0,0,0.2) 0%, transparent 40%, rgba(0,0,0,0.45) 100%);
}
body.bursting .fyp-veil {
  opacity: 0.55;
  background:
    linear-gradient(90deg, rgba(0,0,0,0.4) 0%, transparent 30%, transparent 70%, rgba(0,0,0,0.4) 100%),
    radial-gradient(600px 400px at 50% 50%, rgba(254,44,85,0.18), transparent 60%);
}
.fyp-speed {
  position: fixed;
  left: 50%;
  top: 5.2rem;
  transform: translateX(-50%) translateY(-8px);
  z-index: 5;
  pointer-events: none;
  opacity: 0;
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: clamp(1.15rem, 4vw, 1.7rem);
  color: #fff;
  text-shadow:
    0 0 18px rgba(254,44,85,0.75),
    0 0 18px rgba(37,244,238,0.45),
    0 2px 10px rgba(0,0,0,0.7);
  transition: opacity 180ms ease, transform 180ms ease;
}
body.bursting .fyp-speed {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.topbar, main, .footer { position: relative; z-index: 1; }
body.diving .topbar {
  background: rgba(0, 0, 0, 0.45);
  border-bottom-color: rgba(255,255,255,0.08);
  backdrop-filter: blur(14px);
}
body.diving main .screen.active {
  background: rgba(0, 0, 0, 0.58);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 1.25rem;
  padding: 1.25rem 1.15rem 1.5rem;
  backdrop-filter: blur(14px);
  box-shadow:
    0 0 0 1px rgba(37, 244, 238, 0.12),
    0 0 0 1px rgba(254, 44, 85, 0.08) inset,
    0 20px 60px rgba(0,0,0,0.45);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.1rem 1.4rem;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.brand { display: flex; gap: 0.75rem; align-items: center; }
.brand-mark {
  width: 2.4rem; height: 2.4rem; border-radius: 0.55rem;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--tt-red), var(--tt-cyan));
  color: #000;
  font-family: var(--font-display);
  font-size: 1.5rem;
  letter-spacing: -0.04em;
}
.brand-name {
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  font-size: 1.35rem;
  line-height: 1;
  text-transform: uppercase;
}
.brand-sub { color: var(--muted); font-size: 0.78rem; margin-top: 0.15rem; }
.meters { display: flex; gap: 1rem; }
.meter {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
}
.meter strong {
  display: block;
  color: var(--ink);
  font-size: 1rem;
  margin-top: 0.15rem;
}

main {
  width: min(720px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.5rem 0 4rem;
  min-height: calc(100vh - 8rem);
}

.screen { display: none; animation: rise 420ms ease; }
.screen.active { display: block; }
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent2);
  font-size: 0.72rem;
}
h1 {
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 10vw, 5rem);
  line-height: 0.95;
  letter-spacing: 0.01em;
  margin: 0.4rem 0 1rem;
  text-transform: uppercase;
}
.lede {
  font-size: 1.05rem;
  color: #d9d0c4;
  max-width: 38rem;
  line-height: 1.55;
}
.rules {
  margin: 1.6rem 0 2rem;
  padding: 1rem 1.1rem;
  list-style: none;
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 1rem;
}
.rules li {
  font-family: var(--font-mono);
  font-size: 0.86rem;
  color: #cfc5b8;
  padding: 0.35rem 0;
  border-bottom: 1px dashed rgba(255,255,255,0.06);
}
.rules li:last-child { border-bottom: 0; }

.cta {
  appearance: none;
  border: 0;
  cursor: pointer;
  background: linear-gradient(90deg, var(--tt-red), #ff4d6d 45%, var(--tt-cyan));
  color: #000;
  font-family: var(--font-display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 1.15rem;
  padding: 0.95rem 1.4rem;
  border-radius: 999px;
  box-shadow: 0 10px 40px rgba(254, 44, 85, 0.32), 0 0 24px rgba(37, 244, 238, 0.18);
  transition: transform 160ms ease, filter 160ms ease;
}
.cta:hover { transform: translateY(-1px) scale(1.01); filter: brightness(1.05); }
.cta:active { transform: translateY(1px) scale(0.99); }
.cta.compact { font-size: 1rem; padding: 0.8rem 1.1rem; }
.fineprint { color: var(--muted); font-size: 0.82rem; margin-top: 1rem; }

.round-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.4rem;
  font-family: var(--font-mono);
  color: var(--muted);
}
.timer-wrap {
  flex: 1;
  max-width: 280px;
  height: 10px;
  background: rgba(255,255,255,0.08);
  border-radius: 999px;
  position: relative;
  overflow: hidden;
}
.timer-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  background: linear-gradient(90deg, var(--tt-cyan), var(--tt-red));
  transition: width 100ms linear;
}
#timerText {
  position: absolute;
  right: 0;
  top: -1.4rem;
  font-size: 0.78rem;
}

.prompt {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 6vw, 3rem);
  line-height: 1.05;
  text-transform: uppercase;
  margin: 0 0 1.4rem;
}

.audio-dock {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-wrap: wrap;
  margin: -0.4rem 0 1.2rem;
}
.audio-dock.hidden { display: none; }
.audio-btn {
  background: linear-gradient(90deg, #25f4ee, #ff2d55) !important;
  color: #0a0610 !important;
  box-shadow: 0 8px 28px rgba(37, 244, 238, 0.22) !important;
}
.audio-hint {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
}

.answer-form {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}
.answer-form input {
  flex: 1;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 1rem;
  padding: 0.95rem 1.15rem;
  outline: none;
}
.answer-form input:focus {
  border-color: rgba(124, 245, 255, 0.55);
  box-shadow: 0 0 0 3px rgba(124, 245, 255, 0.12);
}

.feedback {
  min-height: 1.4rem;
  margin-top: 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: var(--warn);
}
.feedback.bad { color: #ff8f9f; }
.feedback.ok { color: var(--good); }

.accepted-card {
  margin-top: 1.4rem;
  padding: 1.2rem;
  border-radius: 1.1rem;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02));
}
.accepted-card.hidden { display: none; }
.tier {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--accent2);
}
.accepted-answer {
  font-family: var(--font-display);
  font-size: 2rem;
  text-transform: uppercase;
  margin: 0.35rem 0;
}
.points { color: var(--muted); margin-bottom: 1rem; font-family: var(--font-mono); }

.final-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
  margin: 1.2rem 0 1.5rem;
}
.final-stats div {
  padding: 1rem;
  border-radius: 1rem;
  background: var(--card);
  border: 1px solid var(--line);
}
.final-stats span {
  display: block;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
}
.final-stats strong {
  font-family: var(--font-display);
  font-size: 2.4rem;
  letter-spacing: 0.02em;
}

.result-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.5rem;
}
.result-list li {
  display: grid;
  grid-template-columns: 2rem 1fr auto;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.86rem;
}
.result-list .miss { color: #ff8f9f; }
.result-list .hit { color: var(--good); }

.footer {
  border-top: 1px solid var(--line);
  padding: 1rem 1.4rem 1.4rem;
  color: var(--muted);
  font-size: 0.75rem;
  font-family: var(--font-mono);
}

@media (max-width: 600px) {
  .answer-form { flex-direction: column; align-items: stretch; }
  .meters { gap: 0.6rem; }
  .brand-sub { display: none; }
}
