:root {
    --cold-blue: #3498db;
    --hot-red: #e74c3c;
    --heavy-gold: #f1c40f;
    --bg-dark: #1a1a1a;
    --panel-bg: #2c3e50;
    --text-light: #ecf0f1;
    --accent: #2ecc71;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    margin: 0;
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

header {
    background-color: #000;
    padding: 10px 20px;
    text-align: center;
    border-bottom: 2px solid var(--accent);
    position: relative;
}

main {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 10px;
    padding: 10px;
    flex-grow: 1;
    overflow: hidden;
}

.simulation-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(0,0,0,0.3);
    border-radius: 8px;
    padding: 12px;
    position: relative;
    min-height: 0;
    overflow: auto;
}

.etaje-row {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: flex-start;
    gap: 12px;
    flex: 1;
    min-height: 0;
    overflow-x: auto;
    padding-bottom: 4px;
}

.etaj-unit {
    position: relative;
    flex: 0 0 auto;
    width: min(340px, 92vw);
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px;
    border-radius: 12px;
    border: 2px solid rgba(255,255,255,0.12);
    background: rgba(0,0,0,0.2);
    transition: border-color 0.2s, box-shadow 0.2s;
    cursor: pointer;
    outline: none;
}

.etaj-unit:focus-visible {
    box-shadow: 0 0 0 2px rgba(46, 204, 113, 0.5);
}

.etaj-unit.etaj-active {
    border-color: rgba(46, 204, 113, 0.55);
    box-shadow: 0 0 18px rgba(46, 204, 113, 0.18);
}

.etaj-unit.etaj-locked {
    cursor: not-allowed;
    opacity: 0.88;
}

.etaj-heading {
    display: flex;
    flex-direction: column;
    gap: 2px;
    text-align: center;
}

.etaj-name {
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--heavy-gold);
}

.etaj-target {
    font-size: 0.72rem;
    color: #aeb8c2;
}

.etaj-hypothesis-note {
    margin: 0;
    font-size: 0.65rem;
    line-height: 1.35;
    color: #9aa5b1;
    text-align: center;
    font-style: italic;
}

.etaj-lock-overlay {
    position: absolute;
    inset: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(12, 14, 18, 0.72);
    border-radius: 12px;
    backdrop-filter: blur(2px);
}

.etaj-lock-overlay.hidden {
    display: none;
}

.lock-icon {
    font-size: 2.4rem;
    line-height: 1;
    filter: grayscale(1);
    opacity: 0.85;
    user-select: none;
}

.rupere-teorie {
    font-size: 0.62rem;
    line-height: 1.45;
    color: #b8c2cc;
    padding: 6px 8px;
    border-radius: 8px;
    background: rgba(0,0,0,0.25);
    border: 1px solid rgba(255,255,255,0.08);
    margin-top: 4px;
}

.info-box-note {
    font-size: 0.78rem;
    background: rgba(0,0,0,0.2);
    padding: 10px;
    border-radius: 5px;
    line-height: 1.45;
}

.columns-container {
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: stretch;
    flex: 1;
    gap: 0;
    min-height: 220px;
    position: relative;
}

.columns-container:not(.columns-container--legacy) {
    overflow: visible;
}

/* Etaj 1 — aspect original: coloană rece deasupra, coloană caldă dedesubt, țevi la mijloc */
.etaj-unit--legacy {
    width: min(340px, 94vw);
}

.columns-container--legacy {
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 26px;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    min-height: 0;
    position: relative;
}

.columns-container--legacy .column {
    width: 100%;
    max-width: 300px;
    min-height: 300px;
    flex: 0 0 auto;
}

.columns-container--legacy .loop-pipes {
    position: absolute;
    left: 50%;
    top: 50%;
    width: min(300px, 100%);
    height: 140px;
    transform: translate(-50%, -50%);
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    justify-content: center;
    align-items: stretch;
    gap: 10px;
    z-index: 9;
}

.columns-container--legacy .pipe {
    position: relative;
    top: 0;
    left: auto;
    width: 20px;
    height: 100%;
    min-height: 0;
    flex: 0 0 20px;
}

.columns-container--legacy .pipe-top,
.columns-container--legacy .pipe-bottom {
    left: auto;
}

.columns-container--legacy .pipe-label {
    left: 50%;
    top: 50%;
    bottom: auto;
    transform: translate(-50%, -50%);
    width: 120px;
    font-size: 0.58rem;
    text-align: center;
}

.columns-container--legacy .pipe::before {
    background: repeating-linear-gradient(
        to bottom,
        rgba(255,255,255,0.0) 0px,
        rgba(255,255,255,0.0) 10px,
        rgba(255,255,255,0.5) 10px,
        rgba(255,255,255,0.5) 18px
    );
    animation: flowPipeY 1.2s linear infinite;
}

.columns-container--legacy .hot-col .column-label {
    top: auto;
    bottom: 10px;
}

.columns-container--legacy .hot-col .column-conc-label {
    top: auto;
    bottom: 46px;
}

.columns-container--legacy .flow-down {
    left: 20%;
    top: 20%;
    font-size: 1.5rem;
}

.columns-container--legacy .flow-up {
    right: 20%;
    bottom: 20%;
    font-size: 1.5rem;
}

.columns-with-liquid {
    position: relative;
    padding-top: 18px;
    padding-bottom: 18px;
}

.liquid-pipes-bridge {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 8;
    pointer-events: none;
}

/* Țevi mai scurte = mai departe de marginile vaselor; lichid/gaz vizibil prin „sticlă” */
.liquid-pipe {
    position: absolute;
    left: 26%;
    right: 26%;
    height: 12px;
    border-radius: 999px;
    border: 1.5px solid rgba(255, 255, 255, 0.42);
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.38) 0%, rgba(160, 220, 255, 0.22) 35%, rgba(40, 120, 190, 0.35) 100%);
    box-shadow:
        inset 0 2px 6px rgba(255, 255, 255, 0.45),
        inset 0 -3px 10px rgba(0, 60, 120, 0.35),
        0 0 14px rgba(100, 200, 255, 0.35);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.liquid-pipe::before {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: inherit;
    background: repeating-linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0px,
        rgba(255, 255, 255, 0) 8px,
        rgba(255, 255, 255, 0.22) 8px,
        rgba(255, 255, 255, 0.22) 11px
    );
    animation: liquidStream 1.25s linear infinite;
    opacity: 0.95;
}

.liquid-pipe::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background:
        radial-gradient(ellipse 5px 4px at 18% 50%, rgba(255, 255, 255, 0.95) 0%, transparent 65%),
        radial-gradient(ellipse 4px 3px at 48% 50%, rgba(220, 245, 255, 0.75) 0%, transparent 60%),
        radial-gradient(ellipse 5px 4px at 78% 50%, rgba(255, 255, 255, 0.85) 0%, transparent 65%);
    background-size: 140% 100%;
    animation: liquidBubbles 2.1s linear infinite;
    opacity: 0.9;
    pointer-events: none;
}

.liquid-pipe--gas {
    background:
        linear-gradient(180deg, rgba(255, 240, 220, 0.35) 0%, rgba(255, 160, 110, 0.22) 45%, rgba(200, 70, 40, 0.28) 100%);
    box-shadow:
        inset 0 2px 5px rgba(255, 230, 200, 0.35),
        inset 0 -3px 8px rgba(120, 40, 20, 0.35),
        0 0 12px rgba(255, 150, 90, 0.28);
}

.liquid-pipe--gas::before {
    background: repeating-linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0px,
        rgba(255, 255, 255, 0) 6px,
        rgba(255, 220, 180, 0.28) 6px,
        rgba(255, 220, 180, 0.28) 9px
    );
    animation: liquidStream 1.4s linear infinite reverse;
}

.liquid-pipe--gas::after {
    background:
        radial-gradient(ellipse 4px 3px at 22% 50%, rgba(255, 255, 255, 0.75) 0%, transparent 60%),
        radial-gradient(ellipse 3px 2px at 58% 45%, rgba(255, 200, 160, 0.55) 0%, transparent 55%),
        radial-gradient(ellipse 4px 3px at 82% 52%, rgba(255, 240, 220, 0.65) 0%, transparent 58%);
    animation: gasBubbles 1.8s linear infinite reverse;
}

.liquid-pipe-label {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.52rem;
    letter-spacing: 0.03em;
    color: rgba(255, 255, 255, 0.88);
    text-transform: uppercase;
    white-space: nowrap;
    text-shadow: 0 0 6px rgba(0, 0, 0, 0.75);
    z-index: 2;
    pointer-events: none;
}

.liquid-pipe-top .liquid-pipe-label {
    bottom: calc(100% + 6px);
    top: auto;
}

.liquid-pipe-bottom .liquid-pipe-label {
    top: calc(100% + 6px);
    bottom: auto;
}

.liquid-pipe-top {
    top: 8px;
}

.liquid-pipe-bottom {
    bottom: 8px;
}

@keyframes liquidStream {
    from { transform: translateX(-14px); }
    to { transform: translateX(14px); }
}

@keyframes liquidBubbles {
    from { transform: translateX(-8%); }
    to { transform: translateX(8%); }
}

@keyframes gasBubbles {
    from { transform: translateX(6%); }
    to { transform: translateX(-6%); }
}

.column {
    width: 118px;
    min-width: 96px;
    min-height: 220px;
    flex: 1 1 118px;
    max-width: 140px;
    border: 2px solid #555;
    border-radius: 12px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(to bottom, #222, #111);
    display: flex;
    flex-direction: column;
}

.column-label {
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-weight: bold;
    z-index: 10;
    padding: 5px 15px;
    border-radius: 20px;
    text-transform: uppercase;
    white-space: nowrap;
}

.column-conc-label {
    position: absolute;
    left: 50%;
    top: 48px;
    transform: translateX(-50%);
    z-index: 10;
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    color: rgba(255,255,255,0.85);
    background: rgba(0,0,0,0.28);
    border: 1px solid rgba(255,255,255,0.2);
    white-space: nowrap;
    animation: concFade 1.6s ease-in-out infinite;
}

.hot-col .column-conc-label {
    top: 48px;
}

.cold-col { border-color: var(--cold-blue); }
.cold-col .column-label { background: var(--cold-blue); }
.hot-col { border-color: var(--hot-red); }
.hot-col .column-label { background: var(--hot-red); }
.hot-col .column-label {
    top: 10px;
}

.simulation-area.moment-flash {
    animation: momentFlash 0.35s ease-out;
}

.simulation-area.moment-pulse {
    animation: momentPulse 0.6s ease-out;
}

.column.moment-glow-upgrade {
    box-shadow: 0 0 28px rgba(255, 214, 80, 0.42), inset 0 0 26px rgba(255, 214, 80, 0.18) !important;
}

body.gold-mode .column {
    box-shadow: 0 0 30px rgba(255, 215, 0, 0.55), inset 0 0 24px rgba(255, 215, 0, 0.2) !important;
    filter: saturate(1.18) brightness(1.08);
}

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

@keyframes momentFlash {
    0% { box-shadow: inset 0 0 0 rgba(255,255,255,0); }
    40% { box-shadow: inset 0 0 140px rgba(255,255,255,0.18); }
    100% { box-shadow: inset 0 0 0 rgba(255,255,255,0); }
}

@keyframes momentPulse {
    0% { transform: scale(1); }
    40% { transform: scale(1.01); }
    100% { transform: scale(1); }
}
.cold-col,
.hot-col {
    transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.column.lg-optimal {
    filter: saturate(1.08) brightness(1.04);
}

.cold-col.lg-optimal {
    box-shadow: 0 0 26px rgba(90, 255, 170, 0.42), inset 0 0 18px rgba(120, 255, 195, 0.12);
}

.hot-col.lg-optimal {
    box-shadow: 0 0 26px rgba(90, 255, 170, 0.35), inset 0 0 16px rgba(120, 255, 195, 0.1);
}

.column.lg-off {
    filter: saturate(0.62) brightness(0.78);
    opacity: 0.72;
}

.cold-col.lg-off {
    box-shadow: 0 0 14px rgba(255, 88, 88, 0.28), inset 0 0 16px rgba(255, 88, 88, 0.12);
}

.hot-col.lg-off {
    box-shadow: 0 0 14px rgba(255, 88, 88, 0.3), inset 0 0 14px rgba(255, 88, 88, 0.14);
}

.tray-stack {
    position: absolute;
    inset: 48px 14px 28px;
    display: flex;
    flex-direction: column;
    justify-content: space-evenly;
    z-index: 6;
    pointer-events: none;
}

.tray {
    height: 4px;
    border-radius: 3px;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.18);
    box-shadow: 0 0 6px rgba(255,255,255,0.12);
}

.hot-col .tray-stack {
    justify-content: space-evenly;
    inset: 48px 14px 28px;
}

.process-state {
    align-self: center;
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid rgba(255,255,255,0.2);
}

.process-optimal {
    color: #6effab;
    background: rgba(45, 214, 117, 0.16);
    box-shadow: 0 0 16px rgba(45, 214, 117, 0.28);
}

.process-idle {
    color: #ff8a8a;
    background: rgba(255, 82, 82, 0.15);
    box-shadow: 0 0 16px rgba(255, 82, 82, 0.24);
}

.column.crystallization {
    animation: crystalPulse 1.15s ease-in-out infinite;
}

.cold-col.crystallization canvas {
    opacity: 0.78;
    filter: saturate(0.72) contrast(0.9);
}

.cold-col.crystallization::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background:
        radial-gradient(circle at 15% 20%, rgba(245, 252, 255, 0.4) 0 2px, transparent 3px),
        radial-gradient(circle at 65% 35%, rgba(245, 252, 255, 0.35) 0 2px, transparent 3px),
        radial-gradient(circle at 35% 70%, rgba(245, 252, 255, 0.3) 0 2px, transparent 3px),
        repeating-linear-gradient(
            45deg,
            rgba(230, 246, 255, 0.08) 0px,
            rgba(230, 246, 255, 0.08) 2px,
            rgba(210, 235, 255, 0.03) 2px,
            rgba(210, 235, 255, 0.03) 4px
        ),
        linear-gradient(to bottom, rgba(228, 245, 255, 0.2), rgba(210, 236, 255, 0.08));
    animation: frostShift 2.4s linear infinite;
    z-index: 7;
}

@keyframes crystalPulse {
    0%, 100% { box-shadow: 0 0 8px rgba(220, 240, 255, 0.28); }
    50% { box-shadow: 0 0 22px rgba(230, 245, 255, 0.5); }
}

@keyframes frostShift {
    from { background-position: 0 0, 0 0, 0 0, 0 0; }
    to { background-position: 6px 10px, -8px 6px, 10px -6px, 0 0; }
}

canvas {
    width: 100%;
    height: 100%;
}

.controls-panel {
    background-color: var(--panel-bg);
    padding: 20px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    overflow-y: auto;
}

.panel-toggle-btn {
    display: none;
    position: absolute;
    right: 12px;
    top: 12px;
    border: 1px solid rgba(255,255,255,0.35);
    background: rgba(255,255,255,0.06);
    color: var(--text-light);
    border-radius: 8px;
    padding: 6px 10px;
    font-size: 0.85rem;
}

.panel-close-btn {
    display: none;
}

.panel-backdrop {
    display: none;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

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

.section-title {
    font-size: 0.85rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #dfe6e9;
    margin-top: 6px;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.12);
}

label {
    font-size: 0.9rem;
    color: #bdc3c7;
}

input[type="range"] {
    width: 100%;
    cursor: pointer;
}

.control-row input[type="range"] {
    flex: 1;
}

input[type="number"] {
    width: 78px;
    background: rgba(0,0,0,0.25);
    color: var(--text-light);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 5px;
    padding: 4px 6px;
    font-size: 0.85rem;
}

input[type="range"]:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

input[type="number"]:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

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

.stat-card {
    background: rgba(0,0,0,0.2);
    padding: 10px;
    border-radius: 5px;
    text-align: center;
}

.stat-value {
    display: block;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--accent);
}

.stat-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #95a5a6;
}

.stage-box {
    background: rgba(0,0,0,0.18);
    border-radius: 8px;
    padding: 12px;
}

.stage-value {
    display: block;
    margin-top: 4px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--heavy-gold);
}

.stage-hint {
    margin: 8px 0 0;
    font-size: 0.82rem;
    color: #d0d7de;
    line-height: 1.4;
}

.graph-container {
    height: 200px;
    background: #000;
    border: 1px solid #444;
    margin-top: 10px;
    position: relative;
}

.game-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 100;
    text-align: center;
    padding: 20px;
}

.success-summary {
    max-width: 720px;
    margin-top: 15px;
    padding: 16px;
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
    line-height: 1.5;
    text-align: left;
}

.success-summary p {
    margin: 0 0 10px;
}

.success-summary ul {
    margin: 10px 0 0;
    padding-left: 20px;
}

.success-summary li {
    margin-bottom: 6px;
}

.success-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.success-actions .btn {
    margin-top: 0;
}

a.btn {
    text-decoration: none;
    display: inline-block;
    text-align: center;
    line-height: normal;
}

.btn {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    margin-top: 15px;
}

.btn:hover {
    filter: brightness(1.1);
}

.secondary-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.35);
}

.hidden { display: none; }

.concentration-bar {
    position: absolute;
    right: 10px;
    top: 50px;
    bottom: 50px;
    width: 20px;
    background: #333;
    border-radius: 10px;
    overflow: hidden;
    display: flex;
    flex-direction: column-reverse;
}

.concentration-fill {
    width: 100%;
    background: var(--heavy-gold);
    transition: height 0.3s ease;
}

.flow-indicator {
    position: absolute;
    font-size: 1.5rem;
    color: rgba(255,255,255,0.55);
    text-shadow: 0 0 8px rgba(255,255,255,0.2);
    animation: flowPulse 1.2s ease-in-out infinite;
}

.flow-down { left: 12%; top: 22%; font-size: 1rem; }
.flow-up { right: 12%; bottom: 22%; font-size: 1rem; }

/* Etaj 2–3: țevi de legătură ORIZONTALE între coloane (intră vizual în ambele vase) */
.loop-pipes {
    position: relative;
    width: 92px;
    min-width: 88px;
    flex-shrink: 0;
    align-self: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: stretch;
    gap: 16px;
    margin-left: -18px;
    margin-right: -18px;
    padding: 0 6px;
    pointer-events: none;
    z-index: 12;
}

.pipe {
    position: relative;
    flex: 0 0 auto;
    height: 16px;
    width: 100%;
    min-height: 16px;
    margin: 0;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.35);
    background:
        linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.22) 50%, rgba(255,255,255,0) 100%);
    overflow: hidden;
}

.pipe::before {
    content: "";
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(
        to right,
        rgba(255,255,255,0.0) 0px,
        rgba(255,255,255,0.0) 10px,
        rgba(255,255,255,0.5) 10px,
        rgba(255,255,255,0.5) 18px
    );
    animation: flowPipeX 1.15s linear infinite;
}

.pipe-top {
    left: auto;
}

.pipe-bottom {
    left: auto;
}

.pipe-left::before {
    animation-direction: reverse;
}

.pipe-label {
    position: absolute;
    left: 50%;
    bottom: calc(100% + 4px);
    top: auto;
    transform: translateX(-50%);
    color: rgba(255,255,255,0.78);
    font-size: 0.42rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    white-space: nowrap;
    text-transform: uppercase;
    text-shadow: 0 0 8px rgba(0,0,0,0.55);
    width: 96px;
    text-align: center;
    line-height: 1.1;
}

@keyframes flowPipeX {
    from { transform: translateX(0); }
    to { transform: translateX(18px); }
}

@keyframes flowPipeY {
    from { transform: translateY(0); }
    to { transform: translateY(18px); }
}

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

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

    header p {
        font-size: 0.85rem;
        margin-right: 96px;
    }

    .panel-toggle-btn {
        display: inline-block;
        cursor: pointer;
    }

    main {
        grid-template-columns: 1fr;
        padding: 8px;
    }

    .simulation-area {
        min-height: 72vh;
        padding: 10px;
    }

    .etaje-row {
        flex-direction: column;
        align-items: center;
        overflow-x: visible;
    }

    .etaj-unit {
        width: min(96vw, 380px);
    }

    .columns-container {
        gap: 0;
        min-height: 200px;
    }

    .column {
        min-height: 200px;
        max-width: none;
    }

    .columns-container--legacy .column {
        min-height: 240px;
        max-width: min(300px, 92vw);
    }

    .column-label {
        font-size: 0.65rem;
        padding: 4px 8px;
        white-space: nowrap;
    }

    .flow-indicator {
        font-size: 1.15rem;
    }

    .controls-panel {
        position: fixed;
        inset: 0 0 0 auto;
        width: min(92vw, 370px);
        z-index: 250;
        border-radius: 0;
        transform: translateX(100%);
        transition: transform 0.25s ease;
        padding-top: 50px;
        padding-bottom: calc(72px + env(safe-area-inset-bottom));
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: pan-y;
    }

    .controls-panel.open {
        transform: translateX(0);
    }

    .panel-close-btn {
        display: inline-flex;
        position: absolute;
        top: 10px;
        right: 12px;
        width: 32px;
        height: 32px;
        align-items: center;
        justify-content: center;
        border: 1px solid rgba(255,255,255,0.35);
        border-radius: 50%;
        background: rgba(255,255,255,0.08);
        color: #fff;
        font-size: 1.2rem;
        line-height: 1;
        cursor: pointer;
    }

    .panel-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.45);
        z-index: 200;
        display: none;
    }

    .panel-backdrop.visible {
        display: block;
    }

    .controls-panel > *:last-child {
        margin-bottom: 22px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }
}
