:root { --bg: #0b0d12; --card: #171a23; --line: rgba(255,255,255,.12); --text: #e9ecf2; --mute: #8b93a5; --acc: #f5c542; --ok: #3cb44b; --bad: #e6194b; --blue: #6c8cff; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 16px/1.4 system-ui, -apple-system, 'Segoe UI', sans-serif; overflow: hidden; touch-action: none; -webkit-user-select: none; user-select: none; }
#app { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
canvas { max-width: 100vw; max-height: 100vh; background: var(--bg); display: block; touch-action: none; }
.hidden { display: none !important; }
.screen, .overlay { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; overflow-y: auto; padding: 14px; }
.screen { background: radial-gradient(ellipse at 50% 30%, #1d2233 0%, #0b0d12 70%); z-index: 5; }
.overlay { background: rgba(8, 10, 16, .78); z-index: 8; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 22px 26px; box-shadow: 0 14px 50px rgba(0,0,0,.55); max-width: 100%; }
.card.menu { width: 380px; text-align: center; }
.card.lobby { width: min(980px, 100%); max-height: 100%; overflow-y: auto; }
.card.intro { width: 460px; text-align: center; }
.card.end { width: 520px; text-align: center; max-height: 100%; overflow-y: auto; }
.card.box { width: 340px; }
.logo { font-size: 54px; font-weight: 800; letter-spacing: 4px; color: var(--acc); line-height: 1; }
.tag { color: var(--mute); margin: 8px 0 18px; }
.muted { color: var(--mute); font-size: 13px; }
.center { text-align: center; }
.field { display: block; text-align: left; margin-bottom: 12px; font-size: 13px; color: var(--mute); }
input, select { width: 100%; background: #0f1219; color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; font: inherit; }
input[type=range] { padding: 0; accent-color: var(--acc); }
input[type=checkbox] { width: auto; }
button { font: inherit; color: #14161c; background: var(--acc); border: 0; border-radius: 10px; padding: 11px 16px; cursor: pointer; font-weight: 600; }
button.ghost { background: #262b39; color: var(--text); }
button.primary { background: var(--acc); }
button:disabled { opacity: .45; cursor: default; }
button.on { outline: 2px solid var(--acc); }
.row { display: flex; gap: 10px; margin: 10px 0; align-items: center; }
.row > button { flex: 1; }
.row.small { justify-content: space-between; margin-top: 16px; }
.row.small button { flex: none; }
.row.join input { flex: 1; text-transform: uppercase; letter-spacing: 3px; text-align: center; }
.row.join button { flex: none; background: #262b39; color: var(--text); }
.row.end { justify-content: space-between; }
.row.center { justify-content: center; }
.langs { display: flex; gap: 6px; }
.langs button { padding: 7px 11px; background: #262b39; color: var(--text); }
.langs button.on { background: var(--acc); color: #14161c; }
.how { font-size: 12px; color: var(--mute); margin: 8px 0 0; }
.err { color: #ff8a80; min-height: 20px; margin: 6px 0 0; font-size: 14px; }
.lhead { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 14px; }
.lhead .share { flex: 1; min-width: 200px; }
.code { font-size: 38px; font-weight: 800; letter-spacing: 6px; color: var(--acc); line-height: 1; }
.lgrid { display: grid; grid-template-columns: 250px 1fr; gap: 20px; }
.lcol h3 { margin: 0 0 8px; font-size: 15px; }
.plist { list-style: none; padding: 0; margin: 0; }
.plist li { display: flex; align-items: center; gap: 8px; padding: 7px 10px; background: #0f1219; border-radius: 9px; margin-bottom: 6px; }
.plist li .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); flex: none; }
.plist li.off .dot { background: #666; }
.plist li .tagx { font-size: 11px; background: var(--acc); color: #14161c; padding: 1px 7px; border-radius: 999px; }
.plist li .kick { margin-left: auto; padding: 3px 9px; font-size: 12px; background: #3a2328; color: #ffb3ab; }
.plist.roles li.win { outline: 1px solid var(--ok); }
.sgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px 18px; }
.sgrid h4 { grid-column: 1 / -1; margin: 10px 0 0; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--mute); }
.sgrid label { font-size: 13px; color: var(--mute); display: block; }
.sgrid label small { color: #5f6779; }
.sgrid input, .sgrid select { margin-top: 4px; padding: 8px 10px; }
.sgrid label.chk { display: flex; align-items: center; gap: 8px; grid-column: 1 / -1; color: var(--text); }
.dev { margin-top: 10px; padding: 8px; border: 1px dashed #6a5a2a; border-radius: 10px; font-size: 13px; }
.role { font-size: 56px; font-weight: 800; letter-spacing: 3px; margin: 2px 0 6px; }
.role.agent { color: #7be0a3; } .role.assassin { color: #ff6b6b; }
.task { font-size: 17px; margin: 0 0 12px; }
.tips { text-align: left; color: var(--mute); font-size: 14px; padding-left: 18px; margin: 0 0 12px; }
.count { font-size: 64px; font-weight: 800; color: var(--acc); }
.winner { font-size: 34px; font-weight: 800; letter-spacing: 2px; }
.winner.agents { color: #7be0a3; } .winner.assassins { color: #ff6b6b; }
.why { color: var(--mute); margin-bottom: 8px; }
.you { font-size: 18px; margin-bottom: 12px; }
.plist.roles li { font-size: 14px; }
.plist.roles .r-assassin { color: #ff8a80; } .plist.roles .r-agent { color: #9be8a6; }
.spd { padding: 6px 12px; }
.box h2 { margin: 0 0 14px; font-size: 20px; }
.box label { display: block; margin: 14px 0; font-size: 15px; }
.box output { float: right; color: var(--blue); }
.box .chk { display: flex; align-items: center; gap: 8px; }
#rotate { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: #0b0d12; text-align: center; }
#status { position: fixed; left: 50%; top: 12px; transform: translateX(-50%); background: rgba(24,27,36,.92); border: 1px solid var(--line); border-radius: 10px; padding: 8px 16px; z-index: 30; font-size: 14px; }
@media (max-width: 760px) { .lgrid { grid-template-columns: 1fr; } .code { font-size: 30px; } .card { padding: 16px; } .logo { font-size: 44px; } }

#screen-end { background: transparent; justify-content: flex-end; pointer-events: none; }
#screen-end .card { pointer-events: auto; width: 340px; max-height: 92vh; }
@media (max-width: 760px) { #screen-end { align-items: flex-end; justify-content: center; } #screen-end .card { width: 100%; max-height: 46vh; } }
#chat-in { position: fixed; left: 12px; bottom: 12px; width: min(420px, calc(100vw - 24px)); z-index: 12; background: rgba(15,18,25,.95); }
