:root {
    color-scheme: light;
    --ink: #172033;
    --muted: #667085;
    --quiet: #eef2f7;
    --line: #d8dee8;
    --panel: #ffffff;
    --canvas: #f6f8fb;
    --blue: #2563eb;
    --teal: #0f766e;
    --red: #dc2626;
    --green: #16a34a;
    --amber: #d97706;
    --shadow: 0 18px 45px rgba(18, 26, 43, 0.12);
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    background:
        linear-gradient(135deg, rgba(37, 99, 235, 0.10), transparent 34%),
        linear-gradient(315deg, rgba(15, 118, 110, 0.12), transparent 36%),
        var(--canvas);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
select,
textarea,
input {
    font: inherit;
}

button,
select {
    border: 1px solid var(--line);
    background: var(--panel);
    color: var(--ink);
    min-height: 38px;
    border-radius: 8px;
}

button {
    padding: 0 14px;
    cursor: pointer;
}

button:hover,
select:hover {
    border-color: #aeb8c8;
}

button:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid rgba(37, 99, 235, 0.22);
    outline-offset: 2px;
}

.app-shell {
    min-height: 100%;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 16px;
    padding: 18px;
}

.topbar,
.diagnostics-bar,
.pane {
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(216, 222, 232, 0.92);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px;
    border-radius: 8px;
}

.brand {
    display: flex;
    align-items: center;
    min-width: 230px;
    gap: 12px;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--blue), var(--teal));
    color: #fff;
    font-weight: 800;
    font-size: 21px;
}

.brand h1 {
    margin: 0;
    font-size: 18px;
    line-height: 1.2;
}

.brand p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.sample-picker {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
}

.sample-picker select {
    padding: 0 34px 0 12px;
}

.workspace {
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
    gap: 16px;
}

.pane {
    min-height: 0;
    display: grid;
    grid-template-rows: auto 1fr;
    overflow: hidden;
    border-radius: 8px;
}

.pane-header {
    min-height: 46px;
    padding: 0 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
    font-size: 13px;
    color: var(--muted);
}

.pane-header span:first-child {
    color: var(--ink);
    font-weight: 700;
}

.editor-frame {
    min-height: 0;
    display: grid;
    grid-template-columns: 54px 1fr;
    background: #101827;
}

.line-numbers {
    margin: 0;
    padding: 16px 10px 16px 0;
    list-style: none;
    color: #687386;
    background: #0c1320;
    border-right: 1px solid #1f2937;
    text-align: right;
    font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    overflow: hidden;
    user-select: none;
}

.line-numbers li {
    height: 20.15px;
}

#codeEditor {
    min-width: 0;
    width: 100%;
    height: 100%;
    min-height: 520px;
    resize: none;
    border: 0;
    padding: 16px 18px;
    color: #f8fafc;
    background: transparent;
    caret-color: #93c5fd;
    font: 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    tab-size: 4;
}

.preview-surface {
    min-height: 0;
    padding: 24px;
    display: grid;
    place-items: center;
    overflow: auto;
    background:
        linear-gradient(90deg, rgba(23, 32, 51, 0.045) 1px, transparent 1px),
        linear-gradient(rgba(23, 32, 51, 0.045) 1px, transparent 1px),
        #fbfcff;
    background-size: 22px 22px;
}

.device-preview {
    width: min(100%, 560px);
    min-height: 420px;
    padding: 28px;
    border: 1px solid #e3e8f0;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 22px 60px rgba(15, 23, 42, 0.16);
}

.diagnostics-bar {
    min-height: 46px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 13px;
}

.diagnostics-bar > div {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dot {
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--green);
}

.dot.warning {
    background: var(--amber);
}

.dot.error {
    background: var(--red);
}

#diagnosticSummary {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.swift-root,
.sou-vstack,
.sou-hstack,
.sou-zstack,
.sou-list,
.sou-form,
.sou-section,
.sou-scroll {
    min-width: 0;
}

.swift-root {
    color: #111827;
}

.sou-vstack,
.sou-section,
.sou-form,
.sou-list {
    display: flex;
    flex-direction: column;
}

.sou-hstack {
    display: flex;
    align-items: center;
}

.sou-zstack {
    display: grid;
    place-items: center;
}

.sou-zstack > * {
    grid-area: 1 / 1;
}

.sou-scroll {
    max-height: 380px;
    overflow: auto;
}

.sou-form,
.sou-list {
    width: 100%;
    gap: 10px;
}

.sou-list > * {
    padding: 12px 0;
    border-bottom: 1px solid #e5e7eb;
}

.sou-list > *:last-child {
    border-bottom: 0;
}

.sou-section {
    width: 100%;
    gap: 10px;
}

.sou-section-title {
    color: #6b7280;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.sou-text {
    overflow-wrap: anywhere;
}

.sou-button {
    width: fit-content;
    border: 1px solid #cbd5e1;
    background: #f8fafc;
    color: #0f172a;
    font-weight: 700;
}

.sou-button.prominent {
    border-color: transparent;
    background: var(--blue);
    color: #fff;
}

.sou-input,
.sou-textarea,
.sou-select {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #fff;
    color: #111827;
}

.sou-input,
.sou-select {
    height: 40px;
    padding: 0 12px;
}

.sou-textarea {
    min-height: 110px;
    padding: 10px 12px;
    resize: vertical;
}

.sou-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
}

.sou-slider {
    width: 100%;
}

.sou-progress {
    width: 100%;
}

.sou-symbol {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, var(--blue), var(--teal));
    font-weight: 800;
}

.sou-color {
    width: 100%;
    min-height: 96px;
    border: 1px solid rgba(15, 23, 42, 0.08);
}

.sou-shape {
    width: 120px;
    height: 90px;
    background: var(--blue);
}

.sou-shape.circle {
    width: 104px;
    height: 104px;
    border-radius: 50%;
}

.sou-shape.capsule {
    width: 150px;
    height: 58px;
    border-radius: 999px;
}

.sou-shape.ellipse {
    width: 150px;
    height: 92px;
    border-radius: 50%;
}

.sou-spacer {
    min-width: 16px;
    min-height: 16px;
    flex: 1 1 auto;
}

.sou-divider {
    width: 100%;
    height: 1px;
    border: 0;
    background: #e5e7eb;
}

.sou-unsupported {
    width: 100%;
    padding: 12px;
    border: 1px dashed #f59e0b;
    border-radius: 8px;
    background: #fffbeb;
    color: #92400e;
    font-size: 13px;
}

.font-largeTitle {
    font-size: 34px;
    line-height: 1.08;
    font-weight: 800;
}

.font-title {
    font-size: 26px;
    line-height: 1.15;
    font-weight: 760;
}

.font-title2 {
    font-size: 22px;
    line-height: 1.2;
    font-weight: 720;
}

.font-title3 {
    font-size: 20px;
    line-height: 1.25;
    font-weight: 700;
}

.font-headline {
    font-size: 17px;
    font-weight: 730;
}

.font-subheadline {
    font-size: 15px;
    color: #475467;
}

.font-caption {
    font-size: 12px;
    color: #667085;
}

@media (max-width: 860px) {
    .app-shell {
        padding: 10px;
        gap: 10px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .toolbar {
        width: 100%;
        justify-content: flex-start;
    }

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

    #codeEditor {
        min-height: 360px;
    }

    .preview-surface {
        padding: 14px;
    }

    .device-preview {
        min-height: 340px;
        padding: 20px;
    }
}

