/* ============================================
   MONOPOLY BURKINA FASO - Styles
   ============================================ */

:root {
    --bg: #f0ebe3;
    --bg-dark: #1a1a2e;
    --text: #2d2d2d;
    --text-light: #6b7280;
    --white: #ffffff;
    --primary: #c0392b;
    --primary-light: #e74c3c;
    --secondary: #2c3e50;
    --accent: #f39c12;
    --success: #27ae60;
    --danger: #e74c3c;
    --info: #3498db;
    --warning: #f1c40f;

    /* Couleurs groupes propriétés */
    --color-marron: #8B4513;
    --color-bleu_clair: #87CEEB;
    --color-rose: #DB7093;
    --color-orange: #FF8C00;
    --color-rouge: #DC143C;
    --color-jaune: #FFD700;
    --color-vert: #2E8B57;
    --color-bleu_fonce: #1a3a5c;

    --board-bg: #c8e6c9;
    --board-border: #2e7d32;
    --board-center: #e8f5e9;
    --space-bg: #f5f5f0;

    --radius: 8px;
    --radius-lg: 16px;
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.15);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3 {
    font-family: 'Playfair Display', serif;
}

/* ============================================
   SCREENS
   ============================================ */
.screen {
    display: none;
    min-height: 100vh;
}
.screen.active {
    display: flex;
}

/* ============================================
   HOME SCREEN
   ============================================ */
.home-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    color: white;
    text-align: center;
    padding: 2rem;
}

.home-logo {
    margin-bottom: 3rem;
}

.logo-icon {
    font-size: 5rem;
    margin-bottom: 1rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-15px); }
}

.home-logo h1 {
    font-size: 4rem;
    font-weight: 900;
    letter-spacing: 8px;
    background: linear-gradient(135deg, #f39c12, #e74c3c, #f39c12);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.home-logo h2 {
    font-size: 1.8rem;
    font-weight: 700;
    color: #ecf0f1;
    letter-spacing: 4px;
    margin-top: 0.5rem;
}

.subtitle {
    color: #bdc3c7;
    font-size: 1.1rem;
    margin-top: 0.5rem;
    letter-spacing: 2px;
}

.home-actions {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 400px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.btn:active { transform: translateY(0); }

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
}

.btn-secondary {
    background: var(--secondary);
    color: white;
}

.btn-success {
    background: var(--success);
    color: white;
}

.btn-danger, .btn-sm.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-outline {
    background: transparent;
    border: 2px solid var(--secondary);
    color: var(--secondary);
}

.btn-outline:hover {
    background: var(--secondary);
    color: white;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: var(--radius-lg);
}

.btn-sm {
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

/* ============================================
   ALERT
   ============================================ */
.alert {
    padding: 1rem;
    border-radius: var(--radius);
    margin-top: 1rem;
    font-size: 0.9rem;
    max-width: 400px;
    width: 100%;
}

.alert-success {
    background: rgba(39, 174, 96, 0.2);
    color: #27ae60;
    border: 1px solid #27ae60;
}

.alert-error {
    background: rgba(231, 76, 60, 0.2);
    color: #e74c3c;
    border: 1px solid #e74c3c;
}

/* ============================================
   SETUP SCREEN
   ============================================ */
.setup-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

.screen#screen-setup {
    display: none;
    flex-direction: column;
    background: var(--bg);
}
.screen#screen-setup.active {
    display: flex;
}

.setup-title {
    font-size: 2rem;
    margin-bottom: 2rem;
    text-align: center;
    color: var(--secondary);
}

.setup-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--secondary);
}

.input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #ddd;
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: 'Inter', sans-serif;
    transition: var(--transition);
}

.input:focus {
    outline: none;
    border-color: var(--primary);
}

.mode-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
}

.mode-card {
    padding: 1.2rem;
    border: 2px solid #ddd;
    border-radius: var(--radius-lg);
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    background: white;
}

.mode-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.mode-card.selected {
    border-color: var(--primary);
    background: rgba(192, 57, 43, 0.05);
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.1);
}

.mode-icon {
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.mode-name {
    font-weight: 700;
    font-size: 1rem;
}

.mode-desc {
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.25rem;
}

/* Players setup */
.players-setup-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.player-slot {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: white;
    border-radius: var(--radius);
    border: 1px solid #e0e0e0;
}

.player-slot input {
    flex: 1;
    padding: 0.4rem 0.6rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: 'Inter', sans-serif;
}

.player-slot .player-color {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
}

.player-slot .remove-player {
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    color: var(--danger);
    padding: 0.2rem 0.5rem;
}

.players-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.setup-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.player-badge-ai {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    background: var(--info);
    color: white;
    border-radius: 20px;
    white-space: nowrap;
}

/* ============================================
   BADGE
   ============================================ */
.badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--secondary);
    color: white;
}
.badge-info { background: var(--info); }
.badge-warning { background: var(--warning); color: #333; }
.badge-success { background: var(--success); }
.badge-danger { background: var(--danger); }

/* ============================================
   GAME LAYOUT
   ============================================ */
.screen#screen-game {
    display: none;
    flex-direction: column;
    height: 100vh;
    background: #e8e0d4;
}
.screen#screen-game.active {
    display: flex;
}

.game-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: var(--secondary);
    color: white;
    z-index: 10;
}

.game-header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.game-header-left h3 {
    font-size: 1.1rem;
    letter-spacing: 2px;
}

.game-header-right {
    display: flex;
    gap: 0.5rem;
}

.game-main {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ============================================
   PLAYER PANEL
   ============================================ */
.panel-players {
    width: 220px;
    padding: 0.75rem;
    overflow-y: auto;
    background: rgba(255,255,255,0.7);
    border-right: 1px solid #d0d0d0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.player-panel-card {
    padding: 0.75rem;
    border-radius: var(--radius);
    background: white;
    border: 2px solid transparent;
    transition: var(--transition);
    cursor: default;
}

.player-panel-card.active-turn {
    border-color: var(--accent);
    box-shadow: 0 0 12px rgba(243, 156, 18, 0.3);
}

.player-panel-card.bankrupt {
    opacity: 0.4;
    text-decoration: line-through;
}

.player-panel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.player-token {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.player-panel-name {
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-panel-money {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 0.25rem;
}

.player-panel-props {
    display: flex;
    gap: 3px;
    flex-wrap: wrap;
}

.prop-dot {
    width: 10px;
    height: 10px;
    border-radius: 2px;
    border: 1px solid rgba(0,0,0,0.2);
}

/* ============================================
   BOARD
   ============================================ */
.board-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    overflow: auto;
}

.board {
    display: grid;
    grid-template-columns: 90px repeat(9, 70px) 90px;
    grid-template-rows: 90px repeat(9, 70px) 90px;
    gap: 0;
    background: var(--board-bg);
    border: 3px solid var(--board-border);
    border-radius: 4px;
    box-shadow: var(--shadow-lg);
    position: relative;
    width: fit-content;
    flex-shrink: 0;
}

.board-center {
    grid-column: 2 / 11;
    grid-row: 2 / 11;
    background: var(--board-center);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    border: 2px solid var(--board-border);
}

.board-center-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--primary);
    letter-spacing: 3px;
    text-align: center;
    line-height: 1.2;
}

.board-center-subtitle {
    font-size: 0.75rem;
    color: var(--text-light);
    letter-spacing: 2px;
    margin-top: 0.25rem;
}

.board-center-info {
    margin-top: 1rem;
    font-size: 0.7rem;
    color: var(--text-light);
    text-align: center;
    line-height: 1.5;
}

/* Board space */
.space {
    background: var(--space-bg);
    border: 1px solid #c8c8c0;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.55rem;
}

.space:hover {
    z-index: 5;
    box-shadow: 0 0 10px rgba(0,0,0,0.2);
    transform: scale(1.05);
}

.space-color-bar {
    height: 14px;
    width: 100%;
    flex-shrink: 0;
}

.space-name {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2px;
    font-weight: 600;
    line-height: 1.15;
    font-size: 0.5rem;
    word-break: break-word;
}

.space-price {
    font-size: 0.5rem;
    text-align: center;
    padding: 1px;
    color: var(--text-light);
    font-weight: 500;
}

.space-players {
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
    justify-content: center;
    padding: 1px;
    position: absolute;
    bottom: 1px;
    left: 0;
    right: 0;
}

.space-player-token {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1.5px solid white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
}

.space-buildings {
    display: flex;
    gap: 1px;
    justify-content: center;
    position: absolute;
    top: 15px;
    left: 0;
    right: 0;
}

.house-icon {
    width: 8px;
    height: 8px;
    background: #27ae60;
    border-radius: 1px;
}

.hotel-icon {
    width: 12px;
    height: 10px;
    background: #e74c3c;
    border-radius: 2px;
}

.space.owned-indicator {
    box-shadow: inset 0 0 0 2px rgba(0,0,0,0.15);
}

.space-mortgage-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.6rem;
}

/* Corner spaces */
.space.corner {
    width: 90px;
    height: 90px;
}

/* Bottom side - normal reading */
.space.bottom {
    flex-direction: column;
}

/* Top side - rotated */
.space.top {
    flex-direction: column-reverse;
}
.space.top .space-color-bar {
    order: 2;
}

/* Left side */
.space.left {
    flex-direction: row;
}
.space.left .space-color-bar {
    height: 100%;
    width: 14px;
}
.space.left .space-name {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
}

/* Right side */
.space.right {
    flex-direction: row-reverse;
}
.space.right .space-color-bar {
    height: 100%;
    width: 14px;
}
.space.right .space-name {
    writing-mode: vertical-rl;
}

/* Local multiplayer setup */
.local-players-setup {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1rem;
}

.local-player-card {
    background: var(--card-bg);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.3s ease;
}

.local-player-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.local-player-number {
    background: var(--primary);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

.local-player-inputs {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
}

.local-player-inputs input[type="text"] {
    flex: 1;
    min-width: 120px;
}

.local-player-inputs input[type="color"] {
    width: 50px;
    height: 40px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
}

.local-player-token-picker {
    display: flex;
    gap: 0.5rem;
}

.local-token-option {
    width: 40px;
    height: 40px;
    border: 2px solid var(--border);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    background: var(--card-bg);
}

.local-token-option:hover {
    border-color: var(--primary);
    transform: scale(1.1);
}

.local-token-option.selected {
    border-color: var(--primary);
    background: var(--primary);
    color: white;
}

.local-player-remove {
    background: var(--danger);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.player-actions {
    display: flex;
    justify-content: center;
    margin-top: 1rem;
}

/* Token animations */
.animated-token {
    position: relative;
    z-index: 10;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 700;
    border: 2px solid rgba(255,255,255,0.8);
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    transition: all 0.2s ease;
}

.token-bounce {
    animation: tokenBounce 0.4s ease-in-out;
}

@keyframes tokenBounce {
    0% { transform: translateY(0px) scale(1); }
    25% { transform: translateY(-8px) scale(1.1); }
    50% { transform: translateY(-12px) scale(1.2); }
    75% { transform: translateY(-8px) scale(1.1); }
    100% { transform: translateY(0px) scale(1); }
}

/* Enhanced space player tokens */
.space-player-token {
    position: relative;
    z-index: 5;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.65rem;
    font-weight: 600;
    border: 2px solid rgba(255,255,255,0.9);
    box-shadow: 0 1px 4px rgba(0,0,0,0.4);
    margin: 1px;
}

/* Corner spaces enhanced visibility */
.space.corner .space-players {
    position: absolute;
    bottom: 5px;
    right: 5px;
    left: 5px;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    justify-content: center;
    z-index: 10;
}

.space.corner .animated-token,
.space.corner .space-player-token {
    width: 16px;
    height: 16px;
    font-size: 0.6rem;
    border-width: 1px;
}

/* Enhanced visibility for tokens on special spaces */
.space.special .space-players {
    position: absolute;
    bottom: 3px;
    left: 3px;
    right: 3px;
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    justify-content: center;
    background: rgba(255,255,255,0.1);
    border-radius: 4px;
    padding: 2px;
}

/* Special spaces */
.space.special {
    background: var(--space-bg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.space-icon {
    font-size: 1.2rem;
    margin-bottom: 2px;
}

.space.corner .space-icon {
    font-size: 1.8rem;
}
.space.corner .space-name {
    font-size: 0.6rem;
    font-weight: 800;
}

/* Highlight on hover group */
.space.group-highlight {
    box-shadow: 0 0 12px rgba(243, 156, 18, 0.5) !important;
}

/* Landing animation */
@keyframes spaceLand {
    0% { background-color: var(--space-bg); }
    50% { background-color: #fff9c4; }
    100% { background-color: var(--space-bg); }
}
.space.landing {
    animation: spaceLand 0.6s ease;
}

/* ============================================
   ACTION PANEL
   ============================================ */
.panel-actions {
    width: 260px;
    padding: 0.75rem;
    overflow-y: auto;
    background: rgba(255,255,255,0.7);
    border-left: 1px solid #d0d0d0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.action-section h4 {
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--secondary);
}

.dice-display {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin-bottom: 0.75rem;
}

.die {
    width: 50px;
    height: 50px;
    background: white;
    border: 2px solid #ccc;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: 2px 2px 6px rgba(0,0,0,0.15);
    transition: var(--transition);
}

@keyframes diceRoll {
    0% { transform: rotateZ(0deg) scale(1); }
    25% { transform: rotateZ(90deg) scale(0.8); }
    50% { transform: rotateZ(180deg) scale(1.1); }
    75% { transform: rotateZ(270deg) scale(0.9); }
    100% { transform: rotateZ(360deg) scale(1); }
}

.die.rolling {
    animation: diceRoll 0.5s ease;
}

.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.action-buttons .btn {
    width: 100%;
    justify-content: center;
}

/* Events feed */
.events-list {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    max-height: 300px;
    overflow-y: auto;
}

.event-item {
    padding: 0.4rem 0.6rem;
    background: white;
    border-radius: 4px;
    font-size: 0.75rem;
    border-left: 3px solid var(--info);
    line-height: 1.3;
}

.event-item.event-rent { border-left-color: var(--danger); }
.event-item.event-buy { border-left-color: var(--success); }
.event-item.event-card { border-left-color: var(--accent); }
.event-item.event-jail { border-left-color: #8e44ad; }
.event-item.event-money { border-left-color: var(--success); }

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 100;
}
.modal-overlay.active { display: block; }

.modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 101;
    max-width: 400px;
    width: 90%;
}
.modal.active { display: block; }
.modal.modal-lg { max-width: 700px; }

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    max-height: 80vh;
    overflow-y: auto;
}

/* Property card modal */
.property-card-modal {
    padding: 0;
    overflow: hidden;
}

.property-card-header {
    padding: 1rem;
    color: white;
    text-align: center;
    font-weight: 700;
}

.property-card-name {
    font-family: 'Playfair Display', serif;
    font-size: 1.2rem;
}

.property-card-body {
    padding: 1rem;
}

.property-card-body table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.property-card-body td {
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid #eee;
}

.property-card-body td:last-child {
    text-align: right;
    font-weight: 600;
}

.property-card-actions {
    padding: 1rem;
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    border-top: 1px solid #eee;
}

.property-card-actions .btn {
    flex: 1;
    min-width: 100px;
}

/* Card modal */
.card-modal {
    text-align: center;
    padding: 2rem;
}

.card-modal-type {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 0.5rem;
}

.card-modal-text {
    font-size: 1.1rem;
    line-height: 1.5;
    margin: 1rem 0;
}

.card-modal .btn {
    margin-top: 1rem;
}

/* ============================================
   SLIDE PANELS
   ============================================ */
.slide-panel {
    position: fixed;
    top: 0;
    right: -400px;
    width: 380px;
    height: 100vh;
    background: white;
    box-shadow: -4px 0 20px rgba(0,0,0,0.15);
    z-index: 50;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.slide-panel.open {
    right: 0;
}

.slide-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid #eee;
    background: var(--secondary);
    color: white;
}

.slide-panel-header h3 {
    font-size: 1rem;
}

.slide-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
}

.log-entry {
    padding: 0.5rem;
    border-bottom: 1px solid #f0f0f0;
    font-size: 0.8rem;
    line-height: 1.4;
}

.log-entry .log-turn {
    font-weight: 700;
    color: var(--primary);
    font-size: 0.7rem;
}

/* ============================================
   GAME OVER
   ============================================ */
.screen#screen-gameover {
    display: none;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    color: white;
    align-items: center;
    justify-content: center;
    text-align: center;
}
.screen#screen-gameover.active {
    display: flex;
}

.gameover-container {
    padding: 2rem;
}

.gameover-trophy {
    font-size: 6rem;
    animation: float 2s ease-in-out infinite;
}

.gameover-container h1 {
    font-size: 3rem;
    margin: 1rem 0;
    background: linear-gradient(135deg, #f39c12, #e74c3c);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#winner-details {
    font-size: 1.2rem;
    color: #bdc3c7;
    margin-bottom: 2rem;
}

.final-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 2rem 0;
    max-width: 800px;
}

.stat-card {
    background: rgba(255,255,255,0.1);
    padding: 1rem;
    border-radius: var(--radius);
    text-align: center;
}

.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent);
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: #bdc3c7;
    margin-top: 0.25rem;
}

/* ============================================
   TRADE MODAL
   ============================================ */
.trade-columns {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1rem;
    align-items: start;
}

.trade-column {
    padding: 1rem;
    background: #f8f8f8;
    border-radius: var(--radius);
}

.trade-column h4 {
    font-size: 0.85rem;
    margin-bottom: 0.75rem;
    text-align: center;
}

.trade-arrow {
    display: flex;
    align-items: center;
    font-size: 1.5rem;
    padding-top: 2rem;
}

.trade-prop-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem;
    background: white;
    border-radius: 4px;
    margin-bottom: 0.3rem;
    cursor: pointer;
    font-size: 0.8rem;
    border: 2px solid transparent;
    transition: var(--transition);
}

.trade-prop-item:hover {
    border-color: var(--primary);
}

.trade-prop-item.selected {
    border-color: var(--primary);
    background: rgba(192, 57, 43, 0.05);
}

.trade-prop-color {
    width: 12px;
    height: 12px;
    border-radius: 2px;
    flex-shrink: 0;
}

.trade-money-input {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

.trade-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
    justify-content: center;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 1200px) {
    .board {
        grid-template-columns: 80px repeat(9, 60px) 80px;
        grid-template-rows: 80px repeat(9, 60px) 80px;
    }
    .space.corner { width: 80px; height: 80px; }
    .panel-players { width: 180px; }
    .panel-actions { width: 220px; }
}

/* ============================================
   SMALL SCREENS - BOARD SCALING
   ============================================ */
@media (max-width: 600px) {
    .screen#screen-game,
    .screen#screen-game.active {
        height: auto;
        min-height: 100vh;
    }

    .game-layout {
        height: auto;
        min-height: 100vh;
    }

    .game-main {
        flex-direction: column;
        overflow: visible;
    }

    /* Players panel: horizontal scroll strip */
    .panel-players {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        border-right: none;
        border-bottom: 1px solid #d0d0d0;
        max-height: none;
        height: auto;
        padding: 0.4rem;
        gap: 0.4rem;
    }

    .player-panel-card {
        min-width: 130px;
        flex-shrink: 0;
        padding: 0.4rem;
    }

    .player-token {
        width: 22px;
        height: 22px;
        font-size: 0.65rem;
    }

    .player-panel-name {
        font-size: 0.7rem;
    }

    .player-panel-money {
        font-size: 0.75rem;
    }

    /* Board wrapper: allow the board to scale */
    .board-wrapper {
        flex: none;
        width: 100%;
        padding: 0;
        overflow: hidden;
        display: flex;
        align-items: flex-start;
        justify-content: center;
    }

    /* Board: render at a known pixel size, then scale via transform */
    .board {
        /* Base size: corners 56px + 9*42px = 490px */
        grid-template-columns: 56px repeat(9, 42px) 56px;
        grid-template-rows: 56px repeat(9, 42px) 56px;
        margin: 0;
        transform-origin: top center;
        /* Scale computed by JS, fallback: scale to ~100vw */
        --board-native-width: 490px;
        transform: scale(var(--board-scale, 1));
        flex-shrink: 0;
    }

    .space.corner {
        width: 56px;
        height: 56px;
    }

    .space-name {
        font-size: 0.4rem;
    }

    .space-price {
        font-size: 0.38rem;
    }

    .space-color-bar {
        height: 10px;
    }

    .space.left .space-color-bar {
        width: 10px;
        height: 100%;
    }

    .space.right .space-color-bar {
        width: 10px;
        height: 100%;
    }

    .space.corner .space-icon {
        font-size: 1.2rem;
    }

    .space.corner .space-name {
        font-size: 0.42rem;
    }

    .space-icon {
        font-size: 0.8rem;
    }

    .space-player-token {
        width: 12px;
        height: 12px;
        font-size: 0.45rem;
        border-width: 1px;
    }

    .house-icon {
        width: 5px;
        height: 5px;
    }

    .hotel-icon {
        width: 8px;
        height: 6px;
    }

    .board-center-title {
        font-size: 0.9rem;
        letter-spacing: 1px;
    }

    .board-center-subtitle {
        font-size: 0.5rem;
    }

    .board-center-info {
        font-size: 0.5rem;
    }

    /* Actions panel: below the board */
    .panel-actions {
        width: 100%;
        border-left: none;
        border-top: 1px solid #d0d0d0;
        max-height: none;
        overflow-y: visible;
        padding: 0.6rem;
    }

    .die {
        width: 40px;
        height: 40px;
        font-size: 1.4rem;
    }

    .events-list {
        max-height: 100px;
    }

    .event-item {
        font-size: 0.7rem;
        padding: 0.25rem 0.4rem;
    }

    /* Game header compact */
    .game-header {
        padding: 0.35rem 0.5rem;
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .game-header-left {
        gap: 0.4rem;
    }

    .game-header-left h3 {
        font-size: 0.8rem;
        letter-spacing: 1px;
    }

    .badge {
        font-size: 0.6rem;
        padding: 0.15rem 0.4rem;
    }

    .game-header-right {
        gap: 0.3rem;
    }

    .game-header-right .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.7rem;
        min-height: 30px;
    }

    /* Buttons touch-friendly */
    .btn {
        min-height: 40px;
    }

    .action-buttons .btn {
        font-size: 0.85rem;
    }

    /* Modals */
    .modal {
        width: 95%;
        max-width: none;
    }

    .slide-panel {
        width: 100%;
        right: -100%;
    }

    /* Disable hover transforms on touch */
    .space:hover {
        transform: none;
        box-shadow: none;
    }
}

@media (max-width: 900px) and (min-width: 601px) {
    .game-main {
        flex-direction: column;
    }
    .panel-players {
        width: 100%;
        flex-direction: row;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid #d0d0d0;
        max-height: 100px;
        padding: 0.5rem;
    }
    .player-panel-card {
        min-width: 150px;
        margin-right: 0.5rem;
    }
    .panel-actions {
        width: 100%;
        border-left: none;
        border-top: 1px solid #d0d0d0;
        max-height: 200px;
        overflow-y: auto;
    }
    .board {
        grid-template-columns: 70px repeat(9, 52px) 70px;
        grid-template-rows: 70px repeat(9, 52px) 70px;
        margin: 0.5rem;
    }
    .space.corner { width: 70px; height: 70px; }
    
    /* Better spacing for mobile */
    .board-wrapper {
        padding: 0.25rem;
    }
    
    /* Improve button sizes for touch */
    .btn {
        min-height: 44px;
        font-size: 1rem;
    }
    
    .btn-sm {
        min-height: 36px;
        font-size: 0.9rem;
    }
}

/* Mobile specific styles */
@media (max-width: 768px) {
    /* Home screen adjustments */
    .home-container {
        padding: 1rem;
    }
    
    .logo-icon {
        font-size: 3rem;
    }
    
    .home-logo h1 {
        font-size: 2.5rem;
        letter-spacing: 4px;
    }
    
    .home-logo h2 {
        font-size: 1.2rem;
        letter-spacing: 2px;
    }
    
    /* Setup screen mobile */
    .setup-container {
        padding: 1rem;
        max-width: 100%;
    }
    
    .mode-cards {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .setup-title {
        font-size: 1.5rem;
    }
    
    /* Modals mobile */
    .modal-content {
        padding: 1rem;
        max-height: 85vh;
    }
    
    /* Property card mobile */
    .property-card-name {
        font-size: 1rem;
    }
    
    .property-card-body table {
        font-size: 0.8rem;
    }
    
    /* Trade modal mobile */
    .trade-columns {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    
    .trade-arrow {
        display: none;
    }
    
    .trade-prop-item {
        font-size: 0.75rem;
    }
    
    /* Touch improvements */
    .btn:hover {
        transform: none;
    }
    
    .btn:active {
        transform: scale(0.95);
    }
    
    /* Local players setup mobile */
    .local-players-setup {
        gap: 0.5rem;
    }
    
    .local-player-card {
        flex-direction: column;
        text-align: center;
        gap: 0.5rem;
    }
    
    .local-player-inputs {
        flex-direction: column;
        width: 100%;
    }
    
    .local-player-inputs input[type="text"] {
        width: 100%;
    }
    
    .local-player-token-picker {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .local-token-option {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
    
    /* Token picker mobile */
    .token-picker {
        justify-content: center;
    }
    
    .token-option {
        min-width: 60px;
        padding: 0.5rem 0.6rem;
    }
    
    .token-option-icon {
        font-size: 1.3rem;
    }
    
    .token-option-label {
        font-size: 0.6rem;
    }
    
    /* Form improvements mobile */
    .input {
        font-size: 16px; /* Prevents zoom on iOS */
        min-height: 44px;
    }
    
    .form-group label {
        font-size: 0.9rem;
    }
    
    /* Lobby mobile */
    .lobby-code {
        font-size: 2rem;
        letter-spacing: 6px;
    }
    
    .lobby-host-actions {
        margin-top: 0.5rem;
    }
    
    .lobby-guest-msg {
        padding: 1rem;
        font-size: 1rem;
    }
    
    /* Property card actions mobile */
    .property-card-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .property-card-actions .btn {
        width: 100%;
    }
}

/* ============================================
   JOIN SCREEN
   ============================================ */
.screen#screen-join {
    display: none;
    flex-direction: column;
    background: var(--bg);
}
.screen#screen-join.active {
    display: flex;
}

/* ============================================
   LOBBY SCREEN
   ============================================ */
.screen#screen-lobby {
    display: none;
    flex-direction: column;
    background: var(--bg);
}
.screen#screen-lobby.active {
    display: flex;
}

.lobby-code-box {
    text-align: center;
    padding: 1.5rem;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-radius: var(--radius-lg);
    color: white;
    margin-bottom: 1.5rem;
}

.lobby-code-box p {
    font-size: 0.9rem;
    color: #bdc3c7;
    margin-bottom: 0.75rem;
}

.lobby-code {
    font-family: 'Playfair Display', serif;
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: 12px;
    color: var(--accent);
    margin-bottom: 1rem;
    user-select: all;
    text-shadow: 0 2px 8px rgba(243, 156, 18, 0.3);
}

.lobby-host-actions {
    text-align: center;
    margin-top: 1rem;
}

.lobby-guest-msg {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
    font-size: 1.1rem;
}

.lobby-guest-msg p {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* ============================================
   TOKEN PICKER
   ============================================ */
.token-picker {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.token-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.6rem 0.8rem;
    border: 2px solid #ddd;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    background: white;
    min-width: 70px;
}

.token-option:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.token-option.selected {
    border-color: var(--primary);
    background: rgba(192, 57, 43, 0.08);
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.15);
}

.token-option-icon {
    font-size: 1.5rem;
}

.token-option-label {
    font-size: 0.65rem;
    font-weight: 600;
    color: var(--text-light);
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #ccc; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #aaa; }

/* Mobile scrollbar */
@media (max-width: 768px) {
    ::-webkit-scrollbar { width: 4px; height: 4px; }
}

/* ============================================
   TOUCH ENHANCEMENTS
   ============================================ */
@media (max-width: 768px) {
    /* Remove hover effects on mobile */
    .btn:hover,
    .space:hover,
    .mode-card:hover,
    .token-option:hover,
    .local-token-option:hover,
    .trade-prop-item:hover,
    .local-player-card:hover {
        transform: none !important;
        box-shadow: var(--shadow) !important;
    }
    
    /* Add tap feedback */
    .btn:active,
    .mode-card:active,
    .token-option:active,
    .local-token-option:active,
    .trade-prop-item:active {
        transform: scale(0.95) !important;
        transition: transform 0.1s ease !important;
    }
    
    .space:active {
        opacity: 0.8;
        transition: opacity 0.1s ease !important;
    }
    
    /* Improve touch targets */
    .space {
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(0,0,0,0.1);
    }
    
    /* Disable text selection on game elements */
    .board, .space, .btn, .panel-players, .panel-actions {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
    }
    
    /* Allow text selection in forms and modals */
    .input, .modal-content, .setup-form {
        -webkit-user-select: text;
        -moz-user-select: text;
        -ms-user-select: text;
        user-select: text;
    }
    
    /* Improve modal positioning on mobile */
    .modal {
        top: 5%;
        transform: translate(-50%, 0);
        max-height: 90vh;
    }
    
    /* Better spacing for touch */
    .action-buttons {
        gap: 0.5rem;
    }
    
    .action-buttons .btn {
        padding: 0.6rem 1rem;
    }
    
    /* Improve dice display on mobile */
    .dice-display {
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    /* Property card improvements */
    .property-card-actions {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .property-card-actions .btn {
        width: 100%;
    }
}

/* Landscape mobile optimization */
@media (max-width: 768px) and (orientation: landscape) {
    .game-layout {
        height: 100vh;
    }
    
    .panel-players {
        max-height: 50px;
    }
    
    .panel-actions {
        max-height: 120px;
    }
}
