/* The Engine Room — site-native look: black, gold, forged iron. */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0a0a0d;
    font-family: "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
    color: #e8c547;
    -webkit-user-select: none;
    user-select: none;
}

#stage {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    touch-action: none;
}
#stage { cursor: default; }

#fatal {
    display: none;
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 50;
    background: rgba(6, 6, 10, 0.95);
    border: 1px solid #ff5555;
    color: #ff8888;
    padding: 14px 18px;
    font-size: 12px;
    max-width: 80vw;
}

.panel {
    background: rgba(10, 10, 14, 0.86);
    border: 1px solid #6a5c2a;
    padding: 8px 10px;
    font-size: 11px;
    line-height: 1.5;
}

.hud { position: fixed; z-index: 10; }

#hud-title { top: 10px; left: 10px; max-width: 430px; }

.hud-title-row { display: flex; align-items: center; gap: 8px; }

#hud-toggle {
    border: none;
    background: none;
    color: #e8c547;
    font-size: 11px;
    padding: 0 2px;
    margin-left: auto;
    cursor: pointer;
}
#hud-toggle:hover { color: #fff; background: none; }
#hud-title.collapsed .hud-sub,
#hud-title.collapsed .hud-links { display: none; }

.hud-title {
    color: #fff;
    font-weight: bold;
    letter-spacing: 3px;
    font-size: 11px;
    white-space: nowrap;
}

.hud-sub { color: #e8c547; opacity: 0.85; margin-top: 2px; }
.hud-sub b { color: #fff; }

.hud-subtitle {
    color: #fff;
    font-weight: bold;
    letter-spacing: 2px;
    margin-bottom: 4px;
    font-size: 10px;
}

.hud-links { margin-top: 5px; display: flex; gap: 12px; }
.hud-links a, a { color: #e8c547; text-decoration: none; }
.hud-links a:hover, a:hover { color: #fff; text-decoration: underline; }

.badge {
    font-size: 9px;
    font-weight: bold;
    letter-spacing: 1px;
    padding: 1px 6px;
    border: 1px solid #55ff55;
    color: #55ff55;
}
.badge.paused { border-color: #ffff55; color: #ffff55; }
.badge.demo { border-color: #e8c547; color: #e8c547; }
.badge.offline { border-color: #ff5555; color: #ff5555; }

/* inlets legend (top-right) */
#legend { top: 10px; right: 10px; min-width: 160px; }
.legend-row {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 10px;
    color: #cfcfcf;
    margin-top: 2px;
}
.legend-swatch {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    flex: 0 0 auto;
    box-shadow: 0 0 5px currentColor;
}
.legend-count { margin-left: auto; color: #fff; opacity: 0.7; }

/* on-stage / pinned detail (bottom-left) */
#info-panel { left: 10px; bottom: 10px; min-width: 230px; max-width: 360px; }
#info-panel.collapsed { min-width: 0; }
#info-panel.collapsed #info-body { display: none; }
.hud-subtitle-btns { display: flex; gap: 6px; }
#info-toggle {
    border: none;
    background: none;
    color: #e8c547;
    font-size: 11px;
    padding: 0 2px;
    cursor: pointer;
}
#info-toggle:hover { color: #fff; background: none; }
.hud-subtitle-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hud-subtitle-row .hud-subtitle { margin-bottom: 0; }
#info-unpin { display: none; padding: 1px 6px; font-size: 11px; line-height: 1.3; }

.k-cat { font-weight: bold; }
.k-txid { display: block; margin: 2px 0; }
.k-row { color: #fff; opacity: 0.82; font-size: 10px; word-break: break-word; }
.k-dim { opacity: 0.5; font-size: 9px; font-style: italic; }

#hud-hint {
    bottom: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

button {
    background: #000;
    border: 1px solid #e8c547;
    color: #e8c547;
    font-family: inherit;
    font-size: 10px;
    padding: 3px 8px;
    cursor: pointer;
}
button:hover { background: #e8c547; color: #000; }

#lookup-box {
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 5px 6px;
}
#lookup-input {
    background: #000;
    border: 1px solid #3a4150;
    color: #c8d0dc;
    font-family: inherit;
    font-size: 10px;
    padding: 3px 6px;
    width: 300px;
}
#lookup-input:focus { outline: none; border-color: #e8c547; }
#lookup-input.busy { border-color: #e8c547; opacity: 0.6; }
#lookup-btn { padding: 3px 7px; }

#banner {
    position: fixed;
    top: 11%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    display: none;
    text-align: center;
    background: rgba(10, 10, 14, 0.9);
    border: 1px solid #e8c547;
    color: #fff;
    font-size: 15px;
    font-weight: bold;
    letter-spacing: 1px;
    padding: 12px 20px;
    text-shadow: 0 0 12px #e8c547;
    max-width: 90vw;
}
#banner div + div { color: #e8c547; font-size: 11px; margin-top: 4px; text-shadow: none; }

@media (max-width: 700px) {
    #hud-title { max-width: 64vw; }
    .hud-sub:nth-of-type(2) { display: none; }
    #legend { display: none; }
    #lookup-box { top: 8px; left: auto; right: 8px; transform: none; }
    /* stub that grows on focus — full-width it overlaps the title bar */
    #lookup-input { width: 34px; transition: width 0.15s; }
    #lookup-input:focus { width: 150px; }
    #info-panel { max-width: calc(100vw - 130px); }
    .k-row { font-size: 9px; }
    .btn-label { display: none; }
    #mute-btn, #pause-btn, #save-btn {
        font-size: 16px;
        line-height: 1;
        padding: 5px 9px;
    }
    #hud-hint { bottom: 8px; right: 8px; gap: 8px; background: none; border: none; padding: 0; }
}

.mode-chip {
    display: inline-block;
    font-size: 9px;
    font-weight: bold;
    letter-spacing: 1px;
    padding: 1px 6px;
    margin-right: 6px;
    border: 1px solid #55ff55;
    color: #55ff55;
}
.mode-chip.schematic { border-color: #e8c547; color: #e8c547; }
.mode-chip.blueprint { border-color: #6aa9ff; color: #6aa9ff; }
.mode-chip.jammed { border-color: #ff5555; color: #ff5555; }
.k-asm {
    display: block;
    margin-top: 3px;
    max-height: 64px;
    overflow: hidden;
    color: #9aa2b1;
    font-size: 9px;
    word-break: break-all;
    line-height: 1.4;
}

@media (max-width: 700px) {
    #info-panel .k-asm { display: none; }
}

/* The Machine Museum overlay (OPL-2823) */
#museum-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 60;
    background: rgba(8, 8, 11, 0.97);
    flex-direction: column;
}
#museum-overlay.open { display: flex; }
#museum-head {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 1px solid rgba(232, 197, 71, 0.35);
}
#museum-meta { color: #e8c547; opacity: 0.8; font-size: 10px; }
#museum-close { margin-left: auto; flex: 0 0 auto; }
#museum-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 14px 16px 34px;
    -webkit-overflow-scrolling: touch;
}
.mus-wing {
    color: #fff;
    font-weight: bold;
    letter-spacing: 2px;
    font-size: 11px;
    margin: 20px 0 8px;
    border-bottom: 1px solid #3a3520;
    padding-bottom: 4px;
}
#museum-body .mus-wing:first-child { margin-top: 0; }
.mus-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 10px;
}
.mus-card {
    border: 1px solid #6a5c2a;
    background: rgba(14, 14, 18, 0.9);
    padding: 9px 11px;
    font-size: 10px;
    line-height: 1.55;
}
.mus-title { color: #e8c547; font-weight: bold; letter-spacing: 1px; }
.mus-val { color: #fff; font-size: 17px; font-weight: bold; margin: 2px 0; }
.mus-val span { color: #e8c547; font-size: 10px; font-weight: normal; }
.mus-note { color: #cfc79f; opacity: 0.9; word-break: break-word; }
.mus-dim { color: #8a815c; font-style: italic; font-size: 10px; }
.mus-chip {
    display: inline-block;
    font-size: 8px;
    font-weight: bold;
    letter-spacing: 1px;
    border: 1px solid #6a5c2a;
    color: #e8c547;
    padding: 0 5px;
    margin: 1px 5px 1px 0;
    white-space: nowrap;
}
.mus-chip.donor { border-color: #4ae2a0; color: #4ae2a0; }
.mus-view { font-size: 9px; padding: 2px 7px; margin-top: 5px; }
.mus-row {
    display: flex;
    gap: 8px;
    align-items: baseline;
    font-size: 10px;
    padding: 3px 0;
    border-bottom: 1px dotted rgba(106, 92, 42, 0.35);
}
.mus-row .mus-name { color: #fff; word-break: break-word; }
.mus-row .mus-n { color: #e8c547; flex: 0 0 auto; }
.mus-row .mus-when { margin-left: auto; color: #8a815c; flex: 0 0 auto; }
.mus-row .mus-view { margin-top: 0; flex: 0 0 auto; }

@media (max-width: 700px) {
    .mus-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
    #museum-body { padding: 10px 10px 26px; }
    #museum-head { padding: 10px; gap: 8px; }
    .mus-row .mus-when { display: none; }
}
