* {
    box-sizing: border-box;
}

:root {
    --bg-color: #1a1a2e;
    --panel-bg: #16213e;
    --card-bg: #eaeaea;
    --card-text: #2c3e50;
    --red-team: #e74c3c;
    --blue-team: #3498db;
    --neutral: #d7ccc8;
    --assassin: #212121;
}

html,
body {
    margin: 0;
    width: 100%;
    height: 100%;
}

body {
    background-color: var(--bg-color);
    color: white;
    font-family: "Segoe UI", Tahoma, sans-serif;
    padding: 4px;

    height: 100vh;
    height: 100dvh;

    overflow: hidden;
    display: flex;
    justify-content: center;

    -webkit-tap-highlight-color: transparent;
    overscroll-behavior: none;
}

.game-container {
    width: 100%;
    ax-width: 1000px;
    height: 100%;

    display: flex;
    flex-direction: column;
}

header {
    flex: 0 0 auto;

    display: flex;
    flex-direction: column;
    gap: 5px;

    margin-bottom: 5px;
}

.top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;

    background: var(--panel-bg);
    padding: 5px 10px;
    border-radius: 6px;
}

h1 {
    margin: 0;
    font-size: 1.1rem;
    color: #f39c12;
    letter-spacing: 1px;
}

.scoreboard {
    display: flex;
    gap: 10px;

    font-weight: bold;
    font-size: 0.95rem;
}

.red-team {
    color: var(--red-team);
}

.blue-team {
    color: var(--blue-team);
}

.controls {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: center;
}

button,
.adult-mode-container {
    padding: 6px 10px;
    border: none;
    border-radius: 4px;

    font-family: inherit;
    font-size: 0.8rem;
    font-weight: bold;

    cursor: pointer;
    color: white;
    margin: 0;

    touch-action: manipulation;
}

.spymaster-btn {
    background-color: #9b59b6;
}

.spymaster-btn:hover {
    background-color: #8e44ad;
}

.spymaster-active {
    background-color: #27ae60 !important;
}

.restart-btn {
    background-color: #7f8c8d;
}

.restart-btn:hover {
    background-color: #95a5a6;
}

.adult-mode-container {
    background-color: #c0392b;
    align-items: center;
    display: flex;
}

.adult-mode-container input {
    margin-right: 4px;
    transform: scale(1.1);
}

.status-bar {
    position: relative;

    text-align: center;
    background: var(--panel-bg);

    padding: 2px 28px;
    border-radius: 4px;
    font-size: 0.85rem;
}

.sync-status {
    position: absolute;
    right: 9px;
    top: 50%;
    transform: translateY(-50%);

    font-size: 0.8rem;
}

.sync-ok {
    color: #2ecc71;
}

.sync-working {
    color: #f1c40f;
}

.sync-error {
    color: #e74c3c;
}

/* PLANSZA 5x5 */
.board {
    flex: 1 1 auto;
    min-height: 0;

    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: repeat(5, minmax(0, 1fr));

    gap: 8px;
    padding: 2px;
}

.card {
    appearance: none;
    -webkit-appearance: none;

    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;

    background-color: var(--card-bg);
    color: var(--card-text);

    border: 0;
    border-radius: 8px;

    display: flex;
    align-items: center;
    justify-content: center;

    text-align: center;
    font-weight: bold;
    font-size: clamp(0.5rem, 2.5vmin, 1.1rem);
    line-height: 1.1;
    text-transform: uppercase;

    padding: 4px;
    overflow: hidden;
    overflow-wrap: anywhere;

    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);

    cursor: pointer;
    transition: transform 0.1s;
}

.card:active {
    transform: scale(0.95);
}

/* ODKRYTE KARTY */
.card.revealed {
    pointer-events: none;
    color: white;

    box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5);
    border: none;
}

.card.revealed.red {
    background-color: var(--red-team);
}

.card.revealed.blue {
    background-color: var(--blue-team);
}

.card.revealed.neutral {
    background-color: var(--neutral);
    color: #333;
}

.card.revealed.assassin {
    background-color: var(--assassin);
}

.card.game-over-card {
    opacity: 0.6;
}

/* WIDOK SZEFA — WYŁĄCZNIE LOKALNY */
.spymaster-view .card:not(.revealed).red {
    background-color: #f1948a !important;
    border: 4px solid #922b21 !important;
    color: #511510 !important;
    font-weight: 900;
}

.spymaster-view .card:not(.revealed).blue {
    background-color: #85c1e9 !important;
    border: 4px solid #1b4f72 !important;
    color: #102a3c !important;
    font-weight: 900;
}

.spymaster-view .card:not(.revealed).neutral {
    background-color: #f9e79f !important;
    border: 4px solid #b7950b !important;
    color: #5d4037 !important;
    font-weight: 900;
}

.spymaster-view .card:not(.revealed).assassin {
    background-color: #34495e !important;
    border: 4px solid #000 !important;
    color: #fff !important;
    font-weight: 900;
}

/* MODAL */
.modal {
    position: fixed;
    inset: 0;
    z-index: 1000;

    background: rgba(0, 0, 0, 0.9);

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 16px;
}

.modal-content {
    width: min(420px, 100%);

    background: #2c3e50;
    padding: 20px;
    border-radius: 12px;
    text-align: center;

    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.modal-content h2 {
    margin-top: 0;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.hidden {
    display: none !important;
}

@media (max-height: 520px) {
    h1 {
        font-size: 0.9rem;
    }

    .scoreboard {
        font-size: 0.78rem;
    }

    button,
    .adult-mode-container {
        padding: 4px 7px;
        font-size: 0.72rem;
    }

    .status-bar {
        font-size: 0.72rem;
    }

    .board {
        gap: 5px;
    }
}
