* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --c1: #667eea;
    --c2: #764ba2;
    --shadow-glow: rgba(102, 126, 234, 0.4);
}

.theme-us { --c1: #0591B9; --c2: #0591B9; --shadow-glow: rgba(5,145,185,0.35); }
.theme-africa { --c1: #B95A0E; --c2: #B95A0E; --shadow-glow: rgba(185,90,14,0.35); }
.theme-latin { --c1: #C9261D; --c2: #C9261D; --shadow-glow: rgba(201,38,29,0.35); }
.theme-europe { --c1: #188048; --c2: #188048; --shadow-glow: rgba(24,128,72,0.35); }
.theme-seasia { --c1: #E0982E; --c2: #E0982E; --shadow-glow: rgba(224,152,46,0.35); }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, var(--c1) 0%, var(--c2) 100%);
    min-height: 100svh;
    color: #333;
    overflow-x: hidden;
}

.btn-logout {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 9px 18px; /* ~-10% */
    background: #e53935;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 12.5px; /* ~-10% */
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 1000;
    box-shadow: 0 2px 8px rgba(229, 57, 53, 0.35);
}

.btn-logout:hover {
    background: #c62828;
    transform: translateY(-1px);
}

#app {
    position: relative;
    min-height: 100vh;
}

/* Screen Management */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100svh;
    padding: 20px;
    padding-bottom: 60px; /* Extra padding for timer bar at bottom */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transform: translateY(30px);
    transition: opacity 0.4s ease, transform 0.4s ease, visibility 0.4s;
}

.screen.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    position: relative;
}

.container {
    background: white;
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 600px;
    width: 100%;
    animation: slideUp 0.5s ease;
    position: relative;
}

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

/* Timer Bar for Decision Screen */
.decision-timer-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: none;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.3);
}

.timer-bar-fill {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 100%;
    background-color: #43a047;
    transition: width 0.3s ease, background-color 0.3s ease;
    width: 100%;
}

.timer-bar-text {
    position: relative;
    z-index: 1;
    color: white;
    font-size: 14px;
    font-weight: 700;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    text-align: center;
    line-height: 30px;
    height: 100%;
}

/* Timer Expired Notification */
.timer-expired-notification {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.timer-expired-notification.show {
    opacity: 1;
    visibility: visible;
}

.timer-expired-content {
    text-align: center;
    color: white;
    animation: pulse 0.5s ease-in-out;
}

.timer-expired-icon {
    font-size: 120px;
    margin-bottom: 20px;
}

.timer-expired-title {
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 10px;
}

.timer-expired-subtitle {
    font-size: 24px;
    opacity: 0.8;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
}

/* Text Styles */
h1 {
    font-size: 28px;
    margin-bottom: 10px;
    color: var(--c1);
    text-align: center;
}

h2 {
    font-size: 24px;
    margin-bottom: 10px;
    color: var(--c1);
}

h3 {
    font-size: 20px;
    margin: 20px 0 10px 0;
    color: #333;
}

.subtitle {
    color: #666;
    margin-bottom: 20px;
    text-align: center;
}

.text-center {
    text-align: center;
}

/* Logo */
.logo {
    font-size: 64px;
    text-align: center;
    margin-bottom: 20px;
}

/* Partner Logos */
.partner-logos {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 1px solid #eee;
}

.partner-logos-title {
    display: none;
}

.partner-logos-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
    align-items: center;
    justify-items: center;
}

.partner-logo-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    min-height: 60px;
}

.partner-logo-item img {
    max-width: 100%;
    max-height: 70px;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: grayscale(30%) opacity(0.85);
    transition: all 0.3s ease;
}

.partner-logo-item img:hover {
    filter: grayscale(0%) opacity(1);
    transform: scale(1.05);
}

@media (max-width: 600px) {
    .partner-logos-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    .partner-logo-item img {
        max-height: 50px;
    }
}

/* Input Styles */
.input-group {
    margin: 20px 0;
}

input[type="text"] {
    width: 100%;
    padding: 15px;
    font-size: 18px;
    border: 2px solid #ddd;
    border-radius: 10px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 4px;
    transition: border-color 0.3s ease;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--c1);
}

/* Button Styles */
.btn {
    width: 100%;
    padding: 15px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-top: 10px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--c1) 0%, var(--c2) 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px var(--shadow-glow);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Messages */
.error-message {
    display: none;
    margin-top: 15px;
    padding: 12px;
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 8px;
    color: #c33;
    text-align: center;
}

.error-message.show {
    display: block;
    animation: shake 0.5s ease;
}

.success-message {
    display: none;
    margin-top: 15px;
    padding: 12px;
    background: #efe;
    border: 1px solid #cfc;
    border-radius: 8px;
    color: #363;
    text-align: center;
}

.success-message.show {
    display: block;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Profile Grid */
.profile-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin: 20px 0;
}

.profile-option {
    aspect-ratio: 1;
    border: 3px solid #ddd;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    background: #e9eef5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-option img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.profile-option:hover {
    transform: scale(1.05);
    border-color: var(--c1);
}

.profile-option.selected {
    border-color: var(--c1);
    border-width: 4px;
    transform: scale(1.1);
    box-shadow: 0 5px 15px var(--shadow-glow);
}

/* Profile Display */
.profile-display {
    width: 120px;
    height: 120px;
    margin: 20px auto;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid white;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    background: #e9eef5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-display img {
    width: 100%;
    height: 100%;
    /* object-fit: cover; */
    object-position: center;
    transform: scale(1.2);
    image-rendering: auto;
}

.profile-mini {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--c1);
    background: #e9eef5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.profile-mini img {
    width: 100%;
    height: 100%;
    /* object-fit: cover; */
    object-position: center;
    transform: scale(1.2);
    image-rendering: auto;
}

/* Player Info */
.player-info {
    margin: 20px 0;
}

.player-info h2 {
    font-size: 24px;
    color: var(--c1);
    margin-bottom: 5px;
}

.player-info p {
    color: #666;
    font-size: 16px;
}

/* Waiting */
.waiting-message {
    margin-top: 40px;
}

/* Lobby Instruction */
.lobby-instruction {
    margin-top: 20px;
}
.lobby-instruction-image {
    max-width: 220px;
    width: 60%;
    height: auto;
    margin: 0 auto 12px auto;
    display: block;
}

.spinner {
    width: 50px;
    height: 50px;
    margin: 0 auto 20px auto;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--c1);
    border-radius: 50%;
    animation: spin 3s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Header Info */
.header-info {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid #f0f0f0;
}

.header-info h2 {
    font-size: 20px;
    margin: 0;
}

.header-info p {
    font-size: 14px;
    color: #666;
    margin: 0;
}

/* Sliders */
.sliders-container {
    margin: 20px 0;
}

.slider-item {
    margin-bottom: 30px;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 12px;
    transition: all 0.3s ease;
}

.slider-item:hover {
    background: #f0f2f5;
    transform: translateX(5px);
}

.slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.slider-name {
    font-weight: 600;
    color: #333;
    font-size: 16px;
}

.slider-value {
    font-weight: bold;
    color: var(--c1);
    font-size: 18px;
    min-width: 80px;
    text-align: right;
}

.slider-description {
    font-size: 13px;
    color: #666;
    margin-bottom: 15px;
}

.slider-input {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: #ddd;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    margin-bottom: 8px;
}

.slider-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.slider-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--c1) 0%, var(--c2) 100%);
    cursor: pointer;
    box-shadow: 0 2px 8px var(--shadow-glow);
}

.slider-input::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--c1) 0%, var(--c2) 100%);
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 8px var(--shadow-glow);
}

.slider-minmax {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #999;
}

.slider-cost {
    text-align: center;
    font-size: 13px;
    color: #555;
    margin-top: 6px;
    padding: 4px 8px;
    background: rgba(255, 200, 50, 0.1);
    border-radius: 4px;
    font-weight: 500;
}

.slider-cost .cost-value {
    font-weight: 600;
    color: #d97706;
}

/* Responsive */
@media (max-width: 480px) {
    body { font-size: 17px; }
    .profile-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
    }
    
    .container {
        padding: 20px;
        width: 95vw;
        max-width: 95vw;
        border-radius: 20px;
    }
    
    h1 {
        font-size: 26px;
    }
    
    h2 {
        font-size: 22px;
    }

    input[type="text"] {
        padding: 18px;
        font-size: 20px;
        letter-spacing: 5px;
    }

    .btn {
        padding: 18px;
        font-size: 18px;
        border-radius: 12px;
    }

    .slider-item { padding: 18px; }
    .slider-name { font-size: 18px; }
    .slider-value { font-size: 20px; }
    .slider-description { font-size: 14px; }
    .slider-input { height: 12px; }
    .slider-input::-webkit-slider-thumb { width: 28px; height: 28px; }
    .slider-input::-moz-range-thumb { width: 28px; height: 28px; }
}

/* Region color backgrounds */
.region-us { background-color: #4BCFF4 !important; }
.region-africa { background-color: #F49C55 !important; }
.region-latin { background-color: #FE6F67 !important; }
.region-europe { background-color: #56C187 !important; }
.region-seasia { background-color: #FFCE85 !important; }

/* Decision lock overlay */
.decision-locked-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    border-radius: 0;
    backdrop-filter: blur(2px);
    z-index: 9000;
}

.decision-locked-overlay.show {
    opacity: 1;
    pointer-events: all;
}

.btn-unlock {
    width: auto;
    padding: 16px 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 18px;
    font-weight: 600;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    animation: pulseUnlock 2s ease-in-out infinite;
}

.btn-unlock:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.6);
}

@keyframes pulseUnlock {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

/* Green fade success overlay */
.green-fade {
    position: fixed;
    inset: 0;
    background: #22c55e;
    opacity: 0;
    animation: greenFade 1.2s ease both;
    z-index: 9999;
}

@keyframes greenFade {
    0% { opacity: 0; }
    20% { opacity: 0.85; }
    100% { opacity: 0; }
}

/* Locked phase fullscreen overlay */
.locked-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
}

.locked-overlay.show {
    opacity: 1;
    visibility: visible;
}

.locked-icon {
    font-size: 120px;
    animation: lockedPulse 3s ease-in-out infinite;
}

@keyframes lockedPulse {
    0%, 100% { 
        transform: scale(1); 
        opacity: 0.9;
    }
    50% { 
        transform: scale(1.03); 
        opacity: 1;
    }
}

/* Connection lost overlay */
.connection-lost-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
    color: white;
}

.connection-lost-overlay.show {
    opacity: 1;
    visibility: visible;
}

.connection-lost-icon {
    font-size: 100px;
    margin-bottom: 20px;
    animation: connectionPulse 2s ease-in-out infinite;
}

.connection-lost-text {
    font-size: 36px;
    font-weight: bold;
    margin-bottom: 10px;
}

.connection-lost-subtext {
    font-size: 18px;
    opacity: 0.8;
}

@keyframes connectionPulse {
    0%, 100% { 
        opacity: 0.5;
    }
    50% { 
        opacity: 1;
    }
}

/* Budget screen for Zukunft parliament */
.budget-container {
    margin: 20px 0;
}

.budget-region {
    margin-bottom: 20px;
    padding: 25px;
    border-radius: 12px;
    transition: all 0.3s ease;
    color: white;
}

.budget-region:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

.budget-region-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.budget-region-name {
    font-size: 20px;
    font-weight: 600;
}

.budget-region-value {
    font-size: 28px;
    font-weight: bold;
}

.budget-region-unit {
    font-size: 14px;
    opacity: 0.9;
    margin-top: 5px;
}

.budget-divider {
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
    margin: 20px 0;
}

.budget-usage {
    margin: 15px 0;
}

.budget-usage-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 15px;
}

.budget-usage-row.budget-ok {
    color: rgba(255, 255, 255, 0.95);
    font-weight: 600;
}

.budget-usage-row.budget-exceeded {
    color: #fee;
    font-weight: 700;
}

.budget-value {
    font-weight: 600;
}

.budget-breakdown {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.budget-breakdown-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    opacity: 0.9;
}

.budget-breakdown-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 14px;
    opacity: 0.85;
}

#btn-submit-zukunft {
    margin-top: 20px;
    width: 100%;
}

/* Results display */
.results-container {
    width: 100%;
    max-width: 100%;
}

.results-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 30px;
    color: var(--c1);
    text-align: center;
}

.result-item {
    margin-bottom: 40px;
}

.result-headline {
    font-size: 18px;
    font-weight: 600;
    color: #333;
    margin: 0 0 15px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--c1);
}

.result-chart {
    width: 100%;
    height: 200px;
    display: block;
}

/* Chart legend */
.chart-legend {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #555;
    font-size: 12px;
    margin-top: 6px;
}
.legend-line {
    flex: 0 0 24px;
    height: 0;
    border-top: 2px dashed #999;
}

.budget-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.3);
    margin: 20px 0;
}

.budget-usage {
    margin: 15px 0;
}

.budget-usage-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    font-size: 16px;
}

.budget-usage-row.budget-ok {
    color: #a7f3d0;
    font-weight: 600;
}

.budget-usage-row.budget-exceeded {
    color: #fecaca;
    font-weight: 600;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.budget-value {
    font-weight: bold;
    font-size: 18px;
}

.budget-breakdown {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.budget-breakdown-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    opacity: 0.9;
}

.budget-breakdown-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
    opacity: 0.85;
}

.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    color: #fff;
}
.tag-pending { background: rgba(255, 193, 7, 0.35); }
.tag-fix { background: rgba(16, 185, 129, 0.35); }
.tag-ready { background: rgba(59, 130, 246, 0.35); }

#btn-submit-zukunft {
    margin-top: 20px;
    width: 100%;
}
