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

:root {
    --bg-primary: #0a0e17;
    --bg-secondary: #131a2b;
    --bg-card: #1a2340;
    --text-primary: #e8eaed;
    --text-secondary: #9aa0a6;
    --accent-blue: #4fc3f7;
    --accent-green: #66bb6a;
    --accent-yellow: #ffd54f;
    --accent-orange: #ff8a65;
    --accent-red: #ef5350;
    --accent-purple: #ab47bc;
    --border-color: #2a3550;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

#app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 8px 20px 20px;
}

/* Header */
header {
    text-align: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 12px;
}

header h1 {
    font-size: 1.9rem;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-green));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    color: var(--text-secondary);
    margin-top: 2px;
}

.header-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
}

.header-actions button {
    padding: 6px 12px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.header-actions button:hover {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

.header-actions button.active-control {
    border-color: var(--accent-yellow);
    color: var(--accent-yellow);
    background: rgba(255, 213, 79, 0.08);
}

/* Stats Bar */
#stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 8px;
    padding: 8px;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
}

.stat {
    display: grid;
    grid-template-columns: 34px 86px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-card);
    border-radius: 8px;
    min-width: 0;
    width: 100%;
}

.stat-icon {
    font-size: 1.35rem;
    width: 34px;
    text-align: center;
}

.stat-value {
    width: 86px;
    text-align: right;
    font-size: 1.18rem;
    font-weight: bold;
    color: var(--accent-blue);
    font-variant-numeric: tabular-nums;
    transition: color 0.12s ease, transform 0.12s ease;
}

.value-tick {
    color: var(--accent-yellow);
    transform: translateY(-1px);
}

.stat-label {
    color: var(--text-secondary);
    font-size: 0.85rem;
    min-width: 0;
    overflow-wrap: normal;
}

/* Click Section */
#click-section {
    text-align: center;
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-radius: 12px;
    margin-bottom: 10px;
    box-shadow: var(--shadow);
}

.click-button {
    width: 122px;
    height: 122px;
    border-radius: 50%;
    border: 4px solid var(--accent-blue);
    background: linear-gradient(135deg, var(--bg-card), var(--accent-blue));
    cursor: pointer;
    transition: all 0.1s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0 auto 8px;
    box-shadow: 0 0 30px rgba(79, 195, 247, 0.3);
}

.click-button:hover {
    transform: scale(1.05);
    box-shadow: 0 0 50px rgba(79, 195, 247, 0.5);
}

.click-button:active {
    transform: scale(0.95);
}

.click-icon {
    font-size: 2.55rem;
}

.click-text {
    font-size: 0.86rem;
    font-weight: bold;
    color: white;
}

#click-value {
    font-size: 1.2rem;
    color: var(--accent-green);
    margin-bottom: 4px;
}

#click-money {
    color: var(--accent-yellow);
    margin-bottom: 8px;
}

#auto-production {
    color: var(--text-secondary);
}

#money-details {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-top: 6px;
}

#money-details span {
    color: var(--accent-yellow);
    font-weight: bold;
}

#tariff-control {
    display: grid;
    grid-template-columns: auto minmax(160px, 260px) 80px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 8px;
    color: var(--text-secondary);
}

#tariff-control label {
    color: var(--text-primary);
    font-weight: 600;
}

#sale-tariff {
    accent-color: var(--accent-yellow);
}

#sale-tariff-input {
    width: 80px;
    padding: 7px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
}

#sale-tariff-input::-webkit-outer-spin-button,
#sale-tariff-input::-webkit-inner-spin-button {
    margin: 0;
    -webkit-appearance: none;
}

#sale-tariff-input {
    appearance: textfield;
    -moz-appearance: textfield;
}

/* Tabs */
.tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.tab {
    position: relative;
    padding: 10px 18px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px 8px 0 0;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.tab:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.tab.active {
    background: var(--bg-card);
    color: var(--accent-blue);
    border-bottom-color: var(--bg-card);
}

.tab-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    margin-left: 6px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--accent-red);
    color: white;
    font-size: 0.75rem;
    font-weight: bold;
    line-height: 1;
}

.tab-badge.hidden {
    display: none;
}

/* Tab Content */
.tab-content {
    display: none;
    padding: 16px 20px;
    background: var(--bg-card);
    border-radius: 0 12px 12px 12px;
    box-shadow: var(--shadow);
}

.tab-content.active {
    display: block;
}

.tab-content h2 {
    margin-bottom: 14px;
    color: var(--accent-blue);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
}

/* Plant Cards */
#plants-list, #upgrades-list, #research-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 15px;
}

.plant-card, .upgrade-card, .research-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 15px;
    transition: all 0.2s ease;
}

.plant-card:hover, .upgrade-card:hover, .research-card:hover {
    border-color: var(--accent-blue);
    transform: translateY(-2px);
}

.plant-header, .upgrade-header, .research-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.plant-icon {
    font-size: 2rem;
}

.plant-name, .upgrade-name, .research-name {
    font-weight: bold;
    font-size: 1.1rem;
}

.plant-owned {
    background: var(--accent-blue);
    color: var(--bg-primary);
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: bold;
}

.plant-info, .upgrade-info, .research-info {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.plant-info span, .upgrade-info span, .research-info span {
    display: block;
    margin: 3px 0;
}

.plant-cost, .upgrade-cost, .research-cost {
    color: var(--accent-yellow);
    font-weight: bold;
}

.buy-btn {
    width: 100%;
    padding: 10px;
    background: linear-gradient(135deg, var(--accent-green), #4caf50);
    border: none;
    border-radius: 6px;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.buy-btn + .buy-btn {
    margin-top: 8px;
}

.danger-btn {
    background: linear-gradient(135deg, var(--accent-red), #c62828);
}

.shutdown-btn {
    background: linear-gradient(135deg, var(--accent-orange), #ef6c00);
}

.buy-btn:hover:not(:disabled) {
    transform: scale(1.02);
    box-shadow: 0 0 15px rgba(102, 187, 106, 0.4);
}

.buy-btn:disabled {
    background: var(--border-color);
    color: var(--text-secondary);
    cursor: not-allowed;
}

/* Energy Type Colors */
.energy-coal { border-left: 4px solid #5d4037; }
.energy-gas { border-left: 4px solid #ff8a65; }
.energy-nuclear { border-left: 4px solid var(--accent-purple); }
.energy-solar { border-left: 4px solid var(--accent-yellow); }
.energy-wind { border-left: 4px solid var(--accent-blue); }
.energy-hydro { border-left: 4px solid #26c6da; }
.energy-biomass { border-left: 4px solid var(--accent-green); }

/* Mix Chart */
#mix-chart {
    margin-bottom: 20px;
}

.mix-bar {
    display: flex;
    height: 40px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 15px;
}

.mix-segment {
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.8rem;
    transition: width 0.3s ease;
    min-width: 30px;
}

.mix-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    justify-content: center;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.legend-color {
    width: 15px;
    height: 15px;
    border-radius: 3px;
}

/* Mix Stats */
#mix-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.mix-stat-card {
    background: var(--bg-secondary);
    padding: 15px;
    border-radius: 8px;
    text-align: center;
}

.mix-stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-blue);
}

.mix-stat-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-secondary);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    max-width: 500px;
    border: 2px solid var(--accent-green);
    box-shadow: 0 0 50px rgba(102, 187, 106, 0.3);
}

.modal-content h2 {
    color: var(--accent-green);
    margin-bottom: 20px;
}

.failure-content {
    border-color: var(--accent-red);
    box-shadow: 0 0 50px rgba(239, 83, 80, 0.3);
}

.failure-content h2 {
    color: var(--accent-red);
}

.modal-content p {
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.rules-content {
    max-width: 760px;
    text-align: left;
    border-color: var(--accent-blue);
    box-shadow: 0 0 50px rgba(56, 199, 232, 0.24);
    padding: 28px 40px;
}

.rules-content h2 {
    margin-bottom: 6px;
    color: var(--accent-blue);
    text-align: center;
}

.rules-kicker {
    width: fit-content;
    margin: 0 auto 8px;
    padding: 4px 10px;
    border: 1px solid rgba(97, 211, 148, 0.28);
    border-radius: 999px;
    background: rgba(97, 211, 148, 0.08);
    color: #8df0b4;
    font-size: 0.74rem;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.rules-lead {
    max-width: 580px;
    margin: 0 auto 12px;
    text-align: center;
    line-height: 1.42;
}

.rules-targets {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin: 0 0 14px;
}

.rules-targets span {
    display: grid;
    gap: 2px;
    min-height: 54px;
    place-items: center;
    padding: 8px;
    border: 1px solid rgba(56, 199, 232, 0.2);
    border-radius: 8px;
    background: rgba(56, 199, 232, 0.06);
    color: var(--text-secondary);
    text-align: center;
    font-size: 0.82rem;
}

.rules-targets strong {
    color: var(--accent-yellow);
    font-size: 1.32rem;
    line-height: 1;
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 14px 0;
}

.rule-card {
    position: relative;
    min-height: 112px;
    padding: 13px 14px 13px 54px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: rgba(7, 16, 20, 0.34);
    overflow: hidden;
}

.rule-card::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 0;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-green), var(--accent-yellow));
}

.rule-step {
    position: absolute;
    left: 14px;
    top: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--accent-blue), var(--accent-green));
    color: var(--bg-primary);
    font-weight: 900;
}

.rule-card strong {
    display: block;
    margin-bottom: 5px;
    color: var(--text-primary);
    font-size: 1rem;
}

.rule-card p {
    margin: 0;
    color: var(--text-secondary);
    line-height: 1.34;
}

.rule-card mark {
    padding: 0 3px;
    border-radius: 4px;
    background: rgba(246, 200, 95, 0.14);
    color: #ffe09a;
    font-weight: 800;
}

.rules-objective {
    display: grid;
    gap: 4px;
    margin: 0 0 16px;
    padding: 11px 14px;
    border: 1px solid rgba(246, 200, 95, 0.26);
    border-radius: 8px;
    background: rgba(246, 200, 95, 0.08);
    text-align: center;
}

.rules-objective strong {
    color: var(--accent-yellow);
}

.rules-objective span {
    color: var(--text-primary);
}

#rules-start-btn {
    display: block;
    min-width: 180px;
    margin: 0 auto;
    padding: 12px 24px;
    border: 0;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent-green), var(--accent-blue));
    color: var(--bg-primary);
    font-size: 1rem;
    font-weight: 900;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#rules-start-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 30px rgba(56, 199, 232, 0.22);
}

#victory-stats {
    margin: 20px 0;
    padding: 15px;
    background: var(--bg-card);
    border-radius: 10px;
}

#continue-btn {
    padding: 15px 30px;
    background: linear-gradient(135deg, var(--accent-green), #4caf50);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

#continue-btn:hover {
    transform: scale(1.05);
}

/* Notifications */
#notifications {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1001;
}

.notification {
    background: var(--bg-card);
    border-left: 4px solid var(--accent-blue);
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: 0 8px 8px 0;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
    max-width: 300px;
}

.notification.success {
    border-left-color: var(--accent-green);
}

.notification.warning {
    border-left-color: var(--accent-yellow);
}

.notification.error {
    border-left-color: var(--accent-red);
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Responsive */
@media (max-width: 768px) {
    header h1 {
        font-size: 1.8rem;
    }
    
    #stats-bar {
        grid-template-columns: 1fr;
    }
    
    .stat {
        width: 100%;
    }
    
    .click-button {
        width: 150px;
        height: 150px;
    }
    
    .click-icon {
        font-size: 3rem;
    }

    #tariff-control {
        grid-template-columns: 1fr;
    }
    
    .tabs {
        flex-direction: column;
    }
    
    .tab {
        border-radius: 8px;
    }
}

/* Animations */
.pulse {
    animation: pulse 0.5s ease;
}

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

/* Nuclear warning */
.nuclear-warning {
    animation: nuclearPulse 2s ease infinite;
}

@keyframes nuclearPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(171, 71, 188, 0.3); }
    50% { box-shadow: 0 0 40px rgba(171, 71, 188, 0.6); }
}

/* Green progress */
.green-progress {
    height: 20px;
    background: var(--bg-secondary);
    border-radius: 10px;
    overflow: hidden;
    margin: 10px 0;
}

.green-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-green), #81c784);
    transition: width 0.5s ease;
    border-radius: 10px;
}

/* Redesign: animated control-room interface */
:root {
    --bg-primary: #070b10;
    --bg-secondary: rgba(14, 24, 31, 0.86);
    --bg-card: rgba(20, 35, 44, 0.9);
    --text-primary: #f2f7f5;
    --text-secondary: #c1cfcb;
    --accent-blue: #38c7e8;
    --accent-green: #61d394;
    --accent-yellow: #f6c85f;
    --accent-orange: #ff8f5f;
    --accent-red: #ff5c6c;
    --accent-purple: #b889ff;
    --border-color: rgba(128, 171, 164, 0.2);
    --shadow: 0 18px 60px rgba(0, 0, 0, 0.34);
    --panel-glow: 0 0 0 1px rgba(97, 211, 148, 0.08), 0 22px 70px rgba(4, 13, 18, 0.45);
}

body {
    position: relative;
    background:
        radial-gradient(circle at 18% 12%, rgba(56, 199, 232, 0.18), transparent 28rem),
        radial-gradient(circle at 82% 6%, rgba(246, 200, 95, 0.12), transparent 24rem),
        linear-gradient(145deg, #070b10 0%, #0d1517 48%, #07100d 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -2;
    background:
        linear-gradient(rgba(97, 211, 148, 0.055) 1px, transparent 1px),
        linear-gradient(90deg, rgba(56, 199, 232, 0.045) 1px, transparent 1px);
    background-size: 52px 52px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.88), rgba(0, 0, 0, 0.15));
    animation: gridDrift 28s linear infinite;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background: linear-gradient(105deg, transparent 0 44%, rgba(97, 211, 148, 0.035) 49%, transparent 54% 100%);
    transform: translateX(-55%);
    opacity: 0.45;
    animation: scanBeam 9s ease-in-out infinite;
}

#app {
    position: relative;
}

header {
    position: relative;
    overflow: hidden;
    padding: 10px 20px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(25, 46, 57, 0.94), rgba(14, 34, 32, 0.9)),
        linear-gradient(90deg, rgba(56, 199, 232, 0.12), rgba(97, 211, 148, 0.08));
    box-shadow: var(--panel-glow);
    animation: panelRise 0.65s ease both;
}

header::after {
    content: "";
    position: absolute;
    left: -20%;
    right: -20%;
    bottom: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--accent-blue), var(--accent-green), transparent);
    animation: energyLine 3.8s ease-in-out infinite;
}

header h1 {
    background: linear-gradient(135deg, #65dcff, #78e8a7, #f6c85f);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0;
    filter: drop-shadow(0 0 18px rgba(56, 199, 232, 0.34));
}

.subtitle {
    color: #c8d7d3;
}

.header-actions button,
.tab,
.buy-btn,
#continue-btn,
#retry-btn {
    position: relative;
    overflow: hidden;
}

.header-actions button::before,
.tab::before,
.buy-btn::before,
#continue-btn::before,
#retry-btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(110deg, transparent 0 35%, rgba(255, 255, 255, 0.18) 50%, transparent 65% 100%);
    transform: translateX(-120%);
    transition: transform 0.45s ease;
}

.header-actions button:hover::before,
.tab:hover::before,
.buy-btn:hover::before,
#continue-btn:hover::before,
#retry-btn:hover::before {
    transform: translateX(120%);
}

#stats-bar,
#click-section,
.tab-content {
    border: 1px solid var(--border-color);
    box-shadow: var(--panel-glow);
    backdrop-filter: blur(16px);
    background: rgba(18, 36, 44, 0.96);
}

#stats-bar {
    animation: panelRise 0.7s 0.08s ease both;
}

.stat {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(24, 43, 52, 0.96);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    transition: transform 0.22s ease, border-color 0.22s ease, background 0.22s ease;
}

.stat::after {
    content: "";
    position: absolute;
    inset: auto 12px 0;
    height: 2px;
    border-radius: 2px;
    background: linear-gradient(90deg, var(--accent-blue), var(--accent-green));
    transform: scaleX(0.25);
    transform-origin: left;
    opacity: 0.55;
    transition: transform 0.22s ease, opacity 0.22s ease;
}

.stat:hover {
    transform: translateY(-3px);
    border-color: rgba(97, 211, 148, 0.35);
    background: rgba(24, 46, 53, 0.95);
}

.stat:hover::after {
    transform: scaleX(1);
    opacity: 1;
}

.stat-icon {
    filter: drop-shadow(0 0 10px rgba(56, 199, 232, 0.28));
}

#click-section {
    position: relative;
    overflow: hidden;
    isolation: isolate;
    background:
        radial-gradient(circle at 50% 34%, rgba(56, 199, 232, 0.2), transparent 22rem),
        linear-gradient(145deg, rgba(24, 51, 58, 0.98), rgba(12, 28, 29, 0.96));
    animation: panelRise 0.7s 0.14s ease both;
}

#click-section::before {
    content: "";
    position: absolute;
    inset: 12px;
    z-index: -1;
    border: 1px solid rgba(97, 211, 148, 0.12);
    border-radius: 8px;
    background:
        conic-gradient(from 180deg, rgba(56, 199, 232, 0.12), transparent, rgba(97, 211, 148, 0.12), transparent, rgba(246, 200, 95, 0.1));
    opacity: 0.72;
    animation: reactorSweep 12s linear infinite;
}

.click-button {
    position: relative;
    isolation: isolate;
    overflow: visible;
    border: 1px solid rgba(129, 229, 255, 0.75);
    background:
        radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.46), transparent 18%),
        radial-gradient(circle at 50% 50%, rgba(111, 236, 166, 0.92), rgba(56, 199, 232, 0.86) 45%, rgba(12, 34, 43, 0.98) 72%);
    box-shadow:
        0 0 0 10px rgba(56, 199, 232, 0.08),
        0 0 48px rgba(56, 199, 232, 0.5),
        inset 0 0 34px rgba(255, 255, 255, 0.18);
    transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.16s ease;
    animation: reactorHum 2.8s ease-in-out infinite;
}

.click-button::before,
.click-button::after {
    content: "";
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    pointer-events: none;
}

.click-button::before {
    border: 1px dashed rgba(246, 200, 95, 0.55);
    animation: orbitSpin 9s linear infinite;
}

.click-button::after {
    inset: -14px;
    border: 1px solid rgba(97, 211, 148, 0.2);
    box-shadow: 0 0 24px rgba(97, 211, 148, 0.16);
    animation: ringPulse 2.3s ease-in-out infinite;
}

.click-button:hover {
    transform: scale(1.045) translateY(-2px);
    filter: saturate(1.12);
    box-shadow:
        0 0 0 12px rgba(56, 199, 232, 0.08),
        0 0 64px rgba(97, 211, 148, 0.42),
        inset 0 0 40px rgba(255, 255, 255, 0.18);
}

.click-button:active {
    transform: scale(0.96);
}

.click-icon {
    color: #f6c85f;
    text-shadow: 0 0 24px rgba(246, 200, 95, 0.75);
    animation: boltFloat 1.8s ease-in-out infinite;
}

.click-text {
    color: #ffffff;
    max-width: 120px;
    line-height: 1.2;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
}

#click-value {
    color: #79eda8;
    font-weight: 800;
    font-size: 1.16rem;
    text-shadow: 0 0 18px rgba(97, 211, 148, 0.32);
}

#click-money {
    color: #f8d27b;
    max-width: 620px;
    margin: 0 auto 6px;
    font-size: 0.9rem;
    line-height: 1.25;
    text-shadow: 0 0 18px rgba(246, 200, 95, 0.14);
}

#auto-production,
#money-details,
#tariff-control {
    color: #d1ddda;
}

#flow-metrics {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-columns: minmax(180px, 1fr) auto minmax(180px, 1fr);
    align-items: stretch;
    gap: 10px;
    max-width: 580px;
    margin: 0 auto 6px;
}

.flow-metric {
    position: relative;
    overflow: hidden;
    padding: 7px 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(7, 16, 20, 0.42);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.flow-metric::after {
    content: "";
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
}

.production-flow::after {
    background: linear-gradient(90deg, var(--accent-green), var(--accent-blue));
    box-shadow: 0 0 18px rgba(97, 211, 148, 0.28);
}

.demand-flow::after {
    background: linear-gradient(90deg, var(--accent-yellow), var(--accent-orange));
    box-shadow: 0 0 18px rgba(246, 200, 95, 0.26);
}

.flow-label {
    display: block;
    margin-bottom: 3px;
    color: #e3eeeb;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.flow-metric strong {
    display: block;
    color: #ffffff;
    font-size: 1.18rem;
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}

.production-flow strong {
    color: #7bf0aa;
    text-shadow: 0 0 16px rgba(97, 211, 148, 0.22);
}

.demand-flow strong {
    color: #ffd06b;
    text-shadow: 0 0 16px rgba(246, 200, 95, 0.22);
}

.flow-divider {
    width: 34px;
    align-self: center;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-yellow));
    box-shadow: 0 0 16px rgba(246, 200, 95, 0.22);
}

.flow-divider::before,
.flow-divider::after {
    content: "";
    position: absolute;
}

#network-balance {
    position: relative;
    z-index: 1;
    max-width: 580px;
    margin: 0 auto 6px;
    padding: 6px 14px 7px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    background: rgba(7, 16, 20, 0.34);
}

.balance-labels {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: space-between;
    color: #dce9e5;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.balance-scale {
    position: relative;
    height: 38px;
    margin: 0 20px;
}

.balance-beam {
    position: absolute;
    left: 0;
    right: 0;
    top: 20px;
    z-index: 1;
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-blue), var(--accent-yellow), var(--accent-orange));
    box-shadow: 0 0 18px rgba(56, 199, 232, 0.18);
    transform: rotate(var(--balance-angle));
    transform-origin: center;
    transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.25s ease;
}

.balance-pan {
    position: absolute;
    top: 8px;
    width: 48px;
    height: 12px;
    border: 2px solid currentColor;
    border-top: 0;
    border-radius: 0 0 999px 999px;
}

.production-pan {
    left: 0;
    color: var(--accent-green);
    transform: translateX(-8px);
}

.demand-pan {
    right: 0;
    color: var(--accent-yellow);
    transform: translateX(8px);
}

.balance-pivot {
    position: absolute;
    left: 50%;
    bottom: 4px;
    z-index: 0;
    width: 0;
    height: 0;
    border-left: 14px solid transparent;
    border-right: 14px solid transparent;
    border-bottom: 18px solid rgba(220, 233, 229, 0.72);
    transform: translateX(-50%);
    filter: drop-shadow(0 0 12px rgba(220, 233, 229, 0.14));
}

#balance-status {
    color: #e8f3ef;
    font-size: 0.9rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    text-align: center;
}

.balance-production #balance-status {
    color: #7bf0aa;
}

.balance-demand #balance-status {
    color: #ffd06b;
}

.balance-production .balance-beam {
    box-shadow: 0 0 20px rgba(97, 211, 148, 0.28);
}

.balance-demand .balance-beam {
    box-shadow: 0 0 20px rgba(246, 200, 95, 0.28);
}

#money-details {
    margin-top: 0;
    font-size: 0.92rem;
}

.click-burst {
    position: absolute;
    z-index: 6;
    transform: translate(-50%, -50%);
    color: var(--accent-yellow);
    font-weight: 800;
    font-size: 0.95rem;
    pointer-events: none;
    text-shadow: 0 0 14px rgba(246, 200, 95, 0.75);
    animation: clickBurst 0.85s ease-out forwards;
    white-space: nowrap;
}

#click-value,
#click-money,
#auto-production,
#money-details,
#tariff-control {
    position: relative;
    z-index: 1;
}

#sale-tariff {
    cursor: pointer;
}

#sale-tariff-input {
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#sale-tariff-input:focus {
    outline: none;
    border-color: var(--accent-yellow);
    box-shadow: 0 0 0 3px rgba(246, 200, 95, 0.14);
}

.tabs {
    align-items: flex-end;
}

.tab {
    border-radius: 8px;
    transform: translateY(4px);
}

.tab.active {
    border-color: rgba(56, 199, 232, 0.45);
    box-shadow: 0 -10px 28px rgba(56, 199, 232, 0.08);
    transform: translateY(0);
}

.tab-badge:not(.hidden) {
    animation: badgePop 1.4s ease-in-out infinite;
}

.tab-content.active {
    animation: contentIn 0.32s ease both;
}

.plant-card,
.upgrade-card,
.research-card,
.mix-stat-card {
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(145deg, rgba(20, 35, 44, 0.96), rgba(12, 25, 28, 0.92));
    border-radius: 8px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035);
}

.plant-card::before,
.upgrade-card::before,
.research-card::before,
.mix-stat-card::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 36%);
    opacity: 0;
    transition: opacity 0.22s ease;
}

.plant-card:hover,
.upgrade-card:hover,
.research-card:hover,
.mix-stat-card:hover {
    transform: translateY(-5px);
    border-color: rgba(97, 211, 148, 0.42);
    box-shadow: 0 18px 38px rgba(0, 0, 0, 0.28), 0 0 28px rgba(56, 199, 232, 0.08);
}

.plant-card:hover::before,
.upgrade-card:hover::before,
.research-card:hover::before,
.mix-stat-card:hover::before {
    opacity: 1;
}

.plant-card:hover .plant-icon {
    transform: translateY(-2px) scale(1.08);
}

.plant-icon {
    transition: transform 0.2s ease;
}

.card-success {
    animation: cardSuccess 0.7s ease both;
}

.card-warning {
    animation: cardWarning 0.7s ease both;
}

.card-info {
    animation: cardInfo 0.7s ease both;
}

.tab-flash {
    animation: tabFlash 0.7s ease both;
}

.plant-icon {
    filter: drop-shadow(0 0 14px rgba(255, 255, 255, 0.18));
}

.plant-owned {
    border-radius: 999px;
    box-shadow: 0 0 18px rgba(56, 199, 232, 0.22);
}

.card-description {
    margin-bottom: 10px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    line-height: 1.45;
}

.buy-btn {
    min-height: 42px;
    background: linear-gradient(135deg, #2fbf71, #2b9f88);
    box-shadow: 0 10px 24px rgba(47, 191, 113, 0.18);
}

.danger-btn {
    background: linear-gradient(135deg, var(--accent-red), #9d3046);
    box-shadow: 0 10px 24px rgba(255, 92, 108, 0.18);
}

.shutdown-btn {
    background: linear-gradient(135deg, var(--accent-orange), #b96b21);
    box-shadow: 0 10px 24px rgba(255, 143, 95, 0.18);
}

.buy-btn:disabled {
    box-shadow: none;
}

.mix-bar {
    height: 48px;
    border: 1px solid var(--border-color);
    background: rgba(7, 11, 16, 0.48);
    box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.26);
}

.mix-segment {
    position: relative;
    transition: width 0.55s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.mix-segment::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
    transform: translateX(-100%);
    animation: segmentFlow 2.4s linear infinite;
}

.legend-color {
    box-shadow: 0 0 12px currentColor;
}

.green-progress,
.research-progress {
    height: 14px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(7, 11, 16, 0.55);
    box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.24);
}

.research-progress {
    margin: 0 0 12px;
    border-radius: 999px;
    overflow: hidden;
}

.green-progress-bar,
.research-progress-bar {
    position: relative;
    overflow: hidden;
    background: linear-gradient(90deg, var(--accent-green), var(--accent-blue), var(--accent-yellow));
}

.research-progress-bar {
    height: 100%;
    border-radius: 999px;
    transition: width 0.45s ease;
}

.green-progress-bar::after,
.research-progress-bar::after {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(110deg, rgba(255, 255, 255, 0.24) 0 8px, transparent 8px 18px);
    animation: progressMove 1.2s linear infinite;
}

.research-progress-label {
    color: var(--accent-blue);
}

.modal {
    backdrop-filter: blur(12px);
}

.modal-content {
    border-radius: 8px;
    animation: modalIn 0.38s cubic-bezier(0.2, 0.9, 0.2, 1.1) both;
}

.notification {
    border-radius: 8px;
    backdrop-filter: blur(12px);
    animation: slideIn 0.28s ease, notificationGlow 0.9s ease, fadeOut 0.3s ease 2.7s forwards;
}

@keyframes gridDrift {
    from { background-position: 0 0, 0 0; }
    to { background-position: 52px 104px, 104px 52px; }
}

@keyframes scanBeam {
    0%, 42% { transform: translateX(-60%); opacity: 0; }
    52% { opacity: 1; }
    100% { transform: translateX(60%); opacity: 0; }
}

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

@keyframes energyLine {
    0%, 100% { transform: translateX(-18%); opacity: 0.45; }
    50% { transform: translateX(18%); opacity: 1; }
}

@keyframes reactorSweep {
    from { transform: rotate(0deg) scale(1.2); }
    to { transform: rotate(360deg) scale(1.2); }
}

@keyframes reactorHum {
    0%, 100% { box-shadow: 0 0 0 10px rgba(56, 199, 232, 0.05), 0 0 38px rgba(56, 199, 232, 0.38), inset 0 0 34px rgba(255, 255, 255, 0.14); }
    50% { box-shadow: 0 0 0 16px rgba(97, 211, 148, 0.08), 0 0 62px rgba(97, 211, 148, 0.42), inset 0 0 46px rgba(255, 255, 255, 0.2); }
}

@keyframes orbitSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes ringPulse {
    0%, 100% { transform: scale(0.96); opacity: 0.42; }
    50% { transform: scale(1.04); opacity: 0.82; }
}

@keyframes boltFloat {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    50% { transform: translateY(-5px) rotate(2deg); }
}

@keyframes clickBurst {
    0% { opacity: 0; transform: translate(-50%, -50%) scale(0.72); }
    16% { opacity: 1; }
    100% { opacity: 0; transform: translate(calc(-50% + var(--burst-x)), calc(-50% + var(--burst-y))) scale(1.12); }
}

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

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

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

@keyframes iconBreathe {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-2px) scale(1.04); }
}

@keyframes cardSuccess {
    0% { transform: translateY(0) scale(1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035); }
    35% { transform: translateY(-6px) scale(1.015); box-shadow: 0 0 0 1px rgba(97, 211, 148, 0.5), 0 18px 42px rgba(97, 211, 148, 0.2); }
    100% { transform: translateY(0) scale(1); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035); }
}

@keyframes cardWarning {
    0% { transform: translateX(0); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035); }
    20% { transform: translateX(-4px); }
    40% { transform: translateX(4px); box-shadow: 0 0 0 1px rgba(246, 200, 95, 0.55), 0 18px 42px rgba(246, 200, 95, 0.18); }
    60% { transform: translateX(-2px); }
    80% { transform: translateX(2px); }
    100% { transform: translateX(0); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035); }
}

@keyframes cardInfo {
    0% { transform: translateY(0); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035); }
    35% { transform: translateY(-4px); box-shadow: 0 0 0 1px rgba(56, 199, 232, 0.55), 0 18px 42px rgba(56, 199, 232, 0.18); }
    100% { transform: translateY(0); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.035); }
}

@keyframes tabFlash {
    0%, 100% { box-shadow: none; }
    40% { box-shadow: 0 0 0 1px rgba(97, 211, 148, 0.5), 0 0 28px rgba(97, 211, 148, 0.22); }
}

@keyframes segmentFlow {
    from { transform: translateX(-100%); }
    to { transform: translateX(100%); }
}

@keyframes progressMove {
    from { transform: translateX(-28px); }
    to { transform: translateX(28px); }
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(14px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes notificationGlow {
    0%, 100% { box-shadow: var(--shadow); }
    50% { box-shadow: 0 0 28px rgba(56, 199, 232, 0.22), var(--shadow); }
}

@media (max-width: 768px) {
    #app {
        padding: 12px;
    }

    header {
        padding: 20px 14px;
    }

    #click-section {
        padding: 24px 14px;
    }

    .click-button {
        width: 158px;
        height: 158px;
    }

    .click-text {
        max-width: 112px;
        font-size: 0.9rem;
    }

    .modal-content {
        width: calc(100% - 24px);
        max-height: calc(100vh - 24px);
        overflow-y: auto;
        padding: 24px 16px;
    }

    .modal {
        align-items: flex-start;
        padding: 12px 0;
        overflow-y: auto;
    }

    .rules-grid {
        grid-template-columns: 1fr;
    }

    .rule-card {
        min-height: 0;
    }

    .tab {
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
        transition-duration: 0.001ms !important;
    }
}
