:root {
    --bg-main: #0b0c10;
    --bg-surface: #13151c;
    --bg-elevated: #1c1f2b;
    --accent-red: #e63946;
    --accent-blue: #457b9d;
    --accent-gold: #f4a261;
    --text-primary: #f1faee;
    --text-muted: #8d99ae;
    --border-color: rgba(255, 255, 255, 0.08);
    --radius-lg: 16px;
    --radius-md: 10px;
}

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

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

.hidden { display: none !important; }

/* Топ-бар */
.topbar {
    height: 68px;
    padding: 0 32px;
    background: rgba(19, 21, 28, 0.85);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brand {
    font-weight: 800;
    font-size: 20px;
    letter-spacing: 1.5px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.brand span { color: var(--accent-red); }
.brand-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--accent-red);
    box-shadow: 0 0 12px var(--accent-red);
}

.user-panel {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
    font-weight: 600;
}

/* Кнопки */
.btn {
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    font-size: 13px;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-primary { background: var(--accent-red); color: #fff; }
.btn-primary:hover { background: #d62828; }
.btn-outline {
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-primary);
}
.btn-outline:hover { border-color: var(--accent-red); }
.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.btn-xsmas {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #e63946 0%, #9b2226 100%);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 10px 25px rgba(230, 57, 70, 0.25);
}

/* Контейнеры экранов */
.view-container { padding: 32px; max-width: 1440px; margin: 0 auto; }

.auth-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 68px);
}
.auth-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 42px;
    max-width: 440px;
    text-align: center;
}
.badge-tag {
    display: inline-block;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent-red);
    background: rgba(230, 57, 70, 0.12);
    padding: 5px 12px;
    border-radius: 20px;
    margin-bottom: 16px;
}
.auth-card h1 { font-size: 24px; margin-bottom: 12px; }
.auth-card p { font-size: 14px; color: var(--text-muted); line-height: 1.6; margin-bottom: 28px; }

.dev-sso-box {
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border-color);
    text-align: left;
    font-size: 12px;
    color: var(--text-muted);
}
.dev-sso-box form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }

/* Сетка комнат лобби */
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.rooms-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}
.room-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.room-meta { display: flex; justify-content: space-between; font-size: 13px; color: var(--text-muted); }

/* Игровой стол и расположение 10 кресел */
.game-layout {
    display: grid;
    grid-template-columns: 1fr 360px;
    gap: 24px;
    height: calc(100vh - 80px);
}
.table-area {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    position: relative;
}
.table-Hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}
.phase-indicator {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 15px;
}
.timer-pill {
    background: var(--accent-red);
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 13px;
}

.mafia-table {
    flex: 1;
    position: relative;
    margin: 30px;
    border-radius: 240px;
    background: radial-gradient(circle, #1d212f 0%, #10121a 100%);
    border: 3px solid rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 0 60px rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

.table-center-info { text-align: center; z-index: 2; }
.my-role-card {
    padding: 10px 22px;
    border-radius: 30px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.8px;
}
.private-check-toast {
    margin-top: 10px;
    font-size: 12px;
    color: var(--accent-gold);
    background: rgba(244, 162, 97, 0.12);
    padding: 6px 14px;
    border-radius: 8px;
}

/* Карточка кресла игрока */
.seat-node {
    position: absolute;
    width: 128px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 10px;
    text-align: center;
    transform: translate(-50%, -50%);
    transition: all 0.25s ease;
}
.seat-node.dead {
    opacity: 0.42;
    filter: grayscale(1);
    border-color: #e63946;
}
.seat-number-badge {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--bg-main);
    font-weight: 700;
    font-size: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
}
.seat-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.seat-role-tag {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--accent-gold);
    margin-top: 3px;
}
.seat-actions {
    margin-top: 6px;
    display: flex;
    gap: 4px;
    justify-content: center;
}
.seat-actions button {
    font-size: 10px;
    padding: 4px 7px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 700;
    background: var(--accent-red);
    color: #fff;
}

/* Протокол Судьи */
.judge-sidebar {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.live-dot {
    font-size: 11px;
    font-weight: 700;
    color: #2a9d8f;
}
.logs-stream {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.log-entry {
    font-size: 12px;
    line-height: 1.5;
    padding: 10px;
    background: var(--bg-elevated);
    border-radius: 8px;
    border-left: 3px solid var(--accent-red);
}
.log-entry .time { color: var(--text-muted); font-size: 10px; margin-right: 6px; }

/* Модальное окно админа */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(0, 0, 0, 0.78);
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal-window {
    background: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 1040px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 28px;
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.btn-close { background: none; border: none; color: #fff; font-size: 26px; cursor: pointer; }
.modal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.admin-card { background: var(--bg-elevated); padding: 18px; border-radius: var(--radius-md); }
.admin-card h4 { margin-bottom: 14px; font-size: 15px; }

input[type="text"], input[type="email"], input[type="number"], input[type="file"] {
    width: 100%;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: var(--bg-main);
    color: #fff;
    font-family: inherit;
    font-size: 13px;
}
.inline-form { display: flex; gap: 8px; margin-bottom: 14px; }
.stack-form { display: flex; flex-direction: column; gap: 12px; font-size: 12px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)); gap: 8px; }
.compact-list { list-style: none; max-height: 180px; overflow-y: auto; font-size: 12px; }
.compact-list li {
    display: flex; justify-content: space-between; align-items: center;
    padding: 6px 0; border-bottom: 1px solid var(--border-color);
}

@media (max-width: 980px) {
    .game-layout { grid-template-columns: 1fr; height: auto; }
    .mafia-table { height: 480px; margin: 10px; }
}