/* Teranode Station (OPL-2836) — the CRT mission-control wall.
   Art direction: the design ref's black bezel monitor bank — dark plastic
   panels, red LED annunciator titles, phosphor screens, rainbow accents.
   (Contrast: /console is the cream Win3.1 wall; this is its night-shift
   sibling in the machine room.) */

:root {
    --bezel: #0a0a0c;
    --panel: #131318;
    --panel-hi: #23232c;
    --panel-lo: #000;
    --led-red: #ff3b30;
    --led-dim: #7a1f1a;
    --phos: #3dff6e;
    --phos-dim: #1d7a3a;
    --amber: #ffb347;
    --screen: #05070a;
    --text: #c8c8d0;
}

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

html, body { height: 100%; background: var(--bezel); }

body {
    font-family: "Menlo", "Consolas", "DejaVu Sans Mono", monospace;
    color: var(--text);
    overflow-x: hidden;
}

#desk { min-height: 100%; padding: 8px; }

/* menu bar */
#bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background: linear-gradient(#1b1b22, #101014);
    border: 1px solid #000;
    border-top-color: #2c2c36;
    border-radius: 6px;
    margin-bottom: 8px;
    font-size: 12px;
    flex-wrap: wrap;
}
#bar .logo { width: 10px; height: 10px; border-radius: 50%; background: var(--led-red); box-shadow: 0 0 8px var(--led-red); }
#bar .title { color: #f0f0f4; letter-spacing: 2px; font-weight: bold; }
#bar .sub { color: #6a6a76; font-size: 10px; }
#bar .spacer { flex: 1; }
#bar .clock { color: var(--amber); font-size: 11px; }
#bar button, #bar a button {
    background: #1d1d24;
    color: #c8c8d0;
    border: 1px solid #000;
    border-top-color: #33333e;
    border-radius: 4px;
    font: inherit;
    font-size: 11px;
    padding: 3px 9px;
    cursor: pointer;
}
#bar button:hover { background: #26262f; }
#bar button.node { color: var(--phos); letter-spacing: 1px; }
#bar button.node.on { background: #0e2416; border-color: var(--phos-dim); box-shadow: 0 0 6px rgba(61, 255, 110, .25) inset; }
.badge { padding: 2px 8px; border-radius: 3px; font-size: 10px; letter-spacing: 1px; }
.badge.ok { background: #0e2416; color: var(--phos); }
.badge.wait { background: #2a2213; color: var(--amber); }
.badge.off { background: #2a1210; color: var(--led-red); }

/* the wall */
#grid {
    position: relative; /* the CRT glass overlay anchors to it */
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: 74px;
    grid-auto-flow: dense;
    gap: 8px;
}

/* CRT glass overlay (WebGL2 compositor) — draws every screen as a curved
   phosphor tube; transparent everywhere else so titles/bezels show through */
#glass-cv {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 6;
}
/* under glass the flat 2D canvases become texture sources only, and the
   shader owns the vignette; the body reads as dark molded plastic */
body.glass-on .panel.screen .pbody canvas { visibility: hidden; }
body.glass-on .panel.screen .pbody { background: #08080c; }
body.glass-on .panel.screen .pbody::after { display: none; }

.panel {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0; /* a grid item's auto min-size would floor at the nowrap title */
    min-height: 0;
    background: var(--panel);
    border: 1px solid #000;
    border-top-color: #26262e;
    border-radius: 7px;
    overflow: hidden;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .6);
}
.panel .ptitle {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 8px;
    font-size: 9px;
    letter-spacing: 2px;
    color: var(--led-red);
    text-shadow: 0 0 6px rgba(255, 59, 48, .55);
    background: #0c0c10;
    border-bottom: 1px solid #000;
    white-space: nowrap;
    overflow: hidden;
}
/* a title too long for its panel ellipses rather than shearing mid-word */
.panel .ptitle > span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.panel .ptitle .tdots { color: var(--led-dim); margin-left: auto; flex: none; }
.panel .ptitle .plink { color: #55555f; text-decoration: none; font-size: 10px; }
.panel .ptitle .plink:hover { color: var(--amber); }
.panel .pbody { position: relative; flex: 1; min-height: 0; }
.panel canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* screens get the deeper black + inner bezel */
.panel.screen .pbody { background: var(--screen); }
.panel.screen .pbody::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: 4px;
    box-shadow: inset 0 0 14px rgba(0, 0, 0, .85);
}

noscript { color: var(--text); display: block; padding: 20px; }

/* kiosk mode for future monitor embedding: scene only, no chrome */
body.embed #bar { display: none; }
body.embed #desk { padding: 2px; }

@media (max-width: 700px) {
    #bar .sub { display: none; }
    #grid { grid-auto-rows: 64px; gap: 6px; }
    /* tighter tracking buys a few more characters of title before the ellipsis */
    .panel .ptitle { letter-spacing: 1px; padding: 3px 6px; gap: 4px; }
}
