/* ============================================
   WDTGames - Shared Game Container & Zoom
   ============================================ */

/* Design-Tokens der Spieleleiste. Bewusst auf .game-page gesetzt, damit ein
   einzelnes Spiel den Akzent ueberschreiben kann, ohne die Leiste neu zu bauen. */
.game-page {
    --game-ui-font: var(--kendo-font-family, ui-sans-serif, system-ui, -apple-system,
        'Segoe UI Variable Text', 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif);
    --game-bar-bg: rgba(14, 18, 22, 0.72);
    --game-surface: rgba(255, 255, 255, 0.07);
    --game-surface-hover: rgba(255, 255, 255, 0.13);
    --game-surface-sunken: rgba(0, 0, 0, 0.28);
    --game-border: rgba(255, 255, 255, 0.10);
    --game-text: #f2f5f8;
    --game-text-muted: rgba(242, 245, 248, 0.58);
    --game-accent: #f0c674;
    --game-accent-soft: rgba(240, 198, 116, 0.16);

    height: 100%;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    font-family: var(--game-ui-font);
    color: #ffffff;
    user-select: none;
    -webkit-user-select: none;
    box-sizing: border-box;
}

/* Toolbar - single-line, unified layout */
.game-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    flex-wrap: nowrap;
    background: var(--game-bar-bg);
    border-bottom: 1px solid var(--game-border);
    box-shadow: 0 1px 12px rgba(0, 0, 0, 0.28);
    min-height: 46px;
    backdrop-filter: blur(14px) saturate(140%);
    -webkit-backdrop-filter: blur(14px) saturate(140%);
    z-index: 100;
    flex-shrink: 0;
    overflow-x: auto;
    overflow-y: hidden;

    /* Schriftart hier festnageln: die Spiel-Container setzen teils Serif oder
       Monospace, was sonst bis in die Leiste durchschlaegt. */
    font-family: var(--game-ui-font);
    font-feature-settings: 'tnum' 1;
    font-variant-numeric: tabular-nums;
    color: var(--game-text);
}

/* Thin scrollbar for toolbar overflow */
.game-toolbar::-webkit-scrollbar {
    height: 3px;
}
.game-toolbar::-webkit-scrollbar-track {
    background: transparent;
}
.game-toolbar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 2px;
}

.game-toolbar-title {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    font-size: 0.98rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--game-text);
    margin-right: 2px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Trennstrich hinter dem Titel - ohne zusaetzliches Markup in den Spielen */
.game-toolbar-title::after {
    content: '';
    width: 1px;
    height: 18px;
    background: var(--game-border);
}

/* --- Buttons --- */
.game-toolbar-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 30px;
    padding: 0 12px;
    border: 1px solid var(--game-border);
    background: var(--game-surface);
    color: var(--game-text);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.8125rem;
    font-weight: 500;
    font-family: inherit;
    white-space: nowrap;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}

.game-toolbar-btn:hover:not(:disabled) {
    background: var(--game-surface-hover);
    border-color: rgba(255, 255, 255, 0.18);
}

.game-toolbar-btn:active:not(:disabled) {
    background: rgba(255, 255, 255, 0.05);
}

.game-toolbar-btn:disabled {
    opacity: 0.32;
    cursor: default;
}

.game-toolbar-btn.active {
    background: var(--game-accent-soft);
    border-color: rgba(240, 198, 116, 0.45);
    color: var(--game-accent);
}

/* Sichtbarer Fokusring nur bei Tastaturbedienung */
.game-toolbar-btn:focus-visible,
.game-diff-btn:focus-visible,
.game-zoom-btn:focus-visible {
    outline: 2px solid var(--game-accent);
    outline-offset: 2px;
}

/* --- Stat-Chips --- */
.game-toolbar-stat {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    height: 30px;
    padding: 0 11px;
    line-height: 30px;
    background: var(--game-surface-sunken);
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--game-text);
    white-space: nowrap;
    flex-shrink: 0;
}

.game-toolbar-stat strong {
    font-weight: 500;
    font-size: 0.75rem;
    color: var(--game-text-muted);
}

/* --- Segmentierte Gruppen (Schwierigkeit, Zoom) --- */
.game-diff-group,
.game-zoom-control {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px;
    background: var(--game-surface-sunken);
    border-radius: 10px;
    flex-shrink: 0;
}

.game-diff-btn {
    height: 26px;
    padding: 0 11px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--game-text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.game-diff-btn:hover {
    background: var(--game-surface);
    color: var(--game-text);
}

.game-diff-active {
    background: var(--game-accent-soft) !important;
    color: var(--game-accent) !important;
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(240, 198, 116, 0.35);
}

/* --- Beenden --- */
.game-exit-btn {
    background: transparent;
    border-color: var(--game-border);
    color: var(--game-text-muted);
    margin-right: 2px;
}

.game-exit-btn:hover:not(:disabled) {
    background: rgba(239, 83, 80, 0.16);
    border-color: rgba(239, 83, 80, 0.45);
    color: #ff9b96;
}

/* --- Zoom --- */
.game-zoom-control {
    margin-left: auto;
}

.game-zoom-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 26px;
    border: 0;
    background: transparent;
    color: var(--game-text-muted);
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-family: inherit;
    transition: background-color 0.15s ease, color 0.15s ease;
    padding: 0;
    line-height: 1;
}

.game-zoom-btn:hover {
    background: var(--game-surface);
    color: var(--game-text);
}

.game-zoom-btn:active {
    background: var(--game-accent-soft);
    color: var(--game-accent);
}

.game-zoom-auto {
    font-size: 0.9rem;
}

/* Zoom content area - scrollable when content overflows */
.game-zoom-area {
    flex: 1;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 10px 8px 4px;
    align-self: stretch;
    width: 100%;
}

/* Scrollbar styling for game area */
.game-zoom-area::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.game-zoom-area::-webkit-scrollbar-track {
    background: transparent;
}

.game-zoom-area::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.game-zoom-area::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

.game-zoom-content {
    transform-origin: top center;
    transition: transform 0.15s ease;
}

/* Status bar */
.game-status-bar {
    padding: 8px 20px;
    text-align: center;
    font-size: 1rem;
    font-weight: 600;
    flex-shrink: 0;
}

.game-status-won {
    background: rgba(76, 175, 80, 0.15);
    color: #81c784;
}

.game-status-lost {
    background: rgba(244, 67, 54, 0.15);
    color: #e57373;
}

.game-status-info {
    background: rgba(33, 150, 243, 0.1);
    color: #90caf9;
}

/* Responsive toolbar */
@media (max-width: 1024px) {
    .game-toolbar {
        padding: 5px 9px;
        gap: 6px;
        min-height: 40px;
    }
    .game-toolbar-title { font-size: 0.9rem; gap: 9px; }
    .game-toolbar-title::after { height: 15px; }
    .game-toolbar-btn { height: 27px; padding: 0 9px; font-size: 0.76rem; }
    .game-toolbar-stat { height: 27px; line-height: 27px; padding: 0 8px; font-size: 0.76rem; }
    .game-toolbar-stat strong { font-size: 0.7rem; }
    .game-diff-btn { height: 23px; padding: 0 8px; font-size: 0.72rem; }
    .game-zoom-btn { width: 26px; height: 23px; font-size: 0.88rem; }
}
