:root {
    --bg: #0d0d0d;
    --bg2: #1a1a1a;
    --bg3: #252525;
    --text: #f0f0f0;
    --text-dim: #999;
    --accent: #ff2d55;
    --accent2: #ff6b35;
    --black-card: #111;
    --white-card: #f5f5f5;
    --white-text: #111;
    --success: #30d158;
    --danger: #ff453a;
    --border: #333;
    --radius: 12px;
    --shadow: 0 8px 32px rgba(0,0,0,0.5);
}

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

body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

.screen {
    display: none;
    min-height: 100vh;
}
.screen.active {
    display: block;
}

/* LANDING */
.hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: 2rem;
    background: radial-gradient(ellipse at center, #1a0a0f 0%, #0d0d0d 70%);
}

.hero h1 {
    font-family: 'Space Mono', monospace;
    font-size: clamp(2.5rem, 8vw, 5rem);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -2px;
    margin-bottom: 1rem;
}

.accent {
    color: var(--accent);
    text-shadow: 0 0 40px rgba(255,45,85,0.4);
}

.tagline {
    font-size: 1.2rem;
    color: var(--text-dim);
    margin-bottom: 0.5rem;
}

.deck-info {
    font-size: 0.9rem;
    color: var(--accent2);
    margin-bottom: 2rem;
}

.landing-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-bottom: 2rem;
}

.warning {
    color: var(--danger);
    font-size: 0.85rem;
    max-width: 400px;
}

/* BUTTONS */
.btn {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.85rem 1.8rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-primary {
    background: var(--accent);
    color: white;
}
.btn-primary:hover { background: #ff4d6d; box-shadow: 0 0 20px rgba(255,45,85,0.4); }

.btn-secondary {
    background: var(--bg3);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: #333; }

.btn-ghost {
    background: transparent;
    color: var(--text-dim);
}
.btn-ghost:hover { color: var(--text); }

.btn-danger {
    background: var(--danger);
    color: white;
}
.btn-sm {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}
.btn-block {
    width: 100%;
    margin-bottom: 0.5rem;
}

/* PANEL */
.panel {
    max-width: 480px;
    margin: 4rem auto;
    padding: 2rem;
    background: var(--bg2);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}
.panel.big {
    text-align: center;
    max-width: 500px;
}
.panel h2 {
    font-family: 'Space Mono', monospace;
    margin-bottom: 1.5rem;
    color: var(--accent);
}

label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-dim);
    margin: 1rem 0 0.4rem;
}
input[type="text"], input[type="number"], textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
}
input:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
}
.rules-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem 1rem;
}
.rules-grid label {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.checkbox {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}
.btn-row {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* GAME LAYOUT */
.game-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
}
.room-code {
    font-family: 'Space Mono', monospace;
    font-weight: 700;
    font-size: 1.1rem;
}
.room-code span {
    color: var(--accent);
    letter-spacing: 3px;
}
.round-info {
    color: var(--text-dim);
    font-size: 0.9rem;
}
.header-actions {
    display: flex;
    gap: 0.5rem;
}

.game-layout {
    display: grid;
    grid-template-columns: 240px 1fr 260px;
    gap: 0;
    min-height: calc(100vh - 56px);
}

.sidebar, .chat-sidebar {
    background: var(--bg2);
    padding: 1rem;
    border-right: 1px solid var(--border);
    overflow-y: auto;
}
.chat-sidebar {
    border-right: none;
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.sidebar h3, .chat-sidebar h3 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-dim);
    margin-bottom: 0.75rem;
}

#player-list {
    list-style: none;
    margin-bottom: 1.5rem;
}
#player-list li {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0;
    font-size: 0.9rem;
}
#player-list .badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    background: var(--bg3);
    color: var(--text-dim);
}
#player-list .badge.czar {
    background: var(--accent);
    color: white;
}
#player-list .badge.admin {
    background: var(--accent2);
    color: white;
}
#player-list .played-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    margin-left: auto;
}

.scores-box, .rules-display {
    margin-top: 1.5rem;
    font-size: 0.85rem;
}
#score-list div {
    display: flex;
    justify-content: space-between;
    padding: 0.25rem 0;
}
#rules-text {
    color: var(--text-dim);
    font-size: 0.8rem;
    line-height: 1.4;
}

.main-area {
    padding: 1.5rem;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.status-msg {
    font-size: 1.1rem;
    color: var(--accent);
    margin-bottom: 1.5rem;
    text-align: center;
    font-weight: 600;
}

/* CARDS */
.card {
    width: 160px;
    min-height: 200px;
    border-radius: 10px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    transition: transform 0.15s, box-shadow 0.15s;
    cursor: default;
    position: relative;
    user-select: none;
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 30px rgba(0,0,0,0.5);
}

.black-card {
    background: var(--black-card);
    color: white;
    border: 2px solid #333;
    width: 220px;
    min-height: 280px;
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.35;
}
.black-card .card-pick {
    font-size: 0.75rem;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 1rem;
}

.white-card {
    background: var(--white-card);
    color: var(--white-text);
    border: 2px solid #ddd;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.3;
    cursor: pointer;
}
.white-card.selected {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent), 0 8px 30px rgba(0,0,0,0.5);
    transform: translateY(-8px);
}
.white-card .card-num {
    position: absolute;
    top: 6px;
    right: 8px;
    font-size: 0.7rem;
    color: #999;
}

.cards-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.hand .white-card {
    width: 140px;
    min-height: 180px;
    font-size: 0.85rem;
}

.black-card-area {
    margin-bottom: 2rem;
}

.hand-area {
    width: 100%;
    text-align: center;
}
.hand-area h3 {
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--text-dim);
}
#pick-hint {
    color: var(--accent);
}

.judging-area {
    width: 100%;
    text-align: center;
}
.judging-area h3 {
    margin-bottom: 1rem;
    color: var(--text-dim);
}
.judging-area .white-card {
    cursor: pointer;
}
.judging-area .white-card:hover {
    border-color: var(--success);
}

.winner-reveal {
    text-align: center;
}
.winner-reveal h2 {
    color: var(--success);
    margin-bottom: 1rem;
}

/* CHAT */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    max-height: calc(100vh - 200px);
}
.chat-msg {
    margin-bottom: 0.5rem;
    line-height: 1.3;
}
.chat-msg .name {
    color: var(--accent2);
    font-weight: 600;
}
.chat-input {
    display: flex;
    gap: 0.4rem;
}
.chat-input input {
    flex: 1;
    padding: 0.5rem;
    font-size: 0.85rem;
}

/* MODAL */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}
.modal.hidden { display: none; }
.modal-content {
    background: var(--bg2);
    padding: 2rem;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    max-width: 440px;
    width: 90%;
}

.hidden { display: none !important; }

/* TOAST */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg3);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    z-index: 200;
    font-size: 0.9rem;
    box-shadow: var(--shadow);
}
.toast.hidden { display: none; }
.toast.error { border-color: var(--danger); color: var(--danger); }

/* RESPONSIVE */
@media (max-width: 900px) {
    .game-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr auto;
    }
    .sidebar, .chat-sidebar {
        border: none;
        border-bottom: 1px solid var(--border);
        max-height: 200px;
    }
    .chat-sidebar {
        max-height: 180px;
    }
    .black-card {
        width: 180px;
        min-height: 220px;
        font-size: 1rem;
    }
    .hand .white-card {
        width: 110px;
        min-height: 140px;
        font-size: 0.75rem;
    }
}
