:root {
  --bg: #0b0a08;
  --card: #15130f;
  --line: rgba(255, 255, 255, 0.09);
  --ink: #f4efe2;
  --ink2: #cfc6b0;
  --muted: #9a927f;
  --gold: #e6b422;
  --gold-ink: #1a1405;
  --live: #e5484d;
  --ok: #3fb68b;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font: 16px/1.45 system-ui, -apple-system, 'Segoe UI', Inter, sans-serif;
  background:
    radial-gradient(700px 420px at 50% -80px, rgba(230, 180, 34, 0.18), transparent 70%),
    var(--bg);
  min-height: 100vh;
}
a { color: var(--gold); }
button, .btn {
  font: inherit; font-weight: 600; color: var(--ink); background: #221f19;
  border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center;
  justify-content: center; gap: 6px; min-height: 44px;
}
button:disabled { opacity: 0.5; cursor: default; }
button.gold, .btn.gold { background: var(--gold); color: var(--gold-ink); border-color: transparent; }
button.live { background: var(--live); border-color: transparent; color: #fff; }
button.wide { width: 100%; margin-top: 8px; }
button.big { font-size: 19px; padding: 14px 22px; width: 100%; }
button.link { background: none; border: 0; color: var(--gold); min-height: 0; padding: 8px; }
input {
  font: inherit; color: var(--ink); background: #0f0e0b; border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 12px; width: 100%; min-height: 44px;
}
input:focus { outline: 2px solid var(--gold); outline-offset: -1px; }

.wrap { max-width: 760px; margin: 0 auto; padding: 12px 16px 40px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; color: var(--ink); text-decoration: none; font-size: 18px; }
.brand img { width: 28px; height: 28px; }
.chip { min-height: 36px; padding: 4px 12px 4px 4px; border-radius: 999px; font-size: 14px; }
.chip .av { margin: 0; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin-bottom: 12px; }
h1 { font-size: 26px; line-height: 1.15; margin: 0; letter-spacing: -0.02em; }
h2 { font-size: 15px; margin: 0 0 12px; color: var(--ink2); text-transform: uppercase; letter-spacing: 0.06em; }
.count { color: var(--muted); font-weight: 600; margin-left: 4px; }
.hero { display: flex; gap: 14px; align-items: center; }
.hero .logo { width: 72px; height: 72px; border-radius: 16px; object-fit: cover; flex: none; background: #2a261e; }
.desc { color: var(--ink2); margin: 6px 0 0; }
.status { margin-top: 10px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; padding: 4px 10px; border-radius: 999px; }
.pill.on { background: rgba(63, 182, 139, 0.14); color: #7be0b8; }
.pill.on i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 1.6s infinite; }
.pill.off { background: rgba(255, 255, 255, 0.07); color: var(--muted); }
@keyframes pulse { 50% { opacity: 0.35; } }

.join { text-align: center; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; }
.controls > button { flex: 1 1 auto; }
.controls p { flex-basis: 100%; margin: 4px 0 0; }
.reacts { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.emoji { font-size: 22px; padding: 4px 8px; min-height: 44px; min-width: 44px; background: transparent; }
.host { border-color: rgba(230, 180, 34, 0.45); }
.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.row.center { justify-content: center; flex-wrap: wrap; }

.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 14px 8px; }
.people.small { grid-template-columns: repeat(auto-fill, minmax(68px, 1fr)); }
.people.small .av { width: 48px !important; height: 48px !important; }
.person { position: relative; text-align: center; }
.person-btn { background: none; border: 0; padding: 0; position: relative; min-height: 0; display: inline-block; }
.av {
  border-radius: 50%; background: #2a261e; overflow: hidden; display: grid; place-items: center;
  margin: 0 auto; box-shadow: 0 0 0 3px transparent; transition: box-shadow 0.15s;
}
.av img { width: 100%; height: 100%; object-fit: cover; }
.av span { font-weight: 800; color: var(--ink2); }
.av.talking { box-shadow: 0 0 0 3px var(--gold), 0 0 18px rgba(230, 180, 34, 0.6); }
.badge { position: absolute; bottom: -2px; right: -4px; font-size: 14px; background: var(--card); border-radius: 50%; padding: 2px; line-height: 1; }
.badge.hand { right: auto; left: -4px; }
.react { position: absolute; top: -6px; left: 50%; font-size: 26px; animation: float 4s ease-out forwards; pointer-events: none; }
@keyframes float { from { transform: translate(calc(-50% + var(--i) * 10px), 0); opacity: 1; } to { transform: translate(calc(-50% + var(--i) * 10px), -60px); opacity: 0; } }
.pname { font-size: 13px; color: var(--ink2); margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pmenu {
  position: absolute; z-index: 5; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 4px;
  background: #221f19; border: 1px solid var(--line); border-radius: 14px; padding: 8px;
  display: flex; flex-direction: column; gap: 6px; min-width: 200px; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
}
.pmenu a { padding: 8px; font-size: 14px; }

.chatlog { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; overflow-wrap: anywhere; }
.line b { color: var(--gold); font-weight: 700; margin-right: 4px; }
.line.sys { color: var(--muted); font-size: 14px; }
.chatform { display: flex; gap: 8px; }

.sheet-bg { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet {
  position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 22px 22px 0 0;
  padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto;
}
@media (min-width: 640px) { .sheet-bg { align-items: center; } .sheet { border-radius: 22px; } }
.sheet h2 { font-size: 20px; text-transform: none; letter-spacing: -0.01em; color: var(--ink); padding-right: 40px; }
.sheet form { margin: 0; }
.x { position: absolute; top: 12px; right: 12px; min-height: 36px; width: 36px; padding: 0; border-radius: 50%; }
.or { text-align: center; color: var(--muted); font-size: 13px; margin: 16px 0 8px; }
.seg { display: flex; background: #0f0e0b; border-radius: 12px; padding: 4px; gap: 4px; margin-bottom: 10px; }
.seg button { flex: 1; background: transparent; border: 0; min-height: 40px; color: var(--muted); }
.seg button.on { background: #2a261e; color: var(--ink); }
.seg.chain button.on.xbt { background: var(--gold); color: var(--gold-ink); }
.amounts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.amounts button.on { border-color: var(--gold); color: var(--gold); }
.qr { display: inline-block; padding: 10px; background: #f4efe2; border-radius: 16px; margin: 10px auto; }
.qr canvas { display: block; max-width: 100%; height: auto; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; }
.center { text-align: center; }
.small { font-size: 13px; }
.muted { color: var(--muted); }
.err { color: #ff8f8f; }
.paid { font-size: 22px; font-weight: 800; color: #7be0b8; margin: 24px 0; }
.tip input { margin-top: 10px; }

.foot { color: var(--muted); font-size: 13px; margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px; }
.foot p { margin: 0 0 8px; }
