:root {
    --paper: #f5efe3;
    --paper-strong: #fff9f0;
    --ink: #17324b;
    --ink-soft: rgba(23, 50, 75, 0.72);
    --accent: #e36d4f;
    --accent-deep: #b24c38;
    --sea: #256b74;
    --line: rgba(23, 50, 75, 0.12);
    --shadow: 0 24px 60px rgba(23, 50, 75, 0.12);
    --radius-xl: 30px;
    --radius-lg: 22px;
    --radius-md: 16px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Segoe UI Variable Text", "Trebuchet MS", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(227, 109, 79, 0.18), transparent 38%),
        radial-gradient(circle at top right, rgba(37, 107, 116, 0.18), transparent 36%),
        linear-gradient(160deg, #f9f4ea 0%, #f5efe3 48%, #efe5d5 100%);
    overflow-x: hidden;
}

body.is-loading {
    overflow: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image:
        linear-gradient(rgba(23, 50, 75, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(23, 50, 75, 0.03) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.28), transparent 72%);
    pointer-events: none;
}

.page-backdrop {
    position: fixed;
    border-radius: 999px;
    filter: blur(18px);
    opacity: 0.55;
    pointer-events: none;
}

.page-backdrop-one {
    top: 8%;
    right: -120px;
    width: 320px;
    height: 320px;
    background: rgba(227, 109, 79, 0.18);
}

.page-backdrop-two {
    bottom: 8%;
    left: -110px;
    width: 280px;
    height: 280px;
    background: rgba(37, 107, 116, 0.16);
}

.studio-shell {
    position: relative;
    z-index: 1;
    width: min(1220px, calc(100% - 32px));
    margin: 0 auto;
    padding: 36px 0 64px;
}

.hero,
.tool-card,
.result-card {
    opacity: 0;
    transform: translateY(24px);
    animation: rise-in 720ms cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
    animation-delay: var(--delay, 0ms);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.9fr);
    gap: 24px;
    margin-bottom: 28px;
    padding: 32px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: calc(var(--radius-xl) + 4px);
    background:
        linear-gradient(135deg, rgba(255, 249, 240, 0.88), rgba(255, 255, 255, 0.62)),
        linear-gradient(120deg, rgba(227, 109, 79, 0.08), rgba(37, 107, 116, 0.06));
    box-shadow: var(--shadow);
    backdrop-filter: blur(10px);
}

.hero-copy h1,
.tool-card h2,
.result-card h2 {
    margin: 0;
    font-family: "Sitka Display", "Palatino Linotype", serif;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.hero-copy h1 {
    font-size: clamp(2.4rem, 4.8vw, 4.6rem);
    line-height: 0.94;
    max-width: 11ch;
}

.hero-body,
.card-copy,
.hero-note p,
.summary-tile p {
    color: var(--ink-soft);
    line-height: 1.7;
}

.hero-body {
    max-width: 62ch;
    margin-top: 18px;
    font-size: 1rem;
}

.eyebrow,
.section-tag,
.note-kicker,
.meta-block span,
.summary-tile span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--sea);
}

.eyebrow::before,
.section-tag::before,
.note-kicker::before {
    content: "";
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.hero-aside {
    display: grid;
    gap: 14px;
}

.hero-note,
.tool-card,
.result-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-xl);
    background: rgba(255, 255, 255, 0.72);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.hero-note {
    padding: 20px 22px;
}

.hero-note strong,
.summary-tile strong,
.meta-block strong {
    display: block;
    font-size: 1.15rem;
}

.dashboard {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 20px;
}

.tool-card,
.result-card {
    padding: 26px;
}

.tool-card {
    grid-column: span 6;
}

.result-card {
    grid-column: 1 / -1;
}

.card-header,
.result-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 14px;
}

.pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 62px;
    padding: 10px 14px;
    border-radius: 999px;
    background: rgba(37, 107, 116, 0.1);
    color: var(--sea);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.query-form {
    display: grid;
    gap: 18px;
}

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

.field {
    display: grid;
    gap: 10px;
}

.field span {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--ink);
}

.field input {
    width: 100%;
    border: 1px solid rgba(23, 50, 75, 0.14);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    font: inherit;
    color: var(--ink);
    background: rgba(255, 249, 240, 0.88);
    transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}

.field input:focus {
    outline: none;
    border-color: rgba(37, 107, 116, 0.56);
    box-shadow: 0 0 0 5px rgba(37, 107, 116, 0.12);
    transform: translateY(-1px);
}

.mode-toggle {
    display: inline-grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 0;
    padding: 7px;
    border: 1px solid rgba(23, 50, 75, 0.08);
    border-radius: 999px;
    background: rgba(245, 239, 227, 0.9);
}

.mode-option {
    position: relative;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    padding: 12px 16px;
    border-radius: 999px;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--ink-soft);
    cursor: pointer;
    transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.mode-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.mode-option.is-active {
    background: linear-gradient(135deg, var(--sea), #2f8190);
    color: #fff;
    box-shadow: 0 12px 22px rgba(37, 107, 116, 0.22);
}

.mode-stack.is-hidden {
    display: none;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 4px;
}

.action-button,
.ghost-button {
    border: 0;
    border-radius: 999px;
    padding: 14px 20px;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, color 180ms ease;
}

.action-button {
    color: #fff;
    background: linear-gradient(135deg, var(--accent), var(--accent-deep));
    box-shadow: 0 16px 30px rgba(227, 109, 79, 0.24);
}

.action-button:hover,
.ghost-button:hover {
    transform: translateY(-2px);
}

.action-button:disabled,
.ghost-button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.ghost-button {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(23, 50, 75, 0.12);
}

.result-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin: 20px 0 16px;
}

.meta-block,
.summary-tile {
    padding: 16px 18px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(23, 50, 75, 0.09);
    background: rgba(255, 249, 240, 0.82);
}

.meta-block strong {
    margin-top: 8px;
    font-size: 1rem;
    word-break: break-word;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.summary-tile strong {
    margin-bottom: 6px;
    font-size: 1.3rem;
}

.summary-tile p {
    margin: 0;
    font-size: 0.9rem;
}

.summary-tile-empty {
    grid-column: 1 / -1;
}

.summary-tile-highlight {
    background: linear-gradient(145deg, rgba(227, 109, 79, 0.12), rgba(255, 249, 240, 0.88));
}

.summary-tile-alt {
    background: linear-gradient(145deg, rgba(37, 107, 116, 0.12), rgba(255, 255, 255, 0.82));
}

.response-shell {
    margin: 18px 0 0;
    min-height: 320px;
    max-height: 720px;
    overflow: auto;
    padding: 22px;
    border-radius: var(--radius-lg);
    background: linear-gradient(180deg, #183246, #112535);
    color: #eff7ff;
    font-family: "Cascadia Code", Consolas, monospace;
    font-size: 0.92rem;
    line-height: 1.7;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background:
        linear-gradient(135deg, rgba(17, 37, 53, 0.72), rgba(24, 50, 70, 0.78)),
        radial-gradient(circle at top, rgba(227, 109, 79, 0.16), transparent 36%);
    backdrop-filter: blur(16px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 180ms ease, visibility 180ms ease;
}

.loading-overlay.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.loading-panel {
    width: min(420px, 100%);
    padding: 28px 28px 26px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 28px;
    background: linear-gradient(165deg, rgba(255, 249, 240, 0.96), rgba(255, 255, 255, 0.82));
    box-shadow: 0 24px 70px rgba(10, 24, 36, 0.26);
    text-align: center;
}

.loading-orb {
    width: 70px;
    height: 70px;
    margin: 0 auto 18px;
    border-radius: 50%;
    border: 4px solid rgba(37, 107, 116, 0.12);
    border-top-color: var(--sea);
    border-right-color: var(--accent);
    animation: spin 0.9s linear infinite;
}

.loading-kicker {
    margin: 0 0 10px;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--sea);
}

.loading-title {
    margin: 0;
    font-family: "Sitka Display", "Palatino Linotype", serif;
    font-size: 1.9rem;
    letter-spacing: -0.03em;
}

.loading-text {
    margin: 12px 0 0;
    color: var(--ink-soft);
    line-height: 1.7;
}

code {
    padding: 0.14rem 0.42rem;
    border-radius: 999px;
    background: rgba(23, 50, 75, 0.08);
    font-family: "Cascadia Code", Consolas, monospace;
    font-size: 0.92em;
}

@keyframes rise-in {
    from {
        opacity: 0;
        transform: translateY(24px);
    }

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

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 980px) {
    .hero,
    .tool-card,
    .result-card {
        animation-duration: 560ms;
    }

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

    .tool-card {
        grid-column: 1 / -1;
    }

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

@media (max-width: 640px) {
    .studio-shell {
        width: min(100% - 20px, 1220px);
        padding: 16px 0 36px;
    }

    .hero,
    .tool-card,
    .result-card {
        padding: 20px;
        border-radius: 24px;
    }

    .field-grid,
    .result-meta,
    .summary-grid {
        grid-template-columns: 1fr;
    }

    .form-actions,
    .card-header,
    .result-header {
        flex-direction: column;
        align-items: stretch;
    }

    .action-button,
    .ghost-button {
        width: 100%;
    }
}
