:root {
    /* Source-like green palette */
    --bg: #0a1108;        /* darker olive-black */
    --panelTop: #101810;  /* subtle green tint */
    --panelBot: #0c150d;
    --ink: #dbeed6;       /* pale greenish text */
    --muted: #9db19a;     /* desaturated green-gray */
    --line: #2a3a2a;      /* mossy borders */
    --accent: #75d06b;    /* HUD green */
    --accent2: #8ae27e;   /* lighter accent (unused but kept) */
}

html, body { height: 100%; }
body{
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    display: flex; align-items: center; justify-content: center;
}

/* STAGE — fixed width, height can grow */
.stage{
    width: min(100vw, 960px);
    max-width: 960px;
    margin: 4vh auto;
    background: linear-gradient(180deg, var(--panelTop) 0%, var(--panelBot) 100%);
    border: 2px solid var(--line);
    box-shadow: 0 0 30px rgba(0,0,0,.6);
    position: relative; overflow: hidden;
    display: grid; grid-template-rows: auto auto 1fr auto;
    padding: 0; /* let .shell control side gaps */
}
.stage::before{
    content:""; position:absolute; inset:0; pointer-events:none; opacity:.15;
    /* gridlines retinted from blue to green */
    background:
    linear-gradient(transparent 95%, #1b2a1a 0) 0 0/12px 12px,
    linear-gradient(90deg, transparent 95%, #1b2a1a 0) 0 0/12px 12px;
}

/* Bars + header */
.topbar, .bottombar{
    height: 32px; display:flex; align-items:center; gap:10px; padding:0 10px;
    background: rgba(16,24,16,.9); color: var(--muted);
    border-bottom: 1px solid var(--line);
    text-transform: uppercase; letter-spacing: .05em;
    backdrop-filter: blur(4px);
}
.bottombar{ border-top:1px solid var(--line); border-bottom:none; justify-content:space-between; }

header{
    display:flex; align-items:center; justify-content:space-between; gap:16px;
    padding: 12px 14px; border-bottom:1px solid var(--line);
    background: rgba(16,24,16,.9); backdrop-filter: blur(4px);
}
.brand{ display:flex; align-items:center; gap:14px; min-width:0; }
.brand img{ height:60px; width:auto; border:1px solid var(--line); background:#111b11; padding:4px; }
.brand h1{ margin:0; font-size:18px; text-transform:uppercase; letter-spacing:.06em; }
.tag{ color:var(--muted); font-size:12px; text-transform:uppercase; letter-spacing:.08em; white-space:nowrap; }

.divider{ height:2px; background:linear-gradient(90deg, transparent, var(--accent), transparent); opacity:.5; }

/* MAIN GRID — left slimmer, right fixed.
 *   justify-content:center ensures equal outer gap left/right */
.shell{
    display: grid;
    grid-template-columns: minmax(0, 0.84fr) minmax(0, 260px); /* ~15% slimmer left */
    gap: 12px;
    padding: 16px;                /* equal side padding */
    justify-content: center;      /* balances outer gaps perfectly */
    align-items: start;
    min-height: 0; overflow: hidden;
}

/* LEFT PANEL */
.panel, .modules { display:flex; flex-direction:column; min-height:0; }
.panel{
    border:1px solid var(--line);
    /* retinted panel gradient */
    background: linear-gradient(180deg, #111b12, #0c1410);
}
.panel .hdr{
    padding:8px 10px; border-bottom:1px solid var(--line);
    color:var(--muted); text-transform:uppercase; letter-spacing:.06em; font-size:12px;
}

/* Buttons — slimmed ~15% */
ul.links{ list-style:none; padding:8px; margin:0; display:grid; gap:10px; }
.btn{
    display:flex; align-items:center; justify-content:space-between; text-decoration:none; color:var(--ink);
    padding: 9px 11px;                 /* was 12px 14px */
    border:1px solid var(--line);
    /* retinted button gradient */
    background:linear-gradient(180deg, #111c12 0%, #0e170f 100%);
    text-transform:uppercase; letter-spacing:.05em; font-size:12px; /* was 14px */
    transition: background .15s ease, border-color .15s ease;
}
.btn:hover{
    background:linear-gradient(180deg, #142015 0%, #101a11 100%);
    border-color: var(--accent);
}
.kbd{ font-size:11px; color:var(--muted); }

.status{ padding:8px 10px; border-top:1px solid var(--line); display:flex; gap:8px; flex-wrap:wrap; }
.chip{ border:1px solid var(--line); padding:4px 6px; font-size:11px; color:var(--muted); text-transform:uppercase; }

/* RIGHT SIDEBAR */
.modules{ gap:12px; padding:0; overflow:hidden; align-content:start; }
.module{
    border:1px solid var(--line);
    background:linear-gradient(180deg, #111b12, #0e1810);
}
.module .hdr{
    padding:8px 10px; border-bottom:1px solid var(--line);
    color:var(--muted); text-transform:uppercase; letter-spacing:.06em; font-size:12px;
}
.module .body{ padding:10px; }
.spinbox{ display:flex; justify-content:center; align-items:center; padding:10px; }
.spinbox img{
    width: 150px; height: 150px;                 /* tightened to fit neatly */
    border:1px solid var(--line); background:#0f1910;
}
.note{ margin-top:6px; text-align:center; font-size:11px; color:var(--muted); text-transform:uppercase; }

/* PLAYER */
.player{
    border:1px solid var(--line);
    background:linear-gradient(180deg, #111b12, #0e1810);
    display:flex; flex-direction:column;
}
.player .hdr{
    padding:8px 10px; border-bottom:1px solid var(--line);
    font-size:12px; text-transform:uppercase; color:var(--muted);
}
.scrolling-title{
    overflow:hidden; white-space:nowrap; border-bottom:1px solid var(--line); background:#0f1910;
}
.scrolling-title span{
    display:inline-block; padding:6px 10px; animation:scroll 15s linear infinite; color:var(--muted);
}
@keyframes scroll{ 0%{ transform:translateX(100%); } 100%{ transform:translateX(-100%); } }

.player .body{ padding:10px; display:grid; gap:10px; }
.controls{ display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.btnctl{ border:1px solid var(--line); background:#101a10; padding:6px 10px; cursor:pointer; font-size:12px; color:var(--ink); }
.bar{ position:relative; height:8px; background:#0e1710; border:1px solid var(--line); }
.fill{ position:absolute; top:0; left:0; bottom:0; width:0; background:var(--accent); }
.time{ display:flex; justify-content:space-between; font-size:11px; color:var(--muted); }
.volume{ width: 140px; }

/* Small-height safety */
@media (max-height:760px){
    .topbar, .bottombar { display:none; }
    header{ padding:8px; }
    .shell{ padding:12px; gap:10px; }
    .btn{ padding:8px 10px; }
    .spinbox img{ width:130px; height:130px; }
}
/* ===== Mobile Stack (phones & small tablets) =========================
 *   Stacks LEFT panel, then LOGO/System modules, then Player.
 *   Desktop stays unchanged. Adjust the breakpoint if you like.       */
@media (max-width: 860px) {
    /* Stage: fill width, reduce outer margin a bit */
    .stage{
        width: 100vw;
        max-width: 100%;
        margin: 2vh 0;
        border-width: 1px;
    }

    /* One-column layout */
    .shell{
        grid-template-columns: 1fr;   /* stack everything */
        gap: 12px;
        padding: 12px;
        justify-content: stretch;     /* no centering offset */
    }

    /* Keep the order explicit (left panel first, then sidebar, then player) */
    .panel   { order: 1; }
    .modules { order: 2; }
    .player  { order: 3; }

    /* Header compaction */
    header{
        gap: 10px;
        padding: 10px 12px;
    }
    .brand img{ height: 48px; }
    .brand h1{ font-size: 16px; }

    /* Buttons: slightly taller for touch without changing look */
    ul.links{ padding: 8px; gap: 10px; }
    .btn{ padding: 12px 12px; font-size: 13px; }
    .kbd{ font-size: 11px; }

    /* Sidebar modules: full width; tighten the logo box a bit */
    .modules{ gap: 12px; }
    .spinbox img{
        width: 128px;
        height: 128px;
    }

    /* Player: controls wrap nicely; make volume easier to hit */
    .controls{ gap: 8px; }
    .volume{ width: 100%; max-width: none; }
    .time{ width: 100%; justify-content: space-between; }

    /* Top/Bottom bars take less room on phones */
    .topbar, .bottombar{
        height: 28px;
        padding: 0 8px;
        font-size: 12px;
    }
}

/* Extra-tight phones (mini devices) */
@media (max-width: 360px){
    .brand h1{ font-size: 15px; }
    .btn{ padding: 11px 10px; font-size: 12.5px; }
    .spinbox img{ width: 112px; height: 112px; }
}
/* Mobile: don't vertically center the whole page */
@media (max-width: 860px) {
    html, body { height: auto; min-height: 100%; }
    body {
        display: block;                 /* was flex */
        padding-top: max(8px, env(safe-area-inset-top)); /* notch-safe */
    }

    .stage {
        margin: 0;                      /* no extra top margin */
        width: 100%;
        max-width: 100%;
        border-width: 1px;
    }

    /* (optional) keep the top bar visible when scrolling */
    .topbar { position: sticky; top: 0; z-index: 10; }
}

