/* Demo Game Styling */

/* Viewport and overflow control */
html, body {
    height: 100%;
    overflow: hidden;
}

body {
    display: flex;
    flex-direction: column;
}

/* Main content area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Section adjustments for viewport fitting */
.section {
    flex: 1;
    display: flex;
    align-items: center;
    overflow: hidden;
}

/* Footer sticky to bottom */
.footer {
    margin-top: auto;
    flex-shrink: 0;
}

/* Game Setup */
.setup-container {
    max-width: 500px;
    margin: 0 auto;
    padding: var(--spacing-md);
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--border);
}

.player-setup {
    margin-bottom: var(--spacing-lg);
}

.player-setup label {
    display: block;
    margin-bottom: var(--spacing-xs);
    font-weight: 600;
}

.player-setup select {
    width: 100%;
    padding: var(--spacing-sm);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: var(--surface);
    font-size: 1rem;
    font-family: inherit;
}

.player-names-container {
    margin-bottom: var(--spacing-lg);
}

.player-name-input {
    display: flex;
    align-items: center;
    margin-bottom: var(--spacing-sm);
}

.player-name-input label {
    width: 80px;
    font-weight: 500;
}

.player-name-input input {
    flex-grow: 1;
    padding: var(--spacing-xs) var(--spacing-sm);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    font-family: inherit;
}

.player-color-picker {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    margin-left: var(--spacing-sm);
}

#start-game-btn {
    width: 100%;
    margin-top: var(--spacing-md);
}

/* Game Layout */
.game-container {
    max-width: 1200px;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.game-layout {
    display: grid;
    grid-template-columns: 240px 1fr 300px;
    gap: var(--spacing-md);
    flex: 1;
    overflow: hidden;
}

/* Sidebar */
.game-sidebar {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--spacing-sm);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    height: 100%;
    overflow: hidden;
}

.game-info {
    margin-bottom: var(--spacing-md); /* increased outer spacing */
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md); /* space between heading, status and current-player */
}

.game-info h3 {
    font-size: 0.9rem;
    margin-bottom: var(--spacing-xs);
}

.game-status {
    background: var(--surface);
    border-radius: var(--radius-md);
    padding: var(--spacing-xs);
    margin: var(--spacing-sm) 0; /* increased from var(--spacing-xs) */
    height: 60px;
    border-left: 4px solid var(--primary);
    font-size: 0.75rem;
    line-height: 1.2;
    display: flex;
    align-items: center;
    overflow-y: auto;
}

.game-status p {
    margin: 0;
    font-size: 0.75rem;
}

.current-player {
    margin-top: var(--spacing-xs);
    height: 50px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.current-player h4 {
    font-size: 0.85rem;
    margin-bottom: var(--spacing-xs);
}

.player-indicator {
    display: flex;
    align-items: center;
    gap: var(--spacing-xs);
    margin-top: var(--spacing-xs);
}

.player-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ff5252;
}

.player-stats {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.player-stats-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.player-stats-container h3 {
    font-size: 0.9rem;
    margin-bottom: var(--spacing-xs);
    flex-shrink: 0;
}

.player-stat-item {
    display: flex;
    align-items: center;
    padding: var(--spacing-xs) 0;
    border-bottom: 1px solid var(--border);
}

.player-stat-item .player-color {
    width: 8px;
    height: 8px;
}

.player-stat-name {
    flex-grow: 1;
    margin-left: var(--spacing-xs);
    font-size: 0.7rem;
}

.player-stat-info {
    font-size: 0.65rem;
    color: var(--text-secondary);
    line-height: 1.1;
}

.game-controls {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
    flex-shrink: 0;
    height: 140px; /* mehr Platz für neuen Button */
    justify-content: flex-end;
}

.game-controls button {
    width: 100%;
    padding: var(--spacing-xs) var(--spacing-sm);
    font-size: 0.8rem;
    height: 30px;
}

.game-controls button.signal {
    background-color: #8e2de2 !important;
    border-color:    #8e2de2 !important;
    color:           #ffffff !important;
}

.game-controls button.complete-career {
    background:#2e7d32 !important;
    border-color:#2e7d32 !important;
    color:#ffffff !important;
    font-weight:600;
}

.game-controls button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Game Board */
.game-main {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100%;
    overflow: hidden;
}

.game-board {
    position: relative;
    width: 100%;
    max-width: 700px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    background: var(--surface);
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.board-image {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    max-height: none;
}

.board-players {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.player-piece {
    position: absolute;
    width: 20px; /* Reduced from 24px */
    height: 20px; /* Reduced from 24px */
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: var(--shadow-md);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 10;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 10px; /* Reduced from 12px */
    color: white;
    text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

/* Game Tools - Now in right sidebar */
.game-tools {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    padding: var(--spacing-md);
    height: 100%;
    overflow: hidden;
}

.dice-container {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 120px;
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
}

.dice {
    width: 60px;
    height: 60px;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1s ease;
}

.dice-face {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: var(--radius-md);
    background: white;
    border: 2px solid var(--primary);
    box-shadow: var(--shadow-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.dice-dot {
    position: absolute; /* new: allow precise placement */
    width: 8px;
    height: 8px;
    background-color: var(--primary);
    border-radius: 50%;
}

/* 3x3 grid helper positions (15% inset gives balanced spacing) */
.dice-dot.dot-tl { top:15%; left:15%; }
.dice-dot.dot-tr { top:15%; right:15%; }
.dice-dot.dot-ml { top:50%; left:15%; transform:translateY(-50%); }
.dice-dot.dot-mr { top:50%; right:15%; transform:translateY(-50%); }
.dice-dot.dot-bl { bottom:15%; left:15%; }
.dice-dot.dot-br { bottom:15%; right:15%; }
.dice-dot.dot-c  { top:50%; left:50%; transform:translate(-50%,-50%); }

.dice.rolling {
    animation: diceRoll 0.75s ease;
}

@keyframes diceRoll {
    0% { transform: rotateX(0) rotateY(0); }
    25% { transform: rotateX(180deg) rotateY(90deg); }
    50% { transform: rotateX(270deg) rotateY(180deg); }
    75% { transform: rotateX(180deg) rotateY(270deg); }
    100% { transform: rotateX(360deg) rotateY(360deg); }
}

.cards-display {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.card-slot {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 2px solid var(--border);
    padding: var(--spacing-md);
    display: flex;
    flex-direction: column;
    min-height: 120px;
}

.card-slot h4 {
    text-align: center;
    margin-bottom: var(--spacing-xs);
    padding-bottom: var(--spacing-xs);
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}

.card-content {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    text-align: center;
    font-size: 0.85rem;
}

.card-content h3 {
    font-size: 1rem;
    margin-bottom: var(--spacing-xs);
}

.card-content p {
    font-size: 0.8rem;
    line-height: 1.3;
}

/* Modals */
.modal-content {
    max-width: 600px;
}

.help-modal-content {
    max-width: 800px;
}

.winner-info {
    text-align: center;
    margin: var(--spacing-lg) 0;
}

.winner-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--spacing-sm);
}

.winner-details {
    font-size: 1.2rem;
}

.modal-actions {
    display: flex;
    gap: var(--spacing-md);
    justify-content: center;
    margin-top: var(--spacing-lg);
}

.modal-actions button {
    min-width: 150px;
}

.rules-content {
    margin-top: var(--spacing-md);
    max-height: 70vh;
    overflow-y: auto;
    padding: var(--spacing-sm);
}

/* Responsive Design */
@media (max-width: 1200px) {
    .game-layout {
        grid-template-columns: 200px 1fr 250px;
    }
    
    .game-container {
        max-width: 1000px;
    }
    
    .game-info h3 {
        font-size: 0.8rem;
    }
    
    .game-status {
        font-size: 0.7rem;
        height: 50px;
    }
    
    .current-player h4 {
        font-size: 0.8rem;
    }
    
    .player-stat-name {
        font-size: 0.65rem;
    }
    
    .player-stat-info {
        font-size: 0.6rem;
    }
    
    .game-controls {
        height: 110px;
    }
}

@media (max-width: 1000px) {
    .game-layout {
        grid-template-columns: 180px 1fr 220px;
        gap: var(--spacing-sm);
    }
    
    .board-image {
        max-height: 55vh;
    }
    
    .dice-container {
        height: 80px;
    }
    
    .dice {
        width: 50px;
        height: 50px;
    }
    
    .card-slot {
        min-height: 80px;
    }
    
    .game-info h3 {
        font-size: 0.75rem;
    }
    
    .game-status {
        font-size: 0.65rem;
        height: 45px;
    }
    
    .current-player h4 {
        font-size: 0.75rem;
    }
}

@media (max-width: 900px) {
    .game-layout {
        grid-template-columns: 1fr;
        grid-template-rows: 1fr auto auto;
        height: 100%;
    }
    
    .game-sidebar {
        order: 3;
        height: auto;
        max-height: 30vh;
        overflow-y: auto;
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .game-info {
        flex: 1;
        min-width: 250px;
    }
    
    .player-stats-container {
        flex: 1;
        min-width: 200px;
    }
    
    .game-controls {
        flex: 1;
        min-width: 200px;
        height: auto;
        flex-direction: row;
        gap: var(--spacing-xs);
    }
    
    .game-controls button {
        flex: 1;
        height: 36px;
    }
    
    .game-main {
        order: 1;
        flex: 1;
    }
    
    .game-tools {
        order: 2;
        flex-direction: row;
        gap: var(--spacing-sm);
        height: auto;
    }
}

@media (max-width: 600px) {
    .setup-container {
        padding: var(--spacing-sm);
    }
    
    .game-tools {
        flex-direction: column;
    }
    
    .cards-display {
        flex-direction: column;
    }
    
    .modal-actions {
        flex-direction: column;
    }
    
    .modal-actions button {
        width: 100%;
    }
    
    .player-piece {
        width: 16px; /* Further reduced for mobile */
        height: 16px;
        font-size: 8px;
    }
    
    .player-number {
        font-size: 6px; /* Reduced for mobile */
    }
}

/* Additional scaling for very large screens */
@media (min-width: 1400px) {
    .game-container {
        max-width: 1300px;
    }
    
    .game-layout {
        grid-template-columns: 250px 1fr 320px;
    }
    
    .board-image {
        max-height: 70vh;
    }
    
    .game-tools {
        padding: var(--spacing-lg);
    }
    
    .dice-container {
        height: 140px;
    }
    
    .card-slot {
        min-height: 140px;
    }

    .board-image {
        max-height: 65vh;
    }
    
    .game-tools {
        padding: var(--spacing-lg);
    }
    
    .dice-container {
        height: 140px;
    }
    
    .card-slot {
        min-height: 140px;
    }
}
