/* ============================================
   ENERGY MINIGAMES STYLES
   Shared scaffolding (.energy-game) + per-game styles
   ============================================ */

.energy-game {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding: 20px;
    max-width: 720px;
    margin: 0 auto;
    color: #EAF0F7;
    font-family: 'Poppins', sans-serif;
}

.energy-game .eng-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    max-width: 560px;
    background: rgba(20, 34, 52, 0.85);
    border: 1px solid rgba(76, 194, 255, 0.45);
    border-radius: 12px;
    padding: 10px 18px;
}

.energy-game .eng-timer {
    font-weight: 700;
    font-size: 1.05rem;
}

.energy-game .eng-timer .timer-warning {
    color: #FF5252;
    animation: eng-pulse 0.6s infinite alternate;
}

@keyframes eng-pulse {
    from { opacity: 1; }
    to { opacity: 0.45; }
}

.energy-game .eng-progress {
    font-weight: 600;
    color: #4CC2FF;
}

.energy-game .eng-instruction {
    text-align: center;
    font-size: 1rem;
    max-width: 560px;
    margin: 0;
    line-height: 1.5;
}

.energy-game .eng-instruction em {
    display: block;
    margin-top: 6px;
    color: #A9BDD4;
    font-size: 0.88rem;
}

.energy-game .eng-feedback {
    min-height: 28px;
    font-weight: 700;
    font-size: 0.98rem;
    text-align: center;
    max-width: 560px;
}

.energy-game .eng-feedback.success { color: #39D98A; }
.energy-game .eng-feedback.error { color: #FF7A7A; }

/* Readout tiles */
.energy-game .eng-readouts {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    width: 100%;
    max-width: 560px;
}

.energy-game .eng-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1 1 120px;
    background: rgba(30, 41, 59, 0.75);
    border: 1px solid rgba(76, 194, 255, 0.22);
    border-radius: 10px;
    padding: 8px 12px;
}

.energy-game .eng-k {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #94A3B8;
}

.energy-game .eng-v {
    font-size: 1.2rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.energy-game .eng-good { color: #39D98A; }
.energy-game .eng-bad { color: #FF7A7A; }

/* Progress bar */
.energy-game .eng-bar {
    width: 100%;
    max-width: 560px;
    height: 10px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(76, 194, 255, 0.25);
    border-radius: 99px;
    overflow: hidden;
}

.energy-game .eng-bar > i {
    display: block;
    height: 100%;
    width: 0;
    transition: width 0.1s linear;
    background: #4CC2FF;
}

.energy-game .eng-fill-good { background: #39D98A !important; }
.energy-game .eng-fill-warn { background: #FFB020 !important; }

/* Buttons */
.energy-game .eng-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.energy-game .eng-btn {
    background: transparent;
    color: #A9BDD4;
    border: 1px solid rgba(148, 163, 184, 0.5);
    border-radius: 9px;
    padding: 10px 18px;
    font-family: inherit;
    font-size: 0.95rem;
    cursor: pointer;
}

.energy-game .eng-btn:hover { color: #EAF0F7; border-color: #4CC2FF; }

.energy-game .eng-btn-primary {
    background: linear-gradient(135deg, #4CC2FF, #2563EB);
    color: #04121D;
    border: 0;
    font-weight: 700;
}

/* ---- Grid Balance ---- */
.grid-balance-game .eng-needle {
    position: relative;
    width: 100%;
    max-width: 560px;
    height: 26px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(76, 194, 255, 0.25);
    border-radius: 8px;
    overflow: hidden;
}

.grid-balance-game .eng-needle-band {
    position: absolute;
    left: 41.5%;
    width: 17%;
    top: 0;
    bottom: 0;
    background: rgba(57, 217, 138, 0.16);
    border-left: 1px dashed #39D98A;
    border-right: 1px dashed #39D98A;
}

.grid-balance-game .eng-needle-pin {
    position: absolute;
    top: 3px;
    bottom: 3px;
    width: 4px;
    border-radius: 3px;
    background: #FF7A7A;
    left: 50%;
    transition: left 0.08s linear;
}

.grid-balance-game .eng-pin-good { background: #39D98A; }
.grid-balance-game .eng-pin-bad { background: #FF7A7A; }

.grid-balance-game .eng-sources {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    width: 100%;
    max-width: 560px;
}

.grid-balance-game .eng-source {
    background: rgba(30, 41, 59, 0.75);
    border: 1px solid rgba(76, 194, 255, 0.22);
    border-radius: 10px;
    padding: 12px;
}

.grid-balance-game .eng-source-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.grid-balance-game .eng-source-meta {
    color: #94A3B8;
    font-size: 0.72rem;
    margin-bottom: 8px;
}

.grid-balance-game .eng-source input[type=range] {
    width: 100%;
    accent-color: #4CC2FF;
}

.grid-balance-game .eng-source-output {
    font-variant-numeric: tabular-nums;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 4px;
}

/* ---- Solar String ---- */
.solar-string-game .eng-roof {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    width: 100%;
    max-width: 560px;
}

.solar-string-game .eng-panel {
    position: relative;
    background: rgba(30, 41, 59, 0.75);
    border: 2px solid rgba(148, 163, 184, 0.35);
    border-radius: 10px;
    padding: 14px 4px;
    color: #EAF0F7;
    font-family: inherit;
    font-variant-numeric: tabular-nums;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
}

.solar-string-game .eng-panel:hover:not([disabled]) { border-color: #4CC2FF; }

.solar-string-game .eng-panel[data-state=wired] {
    border-color: #4CC2FF;
    background: rgba(76, 194, 255, 0.16);
}

.solar-string-game .eng-panel[data-state=done] {
    opacity: 0.4;
    border-color: #39D98A;
    cursor: not-allowed;
}

.solar-string-game .eng-shade {
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 0.65rem;
    color: #FFB020;
}
