@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;600;700;800;900&family=Outfit:wght@600;700;800;900&display=swap");

:root {
    --blue: #2563eb;
    --blue-2: #1d4ed8;
    --blue-soft: #eff6ff;
    --blue-glow: rgba(37, 99, 235, 0.14);
    --ink: #0f172a;
    --muted: #94a3b8;
    --muted-2: #64748b;
    --line: #e2e8f0;
    --soft: #f8fafc;
    --soft-2: #f1f5f9;
    --panel: #ffffff;
    --shadow: 0 24px 70px rgba(37, 99, 235, 0.10);
    --shadow-soft: 0 14px 36px rgba(37, 99, 235, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at 16% 4%, rgba(37, 99, 235, 0.08), transparent 28%),
        linear-gradient(180deg, #ffffff 0%, var(--soft) 46%, var(--soft-2) 100%);
    color: var(--ink);
    font-family: Inter, Arial, Helvetica, sans-serif;
}

a {
    color: inherit;
}

svg {
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
}

.topbar {
    align-items: center;
    background: rgba(255, 255, 255, 0.86);
    border-bottom: 1px solid rgba(226, 232, 240, 0.86);
    display: grid;
    gap: 28px;
    grid-template-columns: minmax(260px, auto) 1fr auto;
    min-height: 104px;
    padding: 22px clamp(18px, 4vw, 52px);
}

.brand {
    align-items: center;
    display: flex;
    gap: 18px;
    min-width: 0;
    text-decoration: none;
}

.brand-icon {
    align-items: center;
    background: var(--blue);
    border-radius: 22px;
    box-shadow: 0 22px 44px var(--blue-glow);
    color: #ffffff;
    display: grid;
    height: 58px;
    justify-items: center;
    width: 58px;
}

.brand-icon svg {
    height: 28px;
    width: 28px;
}

.brand strong {
    color: var(--ink);
    display: block;
    font-family: Outfit, Inter, sans-serif;
    font-size: clamp(1.55rem, 3vw, 2rem);
    font-style: italic;
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 0.95;
    text-transform: uppercase;
}

.brand strong span,
.viewer-empty strong span,
.setup-panel h1 span,
.upload-panel h1 span {
    color: var(--blue);
    font-style: normal;
}

.brand strong em {
    background: var(--blue-soft);
    border-radius: 10px;
    color: var(--blue);
    display: inline-block;
    font-size: 0.68rem;
    font-style: normal;
    font-weight: 900;
    letter-spacing: 0;
    margin-left: 10px;
    padding: 4px 8px;
    vertical-align: middle;
}

.brand small,
.system-status small,
.section-kicker {
    color: var(--muted);
    display: block;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.2em;
    line-height: 1.2;
    margin: 10px 0 0;
    text-transform: uppercase;
}

.system-status {
    align-items: center;
    color: var(--muted-2);
    display: flex;
    gap: 12px;
    justify-self: center;
    min-width: 0;
}

.system-status strong {
    color: var(--ink);
    display: block;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.16em;
}

.status-dot {
    background: #22c55e;
    border-radius: 999px;
    box-shadow: 0 0 0 7px rgba(34, 197, 94, 0.10);
    height: 9px;
    width: 9px;
}

.topbar nav {
    display: flex;
    gap: 12px;
}

.icon-link,
.small-button,
.button,
button {
    align-items: center;
    border-radius: 18px;
    display: inline-flex;
    gap: 10px;
    justify-content: center;
    text-decoration: none;
    transition: transform 300ms ease, box-shadow 300ms ease, color 300ms ease, background 300ms ease, border-color 300ms ease;
}

.icon-link {
    background: var(--blue-soft);
    color: var(--blue);
    height: 50px;
    width: 50px;
}

.icon-link svg,
.button svg,
.small-button svg,
button svg {
    height: 18px;
    width: 18px;
}

.icon-link:hover,
.small-button:hover,
.button.secondary:hover {
    background: #dbeafe;
    color: var(--blue-2);
    transform: translateY(-1px);
}

.viewer-shell {
    display: grid;
    gap: 24px;
    grid-template-columns: minmax(300px, 28%) minmax(0, 1fr);
    min-height: calc(100vh - 104px);
    padding: clamp(18px, 3vw, 34px);
}

.app-shell {
    display: grid;
    padding: clamp(20px, 5vw, 54px);
}

.upload-shell {
    grid-template-columns: minmax(320px, 760px);
    justify-content: center;
}

.panel,
.simulation-viewer,
.main-stage {
    animation: panel-in 420ms ease both;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(226, 232, 240, 0.94);
    border-radius: 32px;
    box-shadow: var(--shadow);
}

.panel {
    padding: clamp(22px, 3vw, 32px);
}

.simulation-menu,
.simulation-viewer {
    min-height: 0;
}

.menu-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.panel-heading {
    align-items: flex-start;
    display: flex;
    gap: 16px;
    justify-content: space-between;
}

.panel h2,
.panel-heading h2 {
    align-items: center;
    color: var(--ink);
    display: flex;
    font-family: Outfit, Inter, sans-serif;
    font-size: 1.35rem;
    font-style: italic;
    font-weight: 900;
    gap: 10px;
    letter-spacing: -0.02em;
    margin: 8px 0 0;
    text-transform: uppercase;
}

.panel h2 span,
.panel-heading h2 span {
    color: var(--blue);
    font-style: normal;
}

.compact-search {
    display: grid;
    gap: 12px;
    margin: 26px 0;
}

input,
select,
textarea,
button,
.button,
.small-button {
    font: inherit;
}

input,
select,
textarea {
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 18px;
    color: var(--ink);
    outline: none;
    padding: 17px 18px;
    transition: border-color 250ms ease, box-shadow 250ms ease, background 250ms ease;
    width: 100%;
}

input:focus,
select:focus,
textarea:focus {
    background: #ffffff;
    border-color: rgba(37, 99, 235, 0.55);
    box-shadow: 0 0 0 5px rgba(37, 99, 235, 0.08);
}

textarea {
    line-height: 1.45;
    resize: vertical;
}

label {
    color: var(--muted-2);
    display: grid;
    font-size: 11px;
    font-weight: 900;
    gap: 10px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.search-field {
    align-items: center;
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 18px;
    display: grid;
    gap: 10px;
    grid-template-columns: 20px 1fr;
    padding: 0 16px;
}

.search-field svg {
    color: var(--blue);
    height: 18px;
    width: 18px;
}

.search-field input {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding-inline: 0;
}

button,
.button {
    background: var(--blue);
    border: 1px solid var(--blue);
    box-shadow: 0 18px 36px rgba(37, 99, 235, 0.20);
    color: #ffffff;
    cursor: pointer;
    font-weight: 900;
    min-height: 58px;
    padding: 14px 20px;
}

button:hover,
.button:hover {
    background: var(--blue-2);
    transform: translateY(-1px);
}

.button {
    border-radius: 16px;
    font-size: 14px;
    min-height: auto;
}

.button.secondary,
.small-button {
    background: #ffffff;
    border: 1px solid var(--line);
    box-shadow: none;
    color: var(--blue);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.06em;
    padding: 11px 14px;
    text-transform: uppercase;
    white-space: nowrap;
}

.simulation-list {
    display: grid;
    gap: 12px;
    min-height: 0;
    overflow: auto;
    padding: 2px 4px 2px 0;
}

.simulation-item {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 24px;
    display: grid;
    gap: 14px;
    grid-template-columns: 52px minmax(0, 1fr);
    padding: 14px;
    text-decoration: none;
    transition: transform 300ms ease, box-shadow 300ms ease, border-color 300ms ease, background 300ms ease;
}

.simulation-item.active,
.simulation-item:hover {
    background: var(--blue-soft);
    border-color: rgba(37, 99, 235, 0.35);
    box-shadow: var(--shadow-soft);
    transform: translateY(-2px) scale(1.01);
}

.simulation-icon {
    align-items: center;
    background: var(--blue-soft);
    border-radius: 18px;
    color: var(--blue);
    display: grid;
    height: 52px;
    justify-items: center;
    width: 52px;
}

.simulation-icon svg {
    height: 22px;
    width: 22px;
}

.simulation-copy {
    min-width: 0;
}

.simulation-copy strong {
    color: var(--ink);
    display: block;
    font-size: 14px;
    font-weight: 900;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.simulation-copy small {
    color: var(--muted);
    display: block;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.16em;
    margin-top: 7px;
    overflow: hidden;
    text-overflow: ellipsis;
    text-transform: uppercase;
    white-space: nowrap;
}

.simulation-viewer {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
}

.viewer-toolbar {
    align-items: center;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 20px;
    justify-content: space-between;
    min-height: 122px;
    padding: 26px 30px;
}

.viewer-toolbar h1 {
    color: var(--ink);
    font-family: Outfit, Inter, sans-serif;
    font-size: clamp(1.55rem, 2.6vw, 2.3rem);
    font-style: italic;
    font-weight: 900;
    letter-spacing: -0.04em;
    line-height: 1;
    margin: 8px 0 10px;
}

.viewer-toolbar p:not(.section-kicker) {
    color: var(--muted-2);
    font-size: 14px;
    font-weight: 700;
    line-height: 1.45;
    margin: 0;
    max-width: 860px;
}

.viewer-actions {
    display: flex;
    flex-shrink: 0;
    gap: 10px;
}

.viewer-frame-wrap {
    background: #ffffff;
    min-height: 0;
}

.viewer-frame-wrap iframe {
    border: 0;
    display: block;
    height: 100%;
    width: 100%;
}

.viewer-empty {
    align-items: center;
    color: var(--muted-2);
    display: grid;
    gap: 14px;
    height: 100%;
    justify-items: center;
    padding: 44px;
    text-align: center;
}

.empty-icon {
    background: var(--blue-soft);
    border-radius: 32px;
    color: var(--blue);
    display: grid;
    height: 96px;
    place-items: center;
    width: 96px;
}

.empty-icon svg {
    height: 44px;
    width: 44px;
}

.viewer-empty strong {
    color: var(--ink);
    font-family: Outfit, Inter, sans-serif;
    font-size: clamp(2rem, 5vw, 4rem);
    font-style: italic;
    font-weight: 900;
    letter-spacing: -0.06em;
    text-transform: uppercase;
}

.upload-panel {
    display: grid;
    gap: 18px;
    padding: clamp(28px, 5vw, 50px);
}

.upload-panel h1 {
    color: var(--ink);
    font-family: Outfit, Inter, sans-serif;
    font-size: clamp(2.2rem, 6vw, 4.8rem);
    font-style: italic;
    font-weight: 900;
    letter-spacing: -0.06em;
    line-height: 0.95;
    margin: 0;
    text-transform: uppercase;
}

.upload-panel > p:not(.section-kicker) {
    color: var(--muted-2);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.5;
    margin: 0 0 10px;
}

.file-zone {
    align-items: center;
    background: var(--blue-soft);
    border: 2px dashed rgba(37, 99, 235, 0.24);
    border-radius: 28px;
    color: var(--blue);
    justify-items: center;
    min-height: 136px;
    padding: 22px;
    text-align: center;
}

.file-zone span {
    display: grid;
    place-items: center;
}

.file-zone svg {
    height: 34px;
    width: 34px;
}

.file-zone input {
    max-width: 420px;
}

.alert {
    border-radius: 18px;
    grid-column: 1 / -1;
    padding: 14px 18px;
}

.alert.success {
    background: #ecfdf5;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.alert.error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.empty {
    color: var(--muted-2);
    font-weight: 800;
    grid-column: 1 / -1;
    text-align: center;
}

.setup-panel {
    grid-column: 1 / -1;
    margin: 0 auto;
    max-width: 980px;
}

.setup-panel h1 {
    color: var(--ink);
    font-family: Outfit, Inter, sans-serif;
    font-size: clamp(2rem, 5vw, 4rem);
    font-style: italic;
    font-weight: 900;
    letter-spacing: -0.06em;
    line-height: 0.95;
    margin: 8px 0 12px;
    text-transform: uppercase;
}

.setup-panel p:not(.section-kicker) {
    color: var(--muted-2);
    font-size: 18px;
    font-weight: 700;
    line-height: 1.45;
    margin: 0 0 22px;
}

.setup-grid {
    display: grid;
    gap: 18px;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.setup-grid > div {
    background: var(--soft);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 20px;
}

.setup-grid strong {
    display: block;
    margin-bottom: 12px;
}

.setup-grid code {
    background: var(--blue-soft);
    border-radius: 10px;
    color: var(--blue-2);
    display: inline-block;
    font-size: 13px;
    line-height: 1.45;
    max-width: 100%;
    overflow-wrap: anywhere;
    padding: 5px 8px;
}

.setup-grid ul {
    color: var(--muted-2);
    line-height: 1.6;
    margin: 0;
    padding-left: 20px;
}

@keyframes panel-in {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.98);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 1100px) {
    .topbar,
    .viewer-shell {
        grid-template-columns: 1fr;
    }

    .system-status {
        justify-self: start;
    }

    .viewer-shell {
        min-height: 0;
    }

    .menu-panel {
        max-height: 460px;
    }

    .simulation-viewer {
        min-height: 680px;
    }
}

@media (max-width: 760px) {
    .topbar {
        padding: 18px;
    }

    .topbar nav {
        position: absolute;
        right: 18px;
        top: 22px;
    }

    .brand {
        padding-right: 120px;
    }

    .viewer-shell,
    .app-shell {
        gap: 18px;
        padding: 16px;
    }

    .panel,
    .simulation-viewer,
    .main-stage {
        border-radius: 24px;
    }

    .viewer-toolbar {
        align-items: stretch;
        flex-direction: column;
        padding: 22px;
    }

    .viewer-actions {
        width: 100%;
    }

    .viewer-actions .button {
        flex: 1;
    }

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

    .simulation-viewer {
        min-height: 560px;
    }

    .brand strong em {
        margin-left: 0;
        margin-top: 8px;
    }
}
