:root {
    --sim-bg: var(--color-dark, #1c1c1c);
    --sim-surface: #232527;
    --sim-surface-2: #1c1e20;
    --sim-surface-3: #292b2e;
    --sim-line: rgba(255, 255, 255, 0.1);
    --sim-line-strong: rgba(255, 255, 255, 0.2);
    --sim-text: #f2f2f2;
    --sim-muted: #9ca3aa;
    --sim-cyan: #2fc1d8;
    --sim-cyan-soft: rgba(47, 193, 216, 0.12);
    --sim-green: #46c987;
    --sim-amber: #e3a948;
    --sim-red: #e65b64;
    --sim-orange: var(--color-main, #ff6b00);
    --sim-shadow: 0 18px 45px rgba(0, 0, 0, 0.28);
}

.sim-eyebrow,
.panel-kicker,
.status-caption {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}
.sim-eyebrow { color: var(--sim-orange); }
.panel-kicker, .status-caption { color: var(--sim-cyan); }

/* Catalog */
.sim-catalog {
    min-height: 72vh;
    color: var(--sim-text);
    background:
        radial-gradient(circle at 18% 8%, rgba(255, 107, 0, 0.045), transparent 28rem),
        repeating-linear-gradient(90deg, transparent 0 79px, rgba(255,255,255,.015) 80px),
        repeating-linear-gradient(0deg, transparent 0 79px, rgba(255,255,255,.015) 80px),
        linear-gradient(180deg, #1c1c1c, #17191b);
}

.sim-catalog__intro {
    max-width: 760px;
}

.sim-catalog__intro h1 {
    margin: 0.35rem 0 0.8rem;
    font-size: clamp(2.3rem, 5vw, 4.2rem);
    font-weight: 800;
    letter-spacing: -0.045em;
}

.sim-catalog__intro p {
    color: #b8bdc2;
    font-size: 1.08rem;
    line-height: 1.75;
}

.lab-card {
    position: relative;
    overflow: hidden;
    padding: 1.6rem;
    border: 1px solid var(--sim-line);
    border-radius: 16px;
    background: linear-gradient(145deg, #242628, #191b1d);
    box-shadow: var(--sim-shadow);
}

.lab-card--available {
    border-color: rgba(255, 107, 0, 0.52);
}

.lab-card--available::after {
    position: absolute;
    top: -95px;
    right: -95px;
    width: 240px;
    height: 240px;
    border: 40px solid rgba(255, 107, 0, 0.055);
    border-radius: 50%;
    content: "";
}

.lab-card--soon {
    color: #a4a8ac;
    background: linear-gradient(145deg, #202224, #181a1c);
}

.lab-card__topline {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.lab-status,
.lab-card__code {
    color: var(--sim-muted);
    font-size: 0.67rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.lab-status {
    padding: 0.32rem 0.55rem;
    border: 1px solid var(--sim-line-strong);
    border-radius: 4px;
}

.lab-status--available {
    color: var(--sim-green);
    border-color: rgba(69, 211, 154, 0.42);
    background: rgba(69, 211, 154, 0.08);
}

.lab-card__icon {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    width: 76px;
    height: 64px;
    margin: 2rem 0 1rem;
    padding: 12px;
    border: 1px solid rgba(21, 184, 214, 0.36);
    border-radius: 10px;
    background: rgba(21, 184, 214, 0.08);
}

.lab-card__icon span {
    width: 12px;
    border-radius: 2px 2px 0 0;
    background: var(--sim-cyan);
}

.lab-card__icon span:nth-child(1) { height: 20px; }
.lab-card__icon span:nth-child(2) { height: 37px; }
.lab-card__icon span:nth-child(3) { height: 28px; }

.lab-card h2 {
    position: relative;
    z-index: 1;
    margin: 1.1rem 0 0.65rem;
    color: var(--sim-text);
    font-size: 1.55rem;
    font-weight: 800;
}

.lab-card p {
    position: relative;
    z-index: 1;
    color: var(--sim-muted);
    line-height: 1.65;
}

.lab-card__features {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin: 1.4rem 0;
    padding: 0;
    list-style: none;
}

.lab-card__features li {
    padding: 0.34rem 0.55rem;
    color: #c1c5c9;
    border: 1px solid var(--sim-line);
    border-radius: 4px;
    font-size: 0.72rem;
}

.sim-primary-btn {
    position: relative;
    z-index: 1;
    padding: 0.65rem 1rem;
    color: #17130f;
    border: 0;
    border-radius: 6px;
    background: var(--sim-orange);
    font-weight: 800;
}

.sim-primary-btn:hover {
    color: #130d08;
    background: #ff8738;
}

.lab-card--soon h2 { color: #d7d9db; }
.lab-card--soon p { color: #8f9498; }

/* Lab shell */
.simulator-app {
    min-height: calc(100vh - 76px);
    padding: 14px;
    color: var(--sim-text);
    background:
        radial-gradient(circle at 70% 0, rgba(21, 184, 214, 0.08), transparent 32%),
        linear-gradient(145deg, #071019, #09131d 60%, #050b11);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
}

.simulator-body {
    padding-top: 56px;
    background: var(--sim-bg);
}

.simulator-body > footer {
    margin-top: 0 !important;
}

.lab-toolbar {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) auto auto;
    align-items: center;
    gap: 1.2rem;
    max-width: 1600px;
    margin: 0 auto 12px;
    padding: 12px 16px;
    border: 1px solid var(--sim-line);
    border-radius: 12px;
    background: rgba(13, 24, 35, 0.96);
    box-shadow: var(--sim-shadow);
}

.lab-toolbar__identity,
.lab-title-row,
.lab-status-cluster,
.command-bar {
    display: flex;
    align-items: center;
}

.lab-toolbar__identity { gap: 0.85rem; }
.lab-title-row { gap: 0.8rem; }

.lab-back {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    color: var(--sim-muted);
    border: 1px solid var(--sim-line);
    border-radius: 7px;
    text-decoration: none;
}

.lab-back:hover { color: var(--sim-cyan); border-color: var(--sim-cyan); }

.lab-title-row h1 {
    margin: 0.1rem 0 0;
    font-size: 1.38rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.model-badge {
    padding: 0.22rem 0.48rem;
    color: var(--sim-amber);
    border: 1px solid rgba(255, 181, 71, 0.35);
    border-radius: 4px;
    background: rgba(255, 181, 71, 0.07);
    font-size: 0.65rem;
    font-weight: 700;
}

.lab-status-cluster {
    gap: 0.65rem;
    min-width: 128px;
}

.status-led {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(69, 211, 154, 0.25);
    border-radius: 50%;
    background: var(--sim-green);
    box-shadow: 0 0 14px rgba(69, 211, 154, 0.7);
}

.status-led.is-running { background: var(--sim-cyan); box-shadow: 0 0 14px rgba(21,184,214,.8); }
.status-led.is-stopping,
.status-led.is-reversing { background: var(--sim-amber); box-shadow: 0 0 14px rgba(255,181,71,.8); }
.status-led.is-fault { background: var(--sim-red); box-shadow: 0 0 14px rgba(255,93,108,.85); }

.lab-status-cluster div { display: grid; }
.lab-status-cluster strong { font-size: 0.82rem; letter-spacing: 0.08em; }

.command-bar { gap: 0.4rem; }

.command-btn,
.icon-action {
    min-height: 34px;
    padding: 0.42rem 0.65rem;
    color: #c1d0dc;
    border: 1px solid var(--sim-line-strong);
    border-radius: 6px;
    background: #111e29;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.command-btn:hover,
.command-btn:focus-visible,
.icon-action:hover,
.icon-action:focus-visible {
    color: #fff;
    border-color: var(--sim-cyan);
    outline: none;
}

.command-btn--run { color: var(--sim-green); border-color: rgba(69,211,154,.38); }
.command-btn--stop { color: var(--sim-red); border-color: rgba(255,93,108,.35); }
.direction-btn.is-active { color: #061117; background: var(--sim-cyan); border-color: var(--sim-cyan); }
.command-separator { width: 1px; height: 25px; margin: 0 0.18rem; background: var(--sim-line-strong); }

.lab-message {
    max-width: 1600px;
    margin: 0 auto 12px;
    padding: 0.7rem 0.9rem;
    color: #cbeaf0;
    border: 1px solid rgba(21,184,214,.35);
    border-radius: 8px;
    background: rgba(21,184,214,.1);
    font-size: 0.82rem;
}

.lab-message.is-error { color: #ffd6da; border-color: rgba(255,93,108,.4); background: rgba(255,93,108,.1); }

.lab-workspace {
    display: grid;
    grid-template-columns: 270px minmax(560px, 1fr) 340px;
    gap: 12px;
    max-width: 1600px;
    margin: 0 auto;
}

.industrial-panel {
    border: 1px solid var(--sim-line);
    border-radius: 10px;
    background: linear-gradient(145deg, rgba(18, 31, 43, 0.98), rgba(10, 20, 29, 0.98));
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid var(--sim-line);
}

.panel-heading--compact { margin-bottom: 0.75rem; padding-bottom: 0.65rem; }

.panel-heading h2,
.educational-note h2 {
    margin: 0.12rem 0 0;
    color: var(--sim-text);
    font-size: 0.95rem;
    font-weight: 750;
}

.icon-action { min-width: 34px; padding: 0.3rem; font-size: 1rem; }

/* Parameters */
.parameter-panel {
    padding: 14px;
}

.parameter-control {
    margin-bottom: 0.7rem;
    padding: 0.62rem;
    border: 1px solid transparent;
    border-radius: 7px;
    background: rgba(255,255,255,.018);
}

.parameter-control--highlight {
    border-color: rgba(21,184,214,.25);
    background: rgba(21,184,214,.055);
}

.parameter-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.38rem;
}

.parameter-label label { color: #d2dde5; font-size: 0.72rem; font-weight: 700; }
.parameter-label span { color: var(--sim-muted); font-size: 0.62rem; font-weight: 700; }

.industrial-input {
    width: 100%;
    height: 36px;
    padding: 0.35rem 0.55rem;
    color: #e7fbff;
    border: 1px solid var(--sim-line-strong);
    border-radius: 5px;
    outline: none;
    background: #07121b;
    font-family: "Cascadia Mono", Consolas, monospace;
    font-size: 0.88rem;
    font-weight: 700;
}

.industrial-input:focus { border-color: var(--sim-cyan); box-shadow: 0 0 0 3px rgba(21,184,214,.1); }
.industrial-input.is-invalid { border-color: var(--sim-red); }

.reference-readout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem;
    margin-top: 0.48rem;
}

.reference-readout span {
    display: grid;
    color: var(--sim-muted);
    font-size: 0.58rem;
    text-transform: uppercase;
}

.reference-readout strong { color: var(--sim-text); font-family: Consolas, monospace; font-size: 0.7rem; }
.reference-readout span:last-child strong { color: var(--sim-cyan); }

.parameter-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; }
.validation-message { margin: 0.4rem 0; padding: 0.55rem; color: #ffd2d7; border-radius: 5px; background: rgba(255,93,108,.1); font-size: 0.7rem; }

.load-control {
    margin-top: 0.8rem;
    padding: 0.8rem 0.65rem;
    border-top: 1px solid var(--sim-line);
    border-bottom: 1px solid var(--sim-line);
}

.industrial-range { width: 100%; accent-color: var(--sim-cyan); }
.range-scale { display: flex; justify-content: space-between; color: #667b8c; font-size: 0.56rem; }

.preset-details { margin-top: 0.8rem; }
.preset-details summary,
.dev-panel summary,
.lab-legal summary { color: #b4c5d1; cursor: pointer; font-size: 0.72rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.preset-details dl { margin: 0.65rem 0 0; }
.preset-details dl div,
.dev-panel dl div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.24rem 0; border-bottom: 1px dotted rgba(150,178,201,.12); font-size: 0.66rem; }
.preset-details dt,
.dev-panel dt { color: var(--sim-muted); font-weight: 500; }
.preset-details dd,
.dev-panel dd { margin: 0; color: #d7e2e9; font-family: Consolas, monospace; }

.scenario-btn {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.55rem;
    width: 100%;
    margin-top: 0.9rem;
    padding: 0.65rem;
    color: #d2dce4;
    border: 1px solid rgba(255,181,71,.28);
    border-radius: 6px;
    background: rgba(255,181,71,.055);
    font-size: 0.66rem;
    text-align: left;
}

.scenario-btn span { padding: .2rem .32rem; color: #151006; border-radius: 3px; background: var(--sim-amber); font-weight: 900; }

/* Drive and motor */
.lab-center-column,
.lab-right-column { display: grid; align-content: start; gap: 12px; }
.drive-motor-grid { display: grid; grid-template-columns: .78fr 1.22fr; gap: 12px; }
.drive-panel,
.motor-panel { min-height: 285px; padding: 14px; }
.drive-profile-code { color: var(--sim-muted); font-family: Consolas, monospace; font-size: .58rem; }

.drive-face {
    position: relative;
    min-height: 205px;
    padding: 14px 44px 12px 14px;
    border: 1px solid #526372;
    border-radius: 8px 18px 12px 8px;
    background: linear-gradient(135deg, #313f4c, #18242f 58%, #0c151d);
    box-shadow: inset 0 0 0 3px rgba(255,255,255,.025), 9px 10px 20px rgba(0,0,0,.35);
}

.drive-display {
    padding: 12px;
    border: 3px solid #061015;
    border-radius: 5px;
    background: #06191b;
    box-shadow: inset 0 0 20px rgba(21,184,214,.08), 0 0 0 1px #4e6370;
    color: #69f1e5;
    font-family: "Cascadia Mono", Consolas, monospace;
    text-shadow: 0 0 10px rgba(105,241,229,.35);
}

.drive-display__top,
.drive-display__bottom { display: flex; justify-content: space-between; gap: .5rem; font-size: .64rem; font-weight: 800; }
.drive-display > strong { display: block; margin: .35rem 0; font-size: clamp(2.2rem, 4vw, 3.6rem); line-height: 1; letter-spacing: -.06em; }
.drive-display > strong small { margin-left: .3rem; font-size: .8rem; letter-spacing: 0; }
.drive-display__bottom { color: #6fb6b0; font-size: .56rem; }

.drive-fins { position: absolute; top: 28px; right: 10px; display: grid; gap: 6px; }
.drive-fins i { display: block; width: 21px; height: 7px; border-radius: 2px; background: #0a1117; box-shadow: inset 0 1px rgba(255,255,255,.08); }

.drive-path { margin-top: 12px; color: #718796; font-size: .55rem; font-weight: 800; letter-spacing: .06em; text-align: center; }
.drive-path span { color: #536774; }
.drive-path.is-active { color: var(--sim-amber); }

.motor-stage { position: relative; min-height: 210px; display: grid; place-items: center; overflow: hidden; }
.motor-stage::before { position: absolute; inset: 12% 8%; border: 1px solid rgba(21,184,214,.08); border-radius: 50%; content: ""; }
.motor-svg { width: 100%; max-height: 205px; filter: drop-shadow(0 13px 13px rgba(0,0,0,.3)); }
#motor-rotor { will-change: transform; }
#rotation-arrow-group {
    transition: opacity .2s;
}
.motor-svg.is-stopped #rotation-arrow-group { opacity: .18; }

.motor-speed-readout { position: absolute; right: 7px; bottom: 4px; display: grid; text-align: right; }
.motor-speed-readout strong { color: #e8f8fb; font-family: Consolas, monospace; font-size: 1.2rem; }
.motor-speed-readout span { color: var(--sim-muted); font-size: .55rem; letter-spacing: .14em; }
.direction-badge { padding: .28rem .42rem; color: var(--sim-muted); border: 1px solid var(--sim-line); border-radius: 4px; font: 700 .62rem Consolas, monospace; }

/* Instrumentation */
.instrument-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

.instrument-card,
.industrial-bar-card { min-height: 105px; padding: 12px; }
.instrument-card { display: grid; align-content: space-between; }
.instrument-label,
.bar-card-heading span { color: var(--sim-muted); font-size: .58rem; font-weight: 800; letter-spacing: .11em; }
.instrument-card > strong { color: #ecf6fa; font: 700 1.3rem Consolas, monospace; }
.instrument-card > strong small { color: var(--sim-muted); font-size: .58rem; }
.instrument-sub { color: #748a9a; font-size: .57rem; }
.instrument-sub b { color: #b6c9d5; }

.bar-card-heading { display: flex; align-items: center; justify-content: space-between; gap: .4rem; }
.bar-card-heading strong { color: #dceaf1; font: 700 .7rem Consolas, monospace; }
.industrial-bar { position: relative; height: 14px; margin: 1.15rem 0 .5rem; overflow: visible; border: 1px solid #354958; border-radius: 2px; background: #061019; }
.industrial-bar > span { display: block; width: 0; height: 100%; background: linear-gradient(90deg, #0c7891, var(--sim-cyan)); transition: width .08s linear; }
.industrial-bar--torque > span { background: linear-gradient(90deg, #9d5d11, var(--sim-amber)); }
.nominal-marker { position: absolute; top: -4px; left: 66.66%; width: 2px; height: 20px; background: rgba(255,255,255,.65); }
.bar-percent { color: var(--sim-muted); font-size: .58rem; }

.fault-panel {
    display: grid;
    grid-template-columns: 54px 1fr;
    align-items: center;
    gap: 1rem;
    padding: 13px;
    color: #ffe6e8;
    border: 1px solid rgba(255,93,108,.48);
    border-radius: 9px;
    background: linear-gradient(90deg, rgba(111,22,34,.58), rgba(47,16,24,.48));
}

.fault-panel[hidden] { display: none; }
.fault-panel__signal { display: grid; width: 48px; height: 48px; place-items: center; color: #1c0508; border-radius: 50%; background: var(--sim-red); font-size: 1.7rem; font-weight: 900; }
.fault-panel span { color: var(--sim-red); font-size: .65rem; font-weight: 900; letter-spacing: .12em; }
.fault-panel h2 { margin: .15rem 0; color: #fff; font-size: 1rem; }
.fault-panel p { margin: 0; color: #dcb6ba; font-size: .65rem; }

/* Trends and right column */
.trend-panel,
.educational-note,
.dev-panel { padding: 14px; }
.trend-legend { display: flex; flex-wrap: wrap; gap: .6rem; margin-bottom: .6rem; }
.trend-legend label { display: flex; align-items: center; gap: .25rem; color: #91a7b7; cursor: pointer; font-size: .58rem; }
.trend-legend input { width: 12px; height: 12px; accent-color: var(--sim-cyan); }
.trend-legend i { width: 12px; height: 2px; }
.signal-ref { background: #ffb547; }
.signal-output { background: #15b8d6; }
.signal-rpm { background: #78df9f; }

.trend-canvas-wrap { position: relative; height: 250px; border: 1px solid var(--sim-line); border-radius: 5px; background: #061019; }
#trend-canvas { width: 100%; height: 100%; }
.axis-label { position: absolute; top: 6px; color: #617887; font-size: .52rem; }
.axis-label--left { left: 7px; }
.axis-label--right { right: 7px; }
.trend-footer { display: flex; justify-content: space-between; gap: .4rem; margin-top: .4rem; color: #617887; font-size: .52rem; }
.trend-footer b { color: #9eb0bd; }

.educational-note { border-left: 3px solid var(--sim-cyan); }
.educational-note p { margin: .5rem 0 0; color: var(--sim-muted); font-size: .72rem; line-height: 1.55; }
.dev-panel { border-style: dashed; }
.dev-panel dl { margin: .65rem 0 0; }

.lab-legal {
    max-width: 1600px;
    margin: 12px auto 0;
    padding: 10px 14px;
    color: var(--sim-muted);
    border: 1px solid var(--sim-line);
    border-radius: 8px;
    background: rgba(10,20,29,.75);
}
.lab-legal p { max-width: 1200px; margin: .75rem 0 .2rem; font-size: .65rem; line-height: 1.6; }

.model-modal { color: var(--sim-text); border: 1px solid var(--sim-line-strong); background: #101b25; }
.model-modal .modal-header { border-color: var(--sim-line); }
.model-modal .modal-body { color: #a8bac7; line-height: 1.65; }

@media (max-width: 1279.98px) {
    .lab-toolbar { grid-template-columns: 1fr auto; }
    .lab-status-cluster { justify-self: end; }
    .command-bar { grid-column: 1 / -1; justify-content: flex-end; border-top: 1px solid var(--sim-line); padding-top: .65rem; }
    .lab-workspace { grid-template-columns: 250px minmax(0, 1fr); }
    .lab-right-column { grid-column: 1 / -1; grid-template-columns: 2fr 1fr; }
    .dev-panel { grid-column: 1 / -1; }
    .trend-canvas-wrap { height: 220px; }
}

@media (max-width: 991.98px) {
    .lab-workspace { grid-template-columns: 230px minmax(0, 1fr); }
    .drive-motor-grid { grid-template-columns: 1fr; }
    .drive-panel,
    .motor-panel { min-height: 255px; }
    .instrument-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .instrument-card--load { grid-column: 1 / -1; }
}

@media (max-width: 767.98px) {
    .simulator-app { padding: 8px; }
    .lab-toolbar { grid-template-columns: 1fr; align-items: stretch; }
    .lab-status-cluster { justify-self: start; }
    .command-bar { grid-column: auto; justify-content: flex-start; overflow-x: auto; }
    .command-btn { flex: 0 0 auto; }
    .lab-workspace { grid-template-columns: 1fr; }
    .parameter-panel { order: 2; }
    .lab-center-column { order: 1; }
    .lab-right-column { order: 3; grid-column: auto; grid-template-columns: 1fr; }
    .trend-panel { order: 1; }
    .drive-motor-grid { grid-template-columns: 1fr; }
    .drive-display > strong { font-size: 3.2rem; }
    .instrument-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .trend-canvas-wrap { height: 210px; }
}

@media (max-width: 479.98px) {
    .lab-title-row { align-items: flex-start; flex-direction: column; gap: .35rem; }
    .lab-toolbar__identity { align-items: flex-start; }
    .command-separator { display: none; }
    .parameter-grid { grid-template-columns: 1fr; }
    .drive-face { padding-right: 38px; }
    .instrument-grid { grid-template-columns: 1fr; }
    .instrument-card--load { grid-column: auto; }
    .fault-panel { grid-template-columns: 40px 1fr; }
    .fault-panel__signal { width: 38px; height: 38px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
