/* The play screen: resources + build palette | map | inspector + controls. */

.playLayout {
    display: grid;
    grid-template-columns: 252px 1fr 272px;
    gap: 14px;
    align-items: start;
}

.playColumn {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ---- Resources ----------------------------------------------------------------------------- */

.resourcesPanel { --led: var(--money); }

.stat {
    display: grid;
    grid-template-columns: 70px 1fr;
    align-items: baseline;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.statLabel {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--dim);
}

.statValue {
    font-family: var(--mono);
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.statDelta {
    grid-column: 2;
    font-family: var(--mono);
    font-size: 11px;
    opacity: 0.75;
}

.gauge {
    position: relative;
    height: 12px;
    margin: 10px 0 4px;
    border-radius: 4px;
    background: var(--inset);
    border: 1px solid var(--line);
    overflow: hidden;
}

.gauge .bar {
    height: 100%;
    width: 0;
    background:
        repeating-linear-gradient(90deg, transparent 0 9px, rgba(0, 0, 0, 0.45) 9px 11px),
        linear-gradient(90deg, #2aa8d6, var(--power));
    box-shadow: 0 0 12px rgba(79, 213, 255, 0.5);
    transition: width 0.2s;
}

.gauge .barWarning1 {
    background:
        repeating-linear-gradient(90deg, transparent 0 9px, rgba(0, 0, 0, 0.45) 9px 11px),
        linear-gradient(90deg, #d08a1c, #ffb347);
    box-shadow: 0 0 12px rgba(255, 179, 71, 0.5);
}

.gauge .barWarning2 {
    background:
        repeating-linear-gradient(90deg, transparent 0 9px, rgba(0, 0, 0, 0.45) 9px 11px),
        linear-gradient(90deg, #c4312a, var(--heat));
    box-shadow: 0 0 14px rgba(255, 106, 77, 0.6);
}

.gaugeMeta {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--dim);
}

.gaugeMeta b {
    font-family: var(--mono);
    font-weight: 600;
}

.sellPowerButton {
    width: 100%;
    margin-top: 12px;
    background: linear-gradient(180deg, #2fb8e6, #1e8bb3);
    border-color: #1c7fa3;
    color: #031219;
}

.sellPowerButton:hover {
    color: #031219;
}

.sellPowerButtonHighlighted {
    background: linear-gradient(180deg, var(--money), #e09a1a);
    border-color: #c58212;
    box-shadow: 0 0 16px rgba(255, 196, 77, 0.6);
}

.challengeLine {
    margin-top: 10px;
    font-size: 12px;
    color: var(--money);
}

.challengeLine:empty {
    display: none;
}

.challengeLine .done {
    color: var(--ok);
    font-weight: 600;
}

/* ---- Build palette ------------------------------------------------------------------------- */

.buildPanel { --led: var(--accent); }

.palette {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 4px;
}

.componentButton {
    display: grid;
    place-items: center;
    aspect-ratio: 1;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--inset);
    cursor: pointer;
    transition: border-color 0.12s, box-shadow 0.12s, transform 0.08s;
}

.componentButton:hover {
    border-color: var(--line-hi);
    transform: translateY(-1px);
}

.componentButtonSelected {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent), 0 0 14px rgba(46, 230, 166, 0.45);
}

.sellToolLabel {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--money);
}

.component {
    width: 25px;
    height: 25px;
}

/* ---- Map ----------------------------------------------------------------------------------- */

.mapPanel {
    --led: var(--power);
    padding: 12px;
}

.mapHeader {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mapHeader .panelTitle {
    margin: 0;
}

.mapName {
    font-weight: 700;
    letter-spacing: 0.04em;
}

.mapFrame {
    display: grid;
    place-items: center;
    min-height: 520px;
    margin-top: 10px;
    padding: 12px;
    border-radius: var(--radius-sm);
    background:
        radial-gradient(ellipse at center, rgba(79, 213, 255, 0.06), transparent 70%),
        var(--inset);
    border: 1px solid var(--line);
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.6);
}

.reactorTable {
    overflow: hidden;
    background: #1f4d6b; /* water colour, so sub-pixel seams between tiles never show */
    border-radius: 4px;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 12px 30px rgba(0, 0, 0, 0.55);
}

.reactorTable .tileArea {
    width: 25px;
    height: 25px;
    float: left;
    overflow: visible;
}

.reactorTable .tile {
    width: 25px;
    height: 25px;
}

.reactorTable .buildable {
    cursor: pointer;
}

.reactorTable .buildable .tile:hover {
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.65);
}

.componentBar {
    margin-top: 22px;
    height: 3px;
    width: 0;
    float: left;
    border-radius: 1px;
}

.componentBarHeat {
    background-color: var(--heat);
    box-shadow: 0 0 4px var(--heat);
}

.componentBarLifetime {
    background-color: var(--life);
}

.componentBarWater {
    background-color: var(--water);
}

.reactorTable .lockedComponent {
    outline: 1px dashed var(--money);
    outline-offset: -1px;
}

/* ---- Inspector & controls ------------------------------------------------------------------ */

.inspectorPanel { --led: var(--research); }

.infoText {
    min-height: 168px;
    color: var(--text);
    font-size: 12.5px;
}

.infoText:empty::before {
    content: "Hover over a tile or a component to see its details.";
    color: var(--dim);
}

.infoText > b:first-child {
    font-size: 14px;
}

.infoText .description {
    color: var(--muted);
}

.infoText img {
    float: right;
    margin: 4px 0 6px 8px;
    border-radius: 4px;
}

.infoText .productionTitle {
    color: var(--dim);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
}

.infoText b {
    font-family: var(--mono);
}

.infoText > b:first-child {
    font-family: var(--font);
}

.cantBuyText {
    color: var(--danger);
    font-weight: 600;
}

.controlsPanel { --led: var(--ok); }

.speedControls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.speedControls .button {
    padding: 8px 10px;
}

.speedControls .stopButton {
    background: transparent;
    border-color: rgba(255, 90, 95, 0.5);
    color: var(--danger);
}

.speedControls .stopButton:hover {
    color: var(--danger);
    background: rgba(255, 90, 95, 0.08);
}

.speedControls .playFastButton {
    background: linear-gradient(180deg, var(--money), #d9951b);
    border-color: #c58212;
    color: #1a1102;
}

.speedControls .playNormalButton {
    background: transparent;
    border-color: var(--line-hi);
    color: var(--muted);
}

.bonusTicks {
    grid-column: 1 / -1;
    font-size: 12px;
    color: var(--money);
}

.bonusTicks span {
    font-family: var(--mono);
    font-weight: 700;
}

.autoRebuildButton {
    display: block;
    margin-top: 10px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--inset);
    color: var(--muted);
    text-align: center;
    font-weight: 600;
}

.autoRebuildButton:hover {
    color: var(--text);
    border-color: var(--line-hi);
}

.autoRebuildButton .on {
    color: var(--ok);
}

.autoRebuildButton .off {
    color: var(--danger);
}

/* Explosion: a flash with a shockwave ring and sparks, over EXPLOSION_MS (ReactorMap.js). */
.explosion {
    position: relative;
    width: 25px;
    height: 25px;
    pointer-events: none;
}

.explosion::before,
.explosion::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
}

.explosion::before {
    background: radial-gradient(circle, #fff7d6 0%, #ffc44d 30%, #ff6a4d 55%, rgba(255, 106, 77, 0) 72%);
    animation: explosionFlash 0.8s ease-out forwards;
}

.explosion::after {
    border: 2px solid rgba(255, 196, 77, 0.9);
    box-shadow:
        0 0 8px rgba(255, 106, 77, 0.8),
        -9px -7px 0 -11px #ffe08a,
        10px -6px 0 -11px #ffe08a,
        -8px 9px 0 -11px #ff8a4d,
        9px 8px 0 -11px #ff8a4d;
    animation: explosionRing 0.8s ease-out forwards;
}

@keyframes explosionFlash {
    0% { transform: scale(0.3); opacity: 1; }
    35% { transform: scale(1.35); opacity: 1; }
    100% { transform: scale(1.6); opacity: 0; }
}

@keyframes explosionRing {
    0% { transform: scale(0.2); opacity: 1; }
    100% { transform: scale(2.1); opacity: 0; }
}
