:root {
    --bg: #f5efe4;
    --panel: rgba(255, 252, 246, 0.9);
    --panel-border: rgba(113, 87, 43, 0.18);
    --text: #23180b;
    --muted: #6b5b44;
    --accent: #2563eb;
    --accent-2: #7dd3fc;
    --shadow: 0 24px 60px rgba(71, 52, 19, 0.14);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.95), transparent 36%),
        linear-gradient(135deg, #f8f4ea 0%, #eadfc9 52%, #f4ede0 100%);
}

body {
    line-height: 1.5;
}

.shell {
    width: min(1200px, calc(100vw - 32px));
    margin: 0 auto;
    padding: 20px 0 32px;
}

.shell--narrow {
    width: min(1040px, calc(100vw - 32px));
}

.hero,
.workspace {
    display: grid;
    gap: 24px;
}

.hero {
    grid-template-columns: 1.3fr 0.9fr;
    align-items: stretch;
    margin-bottom: 16px;
}

.hero--stacked {
    grid-template-columns: 1fr;
}

.hero__copy,
.panel {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: 28px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.hero__copy {
    padding: 28px;
}

.eyebrow {
    margin: 0 0 8px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: #8b6c39;
    font-size: 0.8rem;
    font-weight: 700;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 12px;
    font-size: clamp(2rem, 3.5vw, 3.7rem);
    line-height: 0.95;
}

.lead {
    max-width: 62ch;
    margin-bottom: 0;
    font-size: 1rem;
    color: var(--muted);
}

.hero__status {
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px;
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border-radius: 999px;
    background: #23180b;
    color: #fffef8;
    text-decoration: none;
    font-weight: 700;
    transition: transform 160ms ease, opacity 160ms ease;
}

.button-link:hover {
    transform: translateY(-1px);
    opacity: 0.92;
}

.panel__label {
    margin-bottom: 10px;
    color: #7c5b27;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.78rem;
    font-weight: 800;
}

.workspace {
    grid-template-columns: minmax(260px, 340px) minmax(600px, 1fr);
    align-items: start;
}

.thermos-panel,
.controls,
.readout-grid,
.preset-panel {
    padding: 20px;
}

.thermos-stage {
    display: grid;
    place-items: center;
    min-height: 430px;
    border-radius: 20px;
    background:
        radial-gradient(circle at 50% 15%, rgba(255, 255, 255, 0.95), transparent 35%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(225, 215, 199, 0.82));
}

.thermos {
    width: 184px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.thermos__cap {
    width: 112px;
    height: 40px;
    border-radius: 24px 24px 18px 18px;
    background: linear-gradient(180deg, #66513b 0%, #23180b 100%);
    box-shadow: inset 0 6px 8px rgba(255, 255, 255, 0.14);
}

.thermos__body {
    width: 184px;
    padding: 12px;
    border-radius: 40px;
    background: linear-gradient(180deg, #efe8dc 0%, #d9cab3 100%);
    box-shadow:
        inset 0 10px 18px rgba(255, 255, 255, 0.55),
        inset 0 -10px 18px rgba(87, 67, 35, 0.14);
}

.thermos__glass {
    position: relative;
    overflow: hidden;
    height: 320px;
    border-radius: 30px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0.2)),
        linear-gradient(180deg, #f8fbff 0%, #d6e3f0 100%);
    border: 2px solid rgba(255, 255, 255, 0.75);
}

.thermos__liquid {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 78%;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.32), transparent 20%),
        linear-gradient(180deg, var(--accent-2), var(--accent));
    transition: height 240ms ease, background 240ms ease;
}

.thermos__liquid::before {
    content: "";
    position: absolute;
    inset: 18px 22px auto;
    height: 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.3);
    filter: blur(1px);
}

.thermos__reflection {
    position: absolute;
    top: 16px;
    left: 22px;
    width: 28px;
    height: 240px;
    border-radius: 999px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.68), rgba(255, 255, 255, 0));
}

.thermos__base {
    margin-top: 10px;
    width: 138px;
    height: 14px;
    border-radius: 999px;
    background: rgba(35, 24, 11, 0.18);
    filter: blur(2px);
}

.thermos-legend {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-top: 14px;
}

.legend__label,
.slider-block small,
.controls__header p,
.notes p {
    color: var(--muted);
}

.dashboard {
    display: grid;
    gap: 16px;
}

.control-zone {
    display: grid;
    grid-template-columns: minmax(360px, 1fr) minmax(220px, 280px);
    gap: 16px;
    align-items: start;
}

.preset-panel {
    align-self: stretch;
}

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

.readout {
    position: relative;
    overflow: hidden;
    padding: 18px;
    min-height: 156px;
    border-radius: 20px;
    background:
        linear-gradient(180deg, rgba(15, 23, 42, 0.08), rgba(15, 23, 42, 0.02)),
        #fffefb;
    border: 1px solid rgba(34, 25, 12, 0.08);
}

.readout::after {
    content: "";
    position: absolute;
    inset: auto -18% -40% auto;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(37, 99, 235, 0.18), transparent 65%);
}

.readout__label {
    display: block;
    margin-bottom: 8px;
    color: #7c5b27;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 800;
}

.readout__value {
    display: block;
    font-size: clamp(2.6rem, 6vw, 4.5rem);
    line-height: 0.9;
    letter-spacing: 0.04em;
    font-family: "Courier New", monospace;
    font-variant-numeric: tabular-nums;
}

.readout__unit {
    display: inline-block;
    margin-top: 10px;
    color: var(--muted);
    font-weight: 700;
}

.controls__header {
    margin-bottom: 14px;
}

.preset-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.preset-card {
    display: grid;
    grid-template-columns: 52px 1fr;
    align-items: center;
    gap: 12px;
    appearance: none;
    border: 1px solid rgba(35, 24, 11, 0.12);
    background: rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    padding: 14px;
    text-align: left;
    cursor: pointer;
    transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.preset-card:hover,
.preset-card.is-active {
    transform: translateY(-2px);
    border-color: rgba(37, 99, 235, 0.36);
    box-shadow: 0 12px 24px rgba(37, 99, 235, 0.12);
}

.preset-card__title {
    display: block;
    margin-bottom: 6px;
    font-weight: 800;
}

.preset-card__content {
    display: block;
}

.preset-card__meta {
    display: block;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.35;
}

.preset-card__visual {
    display: block;
    width: 52px;
    height: 52px;
    object-fit: cover;
    border-radius: 18px;
    border: 1px solid rgba(35, 24, 11, 0.08);
    background: rgba(255, 255, 255, 0.8);
}

.slider-block {
    display: grid;
    gap: 6px;
    margin-top: 14px;
    font-weight: 700;
}

.slider-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.slider-inline strong {
    font-family: "Courier New", monospace;
    font-size: 1rem;
    color: #7c5b27;
}

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

noscript {
    display: block;
    padding: 0 16px 24px;
    text-align: center;
    color: #7a2d2d;
}

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

.theory-card {
    padding: 22px;
}

.theory-card--wide {
    grid-column: 1 / -1;
}

.formula-block,
.formula-stack {
    margin: 16px 0;
    padding: 14px 16px;
    border-radius: 18px;
    background: rgba(35, 24, 11, 0.06);
    border: 1px solid rgba(35, 24, 11, 0.08);
}

.formula-block code,
.formula-stack code {
    display: block;
    font-family: "Courier New", monospace;
    font-size: 0.98rem;
    line-height: 1.5;
}

.formula-stack {
    display: grid;
    gap: 10px;
}

.formula-note {
    margin-bottom: 0;
}

.table-wrap {
    overflow-x: auto;
}

.info-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 12px;
}

.info-table th,
.info-table td {
    padding: 12px 14px;
    border-bottom: 1px solid rgba(35, 24, 11, 0.1);
    text-align: left;
}

.info-table th {
    color: #7c5b27;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

@media (max-width: 980px) {
    .hero,
    .workspace {
        grid-template-columns: 1fr;
    }

    .control-zone,
    .presentation-grid {
        grid-template-columns: 1fr;
    }

    .thermos-stage {
        min-height: 360px;
    }
}

@media (max-width: 640px) {
    .shell {
        width: min(100vw - 20px, 1200px);
        padding-top: 20px;
    }

    .hero__copy,
    .panel,
    .thermos-panel,
    .controls,
    .readout-grid {
        border-radius: 22px;
    }

    .hero__copy,
    .hero__status,
    .thermos-panel,
    .controls,
    .readout-grid {
        padding: 20px;
    }

    .readout-grid,
    .preset-grid {
        grid-template-columns: 1fr;
    }
}
