/* ========================================
   GOTHIC THEME
======================================== */

:root {
    --bg-main: #0f0f12;
    --bg-panel: rgba(25, 20, 25, 0.95);
    --bg-card-white: #f5f2f4;
    --bg-card-black: #1a1116;

    --accent: #7b1e2b;
    --accent-light: #a83244;
    --accent-glow: rgba(168, 50, 68, 0.6);

    --gold: #c6a85b;

    --text-main: #e8e6e3;
    --text-muted: #9a8f92;

    --radius: 14px;
    --transition: 0.18s ease;
}

/* ========================================
   GLOBAL
======================================== */

* { box-sizing: border-box; }

body {
    margin: 0;
    height: 100vh;
    font-family: 'Segoe UI', serif;
    background: var(--bg-main);
    color: var(--text-main);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Klimatyczne tło */
body::before {
    content: "";
    position: fixed;
    inset: -30px;
    background: url('/static/bg.png') center/cover no-repeat;
    filter: blur(10px);
    opacity: 0.15;
    z-index: -1;
}

.hidden { display: none !important; }

.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ========================================
   TYPOGRAPHY
======================================== */

.game-title {
    font-size: 3rem;
    font-weight: 900;
    text-align: center;
    letter-spacing: 2px;
    margin-bottom: 20px;
    color: var(--gold);
    text-shadow: 0 0 15px rgba(198,168,91,0.4);
}

/* ========================================
   BUTTONS
======================================== */

button {
    border: none;
    border-radius: var(--radius);
    padding: 10px 18px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
}

.green-btn,
.big-green-btn,
.action-btn {
    background: var(--accent);
    color: white;
}

.green-btn:hover,
.big-green-btn:hover,
.action-btn:hover {
    background: var(--accent-light);
    box-shadow: 0 0 15px var(--accent-glow);
    transform: translateY(-2px);
}

.red-btn {
    background: #3a1a1f;
    color: #fff;
}

.red-btn:hover {
    background: #5a232a;
}

.big-green-btn {
    font-size: 1.2rem;
    padding: 14px 30px;
}

/* ========================================
   LOGIN
======================================== */

#login-screen {
    justify-content: center;
    align-items: center;
    gap: 15px;
    text-align: center;
}

#nickname-input {
    padding: 10px;
    border-radius: var(--radius);
    border: none;
    width: 220px;
}

/* ========================================
   ROOM LIST
======================================== */

#room-list-screen {
    align-items: center;
    padding: 40px 20px;
}

#room-list-screen header {
    width: 100%;
    max-width: 900px;
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.container {
    width: 100%;
    max-width: 900px;
    background: var(--bg-panel);
    padding: 25px;
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#rooms-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 15px;
}

.room-card {
    background: #1a1519;
    padding: 15px;
    border-radius: var(--radius);
    border: 1px solid rgba(255,255,255,0.05);
    transition: var(--transition);
}

.room-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 0 15px rgba(0,0,0,0.6);
}

/* ========================================
   GAME LAYOUT
======================================== */

#game-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#game-screen header {
    padding: 10px 20px;
    background: var(--bg-panel);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.layout {
    flex: 1;
    display: flex;
    min-height: 0;
}

#game-area {
    flex: 3;
    display: flex;
    flex-direction: column;
    padding: 20px;
    min-height: 0;
}

#sidebar {
    flex: 1;
    min-width: 260px;
    background: var(--bg-panel);
    display: flex;
    flex-direction: column;
    padding: 15px;
}

/* ========================================
   PLAY VIEW
======================================== */

#play-view {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

#black-card-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 0;
}

#hand-container {
    height: 260px;
    flex-shrink: 0;
    display: flex;
    gap: 14px;
    overflow-x: auto;
    align-items: center;
    padding: 15px;
    background: linear-gradient(to top, #1a1418, #120d10);
    border-top: 2px solid var(--accent);
}

/* ========================================
   CARDS
======================================== */

.card {
    width: 150px;
    height: 220px;
    border-radius: var(--radius);
    padding: 12px;

    display: flex;
    flex-direction: column;
    justify-content: space-between;

    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;

    transition: transform var(--transition),
                box-shadow var(--transition);

    flex-shrink: 0;
    position: relative;
    z-index: 2;

    /* NOWE — domyślne tło */
    background: var(--bg-card-white);
    color: #111;
}

.card:hover {
    transform: translateY(-8px) rotate(-1deg);
    box-shadow: 0 10px 25px rgba(0,0,0,0.6);
}

.card.selected {
    border: 3px solid var(--accent);
    box-shadow: 0 0 20px var(--accent-glow);
    transform: translateY(-12px);
}

.white-card-render {
    /* opcjonalne nadpisania */
}

.black-card-render {
    background: var(--bg-card-black);
    color: white;
    border: 2px solid var(--gold);
}

.card-content {
    flex: 1;
    overflow-y: auto;
}

.card-footer {
    font-size: 0.7rem;
    opacity: 0.6;
    border-top: 1px solid rgba(0,0,0,0.2);
    padding-top: 4px;
}

/* ========================================
   WINNER CARD
======================================== */

.winner-card {
    border: 3px solid var(--gold) !important;
    background: #2a1d22 !important;
    transform: scale(1.06);
    box-shadow: 0 0 30px rgba(198,168,91,0.6);
}

/* Pieczęć */

.winner-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-15deg);

    background: var(--gold);
    color: #111;

    padding: 0.6em 1.4em;
    border-radius: 999px;
    font-weight: 900;
    letter-spacing: 2px;
    text-transform: uppercase;

    width: max-content;
    white-space: nowrap;

    box-shadow: 4px 4px 0 rgba(0,0,0,0.5);

    animation: stamp 0.4s cubic-bezier(.2,1.4,.4,1);
}

@keyframes stamp {
    0% { transform: translate(-50%, -50%) scale(2) rotate(0); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1) rotate(-15deg); opacity: 1; }
}

/* ========================================
   CHAT
======================================== */

#chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

#chat-messages {
    flex: 1;
    overflow-y: auto;
    background: rgba(0,0,0,0.3);
    padding: 8px;
    border-radius: var(--radius);
    font-size: 0.85rem;
}

/* ========================================
   modal
======================================== */

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5000;
}

.modal-content {
    background: var(--bg-panel);
    padding: 30px;
    border-radius: var(--radius);
    width: 90%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    gap: 15px;

    box-shadow: 0 20px 60px rgba(0,0,0,0.8);
}

/* ========================================
   MOBILE
======================================== */

@media (max-width: 768px) {

    .layout { flex-direction: column; }

    #game-area { height: 65vh; }

    #sidebar {
        height: 35vh;
    }

    .card {
        width: 110px;
        height: 160px;
        font-size: 0.75rem;
    }

    #hand-container {
        height: 180px;
    }

    .winner-badge {
        font-size: 0.85rem;
    }
}

/*