/* Drunk Grok vs Toxic Ex: neon dive bar (left) vs late-night phone screen (right). */
:root {
  --night: #0a0612;
  --night-2: #120a1f;
  --text: #f6f0ff;
  --muted: #b9add0;          /* 8.9:1 on --night */
  --amber: #ffb547;          /* drunk */
  --hotpink: #ff4fd8;        /* neon */
  --lime: #b6ff5c;
  --ex: #c9a7ff;             /* toxic ex lavender */
  --ex-bubble: #2a2140;
  --ex-me: #7a5cff;
  --danger: #ff6b8b;
  --focus: #8fe3ff;
  --round: "Arial Rounded MT Bold", "Nunito", "Trebuchet MS", ui-rounded, system-ui, sans-serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --hand: "Marker Felt", "Comic Sans MS", "Chalkboard SE", "Bradley Hand", cursive;
  --mono: ui-monospace, Menlo, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; font-family: var(--sans); color: var(--text); line-height: 1.5;
  background:
    linear-gradient(105deg, rgba(255,181,71,.10) 0 48%, transparent 48% 52%, rgba(201,167,255,.10) 52%),
    radial-gradient(800px 500px at 10% 0%, rgba(255,79,216,.16), transparent 60%),
    radial-gradient(800px 500px at 100% 30%, rgba(122,92,255,.18), transparent 60%),
    var(--night);
  background-attachment: fixed;
}
a { color: var(--amber); }
code { font-family: var(--mono); font-size: .86em; background: rgba(255,255,255,.07); padding: .1em .35em; border-radius: 6px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 10px; }
.skip-link { position: absolute; left: -9999px; top: 8px; z-index: 20; background: var(--amber); color: #1a0e00; padding: 8px 12px; border-radius: 8px; }
.skip-link:focus { left: 8px; }
.hint { color: var(--muted); font-size: .86rem; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px clamp(14px, 4vw, 40px); padding-top: max(10px, env(safe-area-inset-top));
  background: rgba(10,6,18,.82); backdrop-filter: blur(10px); border-bottom: 1px solid rgba(255,255,255,.07); }
.logo { margin: 0; font-family: var(--round); font-weight: 900; font-size: 1.02rem; }
.logo-drunk { color: var(--amber); text-shadow: 0 0 10px rgba(255,181,71,.6); display: inline-block; transform: rotate(-3deg); }
.logo-vs { color: var(--muted); font-size: .8em; margin: 0 .2em; }
.logo-ex { color: var(--ex); }
.auth { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.auth-status { font-size: .82rem; color: var(--lime); }
.connect-slot:empty { display: none; }

main { max-width: 1180px; margin: 0 auto; padding: clamp(14px, 4vw, 40px); }

/* hero */
.hero { text-align: center; margin: 10px auto 22px; max-width: 760px; }
.hero h1 { font-family: var(--round); font-size: clamp(2rem, 6.5vw, 3.8rem); line-height: 1.05; margin: 0 0 12px; letter-spacing: -.01em; }
.neon { color: #fff; text-shadow: 0 0 6px var(--hotpink), 0 0 18px var(--hotpink), 0 0 36px rgba(255,79,216,.6); }
.sub { color: var(--muted); margin: 0; }
.sub b { color: var(--danger); }
.lock { display: inline-block; margin-left: 6px; padding: 2px 10px; border-radius: 999px; border: 1px solid rgba(255,255,255,.18); font-size: .82rem; color: var(--text); white-space: nowrap; }
.lock.fallback { border-color: var(--danger); color: var(--danger); }

/* ask */
.ask { max-width: 820px; margin: 0 auto; background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.1); border-radius: 22px; padding: clamp(14px, 3vw, 22px); }
.ask-label { display: block; font-weight: 800; margin-bottom: 8px; }
.ask-row { display: flex; gap: 10px; }
.ask-row input { flex: 1; min-width: 0; font: inherit; font-size: 1.1rem; color: var(--text); background: var(--night); border: 2px solid rgba(255,255,255,.14); border-radius: 14px; padding: 12px 14px; }
.ask-row input::placeholder { color: #8e82a6; }
.ask-row input:focus { outline: none; border-color: var(--hotpink); box-shadow: 0 0 0 4px rgba(255,79,216,.2); }
.ask .hint { margin: 8px 0 0; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.pill { font: inherit; font-size: .85rem; color: var(--text); cursor: pointer; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14); border-radius: 999px; padding: 6px 12px; }
.pill:hover { border-color: var(--hotpink); }
.msg { min-height: 1.3em; margin: 10px 0 0; color: var(--amber); font-size: .92rem; }
.msg.error { color: var(--danger); }

/* buttons */
.btn { font: inherit; font-weight: 800; cursor: pointer; border-radius: 14px; border: 1px solid transparent; padding: 11px 18px; min-height: 44px; transition: transform .1s, filter .2s, opacity .2s; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-pop { background: linear-gradient(90deg, var(--amber), var(--hotpink)); color: #1b0618; }
.btn-ghost { background: transparent; color: var(--text); border-color: rgba(255,255,255,.2); }
.btn-ghost:hover:not(:disabled) { border-color: var(--text); }
.btn-worse { background: #2a0f1c; color: #ffd0dc; border-color: var(--danger); }
.btn-worse:hover:not(:disabled) { background: #3a1222; }
.btn-sm { padding: 6px 12px; min-height: 34px; font-size: .84rem; }

/* arena */
.arena { margin-top: 28px; scroll-margin-top: 70px; }
.arena-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.asked { margin: 0; font-family: var(--round); font-size: 1.1rem; }
.asked q { color: var(--text); }
.arena-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.duel { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); gap: 14px; align-items: stretch; }
.vs { align-self: center; font-family: var(--round); font-weight: 900; font-size: 1.6rem; color: #fff; width: 58px; height: 58px; display: grid; place-items: center; border-radius: 50%;
  background: linear-gradient(135deg, var(--amber), var(--hotpink) 50%, var(--ex-me)); box-shadow: 0 0 24px rgba(255,79,216,.5); }

.side { display: flex; flex-direction: column; border-radius: 24px; padding: 16px; min-height: 380px; }
.side-head { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.side-head h2 { margin: 0; font-family: var(--round); font-size: 1.5rem; }
.tagline { margin: 2px 0 0; color: var(--muted); font-size: .82rem; }
.meter { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.meter-name { font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.meter-pips { display: flex; gap: 3px; }
.meter-pips i { width: 10px; height: 16px; border-radius: 3px; background: rgba(255,255,255,.1); }
.meter-pips i.on { background: var(--pip); box-shadow: 0 0 8px var(--pip); }
.feed { list-style: none; margin: 14px 0; padding: 0; flex: 1; display: flex; flex-direction: column; gap: 12px; }
.side-foot { display: flex; flex-direction: column; gap: 8px; }
.side-foot .btn { width: 100%; }
.endpoint { font-family: var(--mono); font-size: .68rem; color: var(--muted); text-align: center; overflow-wrap: anywhere; }
.err { color: #ffc2cf; font-size: .92rem; }
.retry { margin-top: 8px; }

/* Drunk Grok: dive bar */
.side-drunk { --pip: var(--amber); background: linear-gradient(180deg, #1d1006, #130a14); border: 2px solid rgba(255,181,71,.35); box-shadow: inset 0 0 60px rgba(255,181,71,.06); }
.neon-sign { color: #fff3dc; text-shadow: 0 0 4px var(--amber), 0 0 14px var(--amber), 0 0 30px rgba(255,140,0,.6); animation: flicker 6s infinite; }
.side-drunk .feed li { position: relative; background: #fbf3df; color: #2a1a08; padding: 14px 16px 12px; border-radius: 4px;
  font-family: var(--hand); font-size: 1.04rem; line-height: 1.45; box-shadow: 0 6px 14px rgba(0,0,0,.45);
  transform: rotate(var(--tilt, -1deg)); }
.side-drunk .feed li.fresh { animation: slosh .5s ease-out both; }
.side-drunk .feed li:nth-child(even) { --tilt: 1.2deg; }
.side-drunk .feed li::before { content: attr(data-label); display: block; font-family: var(--sans); font-size: .68rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: #9a5a00; margin-bottom: 4px; }
.side-drunk .feed li .err { color: #9b0030; font-family: var(--sans); }
.side-drunk .feed li.is-loading { color: #6b5536; font-style: italic; }

/* Toxic Ex: phone thread */
.side-ex { --pip: var(--ex); background: linear-gradient(180deg, #171026, #0f0a1a); border: 2px solid rgba(201,167,255,.3); }
.phone-head { justify-content: flex-start; padding-bottom: 12px; border-bottom: 1px solid rgba(255,255,255,.08); }
.phone-head .meter { margin-left: auto; }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-size: 1.3rem; background: var(--ex-bubble); border: 2px solid var(--ex); }
.side-ex h2 { color: var(--ex); }
.side-ex .feed li { align-self: flex-start; max-width: 92%; background: var(--ex-bubble); color: var(--text); padding: 10px 14px; border-radius: 20px 20px 20px 6px; }
.side-ex .feed li.fresh { animation: pop .25s ease-out both; }
.side-ex .feed li.me { align-self: flex-end; background: var(--ex-me); color: #fff; border-radius: 20px 20px 6px 20px; font-size: .95rem; }
.side-ex .feed li .receipt { display: block; margin-top: 4px; font-size: .7rem; color: var(--muted); text-align: right; }
.typing { display: inline-flex; gap: 5px; padding: 4px 0; }
.typing i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); animation: bob 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
.side-drunk .typing i { background: #9a5a00; }
.answer { white-space: pre-wrap; overflow-wrap: anywhere; }

/* footer */
.footer { max-width: 1180px; margin: 30px auto 0; padding: 18px clamp(14px, 4vw, 40px) max(28px, env(safe-area-inset-bottom)); color: var(--muted); font-size: .88rem; border-top: 1px solid rgba(255,255,255,.07); text-align: center; }
.footer p { margin: 0 0 10px; }
.credit { display: inline-block; padding: 6px 14px; border-radius: 999px; border: 1px solid rgba(255,255,255,.18); color: var(--text); text-decoration: none; }
.credit b { color: var(--hotpink); }
.credit:hover { border-color: var(--hotpink); }

@keyframes flicker { 0%, 92%, 100% { opacity: 1; } 93% { opacity: .55; } 94% { opacity: 1; } 96% { opacity: .7; } }
@keyframes slosh { 0% { opacity: 0; transform: rotate(-6deg) translateX(-12px); } 60% { transform: rotate(3deg); } }
@keyframes pop { from { opacity: 0; transform: scale(.9) translateY(6px); } }
@keyframes bob { 50% { transform: translateY(-4px); opacity: .5; } }

@media (max-width: 820px) {
  .duel { grid-template-columns: 1fr; }
  .vs { justify-self: center; margin: -6px 0; width: 50px; height: 50px; font-size: 1.3rem; }
  .side { min-height: 0; }
}
@media (max-width: 520px) {
  .ask-row { flex-direction: column; }
  .arena-actions { width: 100%; }
  .arena-actions .btn { flex: 1; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
