:root {
    --bg-dark: #0f1c15;
    --bg-card: #192d22;
    --border-color: #2e4d3b;
    --primary-green: #2ecc71;
    --primary-hover: #27ae60;
    --accent-gold: #f1c40f;
    --accent-orange: #e67e22;
    --accent-blue: #3498db;
    --text-light: #ecf0f1;
    --text-muted: #95a5a6;
    --shadow-soft: 0 8px 24px rgba(0,0,0,0.3);
}

@font-face {
    font-family: "Bebas Neue RESEBA";
    src: url("./assets/final-v2/BebasNeue.otf?v=0.8.7-r13.7-20260805-143730") format("opentype");
    font-display: swap;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-light);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

#game-container {
    width: 100vw;
    max-width: none;
    height: 720px;
    background: radial-gradient(circle at center, #1b3829 0%, #0d1a12 100%);
    border: 0;
    border-radius: 0;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.game-header {
    height: 60px;
    background-color: rgba(25, 45, 34, 0.85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
}

.brand-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-area h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
}

.room-status {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
}

.badge-success {
    background-color: rgba(46, 204, 113, 0.2);
    color: var(--primary-green);
    border: 1px solid var(--primary-green);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
}

.badge-warning {
    background-color: rgba(241, 196, 15, 0.2);
    color: var(--accent-gold);
    border: 1px solid var(--accent-gold);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
}

.badge-danger {
    background-color: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    border: 1px solid #e74c3c;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
}

/* Buttons */
.btn {
    padding: 8px 16px;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed !important;
    transform: none !important;
    box-shadow: none !important;
}

.btn-sm { font-size: 0.78rem; padding: 4px 10px; }
.btn-primary { background: linear-gradient(135deg, #2ecc71, #27ae60); color: #fff; }
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(46, 204, 113, 0.4); }
.btn-warning { background: linear-gradient(135deg, #f1c40f, #d35400); color: #fff; }
.btn-secondary { background: #34495e; color: #fff; }
.btn-danger { background: #e74c3c; color: #fff; }
.btn-lg { font-size: 1.1rem; padding: 12px 24px; width: 100%; }

/* Main Section Layout */
.game-main {
    flex: 1;
    display: grid;
    grid-template-columns: 240px 1fr 280px;
    gap: 0;
    padding: 0;
    overflow: hidden;
}

/* Sidebar Players */
.sidebar-players {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar-players h2 {
    font-size: 1rem;
    color: var(--accent-gold);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 6px;
}

.players-container {
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
}

.player-card {
    background: rgba(0,0,0,0.25);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative;
}

.player-card.active {
    border-color: var(--primary-green);
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.3);
}

.player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #27ae60;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.player-details {
    display: flex;
    flex-direction: column;
}

.player-details .p-name { font-weight: 600; font-size: 0.95rem; }
.player-details .p-pos { font-size: 0.8rem; color: var(--text-muted); }

/* Board Area */
.board-wrapper {
    background: transparent;
    border: 0;
    border-radius: 0;
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.board-37 {
    width: 100%;
    height: 100%;
    position: relative;
    isolation: isolate;
}

.board-art-layers,
.board-art {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.board-art {
    object-fit: cover;
}

.board-art-base { z-index: -6; }
.board-art-mountains { z-index: -5; opacity: 0.32; }
.board-art-clouds {
    z-index: -4;
    opacity: 0.38;
    animation: reseba-cloud-drift 36s ease-in-out infinite alternate;
}
.board-art-forest { z-index: -3; opacity: 0.48; }
.board-art-frame { z-index: 8; object-fit: fill; }

@keyframes reseba-cloud-drift {
    from { transform: translate3d(-1.5%, 0, 0) scale(1.03); }
    to { transform: translate3d(1.5%, 0, 0) scale(1.03); }
}

#board-path-svg {
    width: 100%;
    height: 100%;
    position: relative;
    z-index: 2;
}

.pawns-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 6;
}

.pawn-sprite {
    position: absolute;
    width: 48px;
    height: 58px;
    margin-left: -24px;
    margin-top: -49px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    filter: drop-shadow(0 5px 5px rgba(0,0,0,0.45));
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-origin: 50% 100%;
}

.pawn-sprite.is-moving {
    animation: reseba-pawn-hop 0.55s ease both;
}

.pawn-sprite.is-traveling {
    animation: reseba-pawn-travel-hop 0.65s ease-in-out infinite;
}

.pawn-sprite:not(.is-traveling) .pawn-visual {
    animation: reseba-pawn-idle 3.4s ease-in-out infinite;
    transform-origin: 50% 100%;
    scale: var(--crowd-scale, 1);
}

.pawn-visual,
.pawn-tree,
.pawn-head {
    position: absolute;
    display: block;
    object-fit: contain;
    pointer-events: none;
}

.pawn-visual,
.pawn-tree {
    inset: 0;
    width: 100%;
    height: 100%;
}

.pawn-head {
    width: 56%;
    height: 48%;
    left: 22%;
    top: 1%;
    border-radius: 50%;
    object-fit: cover;
}

.pawn-tree-special {
    transform: translateY(8%);
}

.pawn-head-special {
    width: 180%;
    height: 180%;
    left: -40%;
    top: -62%;
    border-radius: 0;
    object-fit: contain;
    object-position: 50% 50%;
    filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.42));
    z-index: 2;
}

.pawn-label {
    position: absolute;
    z-index: 4;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    display: grid;
    width: max-content;
    min-width: 0;
    max-width: 150px;
    padding: 3px 7px;
    border-radius: 6px;
    background: rgba(10, 27, 19, 0.90);
    color: #ffffff;
    text-align: center;
    line-height: 1.05;
    pointer-events: none;
}

.pawn-label strong {
    font-size: 0.62rem;
    white-space: nowrap;
}

.pawn-label small {
    color: #b8e7a4;
    font-size: 0.38rem;
    opacity: 0.9;
    white-space: nowrap;
}

.pawn-cluster {
    width: 38px;
    height: 38px;
    margin-left: -19px;
    margin-top: -19px;
    border-radius: 50%;
    background: var(--primary-green);
    color: #102018;
    font-weight: 800;
}

@keyframes reseba-pawn-hop {
    0% { transform: translateY(0) scale(1); }
    45% { transform: translateY(-12px) scale(1.08); }
    100% { transform: translateY(0) scale(1); }
}

@keyframes reseba-pawn-travel-hop {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    45% { transform: translateY(-16px) rotate(-2deg); }
    70% { transform: translateY(-8px) rotate(2deg); }
}

@keyframes reseba-pawn-idle {
    0%, 100% { transform: translateY(0) rotate(-0.7deg); }
    50% { transform: translateY(-4px) rotate(0.7deg); }
}

.leader-aura::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: inherit;
    box-shadow: 0 0 15px rgba(241, 196, 15, 0.75);
    pointer-events: none;
}

.effects-layer {
    position: absolute;
    inset: 0;
    z-index: 9;
    pointer-events: none;
    overflow: hidden;
}

.effect-particle {
    position: absolute;
    width: 42px;
    height: 42px;
    object-fit: contain;
    animation: reseba-particle 1.35s ease-out forwards;
}

@keyframes reseba-particle {
    from { transform: translate3d(0, 0, 0) rotate(0); opacity: 1; }
    to { transform: translate3d(var(--dx), var(--dy), 0) rotate(var(--rot)); opacity: 0; }
}

/* Sidebar Controls */
.sidebar-controls {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.turn-card {
    background: rgba(0,0,0,0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    text-align: center;
}

.turn-card .label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; }
.active-player-info { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 6px; }
.active-player-info .avatar-head { font-size: 1.8rem; }
.active-player-info .player-name { font-size: 1.1rem; font-weight: 700; color: var(--primary-green); }

.dice-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.dice-3d {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, #ffffff, #bdc3c7);
    color: #2c3e50;
    font-size: 2.2rem;
    font-weight: 800;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.dice-3d img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.dice-3d.is-rolling {
    animation: reseba-dice-spin 0.5s ease;
}

@keyframes reseba-dice-spin {
    from { transform: rotate(-16deg) scale(0.9); }
    60% { transform: rotate(18deg) scale(1.08); }
    to { transform: rotate(0) scale(1); }
}

.dice-mode-toggle { font-size: 0.8rem; color: var(--text-muted); }

.special-house-alert {
    position: fixed;
    right: 3.2vw;
    top: 17vh;
    width: min(34vw, 470px);
    min-height: 24vh;
    z-index: 80;
    background: rgba(230, 247, 237, 0.84);
    backdrop-filter: blur(13px) saturate(1.18);
    border: 0;
    border-radius: 22px;
    padding: 24px;
    color: #163a2a;
    box-shadow: 0 20px 45px rgba(6, 30, 17, .42);
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: clamp(1rem, 1.65vw, 1.5rem);
    animation: house-alert-enter 500ms cubic-bezier(.2,.8,.2,1) both;
}
.special-house-alert p { line-height: 1.22; }
.special-house-alert strong { display: block; font-size: 1.35em; margin-bottom: .45rem; }
.special-house-alert small { display:block; margin-top: .8rem; font-size:.72em; font-weight:800; color:#8a4b15; }
.house-alert-question,
.house-alert-activity { display:block; margin-top:.65rem; font-size:.72em; line-height:1.3; }
.house-alert-answer { margin-top:.7rem; padding:.55rem .7rem; border-radius:12px; background:rgba(255,255,255,.58); font-size:.67em; line-height:1.35; }
.house-alert-answer summary { cursor:pointer; font-weight:900; color:#20583e; }
@keyframes house-alert-enter { from { opacity:0; transform:translateX(80px) scale(.82); } to { opacity:1; transform:translateX(0) scale(1); } }

.game-log-box {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: rgba(0,0,0,0.4);
    border-radius: 8px;
    padding: 8px;
    overflow: hidden;
}

.game-log-box h3 { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 6px; }
.log-messages { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.log-item { font-size: 0.78rem; color: #bdc3c7; line-height: 1.3; }

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.75);
    display: flex; justify-content: center; align-items: center;
    z-index: 1000;
}

.modal-card {
    background: var(--bg-card);
    border: 2px solid var(--accent-gold);
    border-radius: 12px;
    padding: 24px;
    width: 400px;
    text-align: center;
}

.victory-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: rgba(6, 20, 11, 0.88);
    align-items: center;
    justify-content: center;
}

.victory-overlay > img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

.victory-copy {
    position: relative;
    z-index: 2;
    width: min(90vw, 520px);
    padding: 32px;
    text-align: center;
    color: #fff;
    background: rgba(12, 42, 24, 0.82);
    border: 2px solid var(--accent-gold);
    border-radius: 20px;
    box-shadow: 0 18px 60px rgba(0,0,0,0.55);
}

.victory-copy h2 {
    color: var(--accent-gold);
    font-size: 2rem;
    margin-bottom: 8px;
}

.victory-celebration {
    display: grid;
    grid-template-columns: minmax(95px, 125px) 1fr;
    align-items: end;
    gap: 12px;
    margin: 14px 0 18px;
}

.victory-geysiara {
    width: 100%;
    max-height: 210px;
    object-fit: contain;
    filter: drop-shadow(0 8px 8px rgba(0, 0, 0, .46));
    animation: reseba-victory-bounce 1.8s ease-in-out infinite;
}

.victory-ranking {
    display: grid;
    gap: 7px;
}

.victory-rank-card {
    display: grid;
    grid-template-columns: 30px 60px 1fr;
    align-items: center;
    gap: 7px;
    padding: 5px 8px;
    border: 1px solid rgba(255, 222, 109, .58);
    border-radius: 11px;
    background: rgba(7, 32, 19, .86);
    text-align: left;
}

.victory-rank-card:first-child {
    border-color: #ffd95c;
    background: linear-gradient(90deg, rgba(121, 76, 9, .92), rgba(8, 47, 27, .9));
}

.victory-rank-card img {
    width: 58px;
    height: 66px;
    object-fit: contain;
    animation: reseba-victory-bounce 1.6s ease-in-out infinite;
}

.victory-rank-card strong,
.victory-rank-card small {
    display: block;
}

.victory-rank-card small {
    color: #d8efc4;
}

@keyframes reseba-victory-bounce {
    0%, 100% { transform: translateY(0) rotate(-1deg); }
    50% { transform: translateY(-6px) rotate(1deg); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}

@media (max-width: 768px) {
    body {
        display: block;
        min-height: 100dvh;
        overflow: auto;
    }

    #game-container {
        width: 100%;
        max-width: none;
        height: auto;
        min-height: 100dvh;
        border-radius: 0;
        overflow: visible;
    }

    .game-header {
        height: auto;
        min-height: 60px;
        padding: 10px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .brand-area {
        flex: 1 1 180px;
    }

    .brand-area h1 {
        font-size: 1rem;
    }

    .room-status,
    .header-controls {
        display: flex;
        flex: 1 1 100%;
        flex-wrap: wrap;
        gap: 6px;
    }

    .header-controls .btn {
        flex: 1 1 46%;
        padding: 7px 8px;
        font-size: 0.78rem;
    }

    .game-main {
        display: flex;
        flex-direction: column;
        padding: 8px;
        overflow: visible;
    }

    .board-wrapper {
        order: 1;
        width: 100%;
        aspect-ratio: 16 / 9;
        min-height: 0;
    }

    .sidebar-controls {
        order: 2;
        min-height: 480px;
    }

    .sidebar-players {
        order: 3;
        max-height: 360px;
    }

    .players-container {
        max-height: 280px;
    }

    .pawn-sprite {
        width: 34px;
        height: 42px;
        margin-left: -17px;
        margin-top: -35px;
    }
}

.modal-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
