/* ============================================================
   genpatsu.io — Nuclear Risk Simulator
   Palette
   - Blueprint Pale       #f0f4f8  (background)
   - Graphite             #1c2733  (primary text)
   - Containment Blue     #1565c0  (safe / normal)
   - Warning Amber        #f9a825  (caution)
   - Critical Vermillion  #c62828  (danger)
   - Technical Gray       #78909c  (schematic lines)
   - Diagram White        #ffffff  (panel backgrounds)
   ============================================================ */

:root {
    --c-bg:        #f0f4f8;
    --c-text:      #1c2733;
    --c-safe:      #1565c0;
    --c-caution:   #f9a825;
    --c-danger:    #c62828;
    --c-line:      #78909c;
    --c-panel:     #ffffff;

    --f-display: 'Noto Sans JP', 'Helvetica Neue', sans-serif;
    --f-body:    'Noto Serif JP', 'Times New Roman', serif;
    --f-mono:    'JetBrains Mono', 'Courier New', monospace;

    --flow-speed: 1.6s;
    --diag: -2.5deg;
}

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

html, body {
    background: var(--c-bg);
    color: var(--c-text);
    font-family: var(--f-body);
    font-size: clamp(0.95rem, 1.1vw, 1.05rem);
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
}

body {
    overflow-x: hidden;
    background-image:
        linear-gradient(var(--c-bg), var(--c-bg)),
        repeating-linear-gradient(
            0deg,
            rgba(120, 144, 156, 0.08) 0,
            rgba(120, 144, 156, 0.08) 1px,
            transparent 1px,
            transparent 40px
        ),
        repeating-linear-gradient(
            90deg,
            rgba(120, 144, 156, 0.08) 0,
            rgba(120, 144, 156, 0.08) 1px,
            transparent 1px,
            transparent 40px
        );
    background-blend-mode: normal, multiply, multiply;
    background-attachment: fixed;
}

/* ============= STATUS STRIP (top header) ============= */
.status-strip {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    align-items: center;
    padding: 8px 22px;
    background: rgba(28, 39, 51, 0.96);
    color: var(--c-bg);
    font-family: var(--f-mono);
    font-size: 0.7rem;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--c-line);
}
.status-strip .strip-tag {
    color: var(--c-line);
    margin-right: 8px;
}
.status-strip .strip-center { text-align: center; }
.status-strip .strip-right  { text-align: right; }
.status-strip .risk-dot { vertical-align: middle; margin-right: 6px; }

/* ============= TYPOGRAPHY ============= */
.section-title,
.hero-title {
    font-family: var(--f-display);
    font-weight: 700;
    color: var(--c-text);
    letter-spacing: -0.01em;
}

.section-title {
    font-size: clamp(2rem, 4.5vw, 4rem);
    line-height: 1.15;
    margin-bottom: 18px;
}
.section-title .title-en {
    font-family: var(--f-display);
    font-weight: 400;
    font-size: 0.45em;
    color: var(--c-line);
    letter-spacing: 0.04em;
    margin-left: 12px;
}

.eyebrow-tag,
.eyebrow-num,
.eyebrow-label,
.strip-tag,
.strip-val,
.hud-label,
.hud-value,
.panel-num,
.tl-date,
.tl-loc,
.tl-ines,
.card-num,
.ftag,
.fval,
.anno-text,
.cue-text,
.legend-item,
.m-leg,
.axis-label,
.axis-ticks li {
    font-family: var(--f-mono);
    letter-spacing: 0.02em;
}

.eyebrow-tag,
.eyebrow-num,
.eyebrow-label {
    font-size: 0.78rem;
    color: var(--c-line);
    text-transform: uppercase;
}
.eyebrow-tag {
    background: var(--c-text);
    color: var(--c-bg);
    padding: 2px 8px;
    margin-right: 10px;
}
.eyebrow-num { margin-right: 16px; }
.eyebrow-label { color: var(--c-text); font-weight: 500; }

/* ============= RISK DOTS ============= */
.risk-dot {
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--c-line);
    box-shadow: 0 0 8px rgba(120, 144, 156, 0.3);
    transform: translateY(1px);
}
.risk-dot.risk-safe    { background: var(--c-safe);    box-shadow: 0 0 8px rgba(21, 101, 192, 0.4); }
.risk-dot.risk-caution { background: var(--c-caution); box-shadow: 0 0 8px rgba(249, 168, 37, 0.4); }
.risk-dot.risk-danger  {
    background: var(--c-danger);
    box-shadow: 0 0 8px rgba(198, 40, 40, 0.45);
    animation: pulseDanger 1.5s ease-in-out infinite;
}
@keyframes pulseDanger {
    0%, 100% { transform: translateY(1px) scale(1.0); }
    50%      { transform: translateY(1px) scale(1.15); box-shadow: 0 0 14px rgba(198, 40, 40, 0.7); }
}

/* ============= SECTION SHELL ============= */
.section {
    position: relative;
    padding: 110px 6vw 140px;
    isolation: isolate;
}
.section + .section { margin-top: 0; }

.section-head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    margin-bottom: 14px;
}

.section-lede {
    max-width: 720px;
    margin-bottom: 56px;
    color: var(--c-text);
}
.section-lede .lede-en {
    display: block;
    margin-top: 14px;
    color: var(--c-line);
    font-style: italic;
    font-size: 0.92em;
}

/* ============= DIAGONAL DIVIDERS ============= */
.diagonal-divider {
    position: absolute;
    left: -10%;
    right: -10%;
    height: 90px;
    z-index: -1;
    background-image: repeating-linear-gradient(
        45deg,
        rgba(120, 144, 156, 0.45) 0,
        rgba(120, 144, 156, 0.45) 1px,
        transparent 1px,
        transparent 8px
    );
    background-color: rgba(120, 144, 156, 0.07);
    border-top: 1px solid var(--c-line);
    border-bottom: 1px solid var(--c-line);
    transform: skewY(var(--diag));
}
.divider-down { bottom: -45px; }
.divider-up   { top: -45px; transform: skewY(calc(var(--diag) * -1)); }

/* ============= HERO ============= */
.section--hero {
    min-height: 100vh;
    padding-top: 90px;
    display: flex;
    flex-direction: column;
}
.hero-grid-bg {
    position: absolute;
    inset: 0;
    z-index: -2;
    background-image:
        repeating-linear-gradient(0deg, rgba(120, 144, 156, 0.13) 0 1px, transparent 1px 60px),
        repeating-linear-gradient(90deg, rgba(120, 144, 156, 0.13) 0 1px, transparent 1px 60px);
    pointer-events: none;
}

.hero-header {
    text-align: left;
    max-width: 1100px;
    margin-bottom: 24px;
}
.hero-eyebrow {
    margin-bottom: 28px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}
.hero-title {
    font-size: clamp(2.6rem, 7vw, 6rem);
    line-height: 1.0;
    letter-spacing: -0.02em;
    margin-bottom: 10px;
}
.hero-subtitle {
    font-family: var(--f-display);
    font-weight: 400;
    font-size: clamp(1rem, 1.6vw, 1.4rem);
    color: var(--c-text);
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    align-items: baseline;
}
.subtitle-jp { font-weight: 500; }
.subtitle-en {
    font-family: var(--f-mono);
    font-size: 0.78em;
    color: var(--c-line);
    letter-spacing: 0.04em;
}

/* HERO STAGE: SVG + HUD overlays */
.hero-stage {
    position: relative;
    flex: 1;
    width: min(100%, 1180px);
    margin: 0 auto;
    aspect-ratio: 3 / 2;
    max-height: 70vh;
    border: 1px solid var(--c-line);
    background: var(--c-panel);
    box-shadow: 0 24px 0 -22px var(--c-line), 0 48px 0 -44px var(--c-line);
}
.reactor-svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* SVG draw-on animation */
.reactor-svg .draw {
    stroke-dasharray: 1200;
    stroke-dashoffset: 1200;
    transition: stroke-dashoffset 800ms ease;
}
.reactor-svg.drawn .draw {
    stroke-dashoffset: 0;
}

.reactor-svg .comp {
    opacity: 0;
    transform-origin: 50% 50%;
    transform: scale(0.96);
    transition: opacity 600ms ease, transform 600ms ease;
}
.reactor-svg.drawn .comp { opacity: 1; transform: scale(1); }

/* Coolant flow */
.reactor-svg .flow {
    stroke-dasharray: 12 6;
    stroke-dashoffset: 0;
    opacity: 0;
    transition: opacity 600ms ease;
}
.reactor-svg.drawn .flow { opacity: 1; }
.reactor-svg.drawn .flow-cold,
.reactor-svg.drawn .flow-tower {
    animation: flowDash var(--flow-speed) linear infinite;
}
.reactor-svg.drawn .flow-hot {
    animation: flowDashRev var(--flow-speed) linear infinite;
}
@keyframes flowDash    { to { stroke-dashoffset: -36; } }
@keyframes flowDashRev { to { stroke-dashoffset:  36; } }

/* Steam */
.reactor-svg .steam .puff {
    opacity: 0;
    transform-origin: center;
}
.reactor-svg.drawn .steam .puff { animation: steamRise 3.4s ease-out infinite; }
.reactor-svg.drawn .steam .p1 { animation-delay: 0s; }
.reactor-svg.drawn .steam .p2 { animation-delay: 0.6s; }
.reactor-svg.drawn .steam .p3 { animation-delay: 1.2s; }
@keyframes steamRise {
    0%   { opacity: 0; transform: translateY(0) scale(0.7); }
    25%  { opacity: 0.7; }
    100% { opacity: 0; transform: translateY(-40px) scale(1.2); }
}

.anno-text {
    font-family: var(--f-mono);
    font-size: 11px;
    fill: var(--c-text);
    letter-spacing: 0.04em;
}

/* HUD overlays */
.hud {
    position: absolute;
    background: rgba(28, 39, 51, 0.92);
    color: var(--c-bg);
    padding: 8px 14px;
    font-family: var(--f-mono);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    border: 1px solid var(--c-line);
    min-width: 130px;
}
.hud .hud-label { display: block; color: var(--c-line); font-size: 0.65rem; margin-bottom: 2px; }
.hud .hud-value { display: block; color: var(--c-bg); font-size: 0.95rem; font-weight: 500; }
.hud-tl { top: 14px;    left: 14px;    }
.hud-tr { top: 14px;    right: 14px;   text-align: right; }
.hud-bl { bottom: 14px; left: 14px;    }
.hud-br { bottom: 14px; right: 14px;   text-align: right; }

.hero-footer {
    margin-top: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}
.legend {
    display: flex;
    gap: 22px;
    font-family: var(--f-mono);
    font-size: 0.78rem;
    color: var(--c-text);
}
.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.scroll-cue .cue-text {
    font-size: 0.78rem;
    color: var(--c-line);
    animation: cueBob 2.4s ease-in-out infinite;
    display: inline-block;
}
@keyframes cueBob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(6px); }
}

/* ============= ANATOMY (EXPLODED VIEW) ============= */
.section--anatomy { background: linear-gradient(180deg, var(--c-bg) 0%, #e7eef5 100%); }

.exploded-stage {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
    gap: 48px;
    align-items: start;
    margin-top: 24px;
}

.exploded-svg-wrap {
    position: sticky;
    top: 80px;
    background: var(--c-panel);
    border: 1px solid var(--c-line);
    aspect-ratio: 1 / 1;
    overflow: hidden;
}
.exploded-svg { width: 100%; height: 100%; display: block; }

.ex-comp {
    transform-origin: 50% 50%;
    transition: transform 700ms cubic-bezier(0.2, 0.6, 0.2, 1), opacity 500ms ease;
}
.ex-dome   { transform: translate(0, 0); }
.ex-vessel { transform: translate(0, 0); }
.ex-rods   { transform: translate(0, 0); }
.ex-pipes  { transform: translate(0, 0); }

/* Exploded states */
.exploded-svg.exploded .ex-dome   { transform: translate(0, -60px); }
.exploded-svg.exploded .ex-vessel { transform: translate(0,  60px); }
.exploded-svg.exploded .ex-rods   { transform: translate(80px, 60px); }
.exploded-svg.exploded .ex-pipes  { transform: translate(-80px, 0); }

.exploded-svg.exploded .ex-comp {
    filter: drop-shadow(0 6px 0 rgba(120, 144, 156, 0.18));
}

.exploded-svg .ex-comp.is-active {
    /* a soft outline halo via stroke-width modulation handled in JS */
}

.exploded-panels {
    display: flex;
    flex-direction: column;
    gap: 28px;
}

.ex-panel {
    background: var(--c-panel);
    border: 1px solid var(--c-line);
    padding: 28px 28px 22px;
    position: relative;
    opacity: 0.45;
    transform: translateY(20px);
    transition: opacity 600ms ease, transform 600ms ease, border-color 400ms ease;
    border-left: 4px solid var(--c-line);
}
.ex-panel.is-active {
    opacity: 1;
    transform: translateY(0);
    border-left-color: var(--c-safe);
}
.ex-panel[data-panel="rods"].is-active   { border-left-color: var(--c-caution); }
.ex-panel[data-panel="pipes"].is-active  { border-left-color: var(--c-danger); }

.panel-num {
    position: absolute;
    top: -14px;
    left: 22px;
    background: var(--c-text);
    color: var(--c-bg);
    font-family: var(--f-mono);
    font-size: 0.78rem;
    font-weight: 500;
    padding: 3px 10px;
    letter-spacing: 0.1em;
}
.panel-title {
    font-family: var(--f-display);
    font-weight: 700;
    font-size: 1.4rem;
    margin-bottom: 8px;
    line-height: 1.25;
}
.panel-en {
    font-family: var(--f-mono);
    font-weight: 400;
    font-size: 0.65em;
    color: var(--c-line);
    margin-left: 8px;
    letter-spacing: 0.03em;
}
.panel-body { margin-bottom: 18px; }

.panel-data {
    display: grid;
    grid-template-columns: max-content 1fr;
    column-gap: 18px;
    row-gap: 4px;
    font-family: var(--f-mono);
    font-size: 0.78rem;
    border-top: 1px dashed var(--c-line);
    padding-top: 14px;
}
.panel-data dt { color: var(--c-line); letter-spacing: 0.05em; }
.panel-data dd { color: var(--c-text); }

/* ============= RISK MATRIX ============= */
.section--matrix { background: var(--c-bg); }

.matrix-wrapper {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) 56px;
    gap: 14px;
    max-width: 880px;
    margin: 0 auto 32px;
}

.matrix-axis-y {
    grid-column: 1; grid-row: 1;
    display: flex; flex-direction: column;
    justify-content: space-between;
    align-items: flex-end;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    text-align: center;
}
.matrix-axis-y .axis-label {
    font-size: 0.72rem;
    color: var(--c-line);
    letter-spacing: 0.1em;
    margin-bottom: 8px;
}
.matrix-axis-y .axis-ticks {
    list-style: none;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    height: 100%;
    font-size: 0.66rem;
    color: var(--c-text);
}
.matrix-axis-y .axis-ticks li { padding: 4px 0; }

.matrix-grid {
    grid-column: 2; grid-row: 1;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    grid-template-rows: repeat(5, 1fr);
    gap: 4px;
    aspect-ratio: 1 / 1;
    background: var(--c-line);
    border: 1px solid var(--c-line);
    padding: 2px;
}

.matrix-cell {
    background: var(--c-panel);
    border: 2px solid var(--c-line);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--f-mono);
    font-size: 0.85rem;
    color: var(--c-line);
    transition: background 700ms ease, color 500ms ease, border-color 500ms ease;
}
.matrix-cell .cell-score {
    position: absolute;
    top: 4px;
    left: 6px;
    font-size: 0.6rem;
    color: var(--c-line);
}
.matrix-cell .cell-glyph {
    font-size: 1rem;
    opacity: 0.85;
}

.matrix-cell.filled.r-safe    { background: rgba(21, 101, 192, 0.12); border-color: var(--c-safe);    color: var(--c-safe); }
.matrix-cell.filled.r-low     { background: rgba(21, 101, 192, 0.28); border-color: var(--c-safe);    color: var(--c-safe); }
.matrix-cell.filled.r-medium  { background: rgba(249, 168, 37, 0.28); border-color: var(--c-caution); color: var(--c-text); }
.matrix-cell.filled.r-high    { background: rgba(249, 168, 37, 0.55); border-color: var(--c-caution); color: var(--c-text); }
.matrix-cell.filled.r-danger  { background: rgba(198, 40, 40, 0.55);  border-color: var(--c-danger);  color: var(--c-panel); }
.matrix-cell.filled.r-extreme { background: var(--c-danger);          border-color: var(--c-danger);  color: var(--c-panel); }

.matrix-cell.is-peak {
    animation: peakPulse 1.6s ease-out 1;
}
@keyframes peakPulse {
    0%   { box-shadow: 0 0 0 0 rgba(198, 40, 40, 0.7); }
    100% { box-shadow: 0 0 0 18px rgba(198, 40, 40, 0); }
}

.matrix-axis-x {
    grid-column: 2; grid-row: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.matrix-axis-x .ticks-x {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    width: 100%;
    text-align: center;
    font-size: 0.66rem;
    color: var(--c-text);
    margin-bottom: 6px;
}
.matrix-axis-x .axis-label {
    font-size: 0.72rem;
    color: var(--c-line);
    letter-spacing: 0.1em;
}

.matrix-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 22px;
    margin: 20px auto 0;
    font-family: var(--f-mono);
    font-size: 0.78rem;
    color: var(--c-text);
    max-width: 880px;
}
.m-leg { display: inline-flex; align-items: center; gap: 8px; }
.m-swatch {
    width: 14px; height: 14px;
    display: inline-block;
    border: 1px solid var(--c-line);
}
.m-swatch.m-safe    { background: rgba(21, 101, 192, 0.28); border-color: var(--c-safe); }
.m-swatch.m-caution { background: rgba(249, 168, 37, 0.55); border-color: var(--c-caution); }
.m-swatch.m-danger  { background: var(--c-danger); border-color: var(--c-danger); }

/* ============= TIMELINE ============= */
.section--timeline { background: linear-gradient(180deg, var(--c-bg) 0%, #e7eef5 100%); }

.timeline-wrap {
    position: relative;
    max-width: 920px;
    margin: 30px auto 0;
    padding-left: 60px;
}

.timeline-spine {
    position: absolute;
    top: 0;
    left: 30px;
    width: 2px;
    height: 100%;
    overflow: visible;
}
.timeline-spine .spine-fg {
    stroke-dasharray: 1100;
    stroke-dashoffset: 1100;
    transition: stroke-dashoffset 1.4s ease;
}
.timeline-spine.drawn .spine-fg { stroke-dashoffset: 0; }

.timeline-events {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 50px;
}
.tl-event {
    position: relative;
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 600ms ease, transform 600ms ease;
}
.tl-event.is-visible { opacity: 1; transform: translateX(0); }

.tl-node {
    position: absolute;
    left: -40px;
    top: 18px;
    width: 22px;
    height: 22px;
    border: 2px solid var(--c-line);
    background: var(--c-panel);
    display: flex;
    align-items: center;
    justify-content: center;
}
.tl-node .risk-dot {
    width: 10px;
    height: 10px;
}

.tl-card {
    background: var(--c-panel);
    border: 1px solid var(--c-line);
    border-left: 4px solid var(--c-line);
    padding: 20px 26px 22px;
    position: relative;
}
.tl-event[data-severity="caution"] .tl-card { border-left-color: var(--c-caution); }
.tl-event[data-severity="danger"]  .tl-card { border-left-color: var(--c-danger); }

.tl-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-family: var(--f-mono);
    font-size: 0.72rem;
    color: var(--c-line);
    margin-bottom: 8px;
    letter-spacing: 0.04em;
}
.tl-meta .tl-ines {
    background: var(--c-text);
    color: var(--c-bg);
    padding: 1px 6px;
}
.tl-event[data-severity="danger"] .tl-meta .tl-ines { background: var(--c-danger); }
.tl-event[data-severity="caution"] .tl-meta .tl-ines { background: var(--c-caution); color: var(--c-text); }

.tl-title {
    font-family: var(--f-display);
    font-weight: 700;
    font-size: 1.3rem;
    line-height: 1.3;
    margin-bottom: 8px;
}

/* ============= SAFETY PROTOCOL ============= */
.section--protocol {
    background: var(--c-bg);
    padding-bottom: 60px;
}

.protocol-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 24px;
    margin: 30px 0 60px;
}

.protocol-card {
    background: var(--c-panel);
    border: 1px solid var(--c-line);
    padding: 26px 26px 22px;
    position: relative;
    border-top: 3px solid var(--c-safe);
}
.protocol-card:nth-child(2) { border-top-color: var(--c-caution); }
.protocol-card:nth-child(3) { border-top-color: var(--c-danger); }
.protocol-card:nth-child(4) { border-top-color: var(--c-line); }

.card-num {
    font-family: var(--f-mono);
    font-size: 0.75rem;
    color: var(--c-line);
    margin-bottom: 8px;
    letter-spacing: 0.06em;
}
.card-title {
    font-family: var(--f-display);
    font-weight: 700;
    font-size: 1.2rem;
    margin-bottom: 10px;
    line-height: 1.3;
}
.card-en {
    font-family: var(--f-mono);
    font-weight: 400;
    font-size: 0.7em;
    color: var(--c-line);
    margin-left: 6px;
}

/* ============= DOC FOOTER ============= */
.doc-footer {
    border: 1px solid var(--c-line);
    background: var(--c-panel);
    padding: 22px 26px;
    font-family: var(--f-mono);
    font-size: 0.78rem;
    color: var(--c-text);
    letter-spacing: 0.03em;
    background-image: repeating-linear-gradient(
        45deg,
        rgba(120, 144, 156, 0.06) 0,
        rgba(120, 144, 156, 0.06) 1px,
        transparent 1px,
        transparent 10px
    );
}
.footer-row {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 16px;
    padding: 6px 0;
    border-bottom: 1px dashed rgba(120, 144, 156, 0.4);
}
.footer-row:last-of-type { border-bottom: none; }
.ftag { color: var(--c-line); }
.fval { color: var(--c-text); }
.footer-stamp { justify-content: flex-end; display: flex; padding-top: 14px; }
.footer-stamp .stamp {
    border: 2px solid var(--c-danger);
    color: var(--c-danger);
    padding: 6px 16px;
    transform: rotate(-3deg);
    letter-spacing: 0.18em;
    font-weight: 500;
}

/* ============= RESPONSIVE ============= */
@media (max-width: 880px) {
    .section { padding: 90px 5vw 110px; }
    .exploded-stage { grid-template-columns: 1fr; }
    .exploded-svg-wrap { position: relative; top: 0; aspect-ratio: 1.4 / 1; }
    .matrix-wrapper { grid-template-columns: 36px 1fr; }
    .hud { font-size: 0.62rem; min-width: 100px; padding: 6px 8px; }
    .hud .hud-value { font-size: 0.78rem; }
    .timeline-wrap { padding-left: 44px; }
    .timeline-spine { left: 16px; }
    .tl-node { left: -32px; }
    .footer-row { grid-template-columns: 1fr; gap: 0; }
}

@media (max-width: 520px) {
    .status-strip { grid-template-columns: 1fr; gap: 2px; padding: 6px 12px; }
    .status-strip .strip-center,
    .status-strip .strip-right { text-align: left; }
    .legend { flex-direction: column; gap: 4px; }
    .hud-bl, .hud-br { display: none; }
}
