/* ═══════════════════════════════════════════════
   LW Imposter — Styles
   ═══════════════════════════════════════════════ */

:root {
    --bg: #050507;
    --surface: #0e0e14;
    --surface-2: #151520;
    --glass: rgba(18, 18, 28, 0.65);
    --glass-border: rgba(255, 255, 255, 0.06);
    --border: #1a1a28;
    --text: #eaeaf0;
    --text-muted: #55556a;
    --accent: #7c6cff;
    --accent-glow: rgba(124, 108, 255, 0.25);
    --green: #34d399;
    --red: #f87171;
    --yellow: #fbbf24;
    --radius: 18px;
    --radius-sm: 12px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ── Nav ───────────────────────────────────── */
.nav {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: saturate(180%) blur(24px);
    -webkit-backdrop-filter: saturate(180%) blur(24px);
    background: var(--glass);
    border-bottom: 1px solid var(--glass-border);
}
.nav-inner {
    max-width: 600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    height: 52px;
}
.nav-back {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    transition: color 0.2s;
}
.nav-back:hover { color: var(--text); }
.nav-title {
    font-weight: 700;
    font-size: 0.95rem;
}
.nav-username {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent);
}
.nav-guest {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ── App / Screens ─────────────────────────── */
.app {
    max-width: 600px;
    margin: 0 auto;
    padding: 1.5rem 1.25rem 4rem;
}
.screen { display: none; }
.screen.active { display: block; }

/* ── Home Screen ───────────────────────────── */
.hero {
    text-align: center;
    margin-bottom: 2rem;
}
.hero-icon {
    font-size: 3.5rem;
    margin-bottom: 0.5rem;
}
.hero h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.hero-sub {
    color: var(--text-muted);
    font-size: 0.88rem;
    margin-top: 0.4rem;
}

.guest-input-group {
    margin-bottom: 1.5rem;
}
.guest-input-group label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.guest-input-group input {
    width: 100%;
    padding: 0.7rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}
.guest-input-group input:focus {
    border-color: var(--accent);
}

.home-actions {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 2rem;
}
.divider {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin: 1.25rem 0;
    color: var(--text-muted);
    font-size: 0.75rem;
}
.divider::before, .divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}
.join-row {
    display: flex;
    gap: 0.5rem;
}
.code-input {
    flex: 1;
    padding: 0.65rem 0.8rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1.1rem;
    font-family: 'JetBrains Mono', monospace, inherit;
    font-weight: 700;
    text-align: center;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    outline: none;
}
.code-input:focus { border-color: var(--accent); }

/* ── Buttons ───────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    white-space: nowrap;
}
.btn:disabled { opacity: 0.4; pointer-events: none; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 0.95rem; width: 100%; }
.btn-sm { padding: 0.4rem 0.8rem; font-size: 0.78rem; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: #6b5ce7; transform: translateY(-1px); }
.btn-secondary { background: rgba(255,255,255,0.05); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--accent-glow); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #ef4444; }
.btn-ghost { background: none; color: var(--text-muted); }
.btn-ghost:hover { color: var(--text); }
.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    padding: 0.2rem;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.btn-icon:hover { opacity: 1; }

/* ── Rules ─────────────────────────────────── */
.home-rules {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}
.home-rules h3 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
}
.home-rules ol {
    padding-left: 1.2rem;
    color: var(--text-muted);
    font-size: 0.82rem;
    line-height: 1.7;
}
.home-rules strong { color: var(--text); font-weight: 600; }

/* ── Lobby Screen ──────────────────────────── */
.lobby-header {
    text-align: center;
    margin-bottom: 1.5rem;
}
.lobby-code-display {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.8rem 1.25rem;
}
.lobby-code-display .label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
}
.lobby-code-display .code {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    color: var(--accent);
    font-family: 'JetBrains Mono', monospace, inherit;
}

.player-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.5rem;
}
.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.7rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s;
}
.player-item.is-me { border-color: var(--accent-glow); }
.player-item.is-eliminated { opacity: 0.35; text-decoration: line-through; }
.player-item.is-disconnected { opacity: 0.5; }
.player-name {
    font-weight: 600;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.host-badge {
    font-size: 0.6rem;
    background: rgba(251, 191, 36, 0.12);
    color: var(--yellow);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-weight: 700;
    text-transform: uppercase;
}
.player-actions { display: flex; gap: 0.3rem; }

.lobby-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

/* ── Game Screen ───────────────────────────── */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
}
.round-info { display: flex; gap: 0.5rem; align-items: center; }
.round-badge {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.3rem 0.7rem;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
}
.phase-badge {
    padding: 0.3rem 0.7rem;
    border-radius: 8px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}
.phase-badge.phase-input { background: rgba(124, 108, 255, 0.12); color: var(--accent); }
.phase-badge.phase-vote { background: rgba(251, 191, 36, 0.12); color: var(--yellow); }
.phase-badge.phase-result { background: rgba(52, 211, 153, 0.12); color: var(--green); }

.timer {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 0.3rem 0.7rem;
    border-radius: 8px;
    font-size: 0.82rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.timer.urgent { color: var(--red); border-color: rgba(248, 113, 113, 0.3); }

/* ── Role Card ─────────────────────────────── */
.role-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    text-align: center;
    margin-bottom: 1.25rem;
    position: relative;
    overflow: hidden;
}
.role-card.is-imposter {
    border-color: rgba(248, 113, 113, 0.3);
}
.role-card.is-imposter::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--red), #fb923c);
}
.role-card.is-crew::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--green), #6ee7b7);
}
.role-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
    margin-bottom: 0.3rem;
}
.role-name {
    font-size: 1.5rem;
    font-weight: 800;
}
.role-card.is-imposter .role-name { color: var(--red); }
.role-card.is-crew .role-name { color: var(--green); }
.secret-word {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}
.secret-word .label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.3rem;
}
.secret-word .word {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent);
}

/* Kategorie-Hint (Imposter) */
.category-hint {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}
.category-hint .label {
    display: block;
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 0.3rem;
}
.category-hint .category {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--yellow);
}

/* ── Phase Panels ──────────────────────────── */
.phase-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.phase-panel h3 {
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}
.phase-hint {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-bottom: 1rem;
}
.input-row {
    display: flex;
    gap: 0.5rem;
}
.input-row input {
    flex: 1;
    padding: 0.6rem 0.9rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
}
.input-row input:focus { border-color: var(--accent); }
.guess-row {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}
.guess-row p {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.submitted-list {
    margin-top: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}
.submitted-chip {
    padding: 0.2rem 0.5rem;
    background: rgba(124, 108, 255, 0.08);
    border-radius: 6px;
    font-size: 0.7rem;
    color: var(--accent);
    border: 1px solid rgba(124, 108, 255, 0.15);
}
.submitted-chip.pending {
    background: rgba(85, 85, 106, 0.08);
    color: var(--text-muted);
    border-color: rgba(85, 85, 106, 0.15);
}

/* ── Submissions Display (Vote Phase) ──────── */
.submissions-display {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
}
.submission-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem;
    background: var(--bg);
    border-radius: 8px;
}
.submission-item .name { font-weight: 600; font-size: 0.82rem; }
.submission-item .word {
    font-weight: 500;
    font-size: 0.88rem;
    color: var(--accent);
}

/* ── Vote Targets ──────────────────────────── */
.vote-targets {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}
.vote-btn {
    width: 100%;
    padding: 0.65rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 0.88rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.vote-btn .vote-bar {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    background: rgba(124, 108, 255, 0.12);
    transition: width 0.4s ease;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
.vote-btn .vote-btn-name,
.vote-btn .vote-btn-count { position: relative; z-index: 1; }
.vote-btn .vote-btn-count {
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 700;
}
.vote-btn:hover:not(:disabled) { border-color: var(--accent-glow); background: var(--surface-2); }
.vote-btn.selected { border-color: var(--accent); background: rgba(124, 108, 255, 0.08); }
.vote-btn:disabled { opacity: 0.6; cursor: default; }
.vote-btn.voted { border-color: rgba(124, 108, 255, 0.2); }

/* Skip-Button als Vote-Bar */
#btn-skip-vote {
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 0.5rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.82rem;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
}
#btn-skip-vote .vote-bar {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    background: rgba(85, 85, 106, 0.15);
    transition: width 0.4s ease;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}
#btn-skip-vote .vote-btn-name,
#btn-skip-vote .vote-btn-count { position: relative; z-index: 1; }
#btn-skip-vote .vote-btn-count { font-weight: 700; color: var(--text-muted); }
#btn-skip-vote:disabled { opacity: 0.5; cursor: default; }

/* ── Result Card ───────────────────────────── */
.result-card {
    text-align: center;
    margin-bottom: 1.25rem;
}
.result-card h3 {
    font-size: 1.1rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}
.result-card .eliminated {
    color: var(--red);
    font-weight: 700;
}
.result-card .safe {
    color: var(--yellow);
}
.vote-results {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    margin-bottom: 1rem;
}
.vote-result-item {
    display: flex;
    justify-content: space-between;
    padding: 0.4rem 0.75rem;
    background: var(--bg);
    border-radius: 8px;
    font-size: 0.82rem;
    position: relative;
    overflow: hidden;
}
.vote-result-item .vote-bar {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    background: rgba(124, 108, 255, 0.1);
    transition: width 0.4s ease;
    border-radius: 8px 0 0 8px;
}
.vote-result-item span { position: relative; z-index: 1; }
.vote-count {
    font-weight: 700;
    color: var(--accent);
}

/* ── Game Over ─────────────────────────────── */
.gameover-card {
    text-align: center;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
}
.gameover-card h2 {
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
}
.gameover-card .winner-crew { color: var(--green); }
.gameover-card .winner-imposter { color: var(--red); }
.gameover-card p {
    color: var(--text-muted);
    font-size: 0.88rem;
}
.gameover-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
}

/* ── Toasts ────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 200;
    display: flex;
    flex-direction: column-reverse;
    gap: 0.5rem;
}
.toast {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.6rem 1.2rem;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    animation: toastIn 0.3s ease-out;
    box-shadow: 0 8px 30px rgba(0,0,0,0.4);
}
.toast.error { border-color: rgba(248, 113, 113, 0.3); color: var(--red); }
.toast.success { border-color: rgba(52, 211, 153, 0.3); color: var(--green); }
.toast.warning { border-color: rgba(251, 191, 36, 0.3); color: var(--yellow); }

@keyframes toastIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Lobby Settings ────────────────────────── */
.lobby-settings {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
}
.lobby-settings h3 {
    font-size: 0.88rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: var(--text-muted);
}
.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0;
}
.setting-row label {
    font-size: 0.82rem;
    color: var(--text);
    font-weight: 500;
}
.setting-row select {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-family: inherit;
    font-size: 0.82rem;
    padding: 0.35rem 0.6rem;
    cursor: pointer;
    outline: none;
}
.setting-row select:focus { border-color: var(--accent); }

/* ── Game Header Right ─────────────────────── */
.game-header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
#btn-end-game {
    font-size: 1.1rem;
    padding: 0.3rem 0.5rem;
    border-radius: 8px;
    border: 1px solid rgba(248, 113, 113, 0.2);
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
}
#btn-end-game:hover { background: rgba(248, 113, 113, 0.1); }

/* ── Live Submissions (Input Phase) ────────── */
.live-submissions {
    margin-top: 1rem;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}
.live-submissions h4 {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.5rem;
}

/* ── Kick Area in Game ─────────────────────── */
.game-kick-area {
    margin-top: 1rem;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}
.game-kick-area summary {
    font-size: 0.78rem;
    color: var(--text-muted);
    cursor: pointer;
    user-select: none;
}
.kick-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.3rem 0;
    font-size: 0.82rem;
}

/* ── Result Actions ────────────────────────── */
.result-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* ── Tag Styles ────────────────────────────── */
.tag-me { opacity: 0.4; font-size: 0.7rem; }
.tag-dc { opacity: 0.4; font-size: 0.7rem; }

/* ── Responsive ────────────────────────────── */
@media (max-width: 500px) {
    .app { padding: 1rem 1rem 3rem; }
    .hero h1 { font-size: 1.6rem; }
    .secret-word .word { font-size: 1.4rem; }
}
