:root {
    color-scheme: light dark;
    --background: #f7f3eb;
    --background-start: #fbf8f1;
    --background-end: #f1eadf;
    --background-glow: rgba(255, 255, 255, 0.88);
    --surface: rgba(255, 252, 246, 0.72);
    --surface-strong: #fffdf8;
    --text: #1d1a16;
    --muted: #716a60;
    --quiet: #9b9286;
    --line: #dfd5c5;
    --line-strong: #cfc1ad;
    --accent: #8b513f;
    --accent-strong: #5d3028;
    --accent-soft: rgba(139, 81, 63, 0.1);
    --focus: rgba(139, 81, 63, 0.28);
    --shadow: rgba(83, 62, 38, 0.11);
    --code-background: #26221d;
    --code-text: #f6efe5;
}

@media (prefers-color-scheme: dark) {
    :root {
        --background: #111111;
        --background-start: #181818;
        --background-end: #0c0c0c;
        --background-glow: rgba(255, 255, 255, 0.07);
        --surface: rgba(27, 27, 27, 0.78);
        --surface-strong: #1b1b1b;
        --text: #f2f2f0;
        --muted: #aaa7a2;
        --quiet: #7d7a76;
        --line: #30302f;
        --line-strong: #444240;
        --accent: #c8947e;
        --accent-strong: #edc0ac;
        --accent-soft: rgba(200, 148, 126, 0.11);
        --focus: rgba(226, 179, 159, 0.22);
        --shadow: rgba(0, 0, 0, 0.32);
        --code-background: #090909;
        --code-text: #f0ece6;
    }
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
    scroll-behavior: smooth;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(
            circle at 8% 0%,
            var(--background-glow),
            transparent 31rem
        ),
        linear-gradient(
            180deg,
            var(--background-start),
            var(--background) 42%,
            var(--background-end)
        );
    font-family:
        ui-sans-serif,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
    line-height: 1.6;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}

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

button,
a,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
}

.miniapps-shell {
    width: min(100% - 32px, 1120px);
    margin: 0 auto;
    padding: 22px 0 64px;
}

.site-nav {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    margin-bottom: 54px;
    color: var(--muted);
    font-size: 0.88rem;
}

.site-nav a {
    text-decoration: none;
    text-underline-offset: 4px;
    transition: color 160ms ease;
}

.site-nav a:hover,
.site-nav a:focus-visible {
    color: var(--accent-strong);
    text-decoration: underline;
}

.brand-link {
    color: var(--text) !important;
    font-weight: 700;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--accent);
    font-size: 0.76rem;
    font-weight: 750;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.page-title {
    max-width: 11ch;
    margin: 0 0 20px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2.75rem, 14vw, 4.1rem);
    font-weight: 400;
    letter-spacing: -0.025em;
    line-height: 0.96;
}

.page-lede {
    max-width: 640px;
    margin: 0;
    color: var(--muted);
    font-size: clamp(1rem, 0.94rem + 0.3vw, 1.16rem);
}

.miniapps-hub {
    max-width: 820px;
}

.hub-header {
    padding-bottom: clamp(54px, 9vw, 92px);
}

.tool-list {
    display: grid;
    border-top: 1px solid var(--line);
}

.tool-link {
    position: relative;
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr) auto;
    gap: 13px;
    align-items: center;
    padding: 20px 0;
    border-bottom: 1px solid var(--line);
    text-decoration: none;
}

.tool-icon {
    display: grid;
    width: 46px;
    height: 46px;
    place-items: center;
    border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--line));
    border-radius: 14px;
    color: var(--accent-strong);
    background: var(--accent-soft);
    transition:
        border-color 180ms ease,
        transform 180ms ease;
}

.tool-icon svg {
    width: 24px;
    height: 24px;
}

.tool-copy {
    display: grid;
    gap: 2px;
}

.tool-copy strong {
    font-size: 1.04rem;
    line-height: 1.35;
    transition: color 160ms ease;
}

.tool-copy span {
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.45;
}

.tool-arrow {
    color: var(--quiet);
    font-size: 1.25rem;
    transition:
        color 160ms ease,
        transform 160ms ease;
}

.tool-link:hover .tool-icon,
.tool-link:focus-visible .tool-icon {
    border-color: var(--accent);
    transform: translateY(-2px) rotate(-2deg);
}

.tool-link:hover .tool-copy strong,
.tool-link:focus-visible .tool-copy strong,
.tool-link:hover .tool-arrow,
.tool-link:focus-visible .tool-arrow {
    color: var(--accent-strong);
}

.tool-link:hover .tool-arrow,
.tool-link:focus-visible .tool-arrow {
    transform: translateX(3px);
}

.collection-note {
    max-width: 590px;
    margin: 34px 0 0;
    color: var(--muted);
    font-size: 0.9rem;
}

.site-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 22px;
    padding-top: 72px;
    color: var(--muted);
    font-size: 0.88rem;
}

.site-footer a {
    text-decoration-color: transparent;
    text-underline-offset: 4px;
}

.site-footer a:hover,
.site-footer a:focus-visible {
    color: var(--accent-strong);
    text-decoration-color: currentColor;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 4px;
}

.tool-header {
    max-width: 720px;
    padding-bottom: clamp(42px, 7vw, 72px);
}

.workbench {
    border: 1px solid var(--line-strong);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: 0 24px 70px -44px var(--shadow);
    backdrop-filter: blur(14px);
}

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

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

.field label,
.field-label-row {
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.055em;
    text-transform: uppercase;
}

.field-label-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: baseline;
}

.field-label-row label {
    color: inherit;
    font: inherit;
}

.field-label-row span {
    color: var(--quiet);
    font-size: 0.66rem;
    font-weight: 600;
    letter-spacing: 0.04em;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    background: var(--surface-strong);
    outline: 0;
    transition:
        border-color 160ms ease,
        box-shadow 160ms ease;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--focus);
}

code {
    padding: 0.15em 0.38em;
    border-radius: 5px;
    color: var(--accent-strong);
    background: var(--accent-soft);
    font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
    font-size: 0.9em;
}

.button {
    display: inline-flex;
    justify-content: center;
    gap: 8px;
    align-items: center;
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    font-weight: 750;
    line-height: 1;
    transition:
        border-color 160ms ease,
        background 160ms ease,
        color 160ms ease,
        transform 160ms ease;
}

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

.button:active {
    transform: translateY(0);
}

.button-primary {
    color: #fffaf5;
    background: var(--accent-strong);
}

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

.button-secondary {
    border-color: var(--line-strong);
    color: var(--text);
    background: var(--surface-strong);
}

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

.button-quiet {
    color: var(--muted);
    background: transparent;
}

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

.button svg {
    width: 16px;
    height: 16px;
}

.quick-guide h2 {
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(2rem, 1.7rem + 1.5vw, 3.25rem);
    font-weight: 400;
    line-height: 1.04;
}

@media (prefers-color-scheme: dark) {
    .button-primary {
        background: #8b513f;
    }

    .button-primary:hover,
    .button-primary:focus-visible {
        background: #a05c46;
    }
}

@media (min-width: 621px) {
    .workbench {
        border-radius: 18px;
    }

    .settings-row {
        grid-template-columns: 1fr 1fr;
    }
}

@media (min-width: 621px) {
    .miniapps-shell {
        width: min(100% - 40px, 1120px);
        padding-top: 30px;
    }

    .site-nav {
        margin-bottom: clamp(54px, 9vw, 104px);
    }

    .page-title {
        font-size: clamp(2.8rem, 2rem + 4vw, 5.8rem);
    }

    .tool-link {
        grid-template-columns: 52px minmax(0, 1fr) auto;
        gap: 18px;
    }

    .tool-icon {
        width: 52px;
        height: 52px;
        border-radius: 16px;
    }

    .tool-copy span {
        font-size: 0.94rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
