/* =========================================================
   IMPOSTER · dark app UI · black + orange
   ========================================================= */

:root {
    --bg:        #0a0a0c;
    --bg-2:      #0e0e11;
    --sidebar:   #101013;
    --surface:   #161619;
    --surface-2: #1d1d22;
    --surface-3: #26262c;
    --stroke:    rgba(255, 255, 255, 0.07);
    --stroke-2:  rgba(255, 255, 255, 0.12);

    --text:    #f4f4f5;
    --muted:   #a1a1aa;
    --muted-2: #71717a;

    --accent:      #ff7a1a;
    --accent-2:    #ff9142;
    --accent-press:#e86500;
    --accent-soft: rgba(255, 122, 26, 0.14);
    --accent-ring: rgba(255, 122, 26, 0.35);
    --on-accent:   #1a0f02;

    --green: #34d399;
    --red:   #f43f5e;
    --mystery: #7c5cff;

    --radius:    18px;
    --radius-sm: 12px;
    --shadow:    0 16px 44px rgba(0, 0, 0, 0.5);

    --safe-b: env(safe-area-inset-bottom, 0px);
    --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
::selection { background: var(--accent-soft); }

/* =========================================================
   START PAGE
   ========================================================= */
.app {
    min-height: 100dvh; width: 100%; max-width: 440px; margin: 0 auto;
    padding: calc(24px + var(--safe-t)) 22px calc(28px + var(--safe-b));
    display: flex; flex-direction: column;
}

.brand {
    display: flex; flex-direction: column; align-items: center; gap: 14px;
    text-align: center; padding: 40px 0 30px;
}
.brand .logo {
    width: 88px; height: 88px; border-radius: 24px;
    background: linear-gradient(150deg, var(--accent), var(--accent-press));
    display: grid; place-items: center;
    box-shadow: 0 12px 30px rgba(255, 122, 26, 0.3);
    position: relative;
}
.brand .logo svg { width: 46px; height: 46px; color: #fff; }
.brand h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.6px; }
.brand p { color: var(--muted); font-size: 14.5px; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.join-hint {
    display: flex; align-items: center; gap: 8px; padding: 10px 13px; border-radius: 11px;
    font-size: 13px; color: var(--accent-2); font-weight: 600;
    background: var(--accent-soft); border: 1px solid rgba(255,122,26,.2);
    animation: fadeIn .25s ease;
}
.join-hint svg { width: 15px; height: 15px; flex-shrink: 0; }

/* Toggle-Zeile (z.B. Larry an/aus beim Raum erstellen) */
.toggle-row {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 13px 15px; border-radius: var(--radius-sm);
    background: var(--surface); border: 1px solid var(--stroke);
}
.toggle-row .tr-t { font-size: 14.5px; font-weight: 700; }
.toggle-row .tr-s { font-size: 12px; color: var(--muted); margin-top: 3px; line-height: 1.4; }
.switch { position: relative; display: inline-block; width: 46px; height: 27px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch-track {
    position: absolute; inset: 0; background: var(--surface-3); border-radius: 999px;
    cursor: pointer; transition: background .18s;
}
.switch-track::before {
    content: ''; position: absolute; width: 21px; height: 21px; left: 3px; top: 3px;
    background: #fff; border-radius: 50%; transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch input:checked + .switch-track::before { transform: translateX(19px); }
.switch input:focus-visible + .switch-track { box-shadow: 0 0 0 3px var(--accent-soft); }
.spacer { flex: 1; }
.hidden { display: none !important; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }

.section-label {
    font-size: 11.5px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1px; color: var(--muted-2); margin: 4px 2px;
    display: flex; align-items: center; gap: 6px;
}

/* Inputs */
.field { position: relative; display: flex; align-items: center; }
.field .icon-left {
    position: absolute; left: 15px; width: 20px; height: 20px; color: var(--muted-2); pointer-events: none;
}
input[type="text"] {
    width: 100%; color: var(--text); font-size: 16px; font-family: inherit;
    background: var(--surface); border: 1.5px solid var(--stroke);
    border-radius: var(--radius-sm); padding: 15px 15px 15px 44px; outline: none;
    transition: border-color .16s, box-shadow .16s;
}
input[type="text"]::placeholder { color: var(--muted-2); }
input[type="text"]:focus {
    border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
input.code-input {
    text-align: center; letter-spacing: 12px; font-size: 26px; font-weight: 800;
    text-transform: uppercase; padding-left: 15px;
}
input.code-input::placeholder { letter-spacing: 10px; color: var(--muted-2); }

/* Buttons */
.btn {
    width: 100%; border: none; border-radius: var(--radius-sm);
    padding: 15px 18px; font-size: 16px; font-weight: 700; font-family: inherit;
    display: flex; align-items: center; justify-content: center; gap: 9px;
    cursor: pointer; user-select: none;
    transition: transform .07s ease, background .15s, opacity .15s, box-shadow .15s;
}
.btn svg { width: 20px; height: 20px; }
.btn:active { transform: scale(0.975); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 8px 22px rgba(255,122,26,.28); }
.btn-primary:not(:disabled):hover { background: var(--accent-2); }
.btn-primary:not(:disabled):active { background: var(--accent-press); }
.btn-secondary { background: var(--surface-2); border: 1px solid var(--stroke); color: var(--text); }
.btn-secondary:hover { background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--surface); color: var(--text); }
.btn-danger { background: transparent; border: 1px solid var(--stroke); color: var(--muted); }
.btn-danger:hover { color: var(--red); border-color: rgba(244,63,94,.35); background: rgba(244,63,94,.08); }
.btn-block-lg { padding: 18px; font-size: 17px; }

/* Action tiles */
.actions { display: grid; gap: 12px; }
.action-tile {
    display: flex; align-items: center; gap: 15px; padding: 17px;
    background: var(--surface); border: 1px solid var(--stroke);
    border-radius: var(--radius); cursor: pointer; text-align: left; width: 100%; color: var(--text);
    transition: transform .09s, border-color .16s, background .16s;
}
.action-tile:hover { border-color: var(--stroke-2); background: var(--surface-2); }
.action-tile:active { transform: scale(0.985); }
.action-tile .tile-icon {
    width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; flex-shrink: 0;
}
.action-tile .tile-icon svg { width: 25px; height: 25px; }
.action-tile.primary   .tile-icon { background: var(--accent); color: var(--on-accent); }
.action-tile.secondary .tile-icon { background: var(--surface-3); color: var(--accent); }
.action-tile .tile-text { flex: 1; }
.action-tile .tile-text .t { font-size: 16.5px; font-weight: 700; }
.action-tile .tile-text .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.action-tile .chev { color: var(--muted-2); width: 20px; height: 20px; flex-shrink: 0; }

.foot { text-align: center; color: var(--muted-2); font-size: 12px; padding: 18px 0 4px; }

/* Larry-Sprechblase (Startseite) */
.larry-teaser { margin-top: 46px; text-align: center; animation: fadeIn .4s ease; }
.larry-teaser .lt-label {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px;
    color: var(--muted-2); margin-bottom: 12px;
}
.lt-help {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    width: 15px; height: 15px; border-radius: 50%; flex-shrink: 0; padding: 0;
    background: var(--surface-2); border: 1px solid var(--stroke); color: var(--muted-2);
    cursor: pointer; transition: color .15s, border-color .15s, background .15s;
}
.lt-help svg { width: 9px; height: 9px; }
.lt-help:hover, .lt-help:focus-visible, .lt-help.open {
    color: var(--accent); border-color: var(--accent-ring); background: var(--accent-soft);
}
.lt-popover {
    position: absolute; bottom: calc(100% + 11px); left: 50%; transform: translateX(-50%) translateY(4px);
    width: 240px; max-width: 78vw;
    background: var(--bg-2); border: 1px solid var(--stroke-2); border-radius: 13px;
    padding: 12px 14px; box-shadow: var(--shadow);
    font-size: 12px; font-weight: 500; text-transform: none; letter-spacing: normal;
    color: var(--muted); line-height: 1.5; text-align: left; white-space: normal;
    opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
    z-index: 20;
}
.lt-popover::after {
    content: ''; position: absolute; top: 100%; left: 50%; margin-left: -6px;
    width: 11px; height: 11px; background: var(--bg-2);
    border-right: 1px solid var(--stroke-2); border-bottom: 1px solid var(--stroke-2);
    transform: rotate(45deg) translateY(-6px);
}
.lt-help:hover .lt-popover, .lt-help:focus-visible .lt-popover, .lt-help.open .lt-popover {
    opacity: 1; pointer-events: auto; transform: translateX(-50%) translateY(0);
}
.speech-bubble {
    position: relative; display: inline-flex; align-items: center; justify-content: center;
    max-width: 100%; min-height: 20px;
    background: var(--surface); border: 1px solid var(--stroke); border-radius: 16px;
    padding: 13px 20px; box-shadow: 0 10px 26px rgba(0, 0, 0, .3);
}
.speech-bubble::before {
    content: ''; position: absolute; top: -7px; left: 50%; margin-left: -7px;
    width: 13px; height: 13px; background: var(--surface);
    border-left: 1px solid var(--stroke); border-top: 1px solid var(--stroke);
    transform: rotate(45deg);
}
.speech-bubble .sb-text {
    font-size: 13.5px; font-style: italic; color: var(--muted); white-space: nowrap;
    transition: opacity .32s ease, transform .32s ease;
}
.speech-bubble .sb-text.sb-fade { opacity: 0; transform: translateY(4px); }
@media (max-width: 420px) {
    .speech-bubble .sb-text { white-space: normal; text-align: center; }
}

/* =========================================================
   START PAGE · Hintergrund-Effekt (Aurora + Partikel-Netz + Grain)
   ========================================================= */
.fx-aurora {
    position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
}
.fx-aurora span {
    position: absolute; width: 60vmax; height: 60vmax; border-radius: 50%;
    filter: blur(90px); will-change: transform;
}
.fx-aurora span:nth-child(1) { background: var(--accent); opacity: .28; top: -22%; left: -18%; animation: fxDrift1 26s ease-in-out infinite; }
.fx-aurora span:nth-child(2) { background: var(--mystery); opacity: .22; bottom: -28%; right: -18%; animation: fxDrift2 32s ease-in-out infinite; }
.fx-aurora span:nth-child(3) { background: var(--red); opacity: .14; top: 28%; right: 6%; width: 42vmax; height: 42vmax; animation: fxDrift3 40s ease-in-out infinite; }
@keyframes fxDrift1 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(9%, 11%) scale(1.15); } }
@keyframes fxDrift2 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-11%, -7%) scale(1.1); } }
@keyframes fxDrift3 { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(-7%, 9%) scale(.9); } }

#fxCanvas { position: fixed; inset: 0; z-index: 1; pointer-events: none; }

.fx-grain {
    position: fixed; inset: -60px; z-index: 2; pointer-events: none; opacity: .05; mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.fx-vignette {
    position: fixed; inset: 0; z-index: 3; pointer-events: none;
    background: radial-gradient(ellipse at 50% 38%, transparent 32%, rgba(10,10,12,.5) 76%, rgba(10,10,12,.92) 100%);
}
@media (prefers-reduced-motion: reduce) {
    .fx-aurora span { animation: none !important; }
}

.app { position: relative; z-index: 10; }

/* Help-Button + Regel-Modal */
.help-btn {
    position: fixed; top: calc(18px + var(--safe-t)); right: 18px; z-index: 30;
    background: rgba(22, 22, 25, .6); backdrop-filter: blur(10px); border-color: var(--stroke-2);
}
.rules-steps { display: flex; flex-direction: column; gap: 14px; }
.rules-step { display: flex; gap: 13px; align-items: flex-start; }
.rules-step .rs-icon {
    width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0; margin-top: 1px;
    display: grid; place-items: center; background: var(--accent-soft); color: var(--accent);
}
.rules-step .rs-icon svg { width: 17px; height: 17px; }
.rules-step .rs-text .rt { font-size: 14.5px; font-weight: 700; margin-bottom: 2px; }
.rules-step .rs-text .rs { font-size: 13px; color: var(--muted); line-height: 1.45; }
.rules-divider { height: 1px; background: var(--stroke); margin: 2px 0; }
.rules-tip {
    display: flex; align-items: flex-start; gap: 9px; padding: 12px 13px; border-radius: 12px;
    background: var(--surface); border: 1px solid var(--stroke); font-size: 12.5px; color: var(--muted); line-height: 1.45;
}
.rules-tip svg { width: 15px; height: 15px; color: var(--mystery); flex-shrink: 0; margin-top: 1px; }

/* =========================================================
   LOBBY · full-screen chat + sidebar
   ========================================================= */
.layout { display: flex; height: 100dvh; width: 100%; overflow: hidden; }

/* ---- Sidebar ---- */
.sidebar {
    width: 300px; flex-shrink: 0; background: var(--sidebar);
    border-right: 1px solid var(--stroke); display: flex; flex-direction: column;
    padding-top: var(--safe-t);
}
.sidebar-head {
    display: flex; align-items: center; gap: 11px; padding: 18px 18px 14px;
}
.sidebar-head .mini-logo {
    width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
    background: linear-gradient(150deg, var(--accent), var(--accent-press));
    display: grid; place-items: center;
}
.sidebar-head .mini-logo svg { width: 22px; height: 22px; color: #fff; }
.sidebar-head .st { font-weight: 800; font-size: 18px; letter-spacing: -0.3px; }
.sidebar-head .ss { font-size: 12px; color: var(--muted-2); }

/* Room code card */
.room-card {
    margin: 6px 14px 8px; padding: 13px 15px; border-radius: var(--radius-sm);
    background: var(--surface); border: 1px solid var(--stroke);
    display: flex; align-items: center; gap: 12px;
}
.room-card .rc-info { flex: 1; min-width: 0; }
.room-card .rc-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted-2); }
.room-card .rc-code { font-size: 22px; font-weight: 800; letter-spacing: 3px; color: var(--accent); }
.room-card .rc-actions { display: flex; gap: 7px; }
.icon-btn {
    width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
    background: var(--surface-2); border: 1px solid var(--stroke);
    display: grid; place-items: center; cursor: pointer; color: var(--muted);
    transition: color .15s, background .15s, transform .07s;
}
.icon-btn:hover { color: var(--text); background: var(--surface-3); }
.icon-btn:active { transform: scale(0.9); }
.icon-btn svg { width: 18px; height: 18px; }

/* Players */
.side-section {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px 8px; font-size: 11.5px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 1px; color: var(--muted-2);
}
.player-list {
    flex: 1; overflow-y: auto; padding: 0 10px; display: flex; flex-direction: column; gap: 2px;
    scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent;
}
.player-list::-webkit-scrollbar { width: 6px; }
.player-list::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }
.player-row {
    display: flex; align-items: center; gap: 11px; padding: 9px 10px;
    border-radius: 10px; transition: background .15s; animation: rowIn .25s ease;
}
.player-row:hover { background: var(--surface); }
@keyframes rowIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }
.avatar {
    width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
    display: grid; place-items: center; font-weight: 700; font-size: 16px; color: #fff;
    position: relative;
}
.avatar.host-ring { box-shadow: 0 0 0 2px var(--accent); }
.avatar .online {
    position: absolute; bottom: -2px; right: -2px; width: 12px; height: 12px; border-radius: 50%;
    background: var(--green); border: 2.5px solid var(--sidebar);
}
.player-row .pr-name { flex: 1; font-size: 14.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-row .pr-name .you { color: var(--muted-2); font-weight: 500; font-size: 12.5px; margin-left: 4px; }
.player-row .pr-name .host-crown { display: inline-flex; vertical-align: middle; margin-left: 5px; color: #e8b923; }
.player-row .pr-name .host-crown svg { width: 13px; height: 13px; }
.player-row .tag {
    font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px;
    padding: 3px 7px; border-radius: 6px; flex-shrink: 0;
    background: var(--accent-soft); color: var(--accent);
    display: inline-flex; align-items: center; gap: 3px;
}
.player-row .tag svg { width: 11px; height: 11px; }
.player-row.slot { opacity: .5; }
.player-row.slot .avatar { background: var(--surface-2) !important; color: var(--muted-2); font-weight: 400; }
.player-row.slot .pr-name { color: var(--muted-2); font-weight: 400; font-size: 13.5px; }
.player-row .rank {
    width: 18px; flex-shrink: 0; text-align: center; font-size: 12.5px; font-weight: 800; color: var(--muted-2);
}
.player-row .score-badge {
    font-size: 11px; font-weight: 700; letter-spacing: .2px; flex-shrink: 0;
    padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted-2);
}

/* Sidebar footer */
.sidebar-foot {
    padding: 12px 14px calc(14px + var(--safe-b)); border-top: 1px solid var(--stroke);
    display: flex; flex-direction: column; gap: 9px;
}
.host-hint { font-size: 12px; color: var(--muted-2); text-align: center; padding: 4px 0; }

/* ---- Main / chat ---- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; background: var(--bg); }
.chat-topbar {
    display: flex; align-items: center; gap: 12px; flex-shrink: 0;
    padding: calc(12px + var(--safe-t)) 16px 12px; border-bottom: 1px solid var(--stroke);
    background: var(--bg-2);
}
.chat-topbar .menu-btn { display: none; }
.chat-topbar .ct-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; }
.chat-topbar .ct-title .hash { color: var(--muted-2); }
.chat-topbar .ct-sub { font-size: 12.5px; color: var(--muted-2); font-weight: 500; }
.chat-topbar .grow { flex: 1; }

.role-banner {
    display: flex; align-items: center; justify-content: center; gap: 9px;
    flex-shrink: 0; padding: 11px 16px; font-weight: 800; font-size: 15px;
    letter-spacing: .3px; text-align: center;
    border-bottom: 1px solid var(--stroke);
}
.role-banner svg { width: 18px; height: 18px; flex-shrink: 0; }
.role-banner.word {
    background: var(--accent-soft); color: var(--accent);
}
.role-banner.imposter {
    background: rgba(244,63,94,.14); color: var(--red);
}

.chat-scroll {
    flex: 1; overflow-y: auto; padding: 18px 16px; display: flex; flex-direction: column; gap: 3px;
    scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent;
}
.chat-scroll::-webkit-scrollbar { width: 8px; }
.chat-scroll::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }

.chat-empty {
    margin: auto; text-align: center; color: var(--muted-2); font-size: 14px;
    display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 30px;
}
.chat-empty .ce-icon {
    width: 60px; height: 60px; border-radius: 18px; background: var(--surface); display: grid; place-items: center;
}
.chat-empty .ce-icon svg { width: 28px; height: 28px; color: var(--accent); }

/* Messages */
.msg { display: flex; flex-direction: column; max-width: min(560px, 78%); margin-bottom: 8px; animation: msgIn .2s ease; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.msg .who { font-size: 12px; font-weight: 700; margin: 0 3px 3px; }
.msg .bubble {
    padding: 10px 14px; border-radius: 16px; font-size: 15px; line-height: 1.45; word-break: break-word;
}
.msg.them { align-self: flex-start; }
.msg.them .bubble { background: var(--surface-2); color: var(--text); border-bottom-left-radius: 5px; }
.msg.me { align-self: flex-end; align-items: flex-end; }
.msg.me .bubble { background: var(--accent); color: var(--on-accent); font-weight: 500; border-bottom-right-radius: 5px; }
.msg.grouped { margin-top: -4px; }
.msg.grouped .who { display: none; }

.msg.system { align-self: stretch; max-width: 100%; margin: 10px 0; }
.msg.system .bubble {
    background: var(--surface); color: var(--text); font-size: 13.5px; font-weight: 500;
    text-align: left; padding: 12px 14px; border-radius: 13px; width: 100%;
    border: 1px solid var(--stroke-2); border-left: 3px solid var(--accent);
    display: flex; align-items: center; gap: 10px; box-shadow: 0 2px 12px rgba(0,0,0,.25);
}
.msg.system .bubble svg { width: 17px; height: 17px; color: var(--accent); flex-shrink: 0; }

/* Composer */
.composer {
    flex-shrink: 0; display: flex; gap: 10px; align-items: flex-end;
    padding: 12px 16px calc(14px + var(--safe-b)); border-top: 1px solid var(--stroke); background: var(--bg-2);
}
.composer input {
    flex: 1; padding: 13px 16px; font-size: 15px; font-family: inherit;
    border-radius: 14px; border: 1.5px solid var(--stroke); background: var(--surface);
    color: var(--text); outline: none; transition: border-color .15s;
}
.composer input:focus { border-color: var(--accent); }
.chat-send {
    width: 46px; height: 46px; border-radius: 13px; border: none; flex-shrink: 0;
    background: var(--accent); color: var(--on-accent); display: grid; place-items: center; cursor: pointer;
    transition: transform .07s, background .15s, opacity .15s;
}
.chat-send:hover { background: var(--accent-2); }
.chat-send:active { transform: scale(0.9); }
.chat-send:disabled { opacity: .4; }
.chat-send svg { width: 20px; height: 20px; }

/* ---- Drawer overlay (mobile) ---- */
.drawer-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity .22s; z-index: 40;
}
.drawer-overlay.show { opacity: 1; pointer-events: auto; }

@media (max-width: 899px) {
    .sidebar {
        position: fixed; top: 0; bottom: 0; left: 0; z-index: 50;
        width: 84%; max-width: 320px; transform: translateX(-100%);
        transition: transform .28s cubic-bezier(.22,1,.36,1); box-shadow: 12px 0 40px rgba(0,0,0,.5);
    }
    .sidebar.open { transform: translateX(0); }
    .chat-topbar .menu-btn { display: grid; }
}
@media (min-width: 900px) {
    .drawer-overlay { display: none !important; }
    .chat-topbar { padding-left: 22px; padding-right: 22px; }
}

/* =========================================================
   Shared: toast, spinner, sheet, overlay
   ========================================================= */
.toast {
    position: fixed; left: 50%; bottom: calc(28px + var(--safe-b));
    transform: translateX(-50%) translateY(20px);
    background: var(--surface-3); color: var(--text); border: 1px solid var(--stroke-2);
    padding: 12px 18px; border-radius: 13px; font-size: 14px; font-weight: 600;
    box-shadow: var(--shadow); opacity: 0; pointer-events: none;
    transition: opacity .2s, transform .2s; z-index: 200;
    display: flex; align-items: center; gap: 9px; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast svg { width: 18px; height: 18px; flex-shrink: 0; }
.toast.error svg { color: var(--red); }
.toast.ok svg { color: var(--green); }

.spinner {
    width: 20px; height: 20px; border-radius: 50%;
    border: 2.5px solid rgba(0,0,0,.25); border-top-color: currentColor; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(3px);
    opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 90;
}
.overlay.show { opacity: 1; pointer-events: auto; }
.sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 91;
    background: var(--bg-2); border-top-left-radius: 24px; border-top-right-radius: 24px;
    border-top: 1px solid var(--stroke-2); padding: 10px 20px calc(26px + var(--safe-b));
    transform: translateY(100%); transition: transform .3s cubic-bezier(.22,1,.36,1);
    max-width: 440px; margin: 0 auto; box-shadow: 0 -16px 50px rgba(0,0,0,.55);
}
.sheet.show { transform: translateY(0); }
.sheet .grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 8px auto 18px; }
.sheet h3 { font-size: 20px; font-weight: 800; margin-bottom: 4px; }
.sheet .sub { color: var(--muted); font-size: 14px; margin-bottom: 18px; }

.screen { animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* =========================================================
   Kick button (player rows)
   ========================================================= */
.player-row .kick-btn {
    width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0; border: none;
    background: transparent; color: var(--muted-2); display: grid; place-items: center;
    cursor: pointer; opacity: 0; transition: opacity .15s, color .15s, background .15s;
}
.player-row:hover .kick-btn { opacity: 1; }
.player-row .kick-btn:hover { color: var(--red); background: rgba(244,63,94,.12); }
.player-row .kick-btn svg { width: 15px; height: 15px; }
@media (max-width: 899px) { .player-row .kick-btn { opacity: .7; } }

/* =========================================================
   Settings modal
   ========================================================= */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,.65); backdrop-filter: blur(4px);
    opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 120;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal {
    position: fixed; left: 50%; top: 50%; z-index: 121;
    width: calc(100% - 32px); max-width: 440px; max-height: 86vh; overflow-y: auto;
    background: var(--bg-2); border: 1px solid var(--stroke-2); border-radius: 22px;
    padding: 20px; box-shadow: var(--shadow);
    transform: translate(-50%, -46%) scale(.96); opacity: 0; pointer-events: none;
    transition: opacity .2s, transform .22s cubic-bezier(.22,1,.36,1);
    scrollbar-width: thin; scrollbar-color: var(--surface-3) transparent;
}
.modal.show { transform: translate(-50%, -50%) scale(1); opacity: 1; pointer-events: auto; }
.modal::-webkit-scrollbar { width: 6px; }
.modal::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }

.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.modal-head h3 { font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 9px; }
.modal-head .mh-icon { width: 20px; height: 20px; color: var(--accent); }

.modal-note {
    display: flex; align-items: center; gap: 8px; margin: 10px 0 4px;
    padding: 10px 13px; border-radius: 11px; font-size: 13px; color: var(--muted);
    background: var(--accent-soft); border: 1px solid rgba(255,122,26,.2);
}
.modal-note svg { width: 15px; height: 15px; color: var(--accent); flex-shrink: 0; }
.modal.is-host .modal-note { display: none; }

.modal-body { display: flex; flex-direction: column; gap: 22px; margin-top: 18px; }
.setting-group { display: flex; flex-direction: column; gap: 10px; }
.setting-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--muted-2); }

/* Segmented control */
.segmented { display: flex; gap: 4px; background: var(--surface); border: 1px solid var(--stroke); border-radius: 12px; padding: 4px; }
.seg-btn {
    flex: 1; padding: 10px; border: none; border-radius: 9px; cursor: pointer;
    background: transparent; color: var(--muted); font-size: 14px; font-weight: 600; font-family: inherit;
    transition: background .15s, color .15s;
}
.seg-btn:hover { color: var(--text); }
.seg-btn.active { background: var(--accent); color: var(--on-accent); }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 9px 13px;
    border-radius: 999px; border: 1.5px solid var(--stroke); background: var(--surface);
    color: var(--muted); font-size: 13.5px; font-weight: 600; font-family: inherit; cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
}
.chip:hover { color: var(--text); border-color: var(--stroke-2); }
.chip .chip-emoji { font-size: 15px; }
.chip.active { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }

/* Stepper */
.stepper { display: inline-flex; align-items: center; gap: 4px; align-self: flex-start; background: var(--surface); border: 1px solid var(--stroke); border-radius: 12px; padding: 4px; }
.step-btn {
    width: 42px; height: 42px; border: none; border-radius: 9px; background: var(--surface-2); color: var(--text);
    font-size: 22px; font-weight: 700; cursor: pointer; font-family: inherit; transition: background .15s;
}
.step-btn:hover { background: var(--surface-3); }
.step-btn:active { transform: scale(.92); }
.step-val { min-width: 52px; text-align: center; font-size: 19px; font-weight: 800; }

/* Read-only (Nicht-Host) */
.modal.read-only .seg-btn, .modal.read-only .chip, .modal.read-only .step-btn { pointer-events: none; }
.modal.read-only .seg-btn:not(.active), .modal.read-only .chip:not(.active) { opacity: .45; }
.modal.read-only .stepper { opacity: .7; }

/* Modal footer (Speichern) */
.modal-foot { margin-top: 22px; }
.modal:not(.is-host) .modal-foot { display: none; }

/* =========================================================
   Game bar (Hinweise / Voting / Aktionen)
   ========================================================= */
.game-bar {
    flex-shrink: 0; padding: 12px 16px 4px; border-top: 1px solid var(--stroke);
    background: var(--bg-2); display: flex; flex-direction: column; gap: 10px;
}
.gb-status {
    font-size: 13px; font-weight: 700; color: var(--muted); text-align: center;
    display: flex; align-items: center; justify-content: center; gap: 6px;
}
.gb-action { margin-bottom: 2px; }
.gb-hint { font-size: 13px; color: var(--muted); text-align: center; font-weight: 600; margin-bottom: 2px; }

.vote-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (min-width: 600px) { .vote-grid { grid-template-columns: repeat(3, 1fr); } }
.vote-btn {
    display: flex; align-items: center; gap: 9px; padding: 10px 12px;
    border-radius: 12px; border: 1.5px solid var(--stroke); background: var(--surface);
    color: var(--text); font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
    transition: border-color .15s, background .15s, transform .07s; text-align: left;
}
.vote-btn:hover { border-color: var(--accent); background: var(--surface-2); }
.vote-btn:active { transform: scale(.97); }
.vote-btn .vb-av {
    width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0;
    display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff;
}
.vote-btn .vb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* aktueller Spieler (an der Reihe) */
.player-row.is-turn { background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent-ring); }

/* muted player rows */
.player-row.is-muted { opacity: .55; }
.player-row.is-muted .pr-name { text-decoration: line-through; text-decoration-color: var(--muted-2); }
.player-row .muted-tag { background: var(--surface-2); padding: 3px 6px; }
