.app {
    display: grid;
    grid-template-columns: 300px 1fr 300px;
    gap: 20px;
    padding: clamp(16px, 2.5vw, 28px) var(--content-pad);
    max-width: var(--content-w);
    margin: 0 auto;
}

.main-content {
    min-width: 0;
}

/* Nickname Overlay */
.overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.95);
    z-index: 2000;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.login-box {
    background: var(--card-bg);
    padding: 40px; border-radius: 10px; border: 1px solid #333;
    text-align: center; width: 300px;
}
.login-box input {
    width: 100%; padding: 12px; margin: 20px 0;
    background: #000; border: 1px solid #444; color: white; border-radius: 5px; box-sizing: border-box;
}

/* Player Cards */
.player-card {
    background: var(--card-bg);
    border-radius: 8px; border: 1px solid #333;
    padding: 12px; display: flex; align-items: center; gap: 12px;
    margin-bottom: 10px; position: relative;
    transition: 0.3s;
}
.player-card.is-me { border-color: var(--primary); }
.player-card.is-offline { opacity: 0.3; filter: grayscale(1); }
.offline-tag { font-size: 0.5rem; color: #888; margin-top: 2px; }

.avatar {
    width: 40px; height: 40px; background: #333; border-radius: 50%;
    display: flex; align-items: center; justify-content: center; font-weight: bold;
    flex-shrink: 0;
}
.player-name { font-weight: bold; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.captain-badge {
    font-size: 0.6rem; color: var(--primary); border: 1px solid var(--primary);
    padding: 1px 4px; border-radius: 3px; text-transform: uppercase;
}

/* Columns */
.col-header {
    font-weight: 900; margin-bottom: 20px; text-transform: uppercase;
    letter-spacing: 2px; text-align: center;
}
.unassigned-list {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; width: 100%;
}

/* Main Content */
.match-info {
    text-align: center; border-radius: 12px;
    background: rgba(0,0,0,0.3); padding: 20px;
}
.match-status { color: var(--dim-text); font-size: 1rem; letter-spacing: 3px; font-weight: 900; }
.match-title { font-size: clamp(1.6rem, 5vw, 2.6rem); font-weight: 900; color: var(--primary); margin: 10px 0 30px 0; }

/* Veto Grid */
.map-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px; margin-top: 30px;
}
.map-card {
    background: #111; border-radius: 12px; overflow: hidden; position: relative; cursor: pointer;
    border: 3px solid #333; transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: content-box;
}
.map-card:hover:not(.banned):not(.picked):not(.not-my-turn) { border-color: var(--primary); transform: scale(1.02); }
.map-card.not-my-turn { opacity: 0.4; filter: grayscale(0.8); cursor: not-allowed; }
.map-card.not-my-turn:hover { transform: none; }
.map-card.banned { opacity: 0.15; filter: grayscale(1); cursor: default; }
.map-card.picked { border-color: #4CAF50; box-shadow: 0 0 20px rgba(76, 175, 80, 0.3); }
.map-card.decider { border-color: #FF9800; box-shadow: 0 0 200px rgba(255, 152, 0, 0.2); }
.map-card.is-pending { 
    border-color: #ff9800; 
    transform: scale(1.05); 
    box-shadow: 0 0 15px rgba(255, 152, 0, 0.5); 
    animation: pulse-border 1.5s infinite;
}

.map-card.is-pending:hover { 
    animation: none; 
    border-color: #ffcc00;
    transform: scale(1.08);
}

@keyframes pulse-border {
    0% { border-color: #ff9800; box-shadow: 0 0 5px rgba(255, 152, 0, 0.2); }
    50% { border-color: #ffcc00; box-shadow: 0 0 20px rgba(255, 152, 0, 0.6); }
    100% { border-color: #ff9800; box-shadow: 0 0 5px rgba(255, 152, 0, 0.2); }
}

.map-img { 
    height: 120px; width: 100%; 
    background-size: 40% auto; 
    background-repeat: no-repeat;
    background-position: center; 
    transition: 0.5s; 
    margin-top: 5px;
}
.map-card:hover .map-img { transform: scale(1.1); }

.map-details {
    flex: 1; padding: 0 10px 15px 10px; display: flex; align-items: flex-end; justify-content: center;
    position: relative;
}

.map-status-tag { 
    position: absolute; top: 10px; left: 50%; transform: translateX(-50%);
    background: var(--primary); color: black;
    padding: 2px 8px; border-radius: 4px; font-size: 0.6rem; font-weight: 900; z-index: 5;
}

.voters-list {
    display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; width: 100%;
}
.voter-avatar {
    width: 22px; height: 22px; border-radius: 50%; border: 1px solid #333;
    background-size: cover; background-position: center; transition: 0.2s;
}
.voter-avatar:hover { transform: scale(1.2); z-index: 10; }

.veto-history {
    margin: 20px 0; font-size: 0.8rem; color: #555; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px;
}
.history-item { background: #111; padding: 4px 10px; border-radius: 20px; border: 1px solid #222; }
.history-item.ban { color: #ff4444; }
.history-item.pick { color: #44ff44; }

/* Final Maps */
.final-maps-container {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 30px;
}
.final-map-item {
    background: #111; border-radius: 10px; overflow: hidden; border: 1px solid #333;
}
.final-map-img { 
    height: 100px; 
    background-size: 40% auto; 
    background-repeat: no-repeat;
    background-position: center; 
    background-color: rgba(255,255,255,0.03);
    margin-bottom: 5px;
}
.final-map-info { padding: 10px; font-size: 0.8rem; }

/* Admin */
.admin-panel {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: #000; border: 1px solid var(--primary); padding: 12px 25px;
    display: flex; gap: 15px; border-radius: 50px; z-index: 500; align-items: center;
    box-shadow: 0 0 30px rgba(255, 85, 0, 0.2);
}
.btn.tech { background: #ff4444; color: white; }
.btn.unpause { background: #4CAF50; color: white; }
.btn.pause-toggle.active { background: #4CAF50; }
.btn.pause-toggle.inactive { background: #ff4444; }
.btn.restore { background: #f4c430; color: black; }

/* ===== SELF (2v2): выбор карты капитанами (бан/бан/рулетка) ===== */
.self-veto-box {
    background: rgba(18, 19, 26, 0.65);
    border: 1px solid rgba(255, 85, 0, 0.2);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    backdrop-filter: blur(12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.05);
    min-width: 0;
}
.self-veto-head {
    font-family: 'Outfit', sans-serif;
    font-size: 1.1rem;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 20px;
    color: #e2e4e9;
    text-transform: uppercase;
}
.self-turn-you { 
    color: var(--primary); 
    font-weight: 900; 
    text-shadow: 0 0 10px rgba(255, 85, 0, 0.3);
}

.self-map-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}
@media (max-width: 640px) { .self-map-grid { grid-template-columns: repeat(2, 1fr); } }

.self-map-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid #20222b;
    background: #111218;
    transition: transform 0.25s cubic-bezier(0.25, 1, 0.5, 1), border-color 0.25s, box-shadow 0.25s, filter 0.3s;
}
.self-map-img {
    height: 100px;
    background-size: cover;
    background-position: center;
    transition: transform 0.5s;
}
.self-map-card:hover .self-map-img {
    transform: scale(1.08);
}
.self-map-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 0.85rem;
    letter-spacing: 1.5px;
    padding: 10px 4px;
    text-align: center;
    color: #989fb1;
    background: #15161f;
}
.self-map-card.is-clickable { cursor: pointer; }
.self-map-card.is-clickable:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 8px 24px rgba(255, 85, 0, 0.25);
}
.self-map-card.is-clickable:hover .self-map-name {
    color: #fff;
}
.self-map-card.is-banned { 
    filter: grayscale(1) brightness(0.3); 
    border-color: #1a1b23;
}
.self-map-card.is-banned .self-map-img { filter: blur(2px); }
.self-map-x {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) rotate(-8deg);
    background: linear-gradient(135deg, #e52d27, #b31217);
    color: #fff;
    font-weight: 950;
    font-size: 0.9rem;
    letter-spacing: 3px;
    padding: 5px 16px;
    border-radius: 6px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.5);
    border: 1px solid rgba(255,255,255,0.1);
}

.self-spin-btn {
    margin-top: 20px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-weight: 900;
    letter-spacing: 1.5px;
    padding: 14px 28px;
    background: linear-gradient(135deg, var(--primary) 0%, #ff8c00 100%);
    color: #000;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(255, 85, 0, 0.4);
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}
.self-spin-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(255, 85, 0, 0.6);
    filter: brightness(1.1);
}
.self-spin-btn:disabled {
    opacity: 0.5;
    background: #333;
    color: #666;
    box-shadow: none;
    cursor: not-allowed;
}
.self-spin-btn svg, .self-spin-btn .icon { width: 18px; height: 18px; }

/* Рулетка: горизонтальная лента */
.self-reel-window {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    border: 2px solid #20222b;
    background: #08090c;
    height: 140px;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
/* Эффект выцветания по краям */
.self-reel-window::before {
    content: '';
    position: absolute;
    top: 0; left: 0; bottom: 0;
    width: 90px;
    background: linear-gradient(to right, #08090c 0%, transparent 100%);
    z-index: 2;
    pointer-events: none;
}
.self-reel-window::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 90px;
    background: linear-gradient(to left, #08090c 0%, transparent 100%);
    z-index: 2;
    pointer-events: none;
}
.self-reel-marker {
    position: absolute;
    top: 0; bottom: 0; left: 50%;
    width: 2px;
    margin-left: -1px;
    background: rgba(255, 85, 0, 0.65);
    z-index: 10;
    box-shadow: 0 0 10px rgba(255, 85, 0, 0.4);
    pointer-events: none;
    transform: translateZ(0);
}
.self-reel-marker::before,
.self-reel-marker::after {
    content: '';
    position: absolute; left: 50%; transform: translateX(-50%);
    border: 6px solid transparent;
    z-index: 11;
    filter: drop-shadow(0 0 3px rgba(255, 85, 0, 0.5));
}
.self-reel-marker::before { top: 0; border-top-color: rgba(255, 85, 0, 0.85); }
.self-reel-marker::after { bottom: -1px; border-bottom-color: rgba(255, 85, 0, 0.85); }

.self-reel-strip {
    display: flex;
    height: 100%;
    will-change: transform;
}
.self-reel-item {
    width: 172px;
    flex: 0 0 172px;
    height: 100%;
    padding: 10px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s;
    opacity: 0.65;
}
.self-reel-item.is-winner {
    opacity: 1;
    transform: scale(1.06);
    z-index: 3;
}
.self-reel-img {
    width: 152px;
    height: 85px;
    flex-shrink: 0;
    border-radius: 10px;
    background-size: cover;
    background-position: center;
    border: 2px solid #20222b;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.6);
    transition: border-color 0.3s, box-shadow 0.3s;
}
.self-reel-name {
    text-align: center;
    font-family: 'Outfit', sans-serif;
    font-weight: 800;
    font-size: 0.75rem;
    letter-spacing: 1px;
    margin-top: 8px;
    color: #8f93a1;
    text-transform: uppercase;
    transition: color 0.3s, text-shadow 0.3s;
    flex-shrink: 0;
}
.self-reel-item.is-winner .self-reel-img { 
    border-color: #ff9800; 
    box-shadow: 0 0 25px rgba(255, 152, 0, 0.85), inset 0 0 10px rgba(255, 152, 0, 0.4); 
    animation: winner-pulse 1.8s infinite alternate;
}
.self-reel-item.is-winner .self-reel-name { 
    color: #ffdd00; 
    text-shadow: 0 0 10px rgba(255, 221, 0, 0.8);
}

.self-chosen-label {
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    letter-spacing: 2px;
    color: var(--dim-text, #888);
    font-size: 0.8rem;
    margin-bottom: 12px;
    text-align: center;
}
.self-chosen-label.spin { color: var(--primary); }
.self-chosen-card {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 2px solid var(--primary);
    box-shadow: 0 0 24px rgba(255, 85, 0, 0.25);
    max-width: 360px;
    margin: 0 auto;
}
.self-chosen-img {
    height: 150px;
    background-size: cover;
    background-position: center;
}
.self-chosen-name {
    font-family: 'Outfit', sans-serif;
    font-weight: 900;
    font-size: 1.4rem;
    letter-spacing: 3px;
    padding: 12px;
    text-align: center;
    color: var(--primary);
}

/* Лобби (ссылка/пароль + форма для капитанов) */
.self-lobby-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.self-lobby-link {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 14px 28px;
    font-size: 1rem;
    border-radius: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 900;
}
.self-lobby-link svg, .self-lobby-link .icon { width: 18px; height: 18px; }
.self-lobby-pass { font-size: 0.95rem; color: #ccc; }
.self-lobby-pass b { color: var(--primary); font-family: monospace; font-size: 1.1rem; letter-spacing: 1px; }
.self-lobby-wait { color: #888; font-size: 0.9rem; text-align: center; }
.self-lobby-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    width: 100%;
    margin-top: 8px;
}
.self-lobby-form input {
    flex: 1 1 200px;
    min-width: 0;
    background: #111;
    border: 1px solid #333;
    color: #fff;
    padding: 9px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    outline: none;
}
.self-lobby-form input:focus { border-color: var(--primary); }

@keyframes winner-pulse {
    0% {
        box-shadow: 0 0 15px rgba(255, 152, 0, 0.6), inset 0 0 10px rgba(255, 152, 0, 0.4);
    }
    100% {
        box-shadow: 0 0 35px rgba(255, 152, 0, 1), inset 0 0 15px rgba(255, 152, 0, 0.6);
        transform: scale(1.03);
    }
}

/* ===================== MOBILE ===================== */
@media (max-width: 768px) {
    /* Главный фикс: жёсткая сетка 300|1fr|300 в одну колонку —
       команда 1, центр, команда 2 идут стопкой. */
    .app {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .final-maps-container { grid-template-columns: repeat(2, 1fr); }

    /* Инлайновые крупные шрифты центра лобби (заданы в LobbyView.js). */
    .match-title h1 { font-size: clamp(1.6rem, 8vw, 2.4rem) !important; }
    #score-display { font-size: clamp(2.4rem, 12vw, 4rem) !important; }

    /* Плавающая админ-панель: не вылезать за экран, переносить кнопки. */
    .admin-panel {
        width: calc(100% - 24px);
        max-width: 420px;
        flex-wrap: wrap;
        justify-content: center;
        border-radius: 16px;
        padding: 10px 14px;
        gap: 10px;
    }

    .login-box { width: 100%; max-width: 340px; }
}

@media (max-width: 480px) {
    .unassigned-list { grid-template-columns: 1fr; }
    .final-maps-container { grid-template-columns: 1fr; }
}
