/* ==========================================================================
   SAISHIN-DREAM | GAME STYLESHEET (css/game.css)
   ========================================================================== */

/* --- 1. Viewport & Hintergrund --- */
#game-viewport { 
    width: 100vw; height: 100vh; overflow-y: auto; overflow-x: hidden; 
    position: relative; scroll-behavior: smooth; 
}

#bg-container { 
    display: block; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; 
    z-index: 1; background-image: url('../img/game/Default_Game_Background.jpg'); 
    background-size: cover; background-position: center 100%; 
    background-repeat: no-repeat; pointer-events: none;
}

/* --- 2. Spielfeld & Felder --- */
#field-path { 
    display: flex; flex-direction: column-reverse; align-items: center; 
    justify-content: flex-start; padding: 30vh 0 35vh 0; gap: 40px; 
    position: relative; z-index: 10; 
}

.field {
    width: 70px; height: 70px; border-radius: 50%; display: flex; justify-content: center; 
    align-items: center; font-size: 24px; font-family: var(--font-heading); font-weight: bold; 
    color: white; box-shadow: 0 10px 20px rgba(0,0,0,0.8); border: 3px solid rgba(255,255,255,0.7); 
    position: relative; transition: transform 0.3s ease;
}

.field-rot { background-color: #990000; } 
.field-blau { background-color: #004499; } 
.field-grün { background-color: #1b5e20; }
.field-start { background-color: #333333; }
.field-ziel { background-color: #d4af37; color: #000; width: 100px; height: 100px; font-size: 28px; border-color: #fff;}

/* --- 3. Spielfiguren (Tokens) --- */
.player-token { 
    width: 35px; height: 35px; border-radius: 50%; position: absolute; 
    transition: all 0.5s ease-in-out; box-shadow: 0 0 15px rgba(0,0,0,0.9); 
    border: 2px solid white; z-index: 20; 
}
.token-active { transform: scale(1.2) !important; z-index: 30; border: 3px solid #fff; }

/* --- 4. Ingame-Menü --- */
#menu-toggle {
    position: fixed; top: 15px; right: 15px; z-index: 3000; 
    background: rgba(15, 15, 15, 0.9); border: 1px solid #333; color: #aaa; 
    width: 45px; height: 45px; border-radius: var(--border-radius); display: flex; 
    justify-content: center; align-items: center; font-size: 24px; cursor: pointer; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.8);
}

#game-menu {
    position: fixed; top: 65px; right: 15px; z-index: 3000; 
    background: rgba(10, 10, 10, 0.98); border: 1px solid #333; 
    border-top: 3px solid var(--color-accent-dark); display: none; 
    flex-direction: column; width: 180px; box-shadow: 0 10px 30px rgba(0,0,0,0.9);
}

#game-menu a { padding: 15px 20px; color: #aaa; text-decoration: none; border-bottom: 1px dotted #333; text-transform: uppercase; font-size: 13px; letter-spacing: 1px; }
#game-menu a:hover { background: var(--color-accent-dark); color: #fff; }

/* --- 5. Ladebildschirm --- */
.luxury-overlay { 
    position: fixed; top: 0; left: 0; width: 100vw; height: 100dvh; 
    z-index: 2000; display: flex; flex-direction: column; background-color: #000000; 
}
.overlay-hero { 
    width: 100%; height: 100%; 
    background: radial-gradient(circle at center, #777777 0%, #333333 100%); 
    display: flex; flex-direction: column; justify-content: center; align-items: center; 
}
.spinner { 
    border: 8px solid rgba(255, 255, 255, 0.1); border-top: 8px solid var(--color-accent); 
    border-radius: 50%; width: 60px; height: 60px; animation: spin 1s linear infinite; margin-bottom: 20px; z-index: 2; 
}
@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* --- 6. UI Panel --- */
#ui-panel { 
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); 
    width: calc(100vw - 40px); max-width: 400px; background: rgba(15, 15, 15, 0.98); 
    border-top: 3px solid var(--color-accent-dark); padding: 15px 20px; color: #aaa; 
    box-shadow: 0 15px 40px rgba(0,0,0,0.9); z-index: 1000; user-select: none; 
    box-sizing: border-box; border-radius: var(--border-radius); border: 1px solid #222;
    max-height: 90vh; overflow-y: auto; scrollbar-width: none;
}
#ui-panel::-webkit-scrollbar { display: none; }
#drag-handle { width: 100%; height: 10px; margin-bottom: 10px; display: flex; justify-content: center; align-items: center; cursor: grab; touch-action: none; flex-shrink: 0; }
#drag-handle::after { content: ''; width: 40px; height: 4px; background: #444; border-radius: 2px; }
.player-header { display: flex; flex-direction: row; justify-content: space-between; align-items: center; width: 100%; margin-bottom: 10px; }
.player-details { text-align: left; flex-grow: 1; }
.player-details h3 { margin: 0 0 2px 0; font-size: 22px; font-family: var(--font-heading); }

.btn-dice { 
    font-size: 32px; background: var(--color-accent); color: white; border: none; 
    border-radius: 50%; width: 60px; height: 60px; display: flex; justify-content: center; 
    align-items: center; cursor: pointer; box-shadow: 0 5px 15px rgba(204,0,0,0.5); 
    transition: transform 0.1s, background 0.3s; line-height: 1; padding-bottom: 4px; margin: 0; flex-shrink: 0; 
}
.btn-dice:hover:not(:disabled) { background: #ff3333; transform: scale(1.05); }
.btn-dice:disabled { background: #333; color: #777; box-shadow: none; cursor: not-allowed; opacity: 0.5; }

#btn-tasks { background-color: #222; color: #aaa; border: 1px solid #444; padding: 10px; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; width: 100%; cursor: pointer; margin-bottom: 10px; border-radius: var(--border-radius); }
#btn-tasks:hover { background-color: #333; color: #fff;}
#action-box { background: #0a0a0a; color: #ddd; padding: 20px; border: 1px solid #222; width: 100%; box-sizing: border-box; border-radius: var(--border-radius); margin-bottom: 15px; display: none; }
#action-title { font-family: var(--font-heading); font-size: 20px; margin-top:0; border-bottom: 1px dotted #444; padding-bottom: 10px; color: #fff; text-align: center;}
#action-text { font-size: 16px; line-height: 1.6; margin-top: 15px; text-align: center;}
#interaction-area { width: 100%; display: none; }
#timer-container { text-align: center; background: rgba(255,255,255,0.05); padding: 10px; border: 1px dotted #555; margin-bottom: 15px; }
#btn-start-timer { background-color: #555; color: #fff; width: 100%; border:none; padding:10px; font-family: var(--font-body); text-transform: uppercase; font-weight: bold; cursor: pointer; border-radius: var(--border-radius); }
#timer-countdown { font-family: var(--font-heading); font-size: 30px; color: var(--color-accent); text-shadow: 0 0 10px rgba(204,0,0,0.5); }
.sf-buttons { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.sf-buttons button { width: 48%; font-size: 14px; margin-bottom: 0; border: none; padding: 12px; font-family: var(--font-body); text-transform: uppercase; font-weight: bold; cursor: pointer; border-radius: var(--border-radius); }
.btn-success { background-color: #28a745 !important; color: white; }
.btn-fail { background-color: #222 !important; border: 1px solid #444 !important; color: #aaa;}
.task-nav { display: flex; justify-content: space-between; width: 100%; margin-top: 10px; }
.task-nav button { width: 48%; background-color: #444; color: white; border-radius: var(--border-radius); border: none; padding: 10px; cursor: pointer;}
.btn-close { background-color: #222; color: white; width: 100% !important; border: 1px solid #444 !important; margin-top: 10px; border-radius: var(--border-radius); padding: 12px; cursor: pointer;}
.single-btn { width: 100% !important; }

@media (min-width: 800px) {
    #ui-panel { width: fit-content; max-width: 650px; padding: 20px; }
    #ui-panel.ui-panel-expanded { display: grid !important; grid-template-columns: 180px 1fr; gap: 20px; align-items: start; }
    #ui-panel.ui-panel-expanded #drag-handle { grid-column: 1 / span 2; margin-bottom: 5px; }
    #ui-panel.ui-panel-expanded #player-section { grid-column: 1; grid-row: 2; border-right: 1px dotted #333; padding-right: 20px; }
    #ui-panel.ui-panel-expanded #interaction-area { grid-column: 1; grid-row: 3; border-right: 1px dotted #333; padding-right: 20px; margin-top: 10px; }
    #ui-panel.ui-panel-expanded #action-box { grid-column: 2; grid-row: 2 / span 2; margin-bottom: 0; min-width: 300px; display: block !important; }
    #ui-panel.ui-panel-expanded .player-header { flex-direction: column; text-align: center; justify-content: center; margin-bottom: 15px; }
    #ui-panel.ui-panel-expanded .player-details { text-align: center; }
    #ui-panel.ui-panel-expanded .player-details h3 { font-size: 20px; margin-bottom: 5px; }
    #ui-panel.ui-panel-expanded .btn-dice { margin-top: 10px; }
    #ui-panel.ui-panel-expanded .sf-buttons { flex-direction: column; gap: 10px; }
    #ui-panel.ui-panel-expanded .sf-buttons button { width: 100% !important; }
    #ui-panel.ui-panel-expanded .task-nav button { width: 48% !important; }
}

#dice-overlay { 
    display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); 
    width: 100px; height: 100px; background: #0a0a0a; border: 3px solid var(--color-accent); 
    color: #fff; font-family: var(--font-heading); font-size: 50px; text-align: center; 
    line-height: 94px; z-index: 4000; box-shadow: 0 0 40px rgba(204, 0, 0, 0.6); border-radius: var(--border-radius);
}
.roll-animation { animation: roll 0.5s linear infinite; }
@keyframes roll { 
    0% { transform: translate(-50%, -50%) rotate(0deg) scale(1); } 
    50% { transform: translate(-50%, -50%) rotate(180deg) scale(1.2); } 
    100% { transform: translate(-50%, -50%) rotate(360deg) scale(1); } 
}

/* ==========================================================================
   SELECT GAME SPEZIFISCHES STYLING (für select_game.php)
   ========================================================================== */

#start-screen, #setup-screen { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }

#start-screen .overlay-hero, #setup-screen .overlay-hero { 
    flex: 0 0 auto; height: auto; min-height: 75px; 
    background: radial-gradient(circle at center, #777777 0%, #333333 100%); 
    display: flex; flex-direction: column; justify-content: center; align-items: center; 
    border-bottom: 3px solid var(--color-accent-dark); padding: 15px; box-sizing: border-box;
}

#start-screen .overlay-hero h1, #setup-screen .overlay-hero h1 { 
    font-family: var(--font-body); font-size: clamp(14px, 4vw, 20px); color: #ffffff; 
    letter-spacing: 2px; text-transform: uppercase; text-align: center; margin: 0 65px; 
    font-weight: 300; line-height: 1.4;
}

#start-screen .overlay-content, #setup-screen .overlay-content { 
    flex: 1 1 auto; height: 0; width: 100%; background-color: var(--bg-content); 
    display: flex; flex-direction: column; padding: 15px; padding-bottom: 35px; box-sizing: border-box; 
    overflow-y: auto; /* NEU: Erlaubt Scrollen auf kleinen Displays */
}

#start-content { 
    display: flex; flex-direction: column; width: 100%; max-width: 1200px; 
    flex: 1 1 auto; height: auto; min-height: min-content; gap: 15px; margin: 0 auto; 
}

#game-list-wrapper { 
    flex: 0 0 40%; min-height: 180px; overflow-y: auto; background: var(--bg-input); 
    border: 1px dotted #555; box-sizing: border-box; border-radius: var(--border-radius);
}

#button-container { display: flex; flex-direction: column; gap: 8px; padding: 12px; box-sizing: border-box; }

.game-mode-btn { 
    background-color: var(--bg-card); color: #aaa; font-family: var(--font-body); text-transform: uppercase; 
    letter-spacing: 1px; font-size: 12px; padding: 12px 15px; border: 1px solid #333; cursor: pointer; 
    width: 100%; font-weight: 600; transition: all 0.3s ease; flex-shrink: 0; display: flex; 
    justify-content: space-between; align-items: center; text-align: left; min-height: 42px; 
    border-radius: var(--border-radius); box-sizing: border-box; margin: 0;
}
.game-mode-btn:hover, .game-mode-btn.selected { background-color: var(--color-accent); color: #fff; border-color: var(--color-accent); }
.game-mode-btn:disabled { background-color: #111; color: #555; border-color: #222; cursor: not-allowed; }

#game-info-container { 
    flex: 1 1 auto; display: flex; flex-direction: column; background: var(--bg-input); 
    padding: 15px; padding-bottom: 25px; text-align: left; box-shadow: inset 0 0 20px rgba(0,0,0,0.5); 
    overflow-y: auto; border: 1px dotted #555; box-sizing: border-box; border-radius: var(--border-radius);
}

#game-title-display { font-family: var(--font-heading); font-size: clamp(20px, 4vw, 30px); color: #fff; margin: 0 0 10px 0; border-bottom: 1px dotted #555; padding-bottom: 10px; flex-shrink: 0;}
#game-cost-display { font-family: var(--font-body); font-size: 14px; color: var(--color-accent); margin-bottom: 10px; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; flex-shrink: 0;}
#game-description-box { flex-grow: 1; font-size: 14px; color: #aaa; overflow-y: auto; line-height: 1.5; margin-bottom: 15px;}
#btn-start-selected { align-self: center; width: 100%; max-width: 300px; font-size: 15px; padding: 12px; margin-bottom: 0; flex-shrink: 0; display: block; text-align: center;}

@media (min-width: 800px) {
    #start-content { flex-direction: row; gap: 30px; }
    #game-list-wrapper { flex: 0 0 35%; height: 100%; }
    .game-mode-btn { font-size: 13px; padding: 15px; min-height: 48px;} 
    #game-info-container { flex: 1 1 auto; height: 100%; padding: 30px; border: none;}
    #btn-start-selected { align-self: flex-end; margin-bottom: 0;}
}

#dynamic-setup-area { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; }
.setup-container { display: flex; gap: 20px; width: 100%; justify-content: center; align-items: flex-start; flex-wrap: wrap; flex-grow: 1; overflow-y: auto; padding-bottom: 15px;}
.player-setup { background: var(--bg-input); border-top: 3px solid var(--color-accent-dark); padding: 20px; width: 100%; max-width: 300px; text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.8); flex-shrink: 0; border-radius: var(--border-radius); box-sizing: border-box;}
.player-setup h2 { font-family: var(--font-heading); color: #fff; font-size: 22px; margin-top: 0; margin-bottom: 15px; }
.player-setup input, .role-select { width: 100%; padding: 10px; margin-bottom: 15px; font-family: var(--font-body); font-size: 15px; text-align: center; border: 1px solid #555; background: #0a0a0a; color: #fff; box-sizing: border-box; border-radius: var(--border-radius);}
.color-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; justify-items: center; margin-bottom: 10px;}
.color-swatch { width: 35px; height: 35px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; transition: transform 0.2s; box-sizing: border-box;}
.color-swatch.selected { border-color: #fff; box-shadow: 0 0 10px rgba(255,255,255,0.5); transform: scale(1.15); }

#token-display {
    position: fixed; top: 15px; right: 15px; z-index: 3000; background: rgba(10, 10, 10, 0.9); border: 1px solid #333;
    color: #aaaaaa; padding: 8px 15px; border-radius: var(--border-radius); font-family: var(--font-body); font-size: 13px; 
    box-shadow: 0 4px 15px rgba(0,0,0,0.8); display: flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: 1px;
}
#token-display strong { color: var(--color-accent); font-size: 16px; font-weight: bold; }

body[data-page="select-game"] #menu-toggle { left: 15px; right: auto; }
body[data-page="select-game"] #game-menu { left: 15px; right: auto; }
