/* ============================================================
   ARTIFICIAL_LIFE — living code
   red on black · terminal aesthetic · JetBrains Mono everywhere
   ============================================================ */

:root {
    --bg: #000000;
    --panel: #050505;
    --panel-2: #0D0D0D;
    --line: rgba(255, 42, 42, 0.16);
    --line-dim: rgba(255, 255, 255, 0.07);
    --red: #FF2A2A;
    --accent: #FF2A2A;   /* follows the selected theme colour */
    --red-bright: #FF5555;
    --red-dim: #8B0000;
    --red-soft: rgba(255, 42, 42, 0.12);
    --red-glow: 0 0 12px rgba(255, 42, 42, 0.35);
    --text: #D8D8D8;
    --muted: #8A8A8A;
    --faint: #555555;
    --live: #33FF66;
    --wait: #FFAA00;
    --err: #FF2A2A;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --font-mono: 'JetBrains Mono', 'SF Mono', Menlo, 'Courier New', monospace;
}

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

html, body {
    height: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overflow: hidden;
}

::selection {
    background: var(--red);
    color: var(--bg);
}

a {
    color: var(--text);
    text-decoration: none;
}

/* ---------- Layout shell ---------- */

.container {
    display: flex;
    height: 100vh;
    margin: 0;
    padding: 0;
}

.sidebar {
    width: 350px;
    min-width: 350px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--panel);
    border-right: 1px solid var(--line);
    overflow: hidden;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #000;
    position: relative;
}

.canvas-container {
    position: relative;
    width: 100%;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    overflow: hidden;
}

#lifeCanvas {
    display: block;
    background: #000;
    image-rendering: pixelated;
    max-width: 100%;
    max-height: 100%;
}

#lifeCanvas:fullscreen,
#lifeCanvas.kinect-fullscreen:fullscreen {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw;
    max-height: 100vh;
    border: none;
    box-shadow: none;
}

/* Faint scanlines + vignette over the stage (not shown in fullscreen) */
.overlay-effects {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        repeating-linear-gradient(0deg,
            rgba(255, 42, 42, 0.02) 0px,
            rgba(255, 42, 42, 0.02) 1px,
            transparent 1px,
            transparent 4px),
        radial-gradient(ellipse at center,
            transparent 60%,
            rgba(0, 0, 0, 0.6) 100%);
}

/* ---------- Sidebar header / wordmark ---------- */

.sidebar-header {
    padding: 24px 22px 18px;
    border-bottom: 1px solid var(--line);
}

.eyebrow {
    font-size: 10px;
    letter-spacing: 0.08em;
    color: var(--faint);
    margin-bottom: 10px;
}

.eyebrow .prompt {
    color: var(--red);
}

.wordmark {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 19px;
    letter-spacing: 0.12em;
    color: var(--text);
    text-shadow: 0 0 18px rgba(255, 42, 42, 0.25);
    white-space: nowrap;
}

.wordmark em {
    font-style: normal;
    color: var(--red);
    text-shadow: var(--red-glow);
}

/* "ART" hidden inside ARTificial — red and artistically rotated */
.wordmark .art {
    color: var(--red);
    text-shadow: var(--red-glow);
}
.wordmark .art > span {
    display: inline-block;
    margin: 0 0.1em;
    vertical-align: baseline;
}
.wordmark .art .flip {
    transform: rotate(180deg);   /* upside down (A and T) */
}
.wordmark .art .mirror {
    transform: scaleX(-1);       /* reflected (R) */
}

.cursor {
    display: inline-block;
    color: var(--red);
    animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

/* ---------- Input channel strip (what the organism hears) ---------- */

.channel-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-top: 16px;
}

.channel {
    appearance: none;
    background: transparent;
    border: 1px solid var(--line-dim);
    border-radius: 2px;
    padding: 8px 4px 6px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    transition: border-color 0.3s var(--ease), color 0.3s var(--ease),
                box-shadow 0.3s var(--ease);
}

.channel:hover {
    border-color: var(--red-dim);
    color: var(--text);
    box-shadow: var(--red-glow);
}

.channel:focus-visible {
    outline: 1px solid var(--red);
    outline-offset: 2px;
}

.led {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #1A1A1A;
    border: 1px solid var(--line-dim);
    transition: background 0.4s var(--ease), border-color 0.4s var(--ease);
}

.led.live {
    background: var(--live);
    border-color: var(--live);
    animation: breathe 2.6s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(51, 255, 102, 0.6);
}

.led.wait {
    background: var(--wait);
    border-color: var(--wait);
    animation: breathe 1.4s ease-in-out infinite;
    box-shadow: 0 0 8px rgba(255, 170, 0, 0.5);
}

.led.err {
    background: var(--err);
    border-color: var(--err);
    box-shadow: 0 0 8px rgba(255, 42, 42, 0.6);
}

@keyframes breathe {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* ---------- Tabs ---------- */

.controls-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.tab-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.tabs {
    display: flex;
    padding: 0 22px;
    border-bottom: 1px solid var(--line);
}

.tab-btn {
    appearance: none;
    background: none;
    border: none;
    border-bottom: 1px solid transparent;
    margin-bottom: -1px;
    padding: 13px 0 11px;
    margin-right: 22px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--faint);
    cursor: pointer;
    transition: color 0.3s var(--ease), border-color 0.3s var(--ease),
                text-shadow 0.3s var(--ease);
}

.tab-btn:hover {
    color: var(--muted);
}

.tab-btn.active {
    color: var(--red);
    border-bottom-color: var(--red);
    text-shadow: var(--red-glow);
}

/* Responsive 16:9 video embed (About tab) */
.video-embed {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    margin: 12px 0 18px;
    border: 1px solid var(--line);
    background: #000;
}
.video-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* One-line intro under a tab, above its sections */
.tab-intro {
    padding: 14px 22px 4px;
    margin: 0;
    font-size: 11px;
    line-height: 1.5;
    color: var(--muted);
}

/* Body input source switch (Camera / Kinect) */
.source-switch {
    display: flex;
    gap: 8px;
    padding: 16px 22px 6px;
}

.source-btn {
    flex: 1;
    appearance: none;
    background: none;
    border: 1px solid var(--line-dim);
    padding: 9px 0;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.25s var(--ease), border-color 0.25s var(--ease),
                box-shadow 0.25s var(--ease);
}

.source-btn:hover {
    color: var(--text);
    border-color: var(--red-dim);
}

.source-btn.active {
    color: var(--red);
    border-color: var(--red);
    box-shadow: var(--red-glow);
    text-shadow: var(--red-glow);
}

.tab-content {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
    scrollbar-width: thin;
    scrollbar-color: var(--red-dim) transparent;
}

.tab-content::-webkit-scrollbar {
    width: 4px;
}

.tab-content::-webkit-scrollbar-thumb {
    background: var(--red-dim);
    border-radius: 2px;
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* ---------- Collapsible sections ---------- */

.panel-section {
    border-bottom: 1px solid var(--line-dim);
}

.panel-section > summary {
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 22px;
    cursor: pointer;
    user-select: none;
    transition: background 0.3s var(--ease);
}

.panel-section > summary::-webkit-details-marker {
    display: none;
}

.panel-section > summary:hover {
    background: rgba(255, 42, 42, 0.03);
}

.sec-label {
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
    transition: color 0.3s var(--ease), text-shadow 0.3s var(--ease);
    display: flex;
    align-items: center;
    gap: 8px;
}

.panel-section[open] > summary .sec-label {
    color: var(--red);
    text-shadow: var(--red-glow);
}

.sec-caret {
    width: 9px;
    height: 9px;
    position: relative;
    flex: none;
}

.sec-caret::before,
.sec-caret::after {
    content: '';
    position: absolute;
    background: var(--faint);
    transition: transform 0.35s var(--ease), background 0.3s var(--ease);
}

.sec-caret::before {
    left: 0;
    top: 4px;
    width: 9px;
    height: 1px;
}

.sec-caret::after {
    left: 4px;
    top: 0;
    width: 1px;
    height: 9px;
}

.panel-section[open] > summary .sec-caret::after {
    transform: rotate(90deg);
}

.panel-section[open] > summary .sec-caret::before,
.panel-section[open] > summary .sec-caret::after {
    background: var(--red);
}

.section-inner {
    padding: 4px 22px 20px;
}

/* Flat tab body (used when a tab has no collapsible sections, e.g. Life) */
.tab-body {
    padding: 18px 22px 22px;
}

.panel-section[open] .section-inner {
    animation: fadeUp 0.45s var(--ease) both;
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(6px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ---------- Controls: buttons ---------- */

.control-btn {
    appearance: none;
    display: block;
    width: 100%;
    background: transparent;
    border: 1px solid var(--red-dim);
    border-radius: 2px;
    padding: 9px 14px;
    margin: 0 0 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text);
    cursor: pointer;
    text-align: center;
    transition: border-color 0.3s var(--ease), color 0.3s var(--ease),
                background 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.control-btn:hover {
    border-color: var(--red);
    color: var(--red-bright);
    box-shadow: var(--red-glow);
}

.control-btn:active {
    background: var(--red-soft);
}

.control-btn:focus-visible {
    outline: 1px solid var(--red);
    outline-offset: 2px;
}

.control-btn.special {
    border-color: var(--red);
    color: var(--red);
    text-shadow: var(--red-glow);
}

/* Running: Start holds a lit, filled state while life is running. */
.control-btn.is-running {
    border-color: var(--red);
    background: var(--red-soft);
    color: var(--red-bright);
    box-shadow: var(--red-glow);
}

/* Paused: Pause stays lit to show the colony is held, not stopped. */
.control-btn.is-active {
    border-color: var(--red);
    color: var(--red-bright);
    box-shadow: var(--red-glow);
}

.control-btn.special:hover {
    background: var(--red);
    color: var(--bg);
    text-shadow: none;
}

.btn-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.btn-row .control-btn {
    margin-bottom: 8px;
}

/* MIDI feedback flashes (added by midi_clean.js) */
.midi-flash {
    background: var(--red-soft) !important;
    border-color: var(--red) !important;
}

.midi-flash-intense {
    background: var(--red) !important;
    color: var(--bg) !important;
}

/* ---------- Controls: toggles ---------- */

.toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    cursor: pointer;
}

.toggle input[type="checkbox"] {
    appearance: none;
    order: 2;
    width: 30px;
    height: 16px;
    border-radius: 2px;
    border: 1px solid var(--line-dim);
    background: var(--panel-2);
    position: relative;
    cursor: pointer;
    flex: none;
    transition: background 0.3s var(--ease), border-color 0.3s var(--ease),
                box-shadow 0.3s var(--ease);
}

.toggle input[type="checkbox"]::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 10px;
    height: 10px;
    border-radius: 1px;
    background: var(--faint);
    transition: transform 0.3s var(--ease), background 0.3s var(--ease);
}

.toggle input[type="checkbox"]:checked {
    background: var(--red-soft);
    border-color: var(--red);
    box-shadow: var(--red-glow);
}

.toggle input[type="checkbox"]:checked::after {
    transform: translateX(14px);
    background: var(--red);
}

.toggle input[type="checkbox"]:focus-visible {
    outline: 1px solid var(--red);
    outline-offset: 2px;
}

.toggle-label {
    order: 1;
    font-size: 12px;
    color: var(--text);
}

/* ---------- Controls: sliders ---------- */

input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 16px;
    background: transparent;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
    height: 2px;
    background: var(--red-dim);
    border-radius: 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 10px;
    height: 10px;
    border-radius: 1px;
    background: var(--red);
    border: none;
    margin-top: -4px;
    box-shadow: var(--red-glow);
    transition: background 0.25s var(--ease), transform 0.25s var(--ease);
}

input[type="range"]:hover::-webkit-slider-thumb {
    background: var(--red-bright);
    transform: scale(1.15);
}

input[type="range"]::-moz-range-track {
    height: 2px;
    background: var(--red-dim);
}

input[type="range"]::-moz-range-thumb {
    width: 10px;
    height: 10px;
    border-radius: 1px;
    background: var(--red);
    border: none;
}

input[type="range"]:hover::-moz-range-thumb {
    background: var(--red-bright);
}

.slider-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 6px 0 10px;
}

.slider-row .slider {
    flex: 1;
}

.slider-value {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--red);
    min-width: 46px;
    text-align: right;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 4px 0;
}

.volume-control span {
    font-size: 11px;
    color: var(--muted);
    min-width: 84px;
}

.volume-control .volume-slider {
    flex: 1;
}

/* ---------- Controls: selects, text inputs, labels ---------- */

.control-label {
    display: block;
    font-family: var(--font-mono);
    font-size: 9.5px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--faint);
    margin: 13px 0 6px;
}

.control-label::before {
    content: '· ';
    color: var(--red-dim);
}

.control-select,
.text-input {
    display: block;
    width: 100%;
    padding: 8px 12px;
    background: var(--panel-2);
    border: 1px solid var(--line-dim);
    border-radius: 2px;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: 12px;
    transition: border-color 0.3s var(--ease), box-shadow 0.3s var(--ease);
}

.control-select:hover,
.text-input:hover {
    border-color: var(--red-dim);
}

.control-select:focus,
.text-input:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: var(--red-glow);
}

.text-input::placeholder {
    color: var(--faint);
}

.control-select {
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5' viewBox='0 0 8 5'%3E%3Cpath d='M0 0l4 5 4-5z' fill='%23FF2A2A'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 30px;
    cursor: pointer;
}

/* ---------- Stats ---------- */

.stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
    padding: 3px 0;
}

.stat span {
    color: var(--text);
}

.stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
    margin-top: 8px;
}

.stat-cell {
    border: 1px solid var(--line-dim);
    border-radius: 2px;
    padding: 10px 8px 8px;
    text-align: center;
    transition: border-color 0.3s var(--ease);
}

.stat-cell:hover {
    border-color: var(--red-dim);
}

.stat-cell .stat-num {
    display: block;
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 700;
    color: var(--red);
    text-shadow: var(--red-glow);
}

.stat-cell .stat-name {
    display: block;
    margin-top: 3px;
    font-family: var(--font-mono);
    font-size: 8.5px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--faint);
}

/* ---------- Kinect setup flow ---------- */

.status-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 2px 0 12px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--muted);
}

.status-row .led {
    flex: none;
}

.setup-card {
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 15px;
    background: var(--panel-2);
}

.setup-lede {
    font-family: var(--font-mono);
    font-size: 11.5px;
    line-height: 1.6;
    color: var(--muted);
    margin-bottom: 13px;
}

.setup-lede::before {
    content: '// ';
    color: var(--red);
}

.setup-steps {
    list-style: none;
    counter-reset: step;
}

.setup-steps li {
    counter-increment: step;
    position: relative;
    padding: 0 0 13px 28px;
    font-size: 11.5px;
    color: var(--muted);
    line-height: 1.55;
}

.setup-steps li::before {
    content: '[' counter(step) ']';
    position: absolute;
    left: 0;
    top: 1px;
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--red);
}

.download-btn {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 14px;
    border: 1px solid var(--red);
    border-radius: 2px;
    color: var(--red);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-shadow: var(--red-glow);
    transition: background 0.3s var(--ease), color 0.3s var(--ease),
                box-shadow 0.3s var(--ease);
}

.download-btn:hover {
    background: var(--red);
    color: var(--bg);
    text-shadow: none;
    box-shadow: var(--red-glow);
}

.download-btn .dl-meta {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.08em;
    opacity: 0.8;
    text-transform: none;
}

.setup-note {
    margin-top: 3px;
    font-size: 10.5px;
    line-height: 1.55;
    color: var(--faint);
}

.kinect-live[hidden] {
    display: none;
}

/* ---------- Advanced disclosure ---------- */

.advanced {
    margin-top: 13px;
    border-top: 1px solid var(--line-dim);
    padding-top: 10px;
}

.advanced > summary {
    list-style: none;
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--faint);
    cursor: pointer;
    transition: color 0.3s var(--ease);
}

.advanced > summary::before {
    content: '+ ';
    color: var(--red-dim);
}

.advanced[open] > summary::before {
    content: '- ';
}

.advanced > summary::-webkit-details-marker {
    display: none;
}

.advanced > summary:hover {
    color: var(--muted);
}

.advanced[open] > summary {
    color: var(--muted);
    margin-bottom: 8px;
}

.hint {
    font-size: 10.5px;
    line-height: 1.6;
    color: var(--faint);
    margin: 8px 0;
}

.hint code {
    font-family: var(--font-mono);
    font-size: 10px;
    background: var(--panel-2);
    border: 1px solid var(--line-dim);
    border-radius: 2px;
    padding: 1px 5px;
    color: var(--red-bright);
}

/* ---------- Audio meter ---------- */

.audio-status {
    margin: 10px 0 6px;
}

.audio-input-status {
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--muted);
}

.volume-meter {
    height: 3px;
    background: var(--panel-2);
    border: 1px solid var(--line-dim);
    overflow: hidden;
    margin: 8px 0 6px;
}

.volume-bar {
    height: 100%;
    width: 0%;
    background: var(--red);
    box-shadow: var(--red-glow);
    transition: width 0.08s linear;
}

.frequency-display {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--faint);
}

/* ---------- Mapping tables (controllers) ---------- */

.map-list {
    font-family: var(--font-mono);
    font-size: 10px;
    line-height: 1.9;
    color: var(--muted);
}

.map-list strong {
    color: var(--text);
    font-weight: 700;
}

.map-heading {
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--red);
    margin: 12px 0 4px;
}

/* ---------- About tab ---------- */

.about-content {
    padding: 20px 22px 28px;
}

.about-content h4 {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--red);
    text-shadow: var(--red-glow);
    margin: 24px 0 10px;
}

.about-content h4::before {
    content: '# ';
    color: var(--red-dim);
}

.about-content h4:first-child {
    margin-top: 0;
}

.about-content p {
    font-size: 12px;
    line-height: 1.7;
    color: var(--muted);
    margin-bottom: 12px;
}

.about-content p strong,
.about-content p em {
    color: var(--text);
    font-style: normal;
}

.about-content ul {
    list-style: none;
    margin-bottom: 12px;
}

.about-content li {
    position: relative;
    padding-left: 16px;
    font-size: 11.5px;
    line-height: 1.8;
    color: var(--muted);
}

.about-content li::before {
    content: '>';
    position: absolute;
    left: 0;
    color: var(--red);
}

.about-content li strong {
    color: var(--text);
    font-weight: 700;
}

.credit-card {
    margin-top: 24px;
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 16px;
    background: var(--panel-2);
}

.credit-card .credit-name {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--red);
    text-shadow: var(--red-glow);
}

.credit-card .credit-role {
    font-family: var(--font-mono);
    font-size: 9.5px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--faint);
    margin: 4px 0 13px;
}

.credit-links {
    display: flex;
    gap: 8px;
}

.credit-links a {
    flex: 1;
    text-align: center;
    padding: 8px 10px;
    border: 1px solid var(--red-dim);
    border-radius: 2px;
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text);
    transition: border-color 0.3s var(--ease), color 0.3s var(--ease),
                box-shadow 0.3s var(--ease);
}

.credit-links a:hover {
    border-color: var(--red);
    color: var(--red-bright);
    box-shadow: var(--red-glow);
}

/* ---------- Footer: the credit lives here, bottom of the page ---------- */

/* Maker credit: Blót (blo7.com). Just the white brand mark, understated at
   rest and brighter on hover. */
.sidebar-footer {
    padding: 14px 22px 16px;
    border-top: 1px solid var(--line);
}

.blot-credit {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.25s var(--ease);
}

.blot-credit:hover { opacity: 1; }

.blot-credit-label {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--faint);
}

.blot-icon {
    width: 20px;
    height: 20px;
    color: #FFFFFF;
}

/* ---------- Load-in sequence ---------- */

.sidebar-header,
.tabs,
.panel-section,
.sidebar-footer {
    animation: fadeUp 0.6s var(--ease) both;
}

.sidebar-header { animation-delay: 0.05s; }
.tabs { animation-delay: 0.12s; }
.panel-section:nth-of-type(1) { animation-delay: 0.18s; }
.panel-section:nth-of-type(2) { animation-delay: 0.24s; }
.panel-section:nth-of-type(3) { animation-delay: 0.30s; }
.panel-section:nth-of-type(4) { animation-delay: 0.36s; }
.panel-section:nth-of-type(5) { animation-delay: 0.42s; }
.panel-section:nth-of-type(6) { animation-delay: 0.48s; }
.panel-section:nth-of-type(7) { animation-delay: 0.54s; }
.sidebar-footer { animation-delay: 0.6s; }

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---------- Body source badge (which input is live) ---------- */

.source-badge {
    position: absolute;
    top: 18px;
    right: 20px;
    z-index: 5;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--red-bright);
    padding: 7px 12px;
    border-radius: 8px;
    background: rgba(5, 5, 7, 0.4);
    border: 1px solid rgba(255, 42, 42, 0.25);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    pointer-events: none;
    text-shadow: var(--red-glow);
}

.source-badge[hidden] { display: none; }

/* Fullscreen projection stays clean */
.main-content:fullscreen .source-badge { display: none; }

/* Upload button label behaves like a control button */
.upload-btn {
    cursor: pointer;
}

/* ---------- Colony HUD (stats over the simulation) ---------- */

.colony-hud {
    position: absolute;
    top: 18px;
    left: 20px;
    display: flex;
    gap: 22px;
    padding: 10px 16px;
    border-radius: 8px;
    background: rgba(5, 5, 7, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.06);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    pointer-events: none;
    z-index: 5;
}

.colony-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    line-height: 1.1;
}

.colony-num {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.colony-label {
    font-family: var(--font-mono);
    font-size: 8.5px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--faint);
    margin-top: 2px;
}

/* Session totals: born glows in the theme accent, died stays dim, both set
   apart from the live "alive now" count by a hairline divider. */
.stat-born { color: var(--accent); text-shadow: 0 0 8px var(--accent); }
.stat-died { color: var(--muted); }

.flow-stat {
    padding-left: 20px;
    border-left: 1px solid rgba(255, 255, 255, 0.09);
}

/* Keep the projection clean in fullscreen */
.main-content:fullscreen .colony-hud,
#lifeCanvas:fullscreen ~ .colony-hud {
    display: none;
}

/* Live "active inputs" readout: what is connected and how it's affecting the life */
.inputs-hud {
    position: absolute;
    left: 20px;
    bottom: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 5;
    pointer-events: none;
}
.input-chip {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 13px;
    border-radius: 8px;
    background: rgba(5, 5, 7, 0.5);
    border: 1px solid var(--line);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.input-chip[hidden] { display: none; }
.input-chip.playing { border-color: var(--accent); box-shadow: 0 0 10px var(--accent); }
.input-chip .input-led {
    width: 7px; height: 7px; border-radius: 50%;
    background: var(--accent); box-shadow: 0 0 8px var(--accent);
    animation: ledPulse 1.4s ease-in-out infinite;
}
.input-chip .input-name { color: var(--accent); font-weight: 700; }
.input-chip .input-note {
    color: var(--muted);
    text-transform: none;
    letter-spacing: 0.02em;
}
.input-meter {
    width: 56px; height: 6px;
    border: 1px solid var(--line-dim);
    border-radius: 3px;
    overflow: hidden;
}
.input-meter i {
    display: block; height: 100%; width: 0%;
    background: var(--accent);
    box-shadow: 0 0 8px var(--accent);
    transition: width 0.08s linear;
}
@keyframes ledPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
.main-content:fullscreen .inputs-hud,
#lifeCanvas:fullscreen ~ .inputs-hud { display: none; }

/* ---------- Sidebar theme swatches ---------- */

.theme-swatches {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin: 4px 0 6px;
}

.swatch-group-label {
    font-family: var(--font-mono);
    font-size: 8.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--faint);
    margin-top: 4px;
}

.swatch-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 7px;
}

/* Divider between solid and multicolour swatches in the fullscreen bar */
.ex-sub-divider {
    width: 1px;
    align-self: stretch;
    background: var(--line);
    margin: 0 4px;
}

.theme-swatch {
    aspect-ratio: 1;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.14);
    background: var(--sw);
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s var(--ease), border-color 0.2s var(--ease),
                box-shadow 0.2s var(--ease);
}

.theme-swatch:hover {
    transform: scale(1.15);
    border-color: rgba(255, 255, 255, 0.45);
}

.theme-swatch.active {
    border-color: #FFFFFF;
    box-shadow: 0 0 0 2px var(--bg), 0 0 10px var(--sw);
}

.theme-swatch:focus-visible {
    outline: 1px solid var(--red);
    outline-offset: 2px;
}

/* ---------- Exhibition control bar ---------- */

.exhibition-bar {
    position: fixed;
    left: 50%;
    bottom: 28px;
    transform: translate(-50%, 24px);
    z-index: 100000;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 16px;
    border-radius: 14px;
    background: rgba(8, 8, 10, 0.62);
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 16px 50px rgba(0, 0, 0, 0.55);
    -webkit-backdrop-filter: blur(20px) saturate(1.3);
    backdrop-filter: blur(20px) saturate(1.3);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s var(--ease), transform 0.4s var(--ease);
}

.exhibition-bar.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0);
}

/* hide the cursor with the bar for a clean projection */
body:not(.ex-cursor):fullscreen,
.main-content:fullscreen:not(.ex-cursor) {
    cursor: none;
}

.ex-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ex-themes {
    gap: 6px;
}

.ex-swatch {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.18);
    background: var(--sw);
    cursor: pointer;
    padding: 0;
    transition: transform 0.2s var(--ease), border-color 0.2s var(--ease),
                box-shadow 0.2s var(--ease);
}

.ex-swatch:hover {
    transform: scale(1.18);
    border-color: rgba(255, 255, 255, 0.5);
}

.ex-swatch.active {
    border-color: #FFFFFF;
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.6), 0 0 14px var(--sw);
    transform: scale(1.15);
}

.ex-swatch:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.ex-divider {
    width: 1px;
    height: 26px;
    background: rgba(255, 255, 255, 0.12);
}

.ex-chip {
    appearance: none;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 8px;
    padding: 7px 12px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: color 0.2s var(--ease), border-color 0.2s var(--ease),
                background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.ex-chip:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.4);
}

.ex-chip.on {
    color: #fff;
    border-color: var(--red);
    background: var(--red-soft);
    box-shadow: 0 0 12px rgba(255, 42, 42, 0.3);
}

.ex-slider {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
}

.ex-slider input[type="range"] {
    width: 110px;
}

.ex-exit {
    appearance: none;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    padding: 7px 16px;
    font-family: var(--font-mono);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
    cursor: pointer;
    transition: color 0.2s var(--ease), border-color 0.2s var(--ease),
                background 0.2s var(--ease);
}

.ex-exit:hover {
    color: #fff;
    border-color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 720px) {
    .exhibition-bar {
        flex-wrap: wrap;
        justify-content: center;
        max-width: 92vw;
        bottom: 16px;
    }
}

/* ---------- Responsive ---------- */

@media (max-width: 900px) {
    body {
        overflow: auto;
    }

    .container {
        flex-direction: column;
        height: auto;
    }

    .sidebar {
        width: 100%;
        min-width: 0;
        height: auto;
        order: 2;
        border-right: none;
        border-top: 1px solid var(--line);
    }

    .tab-content {
        overflow-y: visible;
    }

    .main-content {
        order: 1;
    }

    .canvas-container {
        height: 62vh;
    }
}
