:root {
  --bg: #14102a; --bg2: #1d1740; --card: #231c4a; --line: #3a3170;
  --text: #f4f1ff; --muted: #a9a2cf; --accent: #ffc23d; --accent2: #ff5d8f; --ok: #3ddc97;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh; color: var(--text); font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 16px;
  background: radial-gradient(900px 500px at 15% -10%, #3b1d7a 0%, transparent 60%), radial-gradient(800px 500px at 110% 10%, #1b3d7a 0%, transparent 55%), var(--bg);
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
.screen { max-width: 560px; margin: 0 auto; padding: 18px 14px 40px; }
.hidden { display: none !important; }
.hero { text-align: center; margin: 14px 0 22px; }
.logo { font-size: 46px; }
h1 { margin: 6px 0; font-size: 34px; font-weight: 900; background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { color: var(--muted); margin: 0 6px; line-height: 1.45; }
.card { background: linear-gradient(180deg, var(--card), var(--bg2)); border: 1px solid var(--line); border-radius: 18px; padding: 16px; margin-bottom: 14px; }
label, .lbl { display: block; font-weight: 800; margin: 4px 0 8px; }
.lbl .muted { font-weight: 600; }
input { width: 100%; font: inherit; color: var(--text); background: #0d0a1e; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; outline: none; }
input:focus { border-color: var(--accent); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 0 16px; border-radius: 12px; border: 0; cursor: pointer;
  font: inherit; font-weight: 800; color: var(--text); background: #2f2760; box-shadow: 0 3px 0 #1a1540; }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 #1a1540; }
.btn.main { color: #1b1300; background: linear-gradient(180deg, #ffd56b, var(--accent)); box-shadow: 0 3px 0 #b27d00; }
.btn.ghost { background: transparent; box-shadow: none; border: 1px solid var(--line); }
.btn.wide { width: 100%; margin-top: 10px; }
.btn:disabled { opacity: .5; }
.row { display: flex; gap: 8px; margin-top: 10px; } .row .btn { flex: 1; }
.err { color: #ff8a8a; min-height: 20px; margin-top: 8px; text-align: center; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.back { display: block; text-align: center; color: var(--muted); margin-top: 10px; text-decoration: none; }

.top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.code { font-size: 30px; font-weight: 900; letter-spacing: 6px; color: var(--accent); }

.members { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.members li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: #0d0a1e88; border-radius: 12px; }
.members li.off { opacity: .55; }
.members .av { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 900; background: linear-gradient(135deg, #6c5ce7, #ff5d8f); flex: none; }
.members .nm { flex: 1; } .members small { color: var(--muted); } .members .host { color: var(--accent); }
.members .st { font-size: 13px; color: var(--muted); }

.big { font-size: 26px; font-weight: 900; text-align: center; margin: 6px 0; }
#stage p { line-height: 1.45; }
.games { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0; }
.game { display: flex; align-items: center; gap: 8px; text-align: left; padding: 10px; border-radius: 14px; border: 2px solid var(--line); background: #0d0a1e; color: var(--text); font: inherit; cursor: default; min-height: 60px; position: relative; }
.game.vote, .game.pick { cursor: pointer; }
.game.vote { padding-right: 36px; }
.game.mine { border-color: var(--accent); background: #2a2050; }
.game .em { font-size: 24px; } .game .gn { flex: 1; font-weight: 800; font-size: 15px; } .game .gn small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; }
.game .votes { position: absolute; top: 4px; right: 6px; text-align: right; } .game .votes b { display: inline-block; min-width: 22px; padding: 1px 6px; border-radius: 999px; background: var(--accent2); color: #fff; font-size: 13px; }
.game .votes small { display: block; font-size: 10px; color: var(--muted); max-width: 90px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.choices { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.choices button { font: inherit; font-weight: 700; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: #0d0a1e; color: var(--text); cursor: pointer; }
.choices button.on { background: var(--accent); color: #1b1300; border-color: var(--accent); }

.chat .msgs { height: 220px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding: 4px 2px; margin-bottom: 10px; }
.msg { background: #0d0a1e; border-radius: 12px; padding: 7px 10px; max-width: 88%; align-self: flex-start; word-wrap: break-word; line-height: 1.35; }
.msg b { color: var(--accent); margin-right: 4px; }
.msg.me { align-self: flex-end; background: #3a2a80; } .msg.me b { color: #ffd9a0; }
.msg.sys { align-self: center; background: transparent; color: var(--muted); font-size: 13px; text-align: center; }
.say { display: flex; gap: 8px; } .say input { margin: 0; }

.toast { position: fixed; left: 50%; top: max(14px, env(safe-area-inset-top)); transform: translateX(-50%) translateY(-140%); z-index: 50; background: #2f2760; border: 1px solid #5a4bb0; padding: 10px 16px; border-radius: 12px; font-weight: 700; transition: transform .25s; max-width: 92vw; text-align: center; }
.toast.show { transform: translateX(-50%) translateY(0); }
.conn { position: fixed; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); background: #5a1e2a; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; }
