:root {
    --main-font: 'Courier New', monospace;
}

/* Tax Gradient Slider - Special Style */
#tax-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, 
        #4CAF50 0%,
        #8BC34A 15%,
        #CDDC39 30%,
        #FFEB3B 45%,
        #FFC107 55%,
        #FF9800 65%,
        #FF5722 80%,
        #F44336 100%);
    outline: none;
    opacity: 1;
    transition: opacity 0.2s;
}

#tax-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #000;
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#tax-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #000;
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Discharge Slider - Red (lenient) to Green (strict) */
#discharge-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, 
        #F44336 0%,
        #FF5722 20%,
        #FF9800 35%,
        #FFC107 50%,
        #CDDC39 65%,
        #8BC34A 80%,
        #4CAF50 100%);
    outline: none;
    opacity: 1;
    transition: opacity 0.2s;
}

#discharge-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #000;
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#discharge-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #000;
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Incentives Slider - Gray to Green (more incentives = positive) */
#incentives-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, 
        #9E9E9E 0%,
        #AED581 30%,
        #9CCC65 50%,
        #7CB342 70%,
        #66BB6A 85%,
        #4CAF50 100%);
    outline: none;
    opacity: 1;
    transition: opacity 0.2s;
}

#incentives-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #000;
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#incentives-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #000;
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Transparency Slider - Gray to Blue (more transparency = visibility) */
#transparency-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, 
        #9E9E9E 0%,
        #90CAF9 25%,
        #64B5F6 50%,
        #42A5F5 75%,
        #2196F3 100%);
    outline: none;
    opacity: 1;
    transition: opacity 0.2s;
}

#transparency-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #000;
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#transparency-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #000;
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.gradient-text {
    background: linear-gradient(90deg, #4CAF50 0%, #FFEB3B 33%, #FF9800 66%, #F44336 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: bold;
    font-size: 16px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--main-font);
}

body {
    background-color: #ffffff;
    background-image: radial-gradient(#ccc 1px, transparent 1px);
    background-size: 30px 30px;
    overflow: hidden;
}

.screen {
    display: none;
    width: 100vw;
    height: 100vh;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

/* Global Header */
.top-nav {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    padding: 30px;
    display: flex;
    justify-content: center;
    z-index: 1000;
    background: transparent;
    /* Remove old background */
    backdrop-filter: none;
    /* Remove old blur */
    border-bottom: none;
    pointer-events: none;
    /* Let clicks pass through outside the pill */
}

.nav-container {
    position: relative;
    width: 600px;
    max-width: 90%;
    pointer-events: auto;
    /* Re-enable clicks for the navbar */
}

.nav-bar {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 50px;
    padding: 12px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    position: relative;
    z-index: 1002;
}

.brand-name {
    font-weight: bold;
    font-size: 20px;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #000;
}

.menu-toggle {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    width: 24px;
    height: 18px;
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    height: 2px;
    width: 100%;
    background-color: #000;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.nav-right {
    width: 24px;
    /* Matches menu toggle width for centering */
}

.nav-icon-placeholder {
    width: 20px;
    height: 20px;
    border: 2px solid #000;
    border-radius: 4px;
    /* Simple bag icon representation */
    border-top-left-radius: 2px;
    border-top-right-radius: 2px;
    position: relative;
}

.nav-icon-placeholder::before {
    content: '';
    position: absolute;
    top: -4px;
    left: 4px;
    width: 8px;
    height: 4px;
    border: 2px solid #000;
    border-bottom: none;
    border-radius: 4px 4px 0 0;
}

/* Dropdown Menu */
.nav-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1001;
}

.nav-dropdown.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.nav-dropdown a {
    color: #333;
    text-decoration: none;
    font-size: 14px;
    letter-spacing: 1px;
    font-weight: 500;
    padding: 5px 10px;
    transition: color 0.2s;
}

.nav-dropdown a:hover {
    color: #000;
    text-decoration: underline;
}

/* Landing Screen */
#landing-screen {
    /* Transparent to show grid */
    position: relative;
    overflow: hidden;
}

#background-icons {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    /* Behind content but above background grid */
    pointer-events: none;
}

.landing-content {
    position: relative;
    z-index: 1;
    /* Above icons */
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: 60px;
    /* Offset for header */
}

.landing-card {
    background-color: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
    padding: 40px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    max-width: 800px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.landing-title-red {
    font-size: 48px;
    font-weight: bold;
    color: #000;
    /* Red color */
    text-align: center;
    margin-bottom: 5px;
}

.landing-headline {
    font-size: 32px;
    font-weight: bold;
    color: #000;
    text-align: center;
    margin: 0;
}

.read-more-link {
    font-size: 16px;
    color: #3F51B5;
    /* Blue link color */
    text-decoration: none;
    margin: 10px 0;
    cursor: pointer;
}

.read-more-link:hover {
    text-decoration: underline;
}

.landing-subtext {
    font-size: 18px;
    font-weight: bold;
    color: #000;
    text-align: center;
    margin-top: 5px;
    max-width: 600px;
}

.start-btn {
    background-color: #000;
    color: white;
    border: none;
    padding: 18px 60px;
    font-size: 16px;
    font-weight: bold;
    letter-spacing: 3px;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.start-btn:hover {
    background-color: #333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(107, 91, 149, 0.3);
}

.start-btn:active {
    transform: translateY(0);
}

/* Role Selection Screen */
#role-screen {
    /* Transparent to show grid */
}

.role-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 60px;
    padding: 40px;
    padding-top: 100px;
    /* Offset for header */
}

.role-title {
    font-size: 48px;
    font-weight: bold;
    letter-spacing: 2px;
    color: #000;
    background-color: rgba(255, 255, 255, 0.8);
    padding: 10px 20px;
    border-radius: 8px;
}

.role-cards {
    display: flex;
    gap: 40px;
    align-items: center;
    flex-wrap: wrap;
    /* RESPONSIVE FIX */
    justify-content: center;
    max-width: 100%;
}

.role-card {
    background: white;
    border: 3px solid #999;
    border-radius: 8px;
    padding: 30px 20px;
    width: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.role-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
    border-color: #4a5f8f;
}

.role-icon {
    width: 80px;
    height: 80px;
}

.role-icon svg {
    width: 100%;
    height: 100%;
}

.role-name {
    font-size: 14px;
    font-weight: bold;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}


/* ===== RESPONSIVE DESIGN - LANDING SCREEN ===== */

/* Tablet (768px and below) */
@media (max-width: 768px) {
    /* Navigation */
    .top-nav {
        padding: 20px 15px;
    }

    .nav-container {
        width: 100%;
        max-width: 95%;
    }

    .brand-name {
        font-size: 16px;
        letter-spacing: 1px;
    }

    .nav-bar {
        padding: 10px 20px;
    }

    /* Landing Content */
    .landing-content {
        padding: 20px 15px;
        padding-top: 80px;
    }

    .landing-card {
        padding: 30px 20px;
        max-width: 95%;
        border-radius: 15px;
        gap: 12px;
    }

    .landing-title-red {
        font-size: 36px;
    }

    .landing-headline {
        font-size: 24px;
    }

    .landing-subtext {
        font-size: 16px;
        max-width: 100%;
    }

    .read-more-link {
        font-size: 14px;
    }

    .start-btn {
        padding: 15px 45px;
        font-size: 14px;
        letter-spacing: 2px;
    }

    /* Canvas adjustments */
    #dye-map,
    #dye-map-2 {
        left: 0;
        width: 100%;
        height: auto;
    }

    #dye-map {
        top: 50px !important;
        left: 100px;
    }

    #dye-map-2 {
        top: 200px !important;
    }
}

/* Mobile (480px and below) */
@media (max-width: 480px) {
    /* Navigation */
    .top-nav {
        padding: 15px 10px;
    }

    .brand-name {
        font-size: 14px;
        letter-spacing: 1px;
    }

    .nav-bar {
        padding: 8px 16px;
    }

    .menu-toggle {
        width: 20px;
        height: 15px;
    }

    /* Landing Content */
    .landing-content {
        padding: 15px 10px;
        padding-top: 70px;
    }

    .landing-card {
        padding: 25px 15px;
        border-radius: 12px;
        gap: 10px;
    }

    .landing-title-red {
        font-size: 28px;
        margin-bottom: 3px;
    }

    .landing-headline {
        font-size: 20px;
    }

    .landing-subtext {
        font-size: 14px;
        margin-top: 3px;
    }

    .read-more-link {
        font-size: 13px;
        margin: 8px 0;
    }

    .start-btn {
        padding: 14px 35px;
        font-size: 13px;
        letter-spacing: 1.5px;
    }

    /* Background Icons - reduce size on mobile */
    .bg-icon {
        width: 20px;
        height: 20px;
    }

    /* Role Selection Screen */
    #role-screen {
        overflow-y: auto;
        overflow-x: hidden;
    }

    .role-content {
        gap: 25px;
        padding: 15px 10px;
        padding-top: 70px;
        padding-bottom: 30px;
        min-height: auto;
        justify-content: flex-start;
    }

    .role-title {
        font-size: 22px;
        padding: 8px 16px;
        letter-spacing: 1px;
        margin-bottom: 10px;
    }

    .role-cards {
        gap: 15px;
        flex-direction: column;
        width: 100%;
        align-items: center;
    }

    .role-card {
        width: 85%;
        max-width: 300px;
        min-width: 250px;
        padding: 20px 15px;
        gap: 12px;
    }

    .role-icon {
        width: 55px;
        height: 55px;
    }

    .role-icon-img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

    .role-name {
        font-size: 12px;
    }

    #role-back-btn {
        margin-top: 20px !important;
        padding: 12px 30px;
        font-size: 13px;
    }

    /* Visualization Screen - Mobile */
    #visualization-screen {
        overflow-x: hidden;
        overflow-y: auto;
    }

    .canvas-container {
        position: relative;
        width: 100%;
        height: auto;
        overflow-x: auto;
        padding-bottom: 50vh;
    }

    #dye-map,
    #dye-map-2 {
        width: 100% !important;
        height: auto !important;
        max-width: 100vw;
    }

    /* Before/After labels */
    [style*="top: 314px"],
    [style*="top: 680px"] {
        font-size: 0.9em !important;
        left: 50% !important;
    }

    /* Parameter Panel - Mobile */
    .parameter-panel {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        border-radius: 16px 16px 0 0 !important;
        padding: 16px 12px !important;
        max-height: 50vh !important;
        overflow-y: auto !important;
        z-index: 2000 !important;
    }

    .panel-header h3 {
        font-size: 13px;
        margin-bottom: 8px;
    }

    .role-icon-small-img {
        width: 16px;
        height: 16px;
    }

    .panel-content {
        gap: 15px;
        margin-bottom: 15px;
        margin-top: 10px;
    }

    .param-group {
        gap: 8px;
        padding-bottom: 12px;
    }

    .param-label {
        font-size: 11px;
    }

    .param-value {
        font-size: 12px;
        padding: 6px;
    }

    .checkbox-label {
        font-size: 11px;
        gap: 6px;
    }

    .checkbox-label input[type="checkbox"],
    .checkbox-label input[type="radio"] {
        width: 14px;
        height: 14px;
    }

    .panel-footer {
        gap: 8px;
        margin-top: 12px;
        padding-top: 12px;
    }

    .nav-btn {
        padding: 10px 18px;
        font-size: 12px;
        letter-spacing: 0.5px;
    }

    /* Legend Panel - Mobile */
    .legend-panel {
        width: 180px !important;
        padding: 8px 12px !important;
        font-size: 10px !important;
    }

    .legend-panel.closed {
        left: -180px !important;
    }

    .legend-toggle {
        width: 30px !important;
        height: 30px !important;
    }

    .legend-section h4 {
        font-size: 11px !important;
    }

    .legend-item {
        font-size: 9px !important;
        padding: 3px 0 !important;
    }

    /* Policy Indicators - Mobile */
    .policy-indicators-container {
        top: 15px !important;
        right: 15px !important;
        gap: 6px !important;
    }

    .policy-badge {
        padding: 6px 10px !important;
        font-size: 9px !important;
        letter-spacing: 0.5px !important;
    }

    /* Summary Panel - Mobile */
    .summary-content {
        max-height: 400px !important;
        font-size: 12px !important;
    }

    .summary-section h3 {
        font-size: 14px !important;
    }

    .summary-label,
    .summary-value {
        font-size: 11px !important;
    }
}

/* ===== RESPONSIVE DESIGN - ROLE SELECTION (TABLET) ===== */
@media (max-width: 768px) and (min-width: 481px) {
    #role-screen {
        overflow-y: auto;
    }

    .role-content {
        gap: 40px;
        padding: 25px 20px;
        padding-top: 90px;
        padding-bottom: 40px;
    }

    .role-title {
        font-size: 32px;
        padding: 10px 18px;
        letter-spacing: 1.5px;
    }

    .role-cards {
        gap: 25px;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }

    .role-card {
        width: 180px;
        padding: 25px 15px;
    }

    .role-icon {
        width: 65px;
        height: 65px;
    }

    .role-name {
        font-size: 13px;
    }

    /* Parameter Panel - Tablet */
    .parameter-panel {
        position: absolute;
        bottom: 20px;
        right: 20px;
        left: auto;
        width: 320px;
        max-width: 90%;
        border-radius: 16px;
        padding: 22px;
        max-height: 80vh;
        overflow-y: auto;
    }

    .panel-header h3 {
        font-size: 14px;
    }

    .role-icon-small-img {
        width: 18px;
        height: 18px;
    }

    .panel-content {
        gap: 18px;
        margin-bottom: 20px;
    }

    .param-label {
        font-size: 12px;
    }

    .param-value {
        font-size: 13px;
    }

    .checkbox-label {
        font-size: 12px;
    }

    .nav-btn {
        padding: 11px 20px;
        font-size: 13px;
    }

    /* Visualization Screen - Tablet */
    .canvas-container {
        padding-bottom: 30vh;
    }

    /* Legend Panel - Tablet */
    .legend-panel {
        width: 200px;
        padding: 10px 16px;
        font-size: 10px;
    }

    .legend-panel.closed {
        left: -200px;
    }

    /* Policy Indicators - Tablet */
    .policy-indicators-container {
        top: 20px;
        right: 30px;
        gap: 8px;
    }

    .policy-badge {
        padding: 7px 11px;
        font-size: 11px;
    }
}

/* Parameter Panel Overlay */
.parameter-panel {
    position: absolute;
    bottom: 40px;
    right: 40px;
    width: 340px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    transition: all 0.3s ease;
}

.panel-header h3 {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 10px;
    color: #000;
    line-height: 1.4;
}

.role-icon-small {
    color: #000;
    font-size: 18px;
}

.panel-content {
    display: flex;
    font-weight: bold;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 25px;
    margin-top: 15px;
}

.param-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 15px;
}

.param-group:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.param-label {
    font-size: 13px;
    font-weight: bold;
    color: #000;
}

.param-value {
    font-size: 14px;
    color: #333;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    font-weight: bold;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: #333;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: #000;
}

.panel-footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 15px;
    border-top: 1px solid #f0f0f0;
    padding-top: 15px;
}

.nav-btn {
    border: 1px solid #000;
    padding: 12px 24px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
    background-color: #fff;
    color: #000;
}

.nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.back-btn {
    background-color: #fff;
    color: #000;
}

.next-btn {
    background-color: white;
    color: black;
}

.nav-btn .next-btn {
    background-color: #000;
    color: white !important;
}

.next-btn:hover {
    background-color: #333;
    color: #fff;
}

.download-btn {
    background-color: #fff;
    color: #000;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 48px;
}

.download-btn:hover {
    background-color: #f0f0f0;
}

.summary-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

/* Summary Screen Styles */
.summary-content {
    max-height: 500px;
    overflow-y: auto;
    padding-right: 10px;
}

.summary-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}

.summary-section:last-child {
    border-bottom: none;
}

.summary-section h3 {
    font-size: 16px;
    font-weight: bold;
    margin-bottom: 15px;
    color: #000;
    display: flex;
    align-items: center;
    gap: 8px;
}

.summary-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px dashed #f0f0f0;
}

.summary-item:last-child {
    border-bottom: none;
}

.summary-label {
    font-size: 13px;
    color: black;
    font-weight: 500;
}

.summary-value {
    font-size: 14px;
    color: #000;
    font-weight: bold;
    text-align: right;
}

/* Custom Slider */
.custom-slider-container {
    padding: 10px 0;
}

.custom-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 8px;
    background: linear-gradient(to right, #e0e0e0, #666);
    border: none;
    border-radius: 4px;
    outline: none;
    opacity: 1;
    transition: opacity .2s;
}

.custom-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    background: #000;
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.custom-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #000;
    cursor: pointer;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    border: none;
}

/* Toggle Switch */
.toggle-group {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #fff;
    -webkit-transition: .2s;
    transition: .2s;
    border: 1px solid #ccc;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: #ccc;
    -webkit-transition: .2s;
    transition: .2s;
    border-radius: 50%;
}

input:checked+.slider {
    background-color: green;
    border-color: #000;
}

input:checked+.slider:before {
    transform: translateX(24px);
    background-color: #fff;
    border: none;
}

/* Rounded sliders */
.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

/* --- Policy Indicators --- */
.policy-indicators-container {
    position: fixed;
    top: 30px;
    right: 50px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: flex-end;
    z-index: 2000;
    pointer-events: none;
}

.policy-badge {
    background-color: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.policy-badge.active {
    display: block;
    opacity: 1;
}

/* --- Storyboard Narrative Overlay --- */
.story-overlay {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    max-width: 90%;
    z-index: 3000;
}

.story-card {
    background: #fff;
    border: 2px solid #333;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.5s ease-out;
}

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

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.story-header {
    margin-bottom: 16px;
    border-bottom: 1px solid #eee;
    padding-bottom: 10px;
}

.story-date {
    font-size: 12px;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
}

.story-title {
    font-size: 20px;
    margin-top: 4px;
    color: #000;
}

.story-content {
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    margin-bottom: 24px;
}

.story-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.story-btn {
    background: #000;
    color: #fff;
    border: none;
    padding: 10px 20px;
    font-size: 14px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.2s;
}

.story-btn:hover {
    background: #333;
}

.story-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.story-btn.pulse {
    animation: pulse 1.5s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

/* Highlight Effect */
.story-highlight {
    position: relative;
    z-index: 2500;
    box-shadow: 0 0 0 4px #FFC107, 0 0 20px rgba(255, 193, 7, 0.5) !important;
    transition: box-shadow 0.3s ease;
}

/* --- Story Screen (Cinematic Intro) --- */
#story-screen {
    background-color: #ffffff;
    color: #000;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.story-container {
    max-width: 800px;
    padding: 40px;
}

.intro-title {
    font-size: 48px;
    margin-bottom: 20px;
    color: #000;
    letter-spacing: 2px;
}

.intro-text {
    font-size: 20px;
    font-weight: bold;
    line-height: 1.6;
    color: #333;
    margin-bottom: 40px;
    animation-duration: 1s !important;
}

.intro-date {
    font-size: 14px;
    color: #666;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 10px;
    display: block;
}

.intro-btn {
    background: transparent;
    border: 2px solid #000;
    color: #000;
    padding: 15px 40px;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    letter-spacing: 2px;
}

.intro-btn:hover {
    background: #fff;
    color: #000;
}

/* Background Icons */
.bg-icon {
    position: absolute;
    width: 25px;
    /* Reduced size for dense grid */
    height: 25px;
    opacity: 0.15;
    /* Subtle */
    pointer-events: none;
    transition: all 4.5s ease;
    transform-origin: center;
}

/* Cinematic Entrance Animations */
.ui-hidden {
    opacity: 0 !important;
    pointer-events: none;
    transition: opacity 1.5s ease-in-out;
}

.ui-visible {
    opacity: 1 !important;
    pointer-events: auto;
}

@keyframes zoomOutEntrance {
    0% {
        transform: scale(1.5);
    }

    100% {
        transform: scale(1.0);
    }
}

.zoom-anim {
    animation: zoomOutEntrance 3s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

/* --- Situation Room Transition --- */

/* Card Collapse Animation */
.collapse-card {
    animation: collapseCard 0.8s cubic-bezier(0.55, 0.055, 0.675, 0.19) forwards;
}

@keyframes collapseCard {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(0.9);
        opacity: 0.5;
    }

    100% {
        transform: scale(0);
        opacity: 0;
    }
}

/* Mechanical Slide-In for Role Cards */
.slide-in-mechanical {
    animation: slideInMech 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    opacity: 0;
    /* Start hidden */
}

@keyframes slideInMech {
    0% {
        transform: translateX(100px);
        opacity: 0;
    }

    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

/* --- Visual Enhancements --- */

/* Reactive Grid */
.reactive-grid-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image:
        linear-gradient(rgba(0, 255, 0, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 255, 0, 0.03) 1px, transparent 1px);
    background-size: 50px 50px;
    z-index: -1;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.5s;
}

.reactive-grid-bg.active {
    opacity: 1;
    animation: gridPulse 2s infinite;
}

@keyframes gridPulse {
    0% {
        box-shadow: inset 0 0 50px rgba(0, 255, 0, 0);
    }

    50% {
        box-shadow: inset 0 0 100px rgba(0, 255, 0, 0.1);
    }

    100% {
        box-shadow: inset 0 0 50px rgba(0, 255, 0, 0);
    }
}

/* Glitch Effect */
.glitch-text {
    position: relative;
    color: #000;
}

.glitch-text::before,
.glitch-text::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #fff;
}

.glitch-text::before {
    left: 2px;
    text-shadow: -1px 0 red;
    clip: rect(24px, 550px, 90px, 0);
    animation: glitch-anim-1 2.5s infinite linear alternate-reverse;
}

.glitch-text::after {
    left: -2px;
    text-shadow: -1px 0 blue;
    clip: rect(85px, 550px, 140px, 0);
    animation: glitch-anim-2 3s infinite linear alternate-reverse;
}

@keyframes glitch-anim-1 {
    0% {
        clip: rect(20px, 9999px, 15px, 0);
    }

    20% {
        clip: rect(60px, 9999px, 70px, 0);
    }

    40% {
        clip: rect(20px, 9999px, 15px, 0);
    }

    60% {
        clip: rect(80px, 9999px, 5px, 0);
    }

    80% {
        clip: rect(10px, 9999px, 60px, 0);
    }

    100% {
        clip: rect(50px, 9999px, 30px, 0);
    }
}

@keyframes glitch-anim-2 {
    0% {
        clip: rect(10px, 9999px, 80px, 0);
    }

    20% {
        clip: rect(80px, 9999px, 10px, 0);
    }

    40% {
        clip: rect(30px, 9999px, 50px, 0);
    }

    60% {
        clip: rect(70px, 9999px, 90px, 0);
    }

    80% {
        clip: rect(20px, 9999px, 30px, 0);
    }

    100% {
        clip: rect(60px, 9999px, 10px, 0);
    }
}

/* Typing Cursor */
.typing-cursor::after {
    content: '▋';
    display: inline-block;
    animation: blink 1s infinite;
    color: #000;
    margin-left: 5px;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

/* Role Icon Image */
.role-icon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.legend-section {
    margin-bottom: 20px;
}

.legend-section h4 {
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.legend-desc {
    line-height: 1.4;
    font-weight: bold;
    color: #333;
    margin-bottom: 10px;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
    font-weight: bold;
    font-size: 10px;
    text-transform: uppercase;
}

.legend-line {
    width: 25px;
    height: 3px;
    display: inline-block;
}

.legend-line.dashed {
    border-top: 1px dashed #000;
    background: transparent;
    height: 1px;
}

.legend-symbol {
    width: 12px;
    height: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

.legend-circle {
    width: 16px;
    height: 16px;
    border: 1px solid #000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    font-weight: bold;
    background: #fff;
}

.legend-content {
    /* max-height: 80vh;
    overflow-y: auto; */
}

.legend-toggle {
    position: absolute;
    right: -30px;
    /* Stick out to the right */
    top: 20px;
    width: 30px;
    height: 40px;
    /* Smaller height for arrow */
    background-color: #E0E0E0;
    border: 1px dashed #999;
    border-left: none;
    border-radius: 0 5px 5px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
}

.legend-toggle span {
    font-size: 20px;
    font-weight: bold;
    transition: transform 0.3s ease;
}

.legend-panel.closed .legend-toggle span {
    transform: rotate(180deg);
}

.legend-panel {
    position: absolute;
    top: 0px;
    left: 0;
    /* Visible by default */
    width: 220px;
    background-color: #E0E0E0;
    border-right: 1px dashed #999;
    padding: 10px 20px;
    font-family: 'Arial', sans-serif;
    font-size: 11px;
    color: #000;
    z-index: 3000;
    overflow: visible;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.05);
    transition: left 0.3s ease-in-out;
}

.role-icon-small-img {
    height: 24px;
    width: auto;
    vertical-align: middle;
    margin: 0 5px;
    display: inline-block;
}

.legend-panel.closed {
    left: -220px;
}

/* Intervention Icon (Single icon at start) */
#intervention-layer {
    position: absolute !important;
    top: 90px !important;
    left: 44% !important;
    width: 50% !important;
    height: 400px !important;
    transform: translateX(-50%) !important;
    pointer-events: none !important;
    z-index: 5 !important;
}

#tax-icon-layer {
    position: absolute !important;
    top: 0px !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    pointer-events: none !important;
    z-index: 6 !important;
}

.intervention-icon {
    position: absolute;
    width: 36px;
    height: 36px;
    transform: translate(-50%, -50%);
    cursor: pointer;
    pointer-events: auto;
    z-index: 2001;
    animation: bounce-hint 1.8s infinite ease-in-out;
}

.intervention-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    /* filter: drop-shadow(0 2px 8px rgba(139, 0, 0, 0.6)); */
    transition: all 0.2s ease;
}

.intervention-icon:hover {
    animation: none;
    transform: translate(-50%, -50%) scale(1.2);
}

.intervention-icon:hover img {
    /* filter: drop-shadow(0 4px 16px rgba(255, 193, 7, 0.8)); */
}

@keyframes bounce-hint {
    0%, 100% {
        transform: translate(-50%, -50%) translateY(0);
    }
    50% {
        transform: translate(-50%, -50%) translateY(-6px);
    }
}

/* Custom Tooltip for Intervention */
.intervention-tooltip {
    display: none;
    position: absolute;
    left: 50%;
    top: 45px;
    transform: translateX(-50%);
    background: rgba(255, 255, 255, 0.98);
    color: #333;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 11px;
    line-height: 1.5;
    min-width: 220px;
    max-width: 300px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    border: 1px solid #ddd;
    backdrop-filter: blur(10px);
    white-space: normal;
    z-index: 10000;
    pointer-events: none;
    text-align: left;
}

.intervention-icon:hover .intervention-tooltip {
    display: block;
    animation: tooltipFadeIn 0.15s ease-out;
}

@keyframes tooltipFadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-5px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.intervention-tooltip strong {
    display: block;
    margin-bottom: 6px;
    color: #FF6B6B;
    font-size: 12px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

.intervention-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid white;
}

@keyframes pulse-scale-old {
    0% {
        transform: translate(-50%, -50%) scale(1);
        filter: drop-shadow(0 0 0 rgba(76, 175, 80, 0));
    }

    50% {
        transform: translate(-50%, -50%) scale(1.15);
        filter: drop-shadow(0 0 10px rgba(76, 175, 80, 0.6));
    }

    100% {
        transform: translate(-50%, -50%) scale(1);
        filter: drop-shadow(0 0 0 rgba(76, 175, 80, 0));
    }
}

/* Auto-show tooltip for parameter changes */
.auto-tooltip {
    position: absolute;
    background: rgba(255, 255, 255, 0.98);
    color: #333;
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 11px;
    line-height: 1.5;
    min-width: 220px;
    max-width: 300px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    border: 1px solid #ddd;
    backdrop-filter: blur(10px);
    white-space: normal;
    z-index: 10000;
    pointer-events: none;
    text-align: left;
    transform: translateX(-50%) translateY(-5px);
    opacity: 0;
    transition: opacity 0.15s ease-out, transform 0.15s ease-out;
    --arrow-direction: down;
}

.auto-tooltip.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.auto-tooltip strong {
    display: block;
    margin-bottom: 6px;
    color: #FF6B6B;
    font-size: 12px;
    font-weight: bold;
    font-family: 'Courier New', monospace;
}

/* Arrow pointing down (default - tooltip below icon) */
.auto-tooltip::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-bottom: 6px solid white;
}

/* Arrow pointing up (tooltip above icon) */
.auto-tooltip.show-above::before {
    top: auto;
    bottom: -6px;
    border-bottom: none;
    border-top: 6px solid white;
}

/* Factory Owner Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

.modal-content {
    background: white;
    border-radius: 12px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    text-align: center;
    animation: slideUp 0.3s ease-out;
}

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

.modal-content h2 {
    font-size: 24px;
    margin: 0 0 15px 0;
    color: #333;
    font-family: 'Courier New', monospace;
    font-weight: bold;
}

.modal-content p {
    font-size: 16px;
    color: #666;
    margin: 0 0 30px 0;
    font-family: 'Courier New', monospace;
}

.modal-buttons {
    display: flex;
    gap: 15px;
    flex-direction: row;
    justify-content: center;
}

.modal-btn {
    padding: 12px 24px;
    font-size: 14px;
    font-weight: bold;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Courier New', monospace;
    text-transform: uppercase;
    letter-spacing: 1px;
    flex: 1;
    max-width: 200px;
}

.modal-btn-fresh {
    background: #000;
    color: white;
}

.modal-btn-fresh:hover {
    background: #333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.modal-btn-handover {
    background: #000;
    color: white;
}

.modal-btn-handover:hover {
    background: #333;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}