/* ==========================================
   Lokale Schriftarten (DSGVO-konform)
   ========================================== */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../../fonts/inter-v20-latin-regular.eot');
    src: url('../../fonts/inter-v20-latin-regular.eot?#iefix') format('embedded-opentype'),
         url('../../fonts/inter-v20-latin-regular.woff2') format('woff2'),
         url('../../fonts/inter-v20-latin-regular.woff') format('woff'),
         url('../../fonts/inter-v20-latin-regular.ttf') format('truetype'),
         url('../../fonts/inter-v20-latin-regular.svg#Inter') format('svg');
}

@font-face {
    font-family: 'Outfit';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('../../fonts/outfit-v15-latin-regular.eot');
    src: url('../../fonts/outfit-v15-latin-regular.eot?#iefix') format('embedded-opentype'),
         url('../../fonts/outfit-v15-latin-regular.woff2') format('woff2'),
         url('../../fonts/outfit-v15-latin-regular.woff') format('woff'),
         url('../../fonts/outfit-v15-latin-regular.ttf') format('truetype'),
         url('../../fonts/outfit-v15-latin-regular.svg#Outfit') format('svg');
}

:root {
    /* Base colors */
    --bg-dark: #120e0a;
    --panel-bg: rgba(30, 24, 18, 0.95);
    --panel-section: rgba(45, 36, 27, 0.6);
    --border-color: rgba(245, 166, 35, 0.25);
    --accent-color: #f5a623;
    --accent-glow: rgba(245, 166, 35, 0.3);
    
    /* Text colors */
    --text-main: #fcf8f2;
    --text-muted: #b8b0a1;
    --danger-color: #e55353;

    /* Game specific colors */
    --worker-color: #ffffff;
    --scout-color: #4ade80;
    --supplier-color: #f5a623;
    --soldier-color: #e55353;
    --food-color: #4ade80;
    --material-color: #d4a373;
    --world-bg: #1a1612;
    --world-grid: #241d18;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

html, body {
    overflow-x: hidden;
    max-width: 100vw;
    width: 100%;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    font-size: 16px;
    line-height: 1.5;
    min-height: 100vh;
    min-height: 100dvh;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

html.modal-open, body.modal-open {
    overflow: hidden !important;
    height: 100% !important;
    height: 100dvh !important;
    touch-action: none !important;
}

/* Universeller, touch-freundlicher Mobile-First Button-Stil */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 18px;
    background-color: var(--accent-color);
    color: #120e0a;
    border: none;
    font-size: clamp(0.95rem, 3.5vw, 1.05rem);
    font-weight: 700;
    letter-spacing: 0.5px;
    border-radius: 14px;
    cursor: pointer;
    margin-bottom: 12px;
    transition: background-color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 14px rgba(245, 166, 35, 0.22);
    min-height: 48px;
    touch-action: manipulation;
}

@media (hover: hover) {
    .btn:hover {
        background-color: #ffb84d;
        box-shadow: 0 6px 18px rgba(245, 166, 35, 0.45);
        transform: translateY(-2px);
    }
}

.btn:active {
    transform: scale(0.98);
    background-color: #e09418;
}

.btn-secondary {
    background-color: rgba(245, 166, 35, 0.08);
    color: var(--text-main);
    border: 1px solid var(--border-color);
    box-shadow: none;
    backdrop-filter: blur(6px);
}

@media (hover: hover) {
    .btn-secondary:hover {
        background-color: rgba(245, 166, 35, 0.18);
        border-color: var(--accent-color);
        color: var(--accent-color);
        box-shadow: 0 4px 15px rgba(245, 166, 35, 0.18);
        transform: translateY(-2px);
    }
}

.btn-secondary:active {
    transform: scale(0.98);
    background-color: rgba(245, 166, 35, 0.25);
}

.btn-danger {
    background-color: rgba(229, 83, 83, 0.08);
    color: var(--danger-color);
    border: 1px solid rgba(229, 83, 83, 0.35);
    box-shadow: none;
}

@media (hover: hover) {
    .btn-danger:hover {
        background-color: var(--danger-color);
        color: #ffffff;
        border-color: var(--danger-color);
        box-shadow: 0 4px 15px rgba(229, 83, 83, 0.35);
        transform: translateY(-2px);
    }
}

.btn-danger:active {
    transform: scale(0.98);
    background-color: #c93b3b;
}

.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.3s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.lucide {
    width: 1.25em;
    height: 1.25em;
    stroke-width: 2;
    flex-shrink: 0;
}

/* --- Mobile-First Glassmorphic Modal Dialog Cards --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(12, 9, 6, 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: max(16px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
    overscroll-behavior: contain;
}

.modal-content {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    width: min(440px, 94vw);
    max-width: 440px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    max-height: calc(100dvh - 32px);
    display: flex;
    flex-direction: column;
    animation: modalPop 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes modalPop {
    from { opacity: 0; transform: scale(0.95) translateY(10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 20px 14px 20px;
    border-bottom: 1px solid rgba(245, 166, 35, 0.15);
    flex-shrink: 0;
}

.modal-header h2 {
    font-size: clamp(1.1rem, 4vw, 1.3rem);
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    font-family: 'Outfit', sans-serif;
}

.icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 8px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
}

.icon-btn:active {
    background: rgba(245, 166, 35, 0.15);
    color: var(--accent-color);
}

@media (hover: hover) {
    .icon-btn:hover {
        background: rgba(245, 166, 35, 0.15);
        color: var(--accent-color);
    }
}

.modal-body {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    min-height: 0;
    overscroll-behavior: contain;
}

/* --- Setting Items (Clean Flexbox Alignment) --- */
.setting-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    gap: 12px;
}

.setting-item-danger {
    border-color: rgba(229, 83, 83, 0.3);
    background: rgba(229, 83, 83, 0.06);
}

.setting-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
}

.setting-title {
    font-weight: 700;
    font-size: 0.92rem;
    color: var(--text-main);
}

.danger-text {
    color: var(--danger-color);
}

.setting-desc {
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.3;
}

.user-status-badge {
    color: var(--accent-color);
    font-weight: 700;
    font-size: 0.85rem;
    background: rgba(245, 166, 35, 0.12);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 0;
    text-align: center;
}

.setting-btn {
    width: auto !important;
    margin-bottom: 0 !important;
    padding: 8px 14px !important;
    min-height: 42px !important;
    font-size: 0.85rem !important;
    flex-shrink: 0;
    border-radius: 10px;
}

.setting-range-container {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 160px;
    max-width: 55%;
    flex-shrink: 0;
    min-height: 44px;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

.setting-val-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 28px;
    padding: 0 6px;
    background: rgba(245, 166, 35, 0.12);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--accent-color);
    font-weight: 800;
    font-size: 0.88rem;
    flex-shrink: 0;
    text-align: center;
}

.modal-footer {
    padding: 14px 20px 18px 20px;
    border-top: 1px solid rgba(245, 166, 35, 0.15);
    background: rgba(0, 0, 0, 0.15);
    flex-shrink: 0;
}

.modal-footer .btn {
    margin-bottom: 0;
}

/* --- Ergonomische Toggle Switches (Handy & PC Identisch) --- */
.toggle-switch,
.cc-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 30px;
    min-height: 30px;
    flex-shrink: 0;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

/* Erweitert den Touch-Zielbereich auf mobilen Bildschirmen */
.toggle-switch::after,
.cc-switch::after {
    content: "";
    position: absolute;
    top: -8px;
    bottom: -8px;
    left: -8px;
    right: -8px;
}

.toggle-switch input,
.cc-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
    pointer-events: none;
}

.slider,
.cc-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 30px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
    transition: background-color 0.22s cubic-bezier(0.4, 0, 0.2, 1),
                border-color 0.22s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

.slider:before,
.cc-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background-color: var(--text-muted, #b8b0a1);
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
    transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1),
                background-color 0.22s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

input:checked + .slider,
.cc-switch input:checked + .cc-slider {
    background-color: rgba(245, 166, 35, 0.28);
    border-color: var(--accent-color, #f5a623);
    box-shadow: inset 0 0 8px rgba(245, 166, 35, 0.25), 0 0 10px rgba(245, 166, 35, 0.2);
}

input:checked + .slider:before,
.cc-switch input:checked + .cc-slider:before {
    transform: translateX(22px);
    background-color: var(--accent-color, #f5a623);
    box-shadow: 0 0 12px rgba(245, 166, 35, 0.8), 0 2px 5px rgba(0, 0, 0, 0.4);
}

.toggle-switch input:focus-visible + .slider,
.cc-switch input:focus-visible + .cc-slider {
    outline: 2px solid var(--accent-color, #f5a623);
    outline-offset: 2px;
}

.toggle-switch:active .slider:before,
.cc-switch:active .cc-slider:before {
    transform: scale(0.92) translateX(0);
}

.toggle-switch input:checked:active + .slider:before,
.cc-switch input:checked:active + .cc-slider:before {
    transform: scale(0.92) translateX(22px);
}

/* --- Range Slider (Touch-Optimiert & Cross-Browser) --- */
input[type=range],
input[type=range]:focus,
input[type=range]:active,
input[type=range]:hover {
    -webkit-appearance: none;
    appearance: none;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    outline: none !important;
    box-shadow: none !important;
    cursor: pointer;
    width: 100%;
    height: 44px;
    padding: 0;
    margin: 0;
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}

/* WebKit Track */
input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 10px;
    background: linear-gradient(to right, var(--accent-color, #f5a623) 0%, var(--accent-color, #f5a623) var(--range-progress, 0%), rgba(255, 255, 255, 0.12) var(--range-progress, 0%), rgba(255, 255, 255, 0.12) 100%);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.4);
    transition: background 0.05s linear;
}

/* WebKit Thumb - Vertikal zentriert bei (10px Track - 26px Thumb)/2 = -8px */
input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    height: 26px;
    width: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffffff, var(--accent-color, #f5a623));
    border: 2px solid #ffffff;
    margin-top: -8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6), 0 0 10px rgba(245, 166, 35, 0.5);
    transition: transform 0.15s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.15s ease;
}

input[type=range]::-webkit-slider-thumb:active,
input[type=range].touch-active::-webkit-slider-thumb {
    transform: scale(1.25);
    background: #ffffff;
    box-shadow: 0 0 18px rgba(245, 166, 35, 0.95), 0 3px 10px rgba(0, 0, 0, 0.7);
}

/* Firefox Track */
input[type=range]::-moz-range-track {
    width: 100%;
    height: 10px;
    background: linear-gradient(to right, var(--accent-color, #f5a623) 0%, var(--accent-color, #f5a623) var(--range-progress, 0%), rgba(255, 255, 255, 0.12) var(--range-progress, 0%), rgba(255, 255, 255, 0.12) 100%);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.4);
    transition: background 0.05s linear;
}

/* Firefox Thumb */
input[type=range]::-moz-range-thumb {
    height: 26px;
    width: 26px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ffffff, var(--accent-color, #f5a623));
    border: 2px solid #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6), 0 0 10px rgba(245, 166, 35, 0.5);
    transition: transform 0.15s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.15s ease;
}

input[type=range]::-moz-range-thumb:active,
input[type=range].touch-active::-moz-range-thumb {
    transform: scale(1.25);
    background: #ffffff;
    box-shadow: 0 0 18px rgba(245, 166, 35, 0.95), 0 3px 10px rgba(0, 0, 0, 0.7);
}

input[type=range]:focus-visible::-webkit-slider-thumb {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

input[type=range]:focus-visible::-moz-range-thumb {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* ==========================================
   Eknirb Developer & Network Badge Box
   ========================================== */
.eknirb-badge-box {
    background: rgba(0, 0, 0, 0.18);
    border: 1px solid rgba(245, 166, 35, 0.1);
    border-radius: 14px;
    padding: 10px 12px;
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    backdrop-filter: blur(4px);
    width: 100%;
}

.eknirb-dev-row {
    font-size: 0.76rem;
    color: var(--text-muted);
    font-weight: 400;
    opacity: 0.9;
}

.eknirb-brand-link {
    color: var(--accent-color);
    font-weight: 700;
    text-decoration: none;
    transition: all 0.2s ease;
}

@media (hover: hover) {
    .eknirb-brand-link:hover {
        color: #ffc466;
        text-shadow: 0 0 6px rgba(245, 166, 35, 0.4);
        text-decoration: underline;
    }
}

.eknirb-games-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    width: 100%;
}

.eknirb-label {
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 400;
    opacity: 0.8;
}

.eknirb-pill-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    min-height: 36px;
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(245, 166, 35, 0.15);
    border-radius: 50px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.74rem;
    font-weight: 500;
    transition: all 0.2s ease;
    touch-action: manipulation;
}

.eknirb-pill-btn:active {
    background: rgba(245, 166, 35, 0.15);
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-1px);
}

@media (hover: hover) {
    .eknirb-pill-btn:hover {
        background: rgba(245, 166, 35, 0.15);
        border-color: var(--accent-color);
        color: var(--accent-color);
        transform: translateY(-1px);
    }
}

.eknirb-footer-link {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.2s;
}

@media (hover: hover) {
    .eknirb-footer-link:hover {
        color: var(--accent-color);
    }
}

/* Accessibility Focus Ring */
:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}


