:root {
    --page-bg: #11121a;
    --surface: #181a24;
    --surface-raised: #1f212d;
    --surface-soft: #242632;
    --line: rgba(255, 255, 255, 0.11);
    --line-strong: rgba(255, 255, 255, 0.2);
    --text: #f5f2eb;
    --text-sub: #a8a7ae;
    --text-dim: #72727d;
    --accent: #f0ce78;
    --base-color: #d85a6a;
    --shadow-glow: #572d5d;
    --light-glow: #f6bd86;
    --ambient-color: #5873c7;
    --effect-color: #ff6a28;
    --radius-xl: 30px;
    --radius-lg: 22px;
    --radius-md: 14px;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
    --font-sans: Inter, "Hiragino Sans", "Yu Gothic UI", "Yu Gothic", Meiryo, sans-serif;
    --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    --type-meta: 0.75rem;
    --type-caption: 0.8125rem;
    --type-ui: 0.875rem;
    --type-body: 1rem;
    --type-lead: 1.0625rem;
    --type-card-title: 1.25rem;
    --type-section-title: 2.125rem;
    --type-display: 2.5rem;
    --leading-copy: 1.75;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
    scroll-behavior: smooth;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    overflow-x: hidden;
    background-color: var(--page-bg);
    background:
        radial-gradient(circle at 8% 15%, color-mix(in srgb, var(--shadow-glow) 28%, transparent) 0, transparent 27rem),
        radial-gradient(circle at 94% 30%, color-mix(in srgb, var(--light-glow) 16%, transparent) 0, transparent 31rem),
        var(--page-bg);
    color: var(--text);
    font-family: var(--font-sans);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

button,
input {
    font: inherit;
}

button {
    color: inherit;
}

button,
a,
input[type="range"],
input[type="color"] {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 72%, white);
    outline-offset: 3px;
}

.app-header {
    width: min(1500px, calc(100% - 48px));
    min-height: 76px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 24px;
    border-bottom: 1px solid var(--line);
}

.brand {
    width: max-content;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--text);
    text-decoration: none;
}

.brand-mark {
    width: 26px;
    height: 26px;
    flex: 0 0 auto;
    display: block;
}

.brand-name {
    font-weight: 700;
    letter-spacing: 0.035em;
}

.header-copy {
    margin: 0;
    color: var(--text-dim);
    font-size: var(--type-meta);
    letter-spacing: 0.08em;
}

.quiet-button,
.shuffle-button,
.action-button {
    border: 0;
    cursor: pointer;
}

.quiet-button {
    justify-self: end;
    padding: 9px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: var(--text-sub);
    font-size: var(--type-ui);
    transition: border-color 180ms ease, color 180ms ease, background 180ms ease;
}

.quiet-button:hover {
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
}

.page-shell {
    width: min(1500px, calc(100% - 48px));
    margin: 0 auto;
}

.intro {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.6fr);
    align-items: end;
    gap: 56px;
    padding: 55px 8px 36px;
}

.eyebrow,
.section-number {
    margin: 0;
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: var(--type-meta);
    font-weight: 700;
    letter-spacing: 0.14em;
}

.intro h1 {
    max-width: 850px;
    margin: 10px 0 0;
    font-size: var(--type-display);
    font-weight: 680;
    letter-spacing: -0.045em;
    line-height: 1.2;
}

.intro-copy {
    max-width: 510px;
    margin: 0 0 8px;
    color: var(--text-sub);
    font-size: var(--type-lead);
    line-height: var(--leading-copy);
}

.tool-layout {
    display: grid;
    grid-template-columns: 350px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.control-panel,
.workspace-panel {
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 93%, transparent);
    box-shadow: var(--shadow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.control-panel {
    position: sticky;
    top: 18px;
    max-height: calc(100vh - 36px);
    overflow-y: auto;
    padding: 25px;
    border-radius: var(--radius-lg);
    scrollbar-color: var(--line-strong) transparent;
    scrollbar-width: thin;
}

.control-panel::-webkit-scrollbar {
    width: 6px;
}

.control-panel::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: var(--line-strong);
}

.workspace-panel {
    min-width: 0;
    padding: 28px;
    border-radius: var(--radius-xl);
}

.panel-heading,
.workspace-heading,
.range-label-row,
.ramp-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.panel-heading h2,
.workspace-heading h2 {
    margin: 1px 0 0;
    font-size: 1rem;
    font-weight: 650;
}

.compact-heading {
    margin-bottom: 13px;
}

.shuffle-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 9px;
    border-radius: 8px;
    background: transparent;
    color: var(--text-sub);
    font-size: var(--type-ui);
}

.shuffle-button:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.shuffle-button svg,
.action-button svg {
    width: 16px;
    height: 16px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.7;
}

.color-input-row {
    display: grid;
    grid-template-columns: 74px 1fr;
    gap: 14px;
    margin-top: 17px;
}

.native-color-wrap {
    position: relative;
    width: 74px;
    height: 74px;
    cursor: pointer;
}

.native-color-wrap input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.native-color-wrap span {
    position: absolute;
    inset: 0;
    border: 6px solid var(--surface-soft);
    border-radius: 18px;
    background: var(--base-color);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2), 0 5px 18px rgba(0, 0, 0, 0.24);
    transition: transform 180ms ease;
}

.native-color-wrap:hover span {
    transform: scale(1.03);
}

.native-color-wrap input:focus-visible + span {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

.hex-field label {
    display: block;
    margin: 1px 0 7px;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: var(--type-meta);
    letter-spacing: 0.12em;
}

.hex-input-wrap {
    height: 44px;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-soft);
    color: var(--text-dim);
    font-family: var(--font-mono);
}

.hex-input-wrap:focus-within {
    border-color: color-mix(in srgb, var(--accent) 50%, transparent);
}

.hex-input-wrap input {
    min-width: 0;
    width: 100%;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font-family: var(--font-mono);
    font-size: var(--type-body);
    font-weight: 650;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.field-error {
    min-height: 16px;
    margin: 3px 0 0;
    color: #ff9a9a;
    font-size: var(--type-meta);
}

.preset-wrap {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 6px;
    margin-top: 12px;
}

.preset-swatch {
    aspect-ratio: 1;
    min-width: 0;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 50%;
    background: var(--preset);
    cursor: pointer;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.preset-swatch:hover,
.preset-swatch.is-active {
    transform: translateY(-2px) scale(1.08);
    box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px rgba(255, 255, 255, 0.6);
}

.control-divider {
    height: 1px;
    margin: 22px 0;
    background: var(--line);
}

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

.mode-button {
    min-width: 0;
    padding: 10px 9px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--text-sub);
    cursor: pointer;
    text-align: left;
    transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.mode-button:hover {
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.055);
    color: var(--text);
}

.mode-button:active {
    transform: scale(0.98);
}

.mode-button.is-active {
    border-color: color-mix(in srgb, var(--accent) 65%, transparent);
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--text);
    box-shadow: inset 3px 0 0 var(--accent);
}

.mode-button.wide {
    grid-column: 1 / -1;
}

.mode-button span,
.mode-button small {
    display: block;
}

.mode-button span {
    overflow: hidden;
    font-size: var(--type-ui);
    font-weight: 650;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mode-button small {
    margin-top: 1px;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: var(--type-meta);
    letter-spacing: 0.08em;
}

.mode-description {
    min-height: 35px;
    margin: 10px 2px 0;
    color: var(--text-dim);
    font-size: var(--type-caption);
    line-height: 1.55;
}

.anime-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 12px;
    padding: 11px 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.025);
}

.anime-toggle-row > div > span,
.anime-toggle-row > div > small {
    display: block;
}

.anime-toggle-row > div > span {
    font-size: var(--type-ui);
    font-weight: 650;
}

.anime-toggle-row > div > small {
    margin-top: 1px;
    color: var(--text-dim);
    font-size: var(--type-meta);
}

.range-field + .range-field {
    margin-top: 19px;
}

.ambient-heading {
    margin-bottom: 0;
}

.toggle-switch {
    position: relative;
    width: 42px;
    height: 24px;
    flex: 0 0 auto;
    cursor: pointer;
}

.toggle-switch input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.toggle-switch span {
    position: absolute;
    inset: 0;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: #30323d;
    transition: background 170ms ease, border-color 170ms ease;
}

.toggle-switch span::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--text-sub);
    transition: transform 170ms ease, background 170ms ease;
}

.toggle-switch input:checked + span {
    border-color: color-mix(in srgb, var(--ambient-color) 70%, white);
    background: color-mix(in srgb, var(--ambient-color) 70%, #292b36);
}

.toggle-switch input:checked + span::after {
    background: #fff;
    transform: translateX(18px);
}

.toggle-switch input:focus-visible + span {
    outline: 3px solid var(--accent);
    outline-offset: 3px;
}

.ambient-note {
    margin: 8px 0 13px;
    color: var(--text-dim);
    font-size: var(--type-caption);
}

.ambient-controls {
    transition: opacity 170ms ease;
}

.ambient-controls.is-disabled {
    opacity: 0.38;
}

.ambient-input-row {
    display: grid;
    grid-template-columns: 54px 1fr;
    gap: 12px;
}

.ambient-color-wrap {
    width: 54px;
    height: 54px;
}

.ambient-color-wrap span {
    border-width: 5px;
    border-radius: 14px;
    background: var(--ambient-color);
}

.ambient-input-row .hex-field label {
    margin-top: 0;
}

.ambient-input-row .hex-input-wrap {
    height: 38px;
}

.ambient-range-field {
    margin-top: 13px;
}

.scene-heading {
    margin-bottom: 11px;
}

.control-sub-label {
    margin: 0 0 7px;
    color: var(--text-dim);
    font-size: var(--type-caption);
}

.scene-level {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.scene-level button {
    padding: 8px 6px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: rgba(255, 255, 255, 0.025);
    color: var(--text-sub);
    cursor: pointer;
    font-size: var(--type-caption);
}

.scene-level button:hover,
.scene-level button.is-active {
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.08);
    color: var(--text);
}

.scene-level button.is-active {
    box-shadow: inset 0 -2px 0 var(--accent);
}

.scene-note {
    min-height: 17px;
    margin: 7px 2px 16px;
    color: var(--text-dim);
    font-size: var(--type-caption);
}

.effect-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 5px;
    padding-top: 15px;
    border-top: 1px solid var(--line);
}

.effect-heading > div > span,
.effect-heading > div > small {
    display: block;
}

.effect-heading > div > span {
    font-size: var(--type-ui);
    font-weight: 650;
}

.effect-heading > div > small {
    margin-top: 1px;
    color: var(--text-dim);
    font-size: var(--type-meta);
}

.effect-toggle input:checked + span {
    border-color: color-mix(in srgb, var(--effect-color) 70%, white);
    background: color-mix(in srgb, var(--effect-color) 70%, #292b36);
}

.effect-presets {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin: 11px 0;
}

.effect-presets button {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 7px 4px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    font-size: var(--type-meta);
}

.effect-presets button:hover,
.effect-presets button.is-active {
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
}

.effect-presets i {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--effect-preset);
    box-shadow: 0 0 8px var(--effect-preset);
}

.effect-controls {
    transition: opacity 170ms ease;
}

.effect-controls.is-disabled {
    opacity: 0.38;
}

.direction-field {
    display: grid;
    grid-template-columns: 78px 1fr;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
}

.direction-field > span {
    color: var(--text-dim);
    font-size: var(--type-caption);
}

.direction-pad {
    width: 108px;
    display: grid;
    grid-template-columns: repeat(3, 32px);
    gap: 4px;
}

.direction-pad button {
    width: 32px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    font-size: var(--type-ui);
}

.direction-pad button:hover,
.direction-pad button.is-active {
    border-color: color-mix(in srgb, var(--effect-color) 62%, white);
    background: color-mix(in srgb, var(--effect-color) 15%, transparent);
    color: var(--text);
}

.direction-pad button:disabled {
    cursor: default;
}

.effect-color-wrap span {
    background: var(--effect-color);
}

.range-label-row label {
    font-size: var(--type-ui);
    font-weight: 620;
}

.range-label-row output {
    min-width: 32px;
    padding: 3px 6px;
    border-radius: 6px;
    background: var(--surface-soft);
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: var(--type-meta);
    text-align: center;
}

input[type="range"] {
    width: 100%;
    height: 22px;
    margin: 8px 0 0;
    appearance: none;
    background: transparent;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, #454753, var(--accent));
}

input[type="range"]::-webkit-slider-thumb {
    width: 17px;
    height: 17px;
    margin-top: -6.5px;
    appearance: none;
    border: 3px solid var(--surface);
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.42);
}

input[type="range"]::-moz-range-track {
    height: 4px;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #454753, var(--accent));
}

input[type="range"]::-moz-range-thumb {
    width: 13px;
    height: 13px;
    border: 3px solid var(--surface);
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.42);
}

.range-scale {
    display: flex;
    justify-content: space-between;
    margin-top: -2px;
    color: var(--text-dim);
    font-size: var(--type-meta);
}

.workspace-heading {
    margin-bottom: 18px;
}

.background-switch {
    display: flex;
    align-items: center;
    gap: 7px;
}

.preview-options {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 17px;
}

.object-switch {
    display: flex;
    align-items: center;
    gap: 5px;
}

.object-switch > span {
    margin-right: 3px;
    color: var(--text-dim);
    font-size: var(--type-meta);
}

.object-switch button {
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    font-size: var(--type-meta);
}

.object-switch button:hover,
.object-switch button.is-active {
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.07);
    color: var(--text);
}

.background-switch > span {
    margin-right: 3px;
    color: var(--text-dim);
    font-size: var(--type-meta);
}

.background-switch button {
    width: 28px;
    height: 28px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
}

.background-switch button:hover,
.background-switch button.is-active {
    border-color: rgba(255, 255, 255, 0.48);
}

.background-switch i {
    width: 15px;
    height: 15px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;
}

.bg-paper { background: #e9e6df; }
.bg-gray { background: #787982; }
.bg-ink { background: #11131a; }

.form-preview {
    position: relative;
    height: 380px;
    overflow: hidden;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.09);
    border-radius: 21px;
    background: #787982;
    transition: background 220ms ease;
}

.form-preview[data-bg="paper"] { background: #e9e6df; }
.form-preview[data-bg="gray"] { background: #787982; }
.form-preview[data-bg="ink"] { background: #11131a; }

.form-preview::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: radial-gradient(rgba(255, 255, 255, 0.16) 0.5px, transparent 0.5px);
    background-size: 7px 7px;
    opacity: 0.16;
    pointer-events: none;
}

.object-canvas {
    position: relative;
    z-index: 1;
    width: min(720px, 94%);
    height: auto;
    display: block;
    filter: drop-shadow(0 16px 23px rgba(0, 0, 0, 0.12));
}

.preview-caption {
    position: absolute;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 8px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    background: rgba(14, 15, 22, 0.74);
    color: rgba(255, 255, 255, 0.9);
    font-family: var(--font-mono);
    font-size: var(--type-meta);
    letter-spacing: 0.16em;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    transition: left 180ms ease, right 180ms ease, top 180ms ease, bottom 180ms ease;
}

.preview-caption span {
    width: 42px;
    height: 1px;
    background: currentColor;
}

.light-caption { top: 27px; right: 27px; }
.shadow-caption { left: 27px; bottom: 27px; }

.palette-strip {
    display: grid;
    grid-template-columns: repeat(7, minmax(100px, 1fr));
    gap: 7px;
    margin-top: 13px;
    overflow-x: auto;
    padding-bottom: 5px;
    scrollbar-color: var(--line-strong) transparent;
    scrollbar-width: thin;
}

.color-swatch {
    min-width: 100px;
    height: 188px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 13px 11px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 12px;
    background: var(--swatch);
    color: #fff;
    cursor: pointer;
    text-align: left;
    box-shadow: inset 0 0 0 0 rgba(255, 255, 255, 0.35);
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.color-swatch:hover {
    transform: translateY(-3px);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.46), 0 9px 22px rgba(0, 0, 0, 0.18);
}

.color-swatch:active {
    transform: scale(0.98);
}

.color-swatch.is-base {
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.66);
}

.color-swatch.dark-ink {
    color: #11131a;
}

.swatch-role {
    font-size: var(--type-ui);
    font-weight: 720;
    letter-spacing: 0.02em;
}

.swatch-step {
    display: block;
    margin-top: 2px;
    font-family: var(--font-mono);
    font-size: var(--type-meta);
    font-weight: 600;
    letter-spacing: 0.09em;
    opacity: 0.68;
}

.swatch-hex {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 7px;
    font-family: var(--font-mono);
    font-size: var(--type-ui);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.swatch-hex svg {
    width: 13px;
    height: 13px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.7;
    opacity: 0.7;
}

.ramp-block {
    margin-top: 18px;
}

.ramp-heading {
    margin-bottom: 7px;
    color: var(--text-dim);
    font-size: var(--type-meta);
}

.ramp-heading span:last-child {
    font-family: var(--font-mono);
    letter-spacing: 0.08em;
}

.smooth-ramp {
    position: relative;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.11);
    border-radius: 8px;
    background: linear-gradient(90deg, var(--shadow-glow), var(--base-color), var(--light-glow));
    cursor: crosshair;
    touch-action: none;
}

.smooth-ramp:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--accent) 72%, white);
    outline-offset: 3px;
}

.ramp-cursor {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 14px;
    height: 38px;
    border: 2px solid #fff;
    border-radius: 6px;
    background: var(--ramp-selected, var(--base-color));
    box-shadow: 0 2px 9px rgba(0, 0, 0, 0.48);
    pointer-events: none;
    transform: translate(-50%, -50%);
}

.ramp-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-top: 10px;
}

.ramp-result > span {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-sub);
    font-family: var(--font-mono);
    font-size: var(--type-ui);
    font-weight: 700;
}

.ramp-result i {
    width: 17px;
    height: 17px;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 5px;
    background: var(--ramp-selected, var(--base-color));
}

.ramp-result button {
    padding: 6px 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    color: var(--text-sub);
    cursor: pointer;
    font-size: var(--type-caption);
}

.ramp-result button:hover {
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.palette-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 20px;
}

.action-button {
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-soft);
    color: var(--text-sub);
    font-size: var(--type-ui);
    font-weight: 650;
    transition: background 170ms ease, border-color 170ms ease, color 170ms ease, transform 170ms ease;
}

.action-button:hover {
    border-color: var(--line-strong);
    background: #2a2d3a;
    color: var(--text);
}

.action-button:active {
    transform: scale(0.98);
}

.primary-action {
    border-color: transparent;
    background: var(--text);
    color: #151620;
}

.primary-action:hover {
    background: #fff;
    color: #151620;
}

.preset-library {
    margin-top: 27px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

.preset-library-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
}

.preset-library-heading h3 {
    margin: 2px 0 0;
    font-size: var(--type-body);
}

.json-actions {
    display: flex;
    gap: 7px;
}

.json-actions button {
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    font-size: var(--type-caption);
}

.json-actions button:hover {
    border-color: var(--line-strong);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.preset-empty {
    margin: 15px 0 0;
    padding: 17px;
    border: 1px dashed var(--line);
    border-radius: 11px;
    color: var(--text-dim);
    font-size: var(--type-ui);
    text-align: center;
}

.preset-empty[hidden] {
    display: none;
}

.preset-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 9px;
    margin-top: 14px;
}

.preset-card {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.025);
}

.preset-apply {
    width: 100%;
    padding: 0 13px 13px;
    border: 0;
    background: transparent;
    color: var(--text);
    cursor: pointer;
    text-align: left;
}

.preset-apply:hover {
    background: rgba(255, 255, 255, 0.045);
}

.preset-mini-ramp {
    height: 25px;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    margin: 0 -13px 11px;
}

.preset-mini-ramp i {
    background: var(--mini-color);
}

.preset-name,
.preset-meta {
    display: block;
    padding-right: 33px;
}

.preset-name {
    overflow: hidden;
    font-size: var(--type-ui);
    font-weight: 680;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preset-meta {
    margin-top: 2px;
    color: var(--text-dim);
    font-size: var(--type-meta);
}

.preset-delete {
    position: absolute;
    right: 8px;
    bottom: 9px;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--text-dim);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
}

.preset-delete:hover {
    background: rgba(255, 108, 108, 0.12);
    color: #ff9e9e;
}

.save-dialog {
    width: min(430px, calc(100% - 32px));
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 18px;
    background: #1c1e29;
    color: var(--text);
    box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
}

.save-dialog::backdrop {
    background: rgba(8, 9, 14, 0.72);
    backdrop-filter: blur(5px);
}

.save-dialog form {
    padding: 26px;
}

.save-dialog h2 {
    margin: 5px 0 4px;
    font-size: 1.2rem;
}

.save-dialog p:not(.section-number) {
    margin: 0 0 20px;
    color: var(--text-sub);
    font-size: var(--type-ui);
    line-height: 1.65;
}

.save-dialog label {
    display: block;
    margin-bottom: 6px;
    color: var(--text-dim);
    font-size: var(--type-ui);
}

.save-dialog input {
    width: 100%;
    height: 44px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    outline: 0;
    background: var(--surface-soft);
    color: var(--text);
}

.save-dialog input:focus {
    border-color: var(--accent);
}

.dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 19px;
}

.lp-section {
    margin: 110px 8px 0;
    padding-top: 48px;
    border-top: 1px solid var(--line);
}

.lp-section-heading {
    display: grid;
    grid-template-columns: 0.55fr 1.45fr;
    column-gap: 40px;
}

.lp-section-heading .eyebrow {
    grid-column: 1;
    grid-row: 1 / span 2;
    padding-top: 8px;
}

.lp-section-heading h2 {
    grid-column: 2;
    margin: 0;
    font-size: var(--type-section-title);
    font-weight: 620;
    letter-spacing: -0.04em;
    line-height: 1.28;
}

.lp-section-heading > p:last-child:not(.eyebrow) {
    grid-column: 2;
    max-width: 720px;
    margin: 18px 0 0;
    color: var(--text-sub);
    font-size: var(--type-lead);
    line-height: var(--leading-copy);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-top: 46px;
}

.feature-card {
    min-height: 325px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 28px;
    padding: 28px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.025);
}

.feature-card-copy {
    max-width: 550px;
}

.feature-index {
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: var(--type-meta);
    letter-spacing: 0.1em;
}

.feature-card h3 {
    margin: 24px 0 9px;
    font-size: var(--type-card-title);
}

.feature-card p {
    margin: 0;
    color: var(--text-sub);
    font-size: var(--type-body);
    line-height: var(--leading-copy);
}

.lp-palette-preview {
    height: 112px;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 13px;
}

.lp-palette-preview i {
    background: var(--lp-color);
}

.light-type-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
}

.light-type-list > div {
    min-width: 0;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-soft);
}

.light-type-list span,
.light-type-list small {
    display: block;
}

.light-type-list span {
    margin-top: 9px;
    font-size: var(--type-ui);
    font-weight: 650;
}

.light-type-list small {
    margin-top: 2px;
    color: var(--text-dim);
    font-size: var(--type-meta);
    font-weight: 400;
}

.light-dot {
    width: 12px;
    height: 12px;
    display: block;
    border-radius: 50%;
}

.direct-dot { background: #f0ce78; box-shadow: 0 0 12px rgba(240, 206, 120, 0.38); }
.ambient-dot { background: #5873c7; box-shadow: 0 0 12px rgba(88, 115, 199, 0.38); }
.effect-dot { background: #ff6a28; box-shadow: 0 0 12px rgba(255, 106, 40, 0.38); }

.preview-spec-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
}

.preview-spec-list > span {
    padding: 17px 12px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-soft);
    font-size: var(--type-ui);
}

.preview-spec-list small {
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: var(--type-meta);
}

.save-spec {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-soft);
}

.save-spec span {
    min-width: 0;
    overflow: hidden;
    font-size: var(--type-ui);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.save-spec b {
    margin-right: 7px;
    color: #ff9a94;
    font-family: var(--font-mono);
}

.save-spec small {
    flex: 0 0 auto;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: var(--type-meta);
}

.compact-lp-heading {
    align-items: end;
}

.search-guide-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    margin-top: 45px;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--line);
}

.search-guide-grid article {
    min-height: 185px;
    padding: 27px;
    background: var(--surface);
}

.search-guide-grid h3 {
    margin: 0 0 12px;
    font-size: var(--type-card-title);
}

.search-guide-grid p {
    margin: 0;
    color: var(--text-sub);
    font-size: var(--type-body);
    line-height: var(--leading-copy);
}

.faq-list {
    margin-top: 38px;
    border-top: 1px solid var(--line);
}

.faq-list details {
    border-bottom: 1px solid var(--line);
}

.faq-list summary {
    position: relative;
    padding: 22px 48px 22px 2px;
    cursor: pointer;
    font-size: var(--type-lead);
    font-weight: 620;
    list-style: none;
}

.faq-list summary::-webkit-details-marker {
    display: none;
}

.faq-list summary::after {
    content: "+";
    position: absolute;
    top: 50%;
    right: 9px;
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 1rem;
    transform: translateY(-50%);
}

.faq-list details[open] summary::after {
    content: "−";
}

.faq-list details p {
    margin: -3px 0 22px;
    color: var(--text-sub);
    font-size: var(--type-body);
    line-height: var(--leading-copy);
}

.footer-notes {
    margin: 95px 8px 0;
    padding: 36px 0;
    border-top: 1px solid var(--line);
}

.footer-note-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 36px;
}

.footer-note-item h3 {
    margin: 0 0 8px;
    font-size: var(--type-ui);
    font-weight: 650;
    color: var(--text-sub);
}

.footer-note-item p {
    margin: 0;
    color: var(--text-dim);
    font-size: var(--type-caption);
    line-height: 1.68;
}

.footer-note-item a {
    color: var(--text-sub);
    text-underline-offset: 3px;
}

.footer-note-item a:hover {
    color: var(--text);
}

.final-cta {
    margin: 105px 8px 80px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 40px;
    padding: 45px;
    border-radius: var(--radius-xl);
    background: var(--text);
    color: #161720;
}

.final-cta .eyebrow {
    color: #7f6932;
}

.final-cta h2 {
    max-width: 780px;
    margin: 8px 0 0;
    font-size: 2rem;
    font-weight: 650;
    letter-spacing: -0.04em;
    line-height: 1.25;
}

.final-cta > a {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 22px;
    padding: 13px 16px;
    border: 1px solid rgba(22, 23, 32, 0.22);
    border-radius: 10px;
    color: #161720;
    font-size: var(--type-ui);
    font-weight: 700;
    text-decoration: none;
}

.final-cta > a:hover {
    background: rgba(22, 23, 32, 0.07);
}

.site-footer {
    width: min(1500px, calc(100% - 48px));
    min-height: 86px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    border-top: 1px solid var(--line);
    color: var(--text-dim);
    font-size: var(--type-caption);
}

.footer-brand {
    color: var(--text-sub);
    font-weight: 650;
}

.footer-brand span {
    margin-left: 6px;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: var(--type-meta);
}

.site-footer nav {
    display: flex;
    gap: 20px;
}

.site-footer a {
    color: inherit;
    text-decoration: none;
}

.site-footer a:hover {
    color: var(--text);
}

.site-footer a[aria-current="page"] {
    color: var(--text);
}

.quiet-link {
    text-decoration: none;
}

.license-page {
    padding: 72px 8px 110px;
}

.license-hero {
    display: grid;
    grid-template-columns: 0.55fr 1.45fr;
    gap: 40px;
    padding-bottom: 54px;
    border-bottom: 1px solid var(--line);
}

.license-hero .eyebrow {
    padding-top: 9px;
}

.license-hero h1 {
    margin: 0;
    font-size: var(--type-display);
    font-weight: 650;
    letter-spacing: -0.04em;
    line-height: 1.2;
}

.license-hero-copy > p {
    max-width: 42em;
    margin: 18px 0 0;
    color: var(--text-sub);
    font-size: var(--type-lead);
    line-height: var(--leading-copy);
}

.license-layout {
    display: grid;
    grid-template-columns: 0.55fr 1.45fr;
    gap: 40px;
    padding-top: 30px;
}

.license-index {
    margin: 0;
    color: var(--text-dim);
    font-family: var(--font-mono);
    font-size: var(--type-meta);
    letter-spacing: 0.08em;
}

.license-sections {
    min-width: 0;
}

.license-section {
    padding: 28px 0 32px;
    border-bottom: 1px solid var(--line);
}

.license-section:first-child {
    padding-top: 0;
}

.license-section h2 {
    margin: 0 0 12px;
    font-size: var(--type-card-title);
    font-weight: 650;
}

.license-section p,
.license-section li {
    color: var(--text-sub);
    font-size: var(--type-body);
    line-height: var(--leading-copy);
}

.license-section p {
    max-width: 44em;
    margin: 0;
}

.license-section p + p {
    margin-top: 12px;
}

.license-section ul {
    max-width: 44em;
    margin: 16px 0 0;
    padding-left: 1.25em;
}

.license-section li + li {
    margin-top: 7px;
}

.license-section strong {
    color: var(--text);
}

.license-section a {
    color: var(--text);
    text-underline-offset: 3px;
}

.license-note {
    margin-top: 28px;
    padding: 20px 22px;
    border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
    border-radius: var(--radius-md);
    background: color-mix(in srgb, var(--accent) 6%, var(--surface));
}

.license-note p {
    color: var(--text-sub);
    font-size: var(--type-ui);
    line-height: 1.7;
}

.license-back {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 32px;
    color: var(--text);
    font-size: var(--type-ui);
    text-decoration: none;
}

.license-back span {
    color: var(--accent);
}

.toast {
    position: fixed;
    z-index: 1000;
    left: 50%;
    bottom: 24px;
    max-width: calc(100% - 32px);
    padding: 11px 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    background: rgba(245, 242, 235, 0.96);
    color: #161720;
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.28);
    font-size: var(--type-ui);
    font-weight: 650;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 12px);
    transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

@media (max-width: 1040px) {
    .tool-layout {
        grid-template-columns: 320px minmax(0, 1fr);
    }

    .control-panel {
        padding: 21px;
    }

    .workspace-panel {
        padding: 22px;
    }

    .header-copy {
        display: none;
    }

    .app-header {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 820px) {
    .app-header,
    .page-shell,
    .site-footer {
        width: min(100% - 28px, 720px);
    }

    .intro {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 43px 2px 27px;
    }

    .intro-copy {
        max-width: 620px;
    }

    .tool-layout {
        grid-template-columns: 1fr;
    }

    .control-panel {
        position: static;
        max-height: none;
        overflow: visible;
    }

    .workspace-heading {
        align-items: flex-start;
    }

    .preview-options {
        align-items: flex-end;
        flex-direction: column;
        gap: 8px;
    }

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

    .mode-button.wide {
        grid-column: auto;
    }

    .lp-section,
    .final-cta,
    .footer-notes {
        margin-left: 2px;
        margin-right: 2px;
    }

    .lp-section {
        margin-top: 78px;
    }

    .lp-section-heading {
        grid-template-columns: 1fr;
        row-gap: 13px;
    }

    .lp-section-heading .eyebrow,
    .lp-section-heading h2,
    .lp-section-heading > p:last-child:not(.eyebrow) {
        grid-column: 1;
        grid-row: auto;
    }

    .lp-section-heading .eyebrow {
        padding-top: 0;
    }

    .feature-grid {
        margin-top: 34px;
    }

    .footer-notes {
        margin-top: 60px;
    }

    .final-cta {
        margin-top: 78px;
        align-items: flex-start;
        flex-direction: column;
        padding: 34px;
    }

    .license-page {
        padding-left: 2px;
        padding-right: 2px;
    }

    .license-hero,
    .license-layout {
        grid-template-columns: 1fr;
        gap: 18px;
    }

    .license-hero .eyebrow {
        padding-top: 0;
    }
}

@media (max-width: 600px) {
    .app-header {
        min-height: 66px;
    }

    .quiet-button {
        padding: 8px 10px;
        font-size: var(--type-caption);
    }

    .brand-name {
        font-size: var(--type-body);
    }

    .brand-mark {
        width: 24px;
        height: 24px;
    }

    .intro h1 {
        font-size: 1.875rem;
    }

    .license-page {
        padding-top: 48px;
        padding-bottom: 80px;
    }

    .license-hero h1 {
        font-size: 1.875rem;
    }

    .control-panel,
    .workspace-panel {
        padding: 18px;
        border-radius: 18px;
    }

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

    .mode-button.wide {
        grid-column: 1 / -1;
    }

    .form-preview {
        height: 245px;
    }

    .object-canvas {
        width: 100%;
    }

    .light-caption { top: 18px; right: 18px; }
    .shadow-caption { left: 18px; bottom: 18px; }

    .color-swatch {
        height: 168px;
    }

    .palette-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .action-button {
        width: 100%;
    }

    .preset-library-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .json-actions {
        width: 100%;
    }

    .json-actions button {
        flex: 1;
    }

    .lp-section-heading h2 {
        font-size: 1.75rem;
    }

    .final-cta h2 {
        font-size: 1.75rem;
    }

    .feature-grid,
    .search-guide-grid {
        grid-template-columns: 1fr;
    }

    .feature-card {
        min-height: 0;
        padding: 22px;
    }

    .light-type-list,
    .preview-spec-list {
        grid-template-columns: 1fr;
    }

    .light-type-list > div {
        display: grid;
        grid-template-columns: 16px 1fr;
        align-items: center;
        gap: 8px;
    }

    .light-type-list span {
        margin-top: 0;
    }

    .lp-palette-preview {
        height: 82px;
    }

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

    .search-guide-grid article {
        min-height: 0;
    }

    .footer-note-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .faq-list summary {
        padding-right: 38px;
        font-size: var(--type-body);
    }

    .final-cta {
        padding: 26px;
    }

    .final-cta > a {
        width: 100%;
        justify-content: space-between;
    }

    .site-footer {
        padding: 23px 0;
        flex-direction: column;
        align-items: flex-start;
    }

    .site-footer nav {
        flex-wrap: wrap;
        gap: 10px 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}
