:root {
    color-scheme: light;
    --bg: #fbf4e7;
    --panel: #fffaf0;
    --panel-border: #d9cfbd;
    --ink: #17201d;
    --muted: #4d5953;
    --accent: #6d1d17;
    --accent-strong: #43130f;
    --surface: #fffdf8;
    --sky: #bdf3ed;
    --grass: #7fb981;
    --layer-one: #8bc79a;
    --layer-two: #6fac70;
    --layer-three: #9b7a61;
    --shadow: 0 18px 45px rgba(55, 45, 30, 0.12);
    --radius: 8px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(180deg, rgba(109, 29, 23, 0.08), rgba(251, 244, 231, 0) 340px), var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    letter-spacing: 0;
}

button,
input {
    font: inherit;
}

.app-shell {
    width: min(860px, 100%);
    margin: 0 auto;
    padding: 18px;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.app-hero {
    background: linear-gradient(135deg, rgba(109, 29, 23, 0.10), rgba(109, 29, 23, 0) 48%), var(--surface);
    border: 1px solid var(--panel-border);
    border-top: 6px solid var(--accent);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: clamp(1rem, 2.5vw, 1.45rem) clamp(1rem, 3vw, 1.65rem);
}

.eyebrow {
    margin: 0 0 .55rem;
    color: var(--accent-strong);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    justify-content: center;
}

.plot-panel,
.control-section {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.plot-panel {
    overflow: hidden;
    width: 100%;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-height: 46px;
    padding: 12px 14px 10px;
    border-bottom: 1px solid var(--panel-border);
}

h1,
h2 {
    margin: 0;
    font-weight: 700;
    letter-spacing: 0;
}

h1 {
    font-size: clamp(1.55rem, 3vw, 2.25rem);
    line-height: 1.06;
}

h2 {
    font-size: 1rem;
}

canvas {
    display: block;
    max-width: 100%;
}

#sounding-canvas {
    width: 100%;
    aspect-ratio: 1;
    background: var(--surface);
}

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

.control-section {
    padding: 14px;
}

.control-section h2 {
    margin-bottom: 10px;
}

#model-canvas,
#survey-canvas {
    width: 100%;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    background: var(--surface);
    margin-bottom: 12px;
}

#model-canvas {
    aspect-ratio: 6 / 7;
    max-width: 360px;
    margin-left: auto;
    margin-right: auto;
}

#survey-canvas {
    aspect-ratio: 50 / 19;
}

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

label {
    display: grid;
    gap: 5px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 700;
}

label span {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

output {
    color: var(--accent-strong);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

input[type="range"] {
    width: 100%;
    accent-color: var(--accent);
}

.segmented {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin: 0 0 12px;
    padding: 0;
    border: 0;
}

.segmented legend {
    grid-column: 1 / -1;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 0.88rem;
}

.segmented label {
    position: relative;
    display: block;
}

.segmented input {
    position: absolute;
    opacity: 0;
}

.segmented span {
    display: grid;
    min-height: 34px;
    place-items: center;
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    color: var(--ink);
    background: var(--surface);
}

.segmented input:checked + span {
    border-color: var(--accent);
    background: rgba(109, 29, 23, 0.08);
    color: var(--accent-strong);
    font-weight: 700;
}

.button {
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    color: #fff;
    background: var(--accent);
    box-shadow: 0 7px 20px rgba(24, 37, 33, .08);
    font: inherit;
    font-size: .9rem;
    font-weight: 850;
    cursor: pointer;
}

.button:hover,
.button:focus-visible {
    background: var(--accent-strong);
}

@media (max-width: 760px) {
    .app-shell {
        padding: 14px;
    }

    .app-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

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

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

@media print {
    @page {
        margin: 0.45in;
    }

    *,
    *::before,
    *::after {
        box-shadow: none !important;
        text-shadow: none !important;
    }

    body {
        background: #fff;
        color: #000;
        print-color-adjust: exact;
        -webkit-print-color-adjust: exact;
    }

    #header,
    #footer,
    .controls,
    .app-hero {
        display: none;
    }

    .app-shell {
        display: block;
        width: min(7.4in, 100%);
        margin: 0 auto;
        padding: 0;
    }

    .plot-panel {
        border: 0;
        border-radius: 0;
        box-shadow: none;
        break-inside: avoid;
    }

    .panel-header {
        border-bottom: 1px solid #999;
        padding: 0 0 0.12in;
    }

    #sounding-canvas {
        width: 100%;
        background: #fff;
    }
}
