/* Colors come from brand.json (set on :root by main.js); these are fallbacks. */
:root {
  --primary: #ffc83d; --accent: #6ef3ff; --hot: #ff4fd8; --sky: #140f2e;
  --panel: color-mix(in srgb, var(--sky) 22%, rgba(9, 10, 16, .84));
  --panel-2: rgba(255, 255, 255, .055); --line: rgba(255, 255, 255, .1); --line-2: rgba(255, 255, 255, .18);
  --ink: #f4f3f7; --dim: rgba(236, 234, 244, .66); --faint: rgba(236, 234, 244, .42);
  --on-primary: color-mix(in srgb, var(--primary) 12%, #140d00);
  --ok: #4ade9a;
  --r: 12px; --pad: max(16px, env(safe-area-inset-left));
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, .7), 0 2px 6px rgba(0, 0, 0, .3);
  --display: "Barlow Condensed", "Arial Narrow", sans-serif;
  font-family: "Barlow", system-ui, sans-serif; color: var(--ink); font-size: 15px;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--sky); overscroll-behavior: none; }
::selection { background: color-mix(in srgb, var(--primary) 70%, transparent); color: var(--on-primary); }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
.glass { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
[hidden] { display: none !important; }

/* ---------- name tags + bubbles ---------- */
#tags { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.tag { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; transform-origin: 50% 100%; will-change: transform; }
.nm { display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 8px; border-radius: 8px; background: rgba(10, 11, 17, .78);
  font-size: 15px; font-weight: 600; white-space: nowrap; box-shadow: 0 4px 12px -4px rgba(0,0,0,.6); letter-spacing: .01em; }
.nm::before { content: ""; width: 4px; height: 14px; border-radius: 2px; background: var(--c); }
.tag.bot .nm::after { content: "AI"; order: 3; font: 700 10px/1 "Barlow", sans-serif; letter-spacing: .08em; padding: 3px 4px; border-radius: 4px; background: var(--c); color: #0b0c10; }
.tag.me .nm { background: rgba(10, 11, 17, .55); }
.tier { font-style: normal; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; background: rgba(255,255,255,.12); color: var(--dim); }
.tier:empty { display: none; }
.tier.t2 { background: color-mix(in srgb, var(--primary) 22%, transparent); color: var(--primary); }
.tier.t3, .tier.t4 { background: var(--primary); color: var(--on-primary); }
.tag .mic { display: none; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 25%, transparent); }
.tag.mic-on .mic { display: block; }
.bubble { max-width: 260px; padding: 9px 13px; border-radius: 10px; background: #f6f5f9; color: #15141c; font-size: 15px; line-height: 1.35; font-weight: 500;
  opacity: 0; transform: translateY(6px) scale(.96); transition: opacity .2s, transform .3s cubic-bezier(.2,.9,.3,1); position: relative; text-align: left; box-shadow: 0 8px 20px -8px rgba(0,0,0,.6); }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: #f6f5f9; }
.tag.bot .bubble { background: rgba(12, 13, 20, .92); color: var(--ink); box-shadow: inset 0 2px 0 var(--c), 0 8px 20px -8px rgba(0,0,0,.6); }
.tag.bot .bubble::after { border-top-color: rgba(12, 13, 20, .92); }
.tag.talk .bubble { opacity: 1; transform: none; }
.tag:not(.talk) .bubble { height: 0; padding: 0; overflow: hidden; }
.emote { position: absolute; bottom: 100%; font-size: 34px; animation: float 1.6s cubic-bezier(.2,.9,.3,1) forwards; }
@keyframes float { from { transform: translateY(10px) scale(.5); opacity: 0; } 20% { transform: translateY(0) scale(1.1); opacity: 1; } to { transform: translateY(-60px) scale(1); opacity: 0; } }

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; }
#hud > *, .top > * { pointer-events: auto; }
.top { position: absolute; top: max(16px, env(safe-area-inset-top)); left: var(--pad); right: var(--pad); display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; gap: 12px; pointer-events: none; }
.brand { display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 7px; justify-self: start; max-width: 100%; }
.mark { width: 36px; height: 36px; border-radius: 50%; flex: none; display: grid; place-items: center; background-size: cover; background-position: center;
  background-color: var(--primary); background-image: radial-gradient(circle at 35% 30%, rgba(255,255,255,.55), transparent 55%), radial-gradient(circle, transparent 62%, rgba(0,0,0,.22) 64%, transparent 70%);
  font: 800 15px/1 var(--display); color: var(--on-primary); box-shadow: inset 0 -2px 0 rgba(0,0,0,.2), 0 2px 8px rgba(0,0,0,.4); }
.bn { display: flex; flex-direction: column; line-height: 1; gap: 3px; padding-right: 6px; }
.bn b { font: 800 19px/1 var(--display); letter-spacing: .02em; text-transform: uppercase; }
.bn span { color: var(--primary); font-size: 12px; font-weight: 600; letter-spacing: .04em; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 8px; background: var(--panel-2); border: 1px solid var(--line); font-size: 13px; font-weight: 600; white-space: nowrap; transition: background .15s; }
.chip:hover { background: rgba(255,255,255,.12); }
.chip code { font-family: "JetBrains Mono", monospace; font-size: 12px; color: var(--dim); }
#links { display: flex; gap: 6px; }
#links a { color: var(--ink); text-decoration: none; }

.pot { padding: 10px 22px 12px; text-align: center; min-width: 240px; position: relative; overflow: hidden; }
.pot::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--primary); }
.lbl { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); font-weight: 700; }
.amt { font: 800 44px/1 var(--display); color: var(--primary); font-variant-numeric: tabular-nums; margin: 4px 0 4px; letter-spacing: .01em; }
.amt small { font-size: 18px; margin-left: 6px; color: var(--ink); font-weight: 700; }
.sub { font-size: 13px; color: var(--dim); font-variant-numeric: tabular-nums; }
.sub span { color: var(--ink); font-weight: 600; }
.elig { margin-top: 8px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 6px; background: var(--panel-2); color: var(--dim); display: inline-block; }
.elig.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); }
.pot.bump .amt { animation: bump .5s cubic-bezier(.2,.9,.3,1); }
@keyframes bump { 35% { transform: scale(1.08); } }

.right { justify-self: end; display: flex; gap: 8px; align-items: center; }
.btn { height: 44px; padding: 0 18px; border-radius: 10px; font-weight: 700; font-size: 15px; letter-spacing: .01em; transition: transform .12s, filter .15s, background .15s; white-space: nowrap; display: inline-flex; align-items: center; justify-content: center; }
.btn:hover { filter: brightness(1.06); } .btn:active { transform: scale(.97); }
.btn.primary { background: var(--primary); color: var(--on-primary); box-shadow: inset 0 1px 0 rgba(255,255,255,.4), inset 0 -2px 0 rgba(0,0,0,.15), 0 6px 16px -6px rgba(0,0,0,.55); }
.btn.on { background: var(--panel); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow); }
.btn .t { margin-left: 8px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 3px 6px; border-radius: 4px; background: var(--primary); color: var(--on-primary); }
.icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; transition: background .15s; }
.icon:hover { background: color-mix(in srgb, var(--panel) 80%, #fff 8%); }
.icon svg, .mic svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon.off { color: var(--faint); } .icon.off .w { display: none; }

.board { position: absolute; right: var(--pad); top: 50%; transform: translateY(-50%); width: 230px; padding: 14px 14px 12px; }
.board h3 { margin: 0 0 6px; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); font-weight: 700; }
.board ol { margin: 0; padding: 0; list-style: none; counter-reset: r; }
.board li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; font-weight: 500; counter-increment: r; }
.board li:last-child { border-bottom: 0; }
.board li::before { content: counter(r); width: 14px; flex: none; font: 700 15px/1 var(--display); color: var(--faint); }
.board li:first-child::before { color: var(--primary); }
.board li span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board li b { font: 700 16px/1 var(--display); font-variant-numeric: tabular-nums; }
.board li:first-child b { color: var(--primary); }
.board li.empty { color: var(--dim); font-size: 13px; } .board li.empty::before { display: none; }
.mine { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line-2); font-size: 13px; color: var(--dim); } .mine b { color: var(--primary); font: 700 16px/1 var(--display); }

.chat { position: absolute; left: var(--pad); bottom: max(16px, env(safe-area-inset-bottom)); width: min(380px, calc(100% - 2 * var(--pad))); }
#log { max-height: 230px; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; margin-bottom: 8px;
  mask-image: linear-gradient(to bottom, transparent, #000 30%); -webkit-mask-image: linear-gradient(to bottom, transparent, #000 30%); pointer-events: none; }
.line { font-size: 14px; line-height: 1.4; padding: 5px 10px; border-radius: 8px; background: rgba(10, 11, 17, .66); align-self: flex-start; max-width: 100%; animation: in .25s cubic-bezier(.2,.9,.3,1); }
.line b { margin-right: 6px; font-weight: 700; }
.line.sys { color: var(--dim); }
.line.bot b::after { content: "AI"; margin-left: 5px; font-size: 9px; letter-spacing: .08em; padding: 1px 3px; border-radius: 3px; vertical-align: 2px; background: var(--c); color: #0b0c10; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } }
#chatIn { width: 100%; height: 46px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font: inherit; font-size: 15px; outline: none;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); caret-color: var(--primary); box-shadow: var(--shadow); }
#chatIn::placeholder { color: var(--faint); }
#chatIn:focus { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }

.dock { position: absolute; left: 50%; transform: translateX(-50%); bottom: max(16px, env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 10px; }
.emotes { display: flex; gap: 2px; padding: 4px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.emotes button { width: 38px; height: 38px; border-radius: 8px; font-size: 20px; transition: transform .12s, background .12s; }
.emotes button:hover { background: rgba(255,255,255,.08); transform: translateY(-2px); }
button.mic { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; background: var(--panel); border: 1px solid var(--line-2); box-shadow: var(--shadow); position: relative; transition: background .15s, box-shadow .15s; backdrop-filter: blur(10px); }
button.mic svg { width: 24px; height: 24px; }
button.mic::after { content: ""; position: absolute; left: 50%; top: 50%; width: 28px; height: 2px; background: #ff6b7f; transform: translate(-50%, -50%) rotate(-45deg); border-radius: 2px; }
button.mic.on { background: var(--ok); border-color: transparent; color: #04210f; box-shadow: 0 0 0 calc(var(--lv, 0) * 12px) color-mix(in srgb, var(--ok) 30%, transparent), 0 10px 24px -8px color-mix(in srgb, var(--ok) 70%, transparent); }
button.mic.on::after { display: none; }
#ears.off { color: var(--faint); text-decoration: line-through; }
.help { position: absolute; right: var(--pad); bottom: max(18px, env(safe-area-inset-bottom)); font-size: 12px; line-height: 1.5; color: var(--faint); text-align: right; max-width: 240px; pointer-events: none; text-shadow: 0 1px 3px rgba(0,0,0,.6); }

#toast { position: absolute; top: 150px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.toast { padding: 8px 14px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); font-weight: 600; font-size: 14px; animation: tin 2.6s ease forwards; }
.toast.gold { background: var(--primary); color: var(--on-primary); border-color: transparent; font: 800 22px/1 var(--display); padding: 8px 16px; }
@keyframes tin { 0% { opacity: 0; transform: translateY(-8px); } 10%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-10px); } }

#win { position: fixed; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 20; background: radial-gradient(closest-side, rgba(0,0,0,.55), transparent); animation: tin 6s ease forwards; }
.winCard { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.winCard b { font: 800 clamp(44px, 9vw, 96px)/1 var(--display); text-transform: uppercase; text-shadow: 0 4px 24px rgba(0,0,0,.6); }
.winCard span { font: 800 34px/1 var(--display); color: var(--primary); }
.winCard a { color: var(--accent); pointer-events: auto; font-size: 14px; }

/* ---------- join ---------- */
.join { position: fixed; inset: 0; display: grid; place-items: center start; padding: 24px 16px 24px max(24px, 7vw); overflow-y: auto; z-index: 10;
  background: linear-gradient(90deg, rgba(6,7,12,.55), rgba(6,7,12,.1) 55%, transparent), linear-gradient(0deg, rgba(6,7,12,.5), transparent 40%); }
.join .card { width: min(400px, 100%); padding: 24px; display: flex; flex-direction: column; gap: 16px; border-radius: 16px; background: color-mix(in srgb, var(--panel) 92%, transparent);
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.75), 0 2px 8px rgba(0,0,0,.3); }
.jHead { display: flex; align-items: center; gap: 14px; }
.mark.big { width: 60px; height: 60px; font-size: 24px; }
.join h1 { margin: 0; font: 800 44px/.9 var(--display); letter-spacing: .01em; text-transform: uppercase; color: var(--ink); }
.join p { margin: 6px 0 0; color: var(--dim); font-size: 15px; line-height: 1.35; }
.jPot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); }
.jPot span { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--dim); font-weight: 600; }
.jPot b { font: 800 26px/1 var(--display); color: var(--primary); font-variant-numeric: tabular-nums; }
.live { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 22%, transparent); animation: live 2s ease-in-out infinite; }
@keyframes live { 50% { box-shadow: 0 0 0 6px transparent; } }
.field { display: flex; flex-direction: column; gap: 8px; font-size: 13px; font-weight: 600; color: var(--dim); }
.field input { height: 48px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(0,0,0,.28); color: var(--ink); font: inherit; font-size: 17px; font-weight: 600; outline: none; caret-color: var(--primary); transition: border-color .15s; }
.field input:focus { border-color: color-mix(in srgb, var(--primary) 70%, transparent); }
.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; }
.swatches button { aspect-ratio: 1; border-radius: 8px; background: var(--c); box-shadow: inset 0 -2px 0 rgba(0,0,0,.2); transition: transform .12s, box-shadow .12s; }
.swatches button:hover { transform: translateY(-1px); }
.swatches button.sel { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--ink); }
.check { display: flex; gap: 12px; align-items: center; font-size: 15px; font-weight: 600; cursor: pointer; padding: 2px 0; }
.check em { display: block; font-style: normal; font-weight: 400; font-size: 13px; color: var(--dim); }
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check .sw { width: 40px; height: 24px; flex: none; border-radius: 12px; background: rgba(255,255,255,.14); position: relative; transition: background .2s; }
.check .sw::after { content: ""; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s cubic-bezier(.2,.9,.3,1); box-shadow: 0 1px 3px rgba(0,0,0,.4); }
.check input:checked + .sw { background: var(--ok); }
.check input:checked + .sw::after { transform: translateX(16px); }
.check input:focus-visible + .sw { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn.big { height: 52px; font-size: 17px; border-radius: 12px; }
.join small { color: var(--faint); font-size: 12px; text-align: center; line-height: 1.4; }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  :root { --pad: max(12px, env(safe-area-inset-left)); }
  .top { grid-template-columns: 1fr auto; gap: 8px; }
  .pot { grid-column: 1 / -1; grid-row: 2; justify-self: center; min-width: 0; padding: 6px 16px 8px; }
  .amt { font-size: 32px; } .elig { display: none; }
  .brand { padding: 5px 8px 5px 5px; gap: 8px; } .mark { width: 30px; height: 30px; font-size: 13px; } .bn b { font-size: 16px; } #links, #ca { display: none !important; }
  .btn { height: 38px; padding: 0 12px; font-size: 14px; } .icon { width: 38px; height: 38px; }
  .board { display: none; } .help { display: none; }
  .chat { bottom: calc(max(14px, env(safe-area-inset-bottom)) + 74px); width: calc(100% - 2 * var(--pad)); }
  #log { max-height: 120px; } .line { font-size: 13px; }
  .emotes button { width: 34px; height: 34px; font-size: 18px; }
  button.mic { width: 54px; height: 54px; }
  #ears { display: none !important; }
  #toast { top: 160px; }
  .nm { font-size: 14px; }
  .join { place-items: end center; padding: 16px 12px max(12px, env(safe-area-inset-bottom)); background: linear-gradient(0deg, rgba(6,7,12,.7), transparent 70%); }
  .join .card { padding: 20px; gap: 14px; }
  .join h1 { font-size: 38px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
