:root {
  --red: #c8102e;
  --red-dk: #8f0a20;
  --blue: #0a2463;
  --blue-dk: #061639;
  --navy: #0b1220;
  --gold: #f5c542;
  --white: #ffffff;
  /* chat app */
  --app-bg: #0f1520;
  --app-side: #0a0f19;
  --app-surface: #182133;
  --app-border: #263248;
  --app-text: #e9edf5;
  --app-muted: #8d97ad;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: Impact, Haettenschweiler, "Arial Narrow Bold", "Franklin Gothic Bold", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--white);
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 255, 255, .12), transparent 60%),
    repeating-linear-gradient(180deg, var(--red) 0 60px, #a00d25 60px 120px);
  background-attachment: fixed;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }

/* ---------- ticker ---------- */
.ticker {
  background: var(--gold); color: #111; overflow: hidden; white-space: nowrap;
  font-family: var(--display); letter-spacing: .04em; font-size: 15px;
  border-bottom: 3px solid var(--blue-dk); position: sticky; top: 0; z-index: 30;
}
.ticker-track { display: inline-block; padding: 7px 0; animation: tick 60s linear infinite; }
.ticker-track span { margin-right: 60px; }
@keyframes tick { to { transform: translateX(-50%); } }

/* ---------- hero ---------- */
.hero {
  position: relative; text-align: center; padding: 56px 16px 70px; overflow: hidden;
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,.08) 0 2px, transparent 3px) 0 0 / 40px 40px,
    linear-gradient(180deg, var(--blue-dk), var(--blue));
  border-bottom: 8px solid var(--white);
  box-shadow: 0 8px 0 var(--red);
}
.bunting {
  position: absolute; inset: 0 0 auto 0; height: 46px;
  background:
    radial-gradient(circle at 50% 0, var(--red) 0 30px, transparent 31px) 0 0 / 120px 46px,
    radial-gradient(circle at 50% 0, var(--white) 0 30px, transparent 31px) 40px 0 / 120px 46px,
    radial-gradient(circle at 50% 0, #2148b8 0 30px, transparent 31px) 80px 0 / 120px 46px;
  opacity: .95;
}
.lights { position: absolute; inset: 0; pointer-events: none; }
.lights i {
  position: absolute; top: -40%; width: 30vw; height: 160%;
  background: linear-gradient(180deg, rgba(255,255,255,.18), transparent 70%);
  transform-origin: top center; filter: blur(8px);
  animation: sweep 7s ease-in-out infinite alternate;
}
.lights i:nth-child(1) { left: 5%;  animation-delay: 0s; }
.lights i:nth-child(2) { left: 30%; animation-delay: -2s; }
.lights i:nth-child(3) { left: 55%; animation-delay: -4s; }
.lights i:nth-child(4) { left: 78%; animation-delay: -6s; }
@keyframes sweep { from { transform: rotate(-18deg); } to { transform: rotate(18deg); } }

.kicker { font-family: var(--display); color: var(--gold); letter-spacing: .25em; margin: 20px 0 8px; font-size: 18px; position: relative; }
.hero h1 {
  position: relative; margin: 0; font-family: var(--display); font-weight: 400;
  font-size: clamp(44px, 10vw, 120px); line-height: .92; letter-spacing: .01em;
  text-shadow: 4px 4px 0 var(--red), 8px 8px 0 rgba(0,0,0,.35);
}
.hero h1 span { color: var(--gold); font-size: 1.2em; }
.stamp {
  position: absolute; right: max(16px, 8vw); top: 70px; margin: 0;
  font-family: var(--display); font-size: clamp(14px, 2.4vw, 26px); line-height: 1;
  color: var(--red); background: var(--white); padding: 10px 14px;
  border: 4px solid var(--red); transform: rotate(12deg);
  box-shadow: 0 6px 20px rgba(0,0,0,.4);
  animation: stamp 3s ease-in-out infinite;
}
@keyframes stamp { 50% { transform: rotate(8deg) scale(1.06); } }
.tagline { position: relative; font-size: clamp(16px, 2.2vw, 21px); max-width: 720px; margin: 22px auto; line-height: 1.45; }
.counter {
  position: relative; display: inline-flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 10px;
  background: rgba(0,0,0,.35); border: 2px solid var(--gold); border-radius: 999px; padding: 8px 18px;
}
.counter .dot { width: 10px; height: 10px; border-radius: 50%; background: #ff3b3b; box-shadow: 0 0 10px #ff3b3b; animation: blink 1s infinite; }
.counter .tag { font-family: var(--display); color: var(--gold); letter-spacing: .06em; }
@keyframes blink { 50% { opacity: .3; } }

/* ---------- stage / jumbotron ---------- */
.stage { position: relative; padding: 48px 16px 40px; }
.jumbotron {
  max-width: 1120px; margin: 0 auto; padding: 10px; border-radius: 20px;
  background: linear-gradient(135deg, #fff3b0, var(--gold) 30%, #9c7a12 60%, var(--gold));
  box-shadow: 0 0 0 6px var(--blue-dk), 0 0 60px rgba(245, 197, 66, .55), 0 30px 60px rgba(0,0,0,.5);
}

/* ---------- chat app ---------- */
.app {
  position: relative; display: flex; height: min(78vh, 760px); min-height: 520px;
  background: var(--app-bg); color: var(--app-text); border-radius: 12px; overflow: hidden;
}
.side {
  width: 250px; flex: none; display: flex; flex-direction: column;
  background: var(--app-side); border-right: 1px solid var(--app-border);
}
.side-top { padding: 14px 12px 8px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; }
.brand b { display: block; letter-spacing: .08em; }
.brand small { display: block; color: var(--app-muted); font-size: 12px; }
.logo {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 18px;
  color: var(--gold); background: radial-gradient(circle, var(--blue), var(--blue-dk)); border: 2px solid var(--red);
}
.new-chat {
  width: 100%; text-align: left; padding: 10px 12px; border-radius: 10px;
  background: var(--app-surface); border: 1px solid var(--app-border);
}
.new-chat:hover { border-color: var(--gold); }
.hist { flex: 1; overflow-y: auto; padding: 4px 8px; }
.hist-label { font-size: 12px; color: var(--app-muted); margin: 14px 8px 6px; }
.hist button {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 8px;
  background: none; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hist button:hover { background: var(--app-surface); }
.me { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--app-border); }
.me-av { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--app-surface); }
.me b { display: block; font-size: 14px; }
.me small { color: var(--gold); font-size: 12px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--app-border); }
.picker { position: relative; }
#model-btn { background: none; border: 0; font-weight: 600; font-size: 16px; padding: 6px 10px; border-radius: 8px; }
#model-btn:hover { background: var(--app-surface); }
.model-menu {
  position: absolute; top: 110%; left: 0; z-index: 10; width: 290px; padding: 6px;
  background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,.5);
}
.model-menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 10px; border-radius: 8px; }
.model-menu button:hover { background: rgba(255,255,255,.06); }
.model-menu button.on b::after { content: " ✓"; color: var(--gold); }
.model-menu small { display: block; color: var(--app-muted); margin-top: 2px; }
.badge {
  margin-left: auto; font-size: 11px; font-weight: 700; letter-spacing: .08em;
  color: var(--gold); border: 1px solid var(--gold); border-radius: 999px; padding: 3px 9px;
}
.icon-btn { width: 36px; height: 36px; flex: none; border-radius: 50%; border: 0; background: none; color: var(--app-muted); font-size: 18px; }
.icon-btn:hover { background: rgba(255,255,255,.07); color: var(--app-text); }
.menu { display: none; }

.scroller { flex: 1; overflow-y: auto; scroll-behavior: smooth; }
.welcome { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; text-align: center; }
.welcome[hidden] { display: none; }
.welcome-logo { font-size: 44px; color: var(--gold); text-shadow: 0 0 24px rgba(245,197,66,.6); }
.welcome h2 { font-size: clamp(22px, 3vw, 30px); margin: 10px 0 24px; font-weight: 600; }
.chips { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 620px; width: 100%; }
.chips button {
  text-align: left; padding: 12px 14px; border-radius: 12px; font-size: 14px;
  background: var(--app-surface); border: 1px solid var(--app-border); color: var(--app-text);
}
.chips button:hover { border-color: var(--gold); }

.thread { max-width: 760px; margin: 0 auto; padding: 24px 18px 12px; }
.msg { margin: 0 0 22px; }
.msg.user { display: flex; justify-content: flex-end; }
.msg.user .bubble {
  max-width: 80%; background: var(--app-surface); border: 1px solid var(--app-border);
  padding: 10px 15px; border-radius: 18px; white-space: pre-wrap; word-wrap: break-word;
}
.msg.bot { display: flex; gap: 12px; }
.avatar {
  flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
  color: var(--gold); background: radial-gradient(circle, var(--blue), var(--blue-dk)); border: 2px solid var(--red); font-size: 14px;
}
.body { flex: 1; min-width: 0; padding-top: 4px; }
.think { color: var(--app-muted); font-size: 14px; margin-bottom: 8px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spark { width: 10px; height: 10px; border-radius: 50%; background: var(--gold); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.5); opacity: .4; } }
.shimmer {
  background: linear-gradient(90deg, var(--app-muted) 0%, #fff 50%, var(--app-muted) 100%);
  background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.think-toggle { background: none; border: 0; padding: 0; color: var(--app-muted); font-size: 14px; }
.think-toggle:hover { color: var(--app-text); }
.chev { display: inline-block; transition: transform .2s; }
.think.open .chev { transform: rotate(90deg); }
.think-steps { display: none; width: 100%; margin: 6px 0 0; padding: 4px 0 4px 14px; border-left: 2px solid var(--app-border); list-style: none; }
.think.open .think-steps { display: block; }
.think-steps li { margin: 3px 0; font-size: 13px; }
.content { line-height: 1.65; font-size: 15.5px; }
.content p { margin: 0 0 12px; }
.content.streaming > :last-child::after { content: "●"; color: var(--gold); margin-left: 4px; font-size: .8em; animation: blink .8s infinite; }
.content code { background: rgba(255,255,255,.08); padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.code { margin: 0 0 14px; border: 1px solid var(--app-border); border-radius: 10px; overflow: hidden; }
.code-head { display: flex; justify-content: space-between; padding: 6px 12px; font-size: 12px; color: var(--app-muted); background: #0a0f19; }
.code pre { margin: 0; padding: 14px; overflow-x: auto; background: #070b13; }
.code pre code { background: none; padding: 0; font-size: 13.5px; font-family: ui-monospace, Consolas, monospace; }
.actions { display: flex; gap: 2px; margin-top: 2px; }
.actions button { border: 0; background: none; color: var(--app-muted); width: 30px; height: 30px; border-radius: 8px; font-size: 14px; filter: grayscale(1); opacity: .7; }
.actions button:hover, .actions button.on { background: rgba(255,255,255,.07); opacity: 1; filter: none; }

.composer-wrap { padding: 8px 16px 10px; }
.composer {
  max-width: 760px; margin: 0 auto; display: flex; align-items: flex-end; gap: 4px;
  background: var(--app-surface); border: 1px solid var(--app-border); border-radius: 26px; padding: 7px;
}
.composer:focus-within { border-color: #4a5a7a; }
.composer textarea {
  flex: 1; resize: none; border: 0; outline: 0; background: none; color: var(--app-text);
  font: inherit; font-size: 16px; line-height: 1.45; padding: 7px 4px; max-height: 200px;
}
.composer textarea::placeholder { color: var(--app-muted); }
.send {
  width: 36px; height: 36px; flex: none; border-radius: 50%; border: 0; background: var(--white); position: relative;
}
.send::before { content: "↑"; color: #000; font-weight: 800; font-size: 18px; }
.send:disabled { opacity: .3; cursor: default; }
.send.stop::before { content: ""; display: inline-block; width: 12px; height: 12px; background: #000; border-radius: 2px; }
.fine { text-align: center; color: var(--app-muted); font-size: 12px; margin: 8px 0 0; }

.scrim { display: none; }

/* ---------- chant + confetti ---------- */
.chant {
  position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%) scale(.6); z-index: 40;
  font-family: var(--display); font-size: clamp(40px, 9vw, 110px); color: var(--white); white-space: nowrap;
  text-shadow: 4px 4px 0 var(--red), 8px 8px 0 var(--blue); opacity: 0; pointer-events: none;
}
.chant.go { animation: chant 2.2s ease-out; }
@keyframes chant {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(.6) rotate(-4deg); }
  15% { opacity: 1; transform: translate(-50%, -50%) scale(1.08) rotate(-4deg); }
  70% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(-4deg); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1) rotate(-4deg); }
}
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 35; overflow: hidden; }
.confetti i {
  position: absolute; top: -20px; width: 9px; height: 14px; font-style: normal; font-size: 20px; line-height: 1;
  animation: fall linear forwards;
}
@keyframes fall { to { transform: translateY(110vh) rotate(var(--r)); } }

/* ---------- praise / features / footer ---------- */
.praise { background: var(--white); color: var(--blue-dk); padding: 48px 16px; text-align: center; border-top: 8px solid var(--blue); }
.praise h2 { font-family: var(--display); font-weight: 400; font-size: clamp(28px, 5vw, 48px); margin: 0 0 24px; color: var(--red); letter-spacing: .03em; }
.quotes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; max-width: 1000px; margin: 0 auto; }
.quotes blockquote { margin: 0; padding: 22px; background: #f3f5fb; border-left: 6px solid var(--red); text-align: left; font-size: 18px; font-weight: 600; }
.quotes cite { display: block; margin-top: 10px; font-size: 14px; font-weight: 400; color: #556; font-style: normal; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); }
.feat { padding: 36px 16px; text-align: center; }
.feat b { display: block; font-family: var(--display); font-weight: 400; font-size: clamp(42px, 7vw, 80px); line-height: 1; }
.feat span { font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 14px; }
.feat.red { background: var(--red); }
.feat.white { background: var(--white); color: var(--red); }
.feat.blue { background: var(--blue); }
.foot { background: var(--blue-dk); text-align: center; padding: 28px 16px 36px; font-size: 14px; color: #c9d3ea; }
.foot p { max-width: 760px; margin: 10px auto; line-height: 1.5; }
.foot .stars { color: var(--gold); letter-spacing: .3em; }
.foot .paid { display: inline-block; border: 1px solid #c9d3ea; padding: 4px 10px; font-size: 12px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); z-index: 50;
  background: var(--white); color: #111; padding: 10px 18px; border-radius: 999px; font-weight: 600; font-size: 14px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); opacity: 0; transition: .25s; pointer-events: none; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- small screens ---------- */
@media (max-width: 820px) {
  .side { position: absolute; z-index: 20; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform .25s; }
  .side-open .side { transform: none; }
  .side-open .scrim { display: block; position: absolute; inset: 0; z-index: 15; background: rgba(0,0,0,.5); }
  .menu { display: block; }
  .stamp { position: relative; right: auto; top: auto; display: inline-block; margin-top: 18px; }
  .stage { padding: 28px 8px; }
  .jumbotron { padding: 6px; }
  .app { height: 82vh; }
  .chips { grid-template-columns: 1fr; }
  .badge { display: none; }
  .features { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
