:root {
    --dice-roll-ms: 1200ms;
    --notif-trans-ms: 500ms;
    --primary-blue: #1e3c72;
    --secondary-blue: #2a5298;
    --accent-gold: #fbbf24;
    --dark-panel: #1a2942;
    --light-panel: #233a60;
}

* {
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, var(--primary-blue), var(--secondary-blue));
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    color: #e0e0e0;
    min-height: 100vh;
    position: relative;
}

/* ===== MOBILE FIRST LAYOUT ===== */


.game-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding-bottom: 70px;
    /* Espaço para bottom nav */
}

/* Header Mobile */
.mobile-header {
    background: var(--dark-panel);
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    position: sticky;
    top: 0;
    z-index: 50;
}

.mobile-header h1 {
    font-size: 1.25rem;
    font-weight: 900;
    margin: 0;
    color: var(--accent-gold);
}

.header-stats {
    display: flex;
    gap: 1rem;
    align-items: center;
    font-size: 0.75rem;
}

/* Main Game Board - ALINHADO INFERIOR */
.game-board-wrapper {
    flex: 1;
    padding: 0.3rem;
    overflow-y: auto;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    /* ALINHAR NA PARTE INFERIOR */
}

.board-container {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.5rem;
    padding: 0.3rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    /* ALINHAR TABULEIRO NA LINHA INFERIOR */
    overflow-y: auto;
    min-height: auto;
    width: 100%;
    max-width: 100%;
    gap: 0.5rem;
    /* ESPAÇAMENTO REDUZIDO */
}

/* Bottom Navigation - Mobile */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--dark-panel);
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    padding: 0.5rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
    z-index: 100;
}

.nav-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 0.5rem;
}

.nav-btn:active {
    transform: scale(0.95);
    background: rgba(255, 255, 255, 0.1);
}

.nav-btn.active {
    color: var(--accent-gold);
    background: rgba(251, 191, 36, 0.1);
}

.nav-btn-icon {
    font-size: 1.5rem;
}

/* Sliding Panels - Mobile */
.sliding-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--light-panel);
    border-radius: 1.5rem 1.5rem 0 0;
    max-height: 85vh;
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 200;
    overflow: hidden;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
}

.sliding-panel.active {
    transform: translateY(0);
}

.panel-handle {
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    margin: 0.75rem auto;
}

.panel-content {
    padding: 0 1.5rem 1.5rem;
    overflow-y: auto;
    max-height: calc(85vh - 100px);
    scroll-behavior: smooth;
}

.panel-header {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: var(--light-panel);
    z-index: 10;
}

.panel-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

.panel-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: #e0e0e0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Overlay */
.panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 150;
}

.panel-overlay.active {
    opacity: 1;
    pointer-events: all;
}

/* Touch-Friendly Buttons - REDUZIDOS */
.btn-primary {
    background: var(--accent-gold);
    color: #1a2942;
    border: none;
    padding: 0.6rem 1rem;
    border-radius: 0.5rem;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 36px;
    /* Reduzido de 44px */
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.btn-primary:active {
    transform: scale(0.97);
    background: #f59e0b;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 0.875rem 1.5rem;
    border-radius: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-height: 44px;
}

.btn-secondary:active {
    background: rgba(255, 255, 255, 0.2);
}

/* Player Cards - Mobile Optimized */
.player-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 2px solid transparent;
    transition: all 0.2s;
}

.player-card.active {
    border-color: var(--accent-gold);
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.3);
}

.player-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.player-name {
    font-size: 1.125rem;
    font-weight: 700;
}

.player-money {
    font-size: 1.25rem;
    font-weight: 900;
    color: var(--accent-gold);
}

/* Tabs Mobile */
.tabs-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
    overflow-x: auto;
    scroll-behavior: smooth;
}

.tab-btn {
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    color: #94a3b8;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    min-height: 36px;
}

.tab-btn.active {
    background: var(--accent-gold);
    color: #1a2942;
    border-color: var(--accent-gold);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Board Styles - Responsive */
.board-container {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 1rem;
    padding: 1rem;
    min-height: 400px;
}

/* ===== TABLET & DESKTOP (min-width: 768px) ===== */
@media (min-width: 768px) {
    .game-container {
        padding-bottom: 0;
    }

    .mobile-header {
        padding: 1rem 2rem;
    }

    .mobile-header h1 {
        font-size: 1.5rem;
    }

    .bottom-nav {
        position: relative;
        grid-template-columns: repeat(4, 1fr);
        max-width: 600px;
        margin: 0 auto;
        border-radius: 1rem;
        bottom: auto;
    }

    .game-board-wrapper {
        padding: 2rem;
    }

    .sliding-panel {
        max-width: 480px;
        left: auto;
        right: 0;
        max-height: 100vh;
        border-radius: 1rem 0 0 1rem;
    }

    .panel-content {
        max-height: calc(100vh - 140px);
    }
}

/* ===== DESKTOP (min-width: 1024px) ===== */
@media (min-width: 1024px) {
    .game-container {
        display: grid;
        grid-template-columns: 360px 1fr 360px;
        gap: 1.5rem;
        padding: 1.5rem;
        max-width: 1800px;
        margin: 0 auto;
    }

    .mobile-header {
        display: none;
    }

    .bottom-nav {
        display: none;
    }

    .game-board-wrapper {
        order: 2;
        padding: 0;
    }

    .sliding-panel {
        position: relative;
        transform: translateY(0) !important;
        max-height: calc(100vh - 3rem);
        border-radius: 1rem;
        max-width: none;
        right: auto;
    }

    .sliding-panel.panel-left {
        order: 1;
    }

    .sliding-panel.panel-right {
        order: 3;
    }

    .panel-handle {
        display: none;
    }

    .panel-overlay {
        display: none;
    }

    .panel-close {
        display: none;
    }
}

/* Badge Styles */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2rem;
    font-size: 0.875rem;
    font-weight: 600;
}

.dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
}

/* Progress Indicators */
.progress-bar {
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
    margin-top: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: var(--accent-gold);
    transition: width 0.3s;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ===== SETUP SCREEN STYLES ===== */
.setup-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}

.setup-container {
    background: var(--light-panel);
    border-radius: 1.5rem;
    padding: 2rem;
    max-width: 600px;
    width: 100%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
}

.setup-header {
    text-align: center;
    margin-bottom: 2rem;
}

.setup-header h1 {
    font-size: 2.5rem;
    font-weight: 900;
    color: var(--accent-gold);
    margin: 0 0 0.5rem 0;
}

.setup-header p {
    color: #94a3b8;
    margin: 0;
}

.floating-anchor {
    font-size: 6rem;
    color: var(--accent-gold);
    display: inline-block;
    animation: float 3s ease-in-out infinite;
    text-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

.player-setup-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.player-setup-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.75rem;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-left: 4px solid;
    transition: all 0.2s;
}

.player-setup-card:hover {
    background: rgba(255, 255, 255, 0.08);
}

.player-setup-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex: 1;
    min-width: 0;
    /* Critical for text overflow in flex */
}

.player-name-input {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.5rem;
    padding: 0.5rem 0.75rem;
    color: #e0e0e0;
    font-size: 1rem;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    flex: 1;
    min-height: 40px;
    width: 100%;
    min-width: 0;
    /* Allow shrinking */
}

.player-name-input:focus {
    outline: none;
    border-color: var(--accent-gold);
    background: rgba(255, 255, 255, 0.15);
}

.player-roll-result {
    font-size: 1.5rem;
    font-weight: 700;
    min-width: 60px;
    text-align: center;
    color: var(--accent-gold);
}

.btn-remove {
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
    width: 36px;
    height: 36px;
    border-radius: 0.5rem;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-remove:hover {
    background: rgba(239, 68, 68, 0.3);
}

.setup-actions {
    display: flex;
    gap: 0.75rem;
    flex-direction: column;
}

.setup-actions .btn-primary,
.setup-actions .btn-secondary {
    width: 100%;
}

.order-results {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-top: 1.5rem;
}

.order-results h3 {
    text-align: center;
    margin: 0 0 1rem 0;
    font-size: 1.25rem;
    color: var(--accent-gold);
}

.order-item {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-left: 4px solid;
}

.order-item:last-child {
    margin-bottom: 1.5rem;
}

.game-screen {
    width: 100%;
}

@media (min-width: 768px) {
    .setup-container {
        padding: 3rem;
    }

    .setup-header h1 {
        font-size: 3rem;
    }

    .setup-actions {
        flex-direction: row;
    }
}

/* ===== BOARD STYLES ===== */
.board-game {
    width: 98%;
    /* Mobile: prevent overflow */
    max-width: 100%;
    aspect-ratio: 1;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 0.3rem;
    padding: 0.2rem;
    position: relative;
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(10, 1fr);
    gap: 1px;
    /* Mobile: compact gap */
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    align-self: center;
    margin-bottom: 0.25rem;
}

.house-icon {
    font-size: 1.1rem;
    /* Mobile: large relative to cell */
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.house-name,
.house-price,
.board-corner-label {
    display: none;
    /* Hide details globally */
}

.board-house {
    background: rgba(255, 255, 255, 0.15); /* Mais claro para contrastar com os emojis */
    border-radius: 0.25rem; /* Bordas um pouco mais arredondadas */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    /* Minimal padding */
    position: relative;
    cursor: pointer;
    overflow: hidden;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.2); /* Sombra interna para dar profundidade */
}

.board-center {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 0.2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 0.4rem;
    grid-column: 3 / 9;
    grid-row: 3 / 9;
    gap: 0.2rem;
}

.board-center h3 {
    font-size: 0.8rem;
    font-weight: 900;
    margin: 0;
    color: var(--accent-gold);
    line-height: 1;
}

.board-center-icon {
    font-size: 1.4rem;
    margin: 0;
}

/* Board corners positioning */
.board-corner[style*="grid-column: 3"][style*="grid-row: 3"] {
    grid-column: 8;
    grid-row: 8;
}

.board-corner[style*="grid-column: 1"][style*="grid-row: 3"] {
    grid-column: 1;
    grid-row: 8;
}

.board-corner[style*="grid-column: 1"][style*="grid-row: 1"] {
    grid-column: 1;
    grid-row: 1;
}

.board-corner[style*="grid-column: 3"][style*="grid-row: 1"] {
    grid-column: 8;
    grid-row: 1;
}

@media (min-width: 480px) {
    .board-game {
        width: 100%;
        padding: 0.6rem;
        gap: 0.2rem;
    }

    .house-icon {
        font-size: 1.5rem;
        /* Larger icons on desktop */
    }

    .house-name,
    .house-price {
        display: none;
        /* Keep hidden on desktop too for consistency, or text-align center if needed */
    }

    .board-corner {
        font-size: 1.4rem;
    }

    .house-players {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
        gap: 2px;
        pointer-events: none;
    }

    .player-pawn {
        width: 14px;
        height: 14px;
        border-radius: 50%;
        border: 2px solid white;
        box-shadow: 0 2px 4px rgba(0,0,0,0.5);
        color: transparent; /* Oculta o emoji de texto */
        font-size: 0;
        z-index: 5;
    }

    .board-center h3 {
        font-size: 1.2rem;
    }

    .board-center-icon {
        font-size: 2.2rem;
    }
}

@media (min-width: 768px) {
    .board-game {
        max-width: 100%;
        padding: 0.8rem;
        gap: 0.25rem;
    }

    .board-corner {
        font-size: 1.6rem;
    }

    .board-corner-label {
        font-size: 0.55rem;
    }

    .board-house {
        padding: 0.3rem;
    }

    .house-icon {
        font-size: 1.5rem;
    }

    .house-name {
        font-size: 0.6rem;
    }

    .house-price {
        font-size: 0.5rem;
    }

    .player-pawn {
        width: 16px;
        height: 16px;
        border-radius: 50%;
        border: 2px solid white;
        box-shadow: 0 2px 4px rgba(0,0,0,0.5);
        color: transparent;
        font-size: 0;
        z-index: 5;
    }

    .board-center {
        padding: 0.5rem;
    }

    .board-center h3 {
        font-size: 1.4rem;
    }

    .board-center-icon {
        font-size: 2.6rem;
    }
}

@media (min-width: 1024px) {
    .board-game {
        max-width: 750px;
        padding: 1rem;
        gap: 0.35rem;
    }

    .board-corner {
        font-size: 1.8rem;
    }

    .board-corner-label {
        font-size: 0.6rem;
    }

    .board-house {
        padding: 0.4rem;
    }

    .house-icon {
        font-size: 1.75rem;
    }

    .house-name {
        font-size: 0.65rem;
    }

    .house-price {
        font-size: 0.55rem;
    }

    .player-pawn {
        width: 20px;
        height: 20px;
        border-radius: 50%;
        border: 2px solid white;
        box-shadow: 0 2px 4px rgba(0,0,0,0.5);
        color: transparent;
        font-size: 0;
        z-index: 5;
    }

    .board-center {
        padding: 0.8rem;
        gap: 0.3rem;
    }

    .board-center h3 {
        font-size: 1.6rem;
    }

    .board-center-icon {
        font-size: 3rem;
    }
}

/* ===== TABLET & DESKTOP RESPONSIVENESS ===== */
@media (min-width: 768px) {
    .game-container {
        padding-bottom: 0;
    }

    .game-board-wrapper {
        padding: 1.5rem;
    }

    .board-container {
        padding: 1rem;
    }

    .mobile-header {
        padding: 1rem 2rem;
    }

    .mobile-header h1 {
        font-size: 1.5rem;
    }

    .bottom-nav {
        position: relative;
        grid-template-columns: repeat(4, 1fr);
        max-width: 600px;
        margin: 0 auto;
        border-radius: 1rem;
        bottom: auto;
        padding: 1rem;
    }

    .sliding-panel {
        max-width: 480px;
        left: auto;
        right: 0;
        max-height: 100vh;
        border-radius: 1rem 0 0 1rem;
    }

    .panel-content {
        max-height: calc(100vh - 140px);
    }
}

@media (min-width: 1024px) {
    .game-container {
        display: grid;
        grid-template-columns: 360px 1fr 360px;
        gap: 1.5rem;
        padding: 1.5rem;
        max-width: 1800px;
        margin: 0 auto;
        min-height: 100vh;
    }

    .mobile-header {
        display: none;
    }

    .bottom-nav {
        display: none;
    }

    .game-board-wrapper {
        order: 2;
        padding: 0;
    }

    .sliding-panel {
        position: relative;
        transform: translateY(0) !important;
        max-height: calc(100vh - 3rem);
        border-radius: 1rem;
        max-width: none;
        right: auto;
    }

    .sliding-panel.panel-left {
        order: 1;
    }

    .sliding-panel.panel-right {
        order: 3;
    }

    .panel-handle {
        display: none;
    }

    .panel-overlay {
        display: none;
    }

    .panel-close {
        display: none;
    }

    .board-container {
        padding: 0;
    }
}