@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&display=swap');

:root {
    --navy: #102c47;
    --navy2: #214d72;
    --blue: #2779ae;
    --cyan: #55badb;
    --ink: #1a3449;
    --muted: #62768a;
    --line: #d5e1eb;
    --glass: rgba(252, 254, 255, .91);
    --surface: #f4f8fc
}

* {
    box-sizing: border-box
}

html {
    scroll-behavior: smooth
}

body {
    margin: 0;
    font-family: 'DM Sans', 'Segoe UI', sans-serif;
    min-height: 100vh;
    color: var(--ink);
    background: #0c2134
}

.simulation-video {
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none
}

.simulation-video video {
    width: 100%;
    height: 100%;
    object-fit: cover
}

.simulation-video:after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(128deg, rgba(7, 25, 43, .83), rgba(18, 48, 72, .7))
}

.simulation-header {
    height: 74px;
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 0 max(4vw, 22px);
    background: rgba(250, 253, 255, .96);
    border-bottom: 1px solid #dce7f0;
    backdrop-filter: blur(16px)
}

.simulation-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--navy);
    text-decoration: none;
    font: 800 23px 'Manrope', sans-serif;
    height: 42px;
    overflow: hidden
}

.simulation-brand-icon {
    width: 39px;
    height: 39px;
    object-fit: contain;
    flex-shrink: 0
}

.simulation-brand-wordmark-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 26px;
    overflow: hidden
}

.simulation-brand-wordmark {
    display: block;
    width: 110px;
    max-width: 110px;
    height: auto;
    object-fit: contain;
    flex-shrink: 0
}

.research-tag {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .14em;
    color: #7790a4;
    margin-right: auto
}

.simulation-menu-button {
    display: flex;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 12px;
    width: 45px;
    height: 45px;
    padding: 12px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px
}

.simulation-menu-button span {
    display: block;
    width: 100%;
    height: 2px;
    background: #1e4468;
    border-radius: 4px
}

.simulation-links {
    position: absolute;
    right: max(5vw, 22px);
    top: 75px;
    min-width: 220px;
    display: grid;
    gap: 4px;
    padding: 12px;
    border-radius: 16px;
    background: rgba(242, 249, 255, .97);
    box-shadow: 0 18px 55px rgba(0, 19, 46, .24);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: .25s
}

.simulation-links.open {
    opacity: 1;
    visibility: visible;
    transform: none
}

.simulation-links a {
    padding: 10px 14px;
    border-radius: 9px;
    font-size: .92rem;
    font-weight: 600;
    color: #31536e;
    text-decoration: none
}

.simulation-links a:hover,
.simulation-links a:focus-visible {
    background: #deebf6
}

.simulation-layout {
    max-width: 1560px;
    width: calc(100% - 72px);
    margin: 0 auto 70px
}

@media(max-width:820px) {
    .research-tag {
        display: none
    }
}

.simulation-hero {
    color: white;
    padding: 48px 2px 34px
}

.simulation-eyebrow,
.panel-overline {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .15em;
    text-transform: uppercase
}

.simulation-eyebrow {
    color: #9cdcf7
}

.simulation-hero h1 {
    font: 800 clamp(31px, 3.5vw, 53px)/1.13 'Manrope', sans-serif;
    letter-spacing: -.045em;
    margin: 13px 0 13px
}

.simulation-hero p {
    color: #e1edf4;
    font-size: 15px;
    line-height: 1.75;
    margin: 0
}

.mode-switch {
    display: flex;
    flex-wrap: wrap;
    gap: 9px;
    margin-top: 23px
}

.mode-switch a {
    color: white;
    text-decoration: none;
    font-size: 13px;
    font-weight: 700;
    padding: 12px 18px;
    background: rgba(255, 255, 255, .11);
    border: 1px solid rgba(255, 255, 255, .3);
    border-radius: 9px
}

.mode-switch a.active {
    color: #164768;
    background: #fff;
    border-color: #fff
}

.simulation-shell {
    padding: 0;
    background: transparent;
    box-shadow: none
}

.simulation-shell .container {
    max-width: none;
    width: 100%
}

.simulation-shell #selectType {
    display: none !important
}

.workspace {
    display: grid;
    grid-template-columns: minmax(300px, 385px) minmax(0, 1fr);
    gap: 22px;
    align-items: start
}

.controls-panel,
.results-panel {
    min-width: 0;
    background: var(--glass);
    border: 1px solid rgba(255, 255, 255, .69);
    border-radius: 19px;
    box-shadow: 0 18px 50px rgba(0, 10, 25, .19);
    backdrop-filter: blur(18px)
}

.controls-panel {
    padding: 28px;
    position: relative
}

.results-panel {
    padding: 28px
}

.panel-overline {
    color: #2b83a9;
    margin-bottom: 9px
}

.controls-panel h2,
.results-heading h2 {
    font: 800 23px/1.25 'Manrope', sans-serif;
    color: var(--navy);
    letter-spacing: -.035em;
    margin: 0
}

.panel-intro {
    font-size: 13px;
    line-height: 1.65;
    color: var(--muted);
    margin: 12px 0 24px
}

.input-group {
    border-top: 1px solid var(--line);
    padding: 20px 0 14px
}

.input-group h3,
.result-card h3 {
    margin: 0;
    font: 800 14px 'Manrope', sans-serif;
    color: #234461
}

.group-caption {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.55;
    margin: 7px 0 15px
}

.field-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 12px
}

.field-grid .field:only-child,
.field-grid .field:has(select),
.field-grid .field:last-child:nth-child(odd) {
    grid-column: 1/-1
}

.field {
    min-width: 0
}

.field label {
    display: block;
    font-weight: 700;
    color: #405b73;
    font-size: 12px;
    line-height: 1.45;
    margin-bottom: 7px
}

.field input:not([type=range]):not([type=file]),
.field select {
    width: 100%;
    min-width: 0;
    min-height: 43px;
    display: block;
    background: #fff;
    color: #1d3953;
    font: 600 13px 'DM Sans', sans-serif;
    padding: 10px 11px;
    border: 1px solid #cadae8;
    border-radius: 9px;
    outline: none
}

.field input:focus,
.field select:focus {
    border-color: #2d84b2;
    box-shadow: 0 0 0 3px #2d84b21f
}

.field input[type=range] {
    width: 100%;
    accent-color: #257baa
}

.excitation-fields,
.history-fields {
    padding: 12px 15px 17px;
    margin: 0 0 16px;
    background: #edf6fb;
    border-radius: 11px;
    border: 1px solid #d6e9f3
}

.excitation-fields .field {
    margin-bottom: 11px
}

.history-fields {
    font-size: 12px;
    line-height: 1.8
}

.history-fields a {
    color: #1e6e9e;
    word-break: break-word;
    font-weight: 700
}

.history-fields input[type=file] {
    width: 100%;
    margin-top: 8px;
    font-size: 12px
}

.simulation-actions {
    border-top: 1px solid var(--line);
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding-top: 20px;
    margin-top: 5px
}

.simulation-actions button {
    width: 100% !important;
    height: auto !important;
    min-height: 44px;
    float: none !important;
    border: 1px solid #b9d2e3 !important;
    border-radius: 9px !important;
    background: #f2f8fd !important;
    color: #285777 !important;
    font: 800 12px 'DM Sans', sans-serif;
    padding: 11px 10px;
    cursor: pointer
}

.simulation-actions .action-primary {
    grid-column: 1/-1;
    background: #1d789e !important;
    color: white !important;
    border-color: #1d789e !important;
    font-size: 14px
}

.simulation-actions .action-export {
    background: #e7f3f9 !important
}

.simulation-actions button:hover:not(:disabled) {
    filter: brightness(.95)
}

.simulation-actions button:disabled {
    opacity: .45;
    cursor: not-allowed
}

.results-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 20px
}

.research-pill {
    font-size: 10px;
    font-weight: 800;
    color: #287ca4;
    letter-spacing: .06em;
    background: #e2f1f8;
    border-radius: 30px;
    padding: 9px 13px
}

.result-card,
.canvas-card {
    border: 1px solid #dbe7f0;
    background: rgba(255, 255, 255, .92);
    border-radius: 13px
}

.result-card {
    padding: 18px 19px
}

.result-card-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px
}

.detail-label {
    font-size: 11px;
    color: #7b8ea0
}

.chart-card #plot {
    width: 100% !important;
    min-height: 285px;
    height: 290px !important;
    max-width: 100%;
}

.result-helper {
    color: #637c90;
    background: #edf4fa;
    border-left: 3px solid #6fa7c8;
    border-radius: 7px;
    padding: 12px 14px;
    font-size: 12px;
    line-height: 1.6;
    margin: 16px 0 24px
}

.result-section-title {
    font: 800 17px 'Manrope', sans-serif;
    color: var(--navy);
    margin: 0 0 14px
}

.canvas-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px
}

.canvas-card {
    min-width: 0;
    overflow: hidden
}

.canvas-title {
    padding: 14px 16px 12px;
    border-bottom: 1px solid #e2ecf3;
    display: flex;
    flex-direction: column;
    gap: 4px
}

.canvas-title strong {
    font-size: 12px;
    color: #234663
}

.canvas-title small {
    font-size: 10px;
    color: #8395a3;
    letter-spacing: .04em
}

.canvas-viewport {
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 225px;
    background: linear-gradient(135deg, #fff, #f8fbfe);
    padding: 10px
}

.canvas-viewport canvas {
    display: block;
    max-width: 100%;
    height: auto;
    border: 0 !important
}

.simulation-footer {
    text-align: center;
    padding: 20px;
    color: #dbeaf4;
    font-size: 12px
}

.simulation-shell #inputblock {
    display: block
}

.simulation-shell input,
.simulation-shell select,
.simulation-shell button {
    font-family: inherit
}

@media(max-width:1150px) {
    .workspace {
        grid-template-columns: minmax(270px, 340px) minmax(0, 1fr)
    }

    .controls-panel,
    .results-panel {
        padding: 22px
    }

    .canvas-grid {
        grid-template-columns: 1fr
    }
}

@media(max-width:850px) {
    .workspace {
        grid-template-columns: 1fr
    }

    .controls-panel {
        position: static
    }

    .canvas-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr))
    }

    .simulation-layout {
        width: calc(100% - 34px)
    }

    .research-tag {
        display: none
    }

    .simulation-links {
        margin-left: auto
    }
}

@media(max-width:620px) {
    .simulation-header {
        height: 65px;
        padding: 0 16px
    }

    .simulation-brand {
        font-size: 20px
    }

    .simulation-menu-button {
        display: block;
        margin-left: auto
    }

    .simulation-links {
        display: none;
        position: absolute;
        top: 65px;
        left: 0;
        right: 0;
        flex-direction: column;
        background: #f8fcff;
        padding: 12px 18px;
        box-shadow: 0 15px 20px #0b233533
    }

    .simulation-links.open {
        display: flex
    }

    .simulation-layout {
        width: calc(100% - 22px);
        margin-bottom: 35px
    }

    .simulation-hero {
        padding: 25px 5px
    }

    .simulation-hero p {
        font-size: 13px
    }

    .controls-panel,
    .results-panel {
        padding: 17px;
        border-radius: 14px
    }

    .canvas-grid {
        grid-template-columns: 1fr
    }

    .results-heading {
        align-items: flex-start
    }

    .research-pill {
        display: none
    }

    .field-grid {
        grid-template-columns: 1fr 1fr
    }

    .simulation-actions {
        grid-template-columns: 1fr 1fr
    }
}

@media(prefers-reduced-motion:reduce) {
    html {
        scroll-behavior: auto
    }
}