/* ============================================================
   KINGSPAWN – Premium UI
   Fonts: Cinzel (display) + Rajdhani (UI)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700;900&family=Rajdhani:wght@400;500;600;700&display=swap');

:root {
    --bg-main:      #161512;
    --bg-panel:     #262421;
    --border-color: #3e3b37;
    --text-main:    #c9c5c0;
    --text-muted:   #8c8985;

    --square-light:     #dee3e6;
    --square-dark:      #8ca2ad;
    --square-highlight: rgba(155, 199, 0, 0.45);

    --accent-green:  #629924;
    --accent-yellow: #d4a737;
    --accent-red:    #cc3333;

    --font-display: 'Cinzel', serif;
    --font-ui:      'Rajdhani', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: var(--font-ui), 'Segoe UI', sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: auto; /* FIX: war overflow:hidden, verhinderte Scroll */
}

#app-container {
    display: flex;
    gap: 20px;
    max-width: 1400px;
    width: 100%;
    padding: 20px;
}

/* ============================================================
   SIDEBARS & PANELS
   ============================================================ */
.sidebar {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 15px;
    min-width: 220px;
}

.panel {
    background-color: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
}

.panel h3 {
    font-family: var(--font-display);
    font-size: 0.85rem;
    letter-spacing: 2px;
    color: #fff;
    margin-bottom: 10px;
    text-align: center;
}

.credits {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    color: var(--accent-yellow);
    margin-bottom: 15px;
}

.captured-pieces {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    min-height: 40px;
    padding: 5px;
    background: rgba(0,0,0,0.2);
    border-radius: 4px;
}

.captured-img {
    width: 28px;
    height: 28px;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.5));
}

.event-log {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

#log-content {
    flex-grow: 1;
    overflow-y: auto;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.85rem;
    background: #111;
    padding: 10px;
    border-radius: 4px;
    max-height: 400px;
}

.log-entry {
    padding: 3px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}
.log-entry:last-child {
    border-bottom: none;
    color: #fff;
    font-weight: bold;
}

/* ============================================================
   MAIN GAME CENTER
   ============================================================ */
#game-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

#game-header {
    width: 100%;
    text-align: center;
    background: var(--bg-panel);
    padding: 10px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 1px;
}

.status-active   { color: var(--accent-green); }
.status-thinking { color: var(--accent-yellow); animation: pulse 1.5s infinite; }

@keyframes pulse {
    0%   { opacity: 1; }
    50%  { opacity: 0.6; }
    100% { opacity: 1; }
}

/* ============================================================
   DAS BRETT
   ============================================================ */
#chess-board {
    display: grid;
    grid-template-columns: repeat(8, minmax(60px, 80px));
    grid-template-rows:    repeat(8, minmax(60px, 80px));
    border: 10px solid var(--bg-panel);
    border-radius: 4px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.6);
    user-select: none;
}

.square {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.square.light { background-color: var(--square-light); }
.square.dark  { background-color: var(--square-dark);  }

.square.highlight::after {
    content: '';
    position: absolute;
    inset: 0;
    background-color: var(--square-highlight);
    pointer-events: none;
}

/* ============================================================
   FIGUREN
   ============================================================ */
.piece {
    width: 90%;
    height: 90%;
    cursor: pointer;
    z-index: 10;
    filter: drop-shadow(0 4px 4px rgba(0,0,0,0.4));
    transition: transform 0.1s ease-out;
    will-change: transform;
}

.piece:hover { transform: scale(1.1); }

.spawn-in {
    animation: spawnPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

@keyframes spawnPop {
    0%   { transform: scale(0); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.casting-indicator {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2.5rem;
    font-weight: 900;
    color: rgba(255, 50, 50, 0.8);
    text-shadow: 0 0 10px #000;
    z-index: 5;
    pointer-events: none;
}

/* ============================================================
   SPAWN BAR
   ============================================================ */
#spawn-bar {
    display: flex;
    gap: 10px;
    width: 100%;
    justify-content: space-between;
}

.spawn-btn {
    flex: 1;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 12px;
    border-radius: 6px;
    cursor: pointer;
    font-family: var(--font-ui);
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.2s;
}

.spawn-btn:hover     { background: #322f2b; border-color: var(--text-muted); }
.spawn-btn:active    { transform: translateY(2px); }
.spawn-btn.active    { background: #2e2a1e; border-color: var(--accent-yellow); color: var(--accent-yellow); }
.spawn-btn:disabled  { opacity: 0.35; cursor: not-allowed; }

.btn-cost {
    color: var(--accent-yellow);
    font-size: 0.85rem;
    margin-top: 4px;
}

/* ============================================================
   HAUPTMENÜ — ARCANE WAR ROOM
   ============================================================ */
#menu-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    background: #090806;
    animation: menuFadeIn 0.4s ease-out;
    overflow: hidden;
}

#menu-overlay.hidden { display: none; }

@keyframes menuFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

/* Dramatischer atmosphärischer Hintergrund */
.menu-bg-pattern {
    position: absolute;
    inset: 0;
    pointer-events: none;
    /* Blutroter Radial-Glüh-Spot links + feines Gitter */
    background:
        radial-gradient(ellipse 90% 120% at 40% 55%,
            rgba(140, 22, 12, 0.22) 0%,
            rgba(120, 18, 8, 0.10) 35%,
            transparent 68%),
        radial-gradient(ellipse 50% 60% at 40% 55%,
            rgba(180, 30, 15, 0.10) 0%,
            transparent 55%),
        repeating-linear-gradient(
            0deg,
            transparent 0px, transparent 59px,
            rgba(212, 167, 55, 0.016) 59px, rgba(212, 167, 55, 0.016) 60px
        ),
        repeating-linear-gradient(
            90deg,
            transparent 0px, transparent 59px,
            rgba(212, 167, 55, 0.016) 59px, rgba(212, 167, 55, 0.016) 60px
        );
}

/* Vertikale Trennlinie mit Gold-Glow */
.menu-bg-pattern::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    left: 34%;
    width: 1px;
    background: linear-gradient(180deg,
        transparent 0%,
        rgba(212, 167, 55, 0.06) 15%,
        rgba(212, 167, 55, 0.22) 50%,
        rgba(212, 167, 55, 0.06) 85%,
        transparent 100%
    );
}

.menu-layout {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: row-reverse;
    width: 100%;
    min-height: 100vh;
}

/* ── LINKE BRANDING-SEITE ──────────────────────────────────── */
.menu-brand {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 60px;
    border-left: 1px solid rgba(212, 167, 55, 0.1);
    animation: slideInLeft 0.65s cubic-bezier(0.16, 1, 0.3, 1) 0.05s both;
}

@keyframes slideInLeft {
    from { transform: translateX(-36px); opacity: 0; }
    to   { transform: translateX(0);     opacity: 1; }
}

.menu-brand-inner {
    text-align: center;
    max-width: 460px;
}

/* Held-König mit Glüh-Ring */
.menu-king-icon {
    width: 148px;
    height: 148px;
    margin: 0 auto 36px;
    position: relative;
    animation: heroFloat 6.5s ease-in-out infinite;
}

.menu-king-icon::before {
    content: '';
    position: absolute;
    inset: -28px;
    border-radius: 50%;
    background: radial-gradient(circle,
        rgba(160, 28, 12, 0.28) 0%,
        rgba(120, 18, 8, 0.12) 50%,
        transparent 72%);
    animation: ringBreath 4.5s ease-in-out infinite;
}

.menu-king-icon::after {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    border: 1px solid rgba(212, 167, 55, 0.12);
    box-shadow: 0 0 20px rgba(212, 167, 55, 0.08);
    animation: ringBreath 4.5s ease-in-out infinite 0.7s;
}

.menu-king-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: relative;
    z-index: 1;
    filter:
        drop-shadow(0 0 28px rgba(212, 167, 55, 0.40))
        drop-shadow(0 0 70px rgba(160, 28, 12, 0.25))
        drop-shadow(0 8px 16px rgba(0,0,0,0.7));
}

@keyframes heroFloat {
    0%, 100% { transform: translateY(0px); }
    40%       { transform: translateY(-10px); }
    70%       { transform: translateY(-5px); }
}

@keyframes ringBreath {
    0%, 100% { opacity: 0.7; transform: scale(1); }
    50%       { opacity: 1;   transform: scale(1.05); }
}

.menu-title {
    font-family: var(--font-display);
    font-size: clamp(2.8rem, 5.5vw, 5.0rem);
    font-weight: 900;
    color: #ede5cf;
    letter-spacing: 0.2em;
    line-height: 1;
    margin-bottom: 4px;
    text-shadow:
        0 0 25px rgba(212, 167, 55, 0.38),
        0 0 60px rgba(160, 28, 12, 0.20),
        0 2px 0 rgba(0, 0, 0, 0.9);
}

/* Dekoratives Ornament */
.menu-rule {
    width: 200px;
    height: 24px;
    margin: 16px auto 18px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: rgba(212, 167, 55, 0.4);
    font-size: 0.55rem;
    letter-spacing: 0.4em;
}

.menu-rule::before {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212, 167, 55, 0.45));
}

.menu-rule::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, rgba(212, 167, 55, 0.45), transparent);
}

.menu-tagline {
    font-family: var(--font-ui);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.58em;
    text-transform: uppercase;
    color: var(--accent-yellow);
    opacity: 0.85;
    margin-bottom: 24px;
}

.menu-desc {
    font-family: var(--font-ui);
    font-size: 0.96rem;
    font-weight: 400;
    color: #48403a;
    line-height: 1.85;
    max-width: 300px;
    margin: 0 auto;
}

/* ── RECHTE FORMULAR-SEITE ─────────────────────────────────── */
.menu-form-panel {
    width: 480px;
    min-width: 380px;
    background: linear-gradient(165deg, #131110 0%, #0d0b09 100%);
    border-right: 1px solid rgba(212, 167, 55, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 44px;
    overflow-y: auto;
    animation: slideInRight 0.65s cubic-bezier(0.16, 1, 0.3, 1) 0.12s both;
    position: relative;
}

/* Gold-Akzentlinie oben */
.menu-form-panel::before {
    content: '';
    position: absolute;
    top: 0; left: 6%; right: 6%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(212, 167, 55, 0.35), transparent);
}

@keyframes slideInRight {
    from { transform: translateX(36px); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

.menu-form-inner {
    width: 100%;
    max-width: 380px;
}

.form-heading {
    font-family: var(--font-display);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.45em;
    color: rgba(212, 167, 55, 0.7);
    text-transform: uppercase;
    margin-bottom: 30px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(212, 167, 55, 0.1);
}

.form-section {
    margin-bottom: 22px;
}

.form-section.hidden { display: none; }

.form-label {
    display: block;
    font-family: var(--font-ui);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.38em;
    text-transform: uppercase;
    color: #3e3830;
    margin-bottom: 10px;
}

.form-input {
    display: block;
    width: 100%;
    padding: 11px 14px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.022);
    border: 1px solid #1e1b16;
    color: #dee3e6;
    font-family: var(--font-ui);
    font-size: 0.95rem;
    font-weight: 500;
    transition: border-color 0.2s, box-shadow 0.2s;
    caret-color: var(--accent-yellow);
    letter-spacing: 0.02em;
}

.form-input:focus {
    outline: none;
    border-color: rgba(212, 167, 55, 0.35);
    box-shadow:
        0 0 0 2px rgba(212, 167, 55, 0.06),
        inset 0 0 10px rgba(212, 167, 55, 0.02);
}

.form-input::placeholder { color: #28231d; opacity: 1; }

/* ── OPTION CARDS ─────────────────────────────────────────── */
.option-cards {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.option-card {
    flex: 1;
    min-width: 0;
    cursor: pointer;
}

.option-card input[type="radio"] { display: none; }

.card-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 8px;
    border: 1px solid #1e1b16;
    background: rgba(255, 255, 255, 0.015);
    transition: all 0.18s ease;
    color: #3e3830;
    user-select: none;
    position: relative;
}

/* Eckklammern — erscheinen beim Hover/Checked */
.card-content::before,
.card-content::after {
    content: '';
    position: absolute;
    width: 7px;
    height: 7px;
    opacity: 0;
    transition: opacity 0.18s;
}

.card-content::before {
    top: 3px; left: 3px;
    border-top: 1px solid var(--accent-yellow);
    border-left: 1px solid var(--accent-yellow);
}

.card-content::after {
    bottom: 3px; right: 3px;
    border-bottom: 1px solid var(--accent-yellow);
    border-right: 1px solid var(--accent-yellow);
}

.card-text {
    font-family: var(--font-ui);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.card-icon { font-size: 1rem; }

.color-icon {
    width: 24px;
    height: 24px;
    filter: grayscale(0.5) opacity(0.5);
    transition: filter 0.18s;
}

.option-card:hover .card-content {
    border-color: rgba(212, 167, 55, 0.2);
    color: #7a6a55;
    background: rgba(212, 167, 55, 0.04);
}

.option-card:hover .card-content::before,
.option-card:hover .card-content::after { opacity: 0.7; }

.option-card input:checked + .card-content {
    border-color: rgba(212, 167, 55, 0.45);
    background: rgba(212, 167, 55, 0.07);
    color: var(--accent-yellow);
}

.option-card input:checked + .card-content::before,
.option-card input:checked + .card-content::after { opacity: 1; }

.option-card input:checked + .card-content .color-icon {
    filter: grayscale(0) opacity(1);
}

/* Custom-Time-Slider */
.custom-slider {
    margin-top: 8px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid #1e1b16;
    font-family: var(--font-ui);
    font-size: 0.88rem;
    color: var(--text-main);
    letter-spacing: 0.03em;
}

.custom-slider input[type="range"] {
    display: block;
    width: 100%;
    margin-top: 10px;
    accent-color: var(--accent-yellow);
    cursor: pointer;
}

#custom-time-container.hidden { display: none; }

/* ── KAMPF-STARTEN BUTTON ─────────────────────────────────── */
.btn-primary {
    display: block;
    width: 100%;
    padding: 16px;
    margin-top: 10px;
    background: linear-gradient(170deg, #8b1a1a 0%, #550e0e 100%);
    border: 1px solid rgba(160, 36, 28, 0.5);
    color: #f0d0c0;
    font-family: var(--font-display);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    transition: filter 0.22s, transform 0.1s, box-shadow 0.22s;
}

.btn-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(170deg, rgba(255,255,255,0.08) 0%, transparent 55%);
    pointer-events: none;
}

.btn-primary:hover {
    filter: brightness(1.22);
    box-shadow:
        0 0 28px rgba(140, 22, 14, 0.55),
        0 0 60px rgba(140, 22, 14, 0.22),
        inset 0 0 20px rgba(255, 120, 80, 0.06);
}

.btn-primary:active { transform: scale(0.98); filter: brightness(0.95); }

/* ============================================================
   MENÜ — PANEL-WECHSEL (home ↔ setup)
   ============================================================ */
#menu-home,
#menu-setup {
    width: 100%;
    max-width: 380px;
}

#menu-home.hidden,
#menu-setup.hidden {
    display: none;
}

/* ── SETUP-HEADER (Zurück-Button + Titel) ─────────────────── */
.menu-setup-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(212, 167, 55, 0.1);
}

/* form-heading im setup hat keinen eigenen margin-bottom mehr */
.menu-setup-header .form-heading {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    flex: 1;
}

.menu-back-btn {
    background: transparent;
    border: 1px solid #2a2520;
    color: #4a4038;
    font-family: var(--font-ui);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    padding: 6px 12px;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.menu-back-btn:hover {
    border-color: rgba(212, 167, 55, 0.35);
    color: var(--accent-yellow);
}

/* ============================================================
   MENÜ — HAUPTNAVIGATION (menu-home)
   ============================================================ */
.menu-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.menu-nav-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.018);
    border: 1px solid #1e1b16;
    color: var(--text-main);
    padding: 18px 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
    transition: background 0.2s, border-color 0.2s;
    position: relative;
    overflow: hidden;
}

/* Gold-Schimmer von links beim Hover */
.menu-nav-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg,
        rgba(212, 167, 55, 0.06) 0%,
        transparent 100%);
    transition: left 0.3s ease;
}

.menu-nav-btn:hover::before { left: 0; }

.menu-nav-btn:hover {
    border-color: rgba(212, 167, 55, 0.28);
    background: rgba(212, 167, 55, 0.04);
}

.menu-nav-btn:hover .nav-btn-arrow {
    color: var(--accent-yellow);
    transform: translateX(3px);
}

/* Disabled / "Bald"-Variante */
.menu-nav-btn--soon {
    opacity: 0.45;
    cursor: default;
}

.menu-nav-btn--soon::before { display: none; }
.menu-nav-btn--soon:hover {
    background: rgba(255, 255, 255, 0.018);
    border-color: #1e1b16;
}

.nav-btn-icon {
    font-size: 1.3rem;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
    line-height: 1;
}

.nav-btn-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nav-btn-title {
    font-family: var(--font-display);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.28em;
    color: #c8c0b0;
}

.nav-btn-sub {
    font-family: var(--font-ui);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: #3a3028;
}

.nav-btn-arrow {
    font-size: 1.4rem;
    color: #2a2520;
    flex-shrink: 0;
    transition: color 0.2s, transform 0.2s;
    line-height: 1;
}

.nav-btn-badge {
    font-family: var(--font-ui);
    font-size: 0.55rem;
    font-weight: 700;
    letter-spacing: 0.2em;
    color: #4a4038;
    border: 1px solid #2a2520;
    padding: 3px 8px;
    flex-shrink: 0;
}

/* ============================================================
   MENÜ — SPIELER-INFO (linke Seite, nach Login)
   ============================================================ */
.menu-player-info {
    margin-top: 40px;
    padding-top: 24px;
    border-top: 1px solid rgba(212, 167, 55, 0.08);
    text-align: center;
}

.menu-player-info.hidden { display: none; }

.menu-player-name {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.25em;
    color: #8a7a60;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.menu-player-elo {
    display: inline-flex;
    align-items: baseline;
    gap: 7px;
}

.menu-elo-label {
    font-family: var(--font-ui);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.35em;
    color: #3a3028;
    text-transform: uppercase;
}

.menu-elo-value {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--accent-yellow);
    line-height: 1;
    text-shadow: 0 0 16px rgba(212, 167, 55, 0.25);
}

/* ============================================================
   PAUSE-MENÜ
   ============================================================ */
#pause-overlay {
    position: fixed;
    inset: 0;
    z-index: 900;
    background: rgba(0,0,0,0.72);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

#pause-overlay.hidden { display: none; }

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.pause-menu {
    background: #1c1a17;
    border: 1px solid rgba(212, 167, 55, 0.25);
    border-radius: 10px;
    padding: 40px 48px;
    text-align: center;
    min-width: 300px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.8);
    animation: scaleIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes scaleIn {
    from { transform: scale(0.88); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.pause-title {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: 6px;
    color: #fff;
    margin-bottom: 8px;
}

.pause-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    letter-spacing: 1px;
    margin-bottom: 28px;
}

.pause-btn {
    display: block;
    width: 100%;
    padding: 14px;
    margin-bottom: 10px;
    border: none;
    border-radius: 4px;
    font-family: var(--font-ui);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 2px;
    cursor: pointer;
    transition: all 0.2s;
}

.pause-btn:last-child { margin-bottom: 0; }

.pause-btn.primary {
    background: var(--accent-yellow);
    color: #0d0b09;
}

.pause-btn.primary:hover {
    background: #e8ba3e;
    transform: translateY(-1px);
}

.pause-btn.secondary {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.12);
    color: var(--text-muted);
}

.pause-btn.secondary:hover {
    border-color: rgba(212, 167, 55, 0.4);
    color: var(--accent-yellow);
}

/* ============================================================
   BAUERNUMWANDLUNG
   ============================================================ */
#promotion-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#promotion-overlay.hidden { display: none; }

.promotion-modal {
    background: var(--bg-panel);
    padding: 30px;
    border-radius: 12px;
    border: 2px solid var(--accent-yellow);
    text-align: center;
    box-shadow: 0 20px 50px rgba(0,0,0,0.8);
    width: 450px;
}

.promotion-modal h3 {
    font-family: var(--font-display);
    color: #fff;
    margin-bottom: 10px;
    font-size: 1.3rem;
    letter-spacing: 2px;
}

.promotion-modal p {
    color: var(--text-muted);
    margin-bottom: 20px;
}

.promotion-options {
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.promo-btn {
    flex: 1;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 10px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.2s;
    color: var(--text-main);
    font-family: var(--font-ui);
    font-weight: 600;
}

.promo-btn:hover {
    background: #322f2b;
    border-color: var(--accent-yellow);
    transform: translateY(-2px);
}

.promo-img {
    width: 55px;
    height: 55px;
    margin-bottom: 5px;
    filter: drop-shadow(0 4px 4px rgba(0,0,0,0.4));
}

#promotion-overlay.promo-white .black-promo { display: none; }
#promotion-overlay.promo-black .white-promo { display: none; }

/* ============================================================
   GAME OVER OVERLAY
   ============================================================ */
#game-over-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.2);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 50px;
    z-index: 1000;
    pointer-events: none;
}

#game-over-overlay.hidden { display: none; }

.game-over-banner {
    background: var(--bg-panel);
    padding: 24px 44px;
    border-radius: 8px;
    border: 2px solid var(--accent-yellow);
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
    pointer-events: auto;
    animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.game-over-banner h1 {
    font-family: var(--font-display);
    color: #fff;
    margin-bottom: 18px;
    font-size: 1.6rem;
    letter-spacing: 1px;
}

.game-over-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.game-over-buttons button {
    background: var(--accent-yellow);
    color: #111;
    border: none;
    padding: 10px 28px;
    font-family: var(--font-ui);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 2px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.game-over-buttons button:hover { background: #e8ba3e; }

/* ============================================================
   REPLAY OVERLAY
   ============================================================ */
#replay-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: var(--bg-main);
    display: flex;
    align-items: stretch;
    animation: menuFadeIn 0.3s ease-out;
}

#replay-overlay.hidden { display: none; }

.replay-layout {
    display: flex;
    width: 100%;
    gap: 0;
}

/* — Brett-Spalte — */
.replay-board-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 40px;
    gap: 12px;
}

.replay-header,
.replay-footer {
    width: 100%;
    max-width: 560px;
}

.replay-credits-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.replay-credits-label {
    font-family: var(--font-display);
    font-size: 0.75rem;
    letter-spacing: 2px;
    color: var(--text-muted);
}

.replay-credits-val {
    font-family: var(--font-display);
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--accent-yellow);
}

.replay-credits-unit {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Replay-Board — eigenes Grid */
#replay-board {
    display: grid;
    grid-template-columns: repeat(8, minmax(50px, 70px));
    grid-template-rows:    repeat(8, minmax(50px, 70px));
    border: 8px solid var(--bg-panel);
    border-radius: 4px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.6);
    user-select: none;
}

.replay-square {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.replay-square.light { background-color: var(--square-light); }
.replay-square.dark  { background-color: var(--square-dark);  }

.replay-square.highlight::after {
    content: '';
    position: absolute;
    inset: 0;
    background-color: var(--square-highlight);
    pointer-events: none;
}

/* Controls */
.replay-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.replay-btn {
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    width: 42px;
    height: 42px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.replay-btn:hover:not(:disabled) {
    background: #322f2b;
    border-color: var(--accent-yellow);
    color: var(--accent-yellow);
}

.replay-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.replay-counter {
    font-family: var(--font-display);
    font-size: 0.8rem;
    letter-spacing: 2px;
    color: var(--text-muted);
    min-width: 110px;
    text-align: center;
}

.replay-move-info {
    font-family: 'Courier New', monospace;
    font-size: 0.95rem;
    color: #fff;
    min-height: 1.4em;
    text-align: center;
}

.replay-keyboard-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.5px;
}

/* — Zuglisten-Spalte — */
.replay-list-col {
    width: 280px;
    min-width: 240px;
    background: #1c1a17;
    border-left: 1px solid rgba(255,255,255,0.06);
    display: flex;
    flex-direction: column;
}

.replay-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    font-family: var(--font-ui);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 3px;
    color: var(--text-muted);
}

.replay-close-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-muted);
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 1px;
    transition: all 0.15s;
}

.replay-close-btn:hover {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.replay-move-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.replay-move-item {
    padding: 8px 16px;
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    border-left: 2px solid transparent;
    transition: all 0.12s;
}

.replay-move-item:hover {
    background: rgba(255,255,255,0.04);
    color: var(--text-main);
}

.replay-move-item.active {
    background: rgba(212, 167, 55, 0.08);
    color: var(--accent-yellow);
    border-left-color: var(--accent-yellow);
    font-weight: bold;
}

/* ============================================================
   BRETT-KOORDINATEN
   ============================================================ */
.coord-rank {
    position: absolute;
    top: 3px;
    left: 4px;
    font-family: var(--font-ui);
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
    z-index: 2;
    user-select: none;
}

.coord-file {
    position: absolute;
    bottom: 3px;
    right: 4px;
    font-family: var(--font-ui);
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1;
    pointer-events: none;
    z-index: 2;
    user-select: none;
}

/* ============================================================
   TELEFRAG CRITICAL WARNING
   ============================================================ */
@keyframes telefragPulse {
    0%, 100% { box-shadow: inset 0 0 0 3px rgba(255, 20, 20, 0.9); }
    50%       { box-shadow: inset 0 0 0 3px rgba(255, 20, 20, 0.2); }
}

.square.telefrag-critical {
    animation: telefragPulse 0.6s ease-in-out infinite;
}

/* ============================================================
   RESPONSIVES LAYOUT
   Breakpoints: <1200px (Tablet), <768px (Mobile)
   ============================================================ */

/* Tablet: Sidebars etwas schmaler, Brett skaliert mit */
@media (max-width: 1200px) {
    #app-container {
        gap: 12px;
        padding: 12px;
    }

    .sidebar {
        min-width: 180px;
    }

    #chess-board {
        grid-template-columns: repeat(8, minmax(48px, 64px));
        grid-template-rows:    repeat(8, minmax(48px, 64px));
    }

    #replay-board {
        grid-template-columns: repeat(8, minmax(40px, 56px));
        grid-template-rows:    repeat(8, minmax(40px, 56px));
    }
}

/* Mittleres Tablet: Sidebars unter das Brett klappen */
@media (max-width: 900px) {
    body {
        align-items: flex-start;
    }

    #app-container {
        flex-direction: column;
        align-items: center;
        padding: 10px;
        gap: 10px;
    }

    .sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        width: 100%;
        max-width: 640px;
        min-width: unset;
    }

    .sidebar .panel {
        flex: 1;
        min-width: 160px;
    }

    .event-log {
        flex: 2;
        min-width: 260px;
    }

    #log-content {
        max-height: 180px;
    }

    #game-center {
        width: 100%;
        max-width: 640px;
    }

    #chess-board {
        grid-template-columns: repeat(8, minmax(0, 1fr));
        grid-template-rows:    repeat(8, minmax(0, 1fr));
        width: min(100%, 540px);
        height: min(100%, 540px);
        border-width: 6px;
    }

    .sidebar.left  { order: 2; }
    .sidebar.right { order: 3; }
    #game-center   { order: 1; }
}

/* Mobile: Brett füllt Breite, alles gestapelt */
@media (max-width: 600px) {
    #app-container {
        padding: 6px;
        gap: 8px;
    }

    #chess-board {
        width: calc(100vw - 24px);
        height: calc(100vw - 24px);
        border-width: 4px;
    }

    #replay-board {
        width: calc(100vw - 24px);
        height: calc(100vw - 24px);
    }

    .sidebar {
        gap: 8px;
    }

    .sidebar .panel {
        min-width: 140px;
    }

    #spawn-bar {
        gap: 5px;
    }

    .spawn-btn {
        padding: 8px 4px;
        font-size: 0.8rem;
    }

    .btn-cost {
        font-size: 0.75rem;
    }

    /* Menü auf Mobile: einspaltig */
    .menu-layout {
        flex-direction: column;
    }

    .menu-brand {
        border-left: none;
        border-bottom: 1px solid rgba(212, 167, 55, 0.12);
        padding: 30px 20px 24px;
    }

    .menu-king-icon {
        width: 70px;
        height: 70px;
    }

    .menu-title {
        font-size: 2.2rem;
        letter-spacing: 6px;
    }

    .menu-form-panel {
        width: 100%;
        min-width: unset;
        padding: 24px 16px;
    }

    /* Replay auf Mobile: nur Brett, Liste darunter */
    .replay-layout {
        flex-direction: column;
    }

    .replay-list-col {
        width: 100%;
        max-height: 200px;
    }

    .replay-board-col {
        padding: 16px 10px;
    }

    /* Pause-Menü */
    .pause-menu {
        padding: 28px 24px;
        min-width: unset;
        width: calc(100vw - 40px);
    }

    /* Promotion */
    .promotion-modal {
        width: calc(100vw - 32px);
        padding: 20px 12px;
    }

    .promo-img {
        width: 42px;
        height: 42px;
    }

    /* Koordinaten etwas kleiner */
    .coord-rank,
    .coord-file {
        font-size: 0.55rem;
    }
}

/* ============================================================
   ANALYSE: EVAL-BALKEN & ZUGKLASSIFIKATION
   ============================================================ */

.replay-board-with-eval {
    display: flex;
    align-items: stretch;
    gap: 6px;
}

.replay-eval-bar {
    width: 18px;
    min-width: 18px;
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.eval-bar-inner {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
}

.eval-bar-black {
    background: #1a1a1a;
    width: 100%;
    transition: height 0.3s ease;
}

.eval-bar-white {
    background: #dee3e6;
    width: 100%;
    transition: height 0.3s ease;
}

.eval-bar-label {
    font-family: var(--font-ui);
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-muted);
    padding: 3px 0;
    text-align: center;
    writing-mode: horizontal-tb;
    letter-spacing: 0;
}

/* Zugklassifikation in der Zugliste */
.replay-move-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.move-class-badge {
    font-family: var(--font-ui);
    font-size: 0.8rem;
    font-weight: 700;
    margin-left: 6px;
    flex-shrink: 0;
}

.move-num {
    color: var(--text-muted);
    font-size: 0.75rem;
    min-width: 28px;
    display: inline-block;
}
/* ============================================================
   GAME REPORT PANEL
   ============================================================ */
#replay-game-report {
    border-bottom: 1px solid rgba(255,255,255,0.06);
    flex-shrink: 0;
}

.report-panel {
    padding: 14px 16px 10px;
}

.report-header {
    font-family: var(--font-ui);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 2px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 12px;
}

.report-sides {
    display: flex;
    gap: 0;
    margin-bottom: 12px;
}

.report-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.report-side:first-child {
    padding-right: 12px;
}

.report-side:last-child {
    padding-left: 12px;
}

.report-divider {
    width: 1px;
    background: rgba(255,255,255,0.07);
    flex-shrink: 0;
}

.report-name {
    font-family: var(--font-ui);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 1px;
    color: var(--text-muted);
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.report-grade {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
    margin: 2px 0;
}

.report-acpl {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: 'Courier New', monospace;
}

.report-breakdown {
    font-size: 0.78rem;
    font-family: 'Courier New', monospace;
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 2px;
}

.report-moments {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding-top: 8px;
    border-top: 1px solid rgba(255,255,255,0.05);
}

.report-moment-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
    font-size: 0.75rem;
    line-height: 1.5;
}

.report-moment-label {
    font-family: var(--font-ui);
    font-size: 0.62rem;
    font-weight: 600;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.report-link {
    color: var(--accent-gold);
    cursor: pointer;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    text-decoration: none;
    transition: opacity 0.1s;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.report-link:hover {
    opacity: 0.75;
    text-decoration: underline;
}

.report-swing {
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
    flex-shrink: 0;
    white-space: nowrap;
}

/* ── Eval-Chart ─────────────────────────────────── */
.replay-eval-chart {
    position: relative;
    width: 100%;
    height: 64px;
    padding: 0 12px;
    box-sizing: border-box;
    border-top: 1px solid rgba(255,255,255,0.05);
    cursor: crosshair;
    flex-shrink: 0;
}

/* ── Best-Move-Pfeil / Analyse-Pfeile ──────────────────────── */
.best-move-arrow,
.analysis-arrow-layer {
    transition: opacity 0.2s;
}
#replay-board {
    position: relative;
}

/* ============================================================
   ANALYSIS v2.0: CONTROLS, PV-LINE, CHART-TOOLTIP
   ============================================================ */

.analysis-controls {
    width: 100%;
    padding: 6px 0 2px;
}

.analysis-controls-inner {
    display: flex;
    flex-direction: column;
    gap: 6px;
    background: var(--bg-panel);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 8px 12px;
}

.analysis-depth-info {
    font-family: 'Courier New', monospace;
    font-size: 0.78rem;
    color: var(--accent-yellow);
    letter-spacing: 0.5px;
    min-height: 1.1em;
}

.analysis-time-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.analysis-label {
    font-family: var(--font-ui);
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    flex-shrink: 0;
}

.time-btn-group {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.time-btn {
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    color: var(--text-muted);
    font-family: var(--font-ui);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 3px 9px;
    cursor: pointer;
    transition: all 0.15s;
}
.time-btn:hover  { border-color: var(--text-muted); color: var(--text-main); }
.time-btn.active { background: rgba(212,167,55,0.15); border-color: var(--accent-yellow); color: var(--accent-yellow); }

.btn-analyze-now {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(29,158,117,0.15);
    border: 1px solid #1D9E75;
    border-radius: 5px;
    color: #1D9E75;
    font-family: var(--font-ui);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 4px 12px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.btn-analyze-now:hover   { background: rgba(29,158,117,0.28); }
.btn-analyze-now.running { border-color: var(--accent-yellow); color: var(--accent-yellow); background: rgba(212,167,55,0.12); }

.btn-analyze-icon { font-size: 0.9rem; }
.btn-analyze-icon.spin { display: inline-block; animation: iconSpin 1.2s linear infinite; }
@keyframes iconSpin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ── PV-Textzeile ─────────────────────────────────────────── */
.replay-pv-line {
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    padding: 4px 0 0;
    min-height: 1.2em;
    letter-spacing: 0.3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.pv-label  { font-family: var(--font-ui); font-size: 0.62rem; font-weight: 700; letter-spacing: 2px; color: #1D9E75; background: rgba(29,158,117,0.12); border-radius: 3px; padding: 1px 5px; margin-right: 6px; }
.pv-moves  { color: var(--text-main); }
.pv-alts   { color: var(--text-muted); font-size: 0.7rem; }

/* ── Eval-Chart Tooltip ───────────────────────────────────── */
.eval-chart-tooltip {
    position: absolute;
    display: none;
    background: #1c1a17;
    border: 1px solid rgba(255,255,255,0.12);
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 11px;
    color: #ccc;
    pointer-events: none;
    white-space: nowrap;
    z-index: 10;
    top: 4px;
    font-family: 'Courier New', monospace;
}

/* Chart etwas höher */
.replay-eval-chart { height: 80px; }
/* ── MENÜ LOGOUT-BUTTON ──────────────────────────────────────── */
.menu-logout-btn {
    display: block;
    width: 100%;
    margin-top: 14px;
    background: transparent;
    border: 1px solid #1e1b16;
    color: #3a3028;
    font-family: var(--font-ui);
    font-size: 0.58rem;
    font-weight: 700;
    letter-spacing: 0.38em;
    text-transform: uppercase;
    padding: 8px 0;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s;
}

.menu-logout-btn:hover {
    border-color: rgba(180, 30, 30, 0.35);
    color: #8b3030;
}