:root {
    --felt-900: #0d2b1f;
    --felt-800: #123626;
    --felt-700: #17442f;
    --wood: #3a2a1c;
    --gold: #e8c547;
    --red: #d64545;
    --headlight: #f5f2e9;
    --chrome: #9fb0a6;

    --font-body: 'Manrope', sans-serif;
    --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--felt-900);
    color: var(--headlight);
    min-height: 100vh;
}

button, input, select { font-family: var(--font-body); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Лобі ---------- */
.lobby-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.lobby-wrap { text-align: center; max-width: 700px; }
.lobby-wrap h1 { font-size: 2.4em; margin-bottom: 0; }
.subtitle { color: var(--chrome); margin-top: 6px; font-family: var(--font-mono); }
.lobby-cards { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; margin-top: 30px; }
.lobby-card {
    background: var(--felt-800); border: 1px solid var(--felt-700); border-radius: 10px;
    padding: 20px; width: 260px; text-align: left; box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}
.lobby-card h2 { margin-top: 0; font-size: 1.2em; color: var(--gold); }
.lobby-card label { display: block; margin: 10px 0 4px; font-size: 0.85em; color: var(--chrome); }
.lobby-card input[type=text] {
    width: 100%; padding: 9px; border-radius: 6px; border: 1px solid var(--felt-700);
    background: var(--felt-900); color: var(--headlight); font-size: 1em;
}
.lobby-card input[type=color] { width: 100%; height: 38px; border: none; border-radius: 6px; cursor: pointer; }
.lobby-card button {
    margin-top: 16px; width: 100%; padding: 11px; border: none; border-radius: 6px;
    background: var(--gold); color: #3a2f00; font-weight: 700; font-size: 1em; cursor: pointer;
}
.lobby-card button:hover { filter: brightness(1.08); }
.error { color: var(--red); margin-top: 8px; font-size: 0.9em; min-height: 1.2em; }

/* ---------- Топбар ---------- */
.topbar {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--felt-800); border-bottom: 1px solid var(--felt-700);
    padding: 12px 20px; flex-wrap: wrap; gap: 10px;
}
.room-info, .deck-info { font-family: var(--font-mono); font-size: 0.85em; color: var(--chrome); }
.room-info b { color: var(--gold); }
.turn-info { font-weight: 800; font-size: 1.15em; color: var(--gold); }
#trumpLabel { font-size: 1.3em; }
#trumpLabel.red { color: var(--red); }
#trumpLabel.black { color: var(--headlight); }

/* ---------- Ігровий стіл ---------- */
.table-felt {
    background:
        radial-gradient(ellipse at center, rgba(255,255,255,0.03), transparent 70%),
        var(--felt-900);
    min-height: 60vh;
    padding: 20px;
    display: flex; flex-direction: column; align-items: center; gap: 18px;
}

.opponents-row { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; }
.opponent-chip {
    background: var(--felt-800); border: 1px solid var(--felt-700); border-radius: 8px;
    padding: 8px 12px; display: flex; align-items: center; gap: 8px; font-size: 0.9em;
}
.opponent-chip.is-defender { border-color: var(--red); box-shadow: 0 0 8px rgba(214,69,69,0.4); }
.opponent-chip.is-attacker { border-color: var(--gold); box-shadow: 0 0 8px rgba(232,197,71,0.4); }
.opponent-chip.is-finished { opacity: 0.45; }
.opponent-color { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.opponent-name { font-weight: 700; }
.opponent-cards { font-family: var(--font-mono); color: var(--chrome); font-size: 0.85em; }
.opponent-role { font-size: 0.75em; padding: 1px 6px; border-radius: 3px; font-weight: 700; text-transform: uppercase; }
.opponent-role.attacker { background: var(--gold); color: #3a2f00; }
.opponent-role.defender { background: var(--red); color: #300a0a; }
.opponent-role.done { background: var(--chrome); color: #0d1418; }

.table-area {
    display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; align-items: center;
    min-height: 130px; width: 100%; max-width: 700px;
    background: rgba(0,0,0,0.15); border: 2px dashed var(--felt-700); border-radius: 12px; padding: 16px;
}
.table-pair { position: relative; width: 62px; height: 96px; }

.card {
    width: 56px; height: 82px; border-radius: 6px; background: #fdfcf7;
    box-shadow: 0 3px 8px rgba(0,0,0,0.4);
    display: flex; flex-direction: column; justify-content: space-between; padding: 4px 5px;
    font-family: var(--font-mono); font-weight: 700; color: #1a1a1a; user-select: none;
    position: absolute; top: 0; left: 0;
}
.card.suit-red { color: var(--red); }
.card .rank { font-size: 0.95em; line-height: 1; }
.card .suit-big { font-size: 1.6em; text-align: center; line-height: 1; }
.card.defend-card { top: 14px; left: 12px; box-shadow: 0 5px 12px rgba(0,0,0,0.5); }
.card-back {
    width: 56px; height: 82px; border-radius: 6px;
    background: repeating-linear-gradient(45deg, #1c4a34, #1c4a34 6px, #163826 6px, #163826 12px);
    border: 2px solid var(--felt-700);
}

.my-hand { display: flex; flex-wrap: wrap; justify-content: center; max-width: 900px; padding: 10px 0; }
.my-hand .card {
    position: relative; cursor: pointer; margin-right: -18px; transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.my-hand .card:hover { transform: translateY(-10px); box-shadow: 0 8px 16px rgba(0,0,0,0.5); z-index: 5; }
.my-hand .card:last-child { margin-right: 0; }
.my-hand .card.playable { outline: 2px solid var(--gold); }
.my-hand .card.not-playable { opacity: 0.55; cursor: not-allowed; }
.my-hand .card.not-playable:hover { transform: none; box-shadow: 0 3px 8px rgba(0,0,0,0.4); }

.action-row { display: flex; gap: 12px; min-height: 40px; }
.action-row button {
    padding: 10px 20px; border: none; border-radius: 6px; font-weight: 800; font-size: 0.95em;
    cursor: pointer; text-transform: uppercase; letter-spacing: 0.03em;
}
.btn-take { background: var(--red); color: #300a0a; }
.btn-bito { background: var(--gold); color: #3a2f00; }

.waiting-lobby { text-align: center; padding: 40px 20px; }
.waiting-lobby h3 { color: var(--gold); }
.waiting-lobby p { font-family: var(--font-mono); color: var(--chrome); }
#lobbyPlayers { font-weight: 700; margin: 10px 0; }
.waiting-lobby button {
    margin-top: 14px; padding: 11px 24px; background: var(--gold); color: #3a2f00;
    border: none; border-radius: 6px; font-weight: 800; cursor: pointer;
}
.waiting-lobby button:disabled { background: var(--felt-700); color: var(--chrome); cursor: not-allowed; }

.game-over-banner {
    text-align: center; font-size: 1.6em; font-weight: 800; color: var(--gold);
    padding: 40px 20px; text-shadow: 0 0 16px rgba(232,197,71,0.5);
}

/* ---------- Журнал ---------- */
.log-panel { max-width: 700px; margin: 0 auto 24px; padding: 0 20px; }
.log-panel h3 { color: var(--chrome); font-size: 0.9em; text-transform: uppercase; letter-spacing: 0.04em; }
.event-log {
    background: var(--felt-800); border: 1px solid var(--felt-700); border-radius: 8px;
    padding: 10px; height: 140px; overflow-y: auto; font-size: 0.85em; font-family: var(--font-mono); color: var(--chrome);
}
.event-log div { padding: 3px 0; border-bottom: 1px dashed var(--felt-700); }
.event-log div:last-child { border-bottom: none; }

@media (max-width: 700px) {
    .card, .card-back { width: 44px; height: 66px; }
    .table-pair { width: 50px; height: 78px; }
    .card .suit-big { font-size: 1.3em; }
    .my-hand .card { margin-right: -22px; }
}
