:root {
    color-scheme: dark;
    --bg: #090d17;
    --bg-deep: #05070d;
    --panel: rgba(17, 22, 34, 0.96);
    --panel-soft: rgba(26, 32, 48, 0.92);
    --ink: #f4f6ff;
    --muted: rgba(225, 229, 246, 0.72);
    --line: rgba(255, 255, 255, 0.08);
    --line-strong: rgba(255, 255, 255, 0.15);
    --accent: #ff9d66;
    --accent-strong: #ff6d6f;
    --accent-soft: rgba(255, 157, 102, 0.16);
    --violet: #8d7aff;
    --cyan: #67e8ff;
    --shadow-xl: 0 34px 88px rgba(0, 0, 0, 0.42);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.28);
    --shadow-sm: 0 10px 18px rgba(0, 0, 0, 0.2);
    --radius-2xl: 34px;
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 14px;
    --ease: cubic-bezier(.2, .8, .2, 1);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
}

body {
    font-family: "Manrope", "Segoe UI", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 16% 14%, rgba(255, 157, 102, 0.14), transparent 22%),
        radial-gradient(circle at 82% 12%, rgba(141, 122, 255, 0.16), transparent 20%),
        radial-gradient(circle at 50% 82%, rgba(103, 232, 255, 0.12), transparent 18%),
        linear-gradient(180deg, #101526 0%, var(--bg) 42%, var(--bg-deep) 100%);
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 28%),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.02) 0, rgba(255, 255, 255, 0.02) 1px, transparent 1px, transparent 120px);
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.5), transparent 82%);
}

.hidden {
    display: none !important;
}

.shell {
    width: min(1520px, calc(100% - 40px));
    margin: 28px auto 46px;
    position: relative;
    z-index: 1;
}

.eyebrow,
.swatch-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    font-size: 0.75rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(225, 229, 246, 0.76);
}

.eyebrow::before {
    content: "";
    width: 18px;
    height: 1px;
    background: currentColor;
    opacity: 0.7;
}

.chamber-intro,
.mood-panel,
.canvas-panel,
.control-panel,
.insight-card,
.sidebar-card,
.notice {
    border: 1px solid var(--line);
    border-radius: var(--radius-2xl);
    background: var(--panel);
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(18px);
}

.chamber-intro {
    display: grid;
    gap: 18px;
    padding: 32px;
    margin-bottom: 24px;
    background:
        linear-gradient(180deg, rgba(14, 19, 31, 0.94) 0%, rgba(18, 24, 39, 0.92) 100%);
}

.intro-copy h1,
.panel-head h2,
.insight-card strong,
.sidebar-card strong {
    margin: 0;
    letter-spacing: -0.05em;
}

.intro-copy h1 {
    font-size: 30px;
    line-height: 1;
}

.lead,
.panel-copy,
.insight-card p,
.sidebar-card p,
.form-note,
.notice {
    margin: 0;
    color: var(--muted);
    line-height: 1.72;
}

.lead {
    max-width: 68ch;
    font-size: 1.03rem;
}

.intro-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.intro-tags span {
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(255, 157, 102, 0.12);
    background: rgba(255, 157, 102, 0.08);
    color: #ffe0cb;
    font-size: 0.88rem;
    font-weight: 800;
}

.chamber-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.04fr) 420px 320px;
    gap: 22px;
    align-items: start;
}

.atmosphere-side,
.control-side,
.insight-side {
    display: grid;
    gap: 18px;
}

.mood-panel,
.canvas-panel,
.control-panel,
.insight-card,
.sidebar-card {
    padding: 24px;
}

.mood-panel,
.control-panel,
.insight-card,
.sidebar-card {
    background:
        linear-gradient(180deg, rgba(18, 23, 36, 0.96) 0%, rgba(14, 18, 29, 0.96) 100%);
}

.panel-head {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
}

.panel-head.compact {
    margin-bottom: 14px;
}

.panel-head h2 {
    font-size: 1.54rem;
    line-height: 1.04;
}

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

.preset-button,
button {
    appearance: none;
    border: 0;
    border-radius: 999px;
    min-height: 52px;
    padding: 0 18px;
    font: inherit;
    font-weight: 800;
    letter-spacing: -0.02em;
    cursor: pointer;
    transition: transform 180ms var(--ease), box-shadow 180ms var(--ease), background 180ms var(--ease), opacity 180ms var(--ease);
}

.preset-button {
    color: var(--ink);
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: var(--shadow-sm);
}

.preset-button.is-active {
    background: linear-gradient(135deg, rgba(255, 157, 102, 0.22), rgba(141, 122, 255, 0.22));
    border-color: rgba(255, 255, 255, 0.16);
}

button:hover:not(:disabled),
.preset-button:hover {
    transform: translateY(-1px);
}

button:active:not(:disabled),
.preset-button:active {
    transform: translateY(0);
}

.canvas-panel {
    background:
        linear-gradient(180deg, rgba(14, 19, 30, 0.9) 0%, rgba(11, 15, 25, 0.96) 100%);
}

.chamber-stage {
    padding: 24px;
    border-radius: 28px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.02));
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.chamber-frame {
    position: relative;
    min-height: 720px;
    background:
        radial-gradient(circle at center, rgba(255, 255, 255, 0.06), transparent 52%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01));
}

.chamber-glow {
    position: absolute;
    border-radius: 999px;
    filter: blur(24px);
    pointer-events: none;
    opacity: 0.8;
}

.chamber-glow-a {
    width: 220px;
    height: 220px;
    top: -40px;
    left: -20px;
    background: radial-gradient(circle, rgba(255, 157, 102, 0.34), transparent 70%);
}

.chamber-glow-b {
    width: 240px;
    height: 240px;
    right: -40px;
    bottom: -30px;
    background: radial-gradient(circle, rgba(141, 122, 255, 0.32), transparent 72%);
}

.gradient-stage {
    position: absolute;
    inset: 28px;
    border-radius: 28px;
    box-shadow:
        inset 0 0 0 1px rgba(255, 255, 255, 0.14),
        0 24px 42px rgba(0, 0, 0, 0.22);
}

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

.stack-block,
.color-stack {
    display: grid;
    gap: 16px;
}

.stack-block {
    padding: 16px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.03);
}

.swatch-card {
    display: grid;
    gap: 14px;
    padding: 16px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
}

.swatch-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
}

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

.field > span {
    font-size: 0.86rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(244, 246, 255, 0.82);
}

select,
input[type="color"] {
    width: 100%;
    min-height: 56px;
    padding: 14px 16px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-md);
    background: rgba(255, 255, 255, 0.04);
    color: var(--ink);
    font: inherit;
    transition: border-color 180ms var(--ease), box-shadow 180ms var(--ease), background 180ms var(--ease);
}

select:focus,
input[type="color"]:focus {
    outline: none;
    border-color: rgba(255, 157, 102, 0.34);
    box-shadow: 0 0 0 4px rgba(255, 157, 102, 0.08);
}

select {
    appearance: none;
    padding-right: 48px;
    background-image:
        linear-gradient(45deg, transparent 50%, rgba(244, 246, 255, 0.72) 50%),
        linear-gradient(135deg, rgba(244, 246, 255, 0.72) 50%, transparent 50%);
    background-position:
        calc(100% - 24px) calc(50% - 3px),
        calc(100% - 16px) calc(50% - 3px);
    background-size: 8px 8px, 8px 8px;
    background-repeat: no-repeat;
}

input[type="color"] {
    padding: 8px;
}

.range-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

input[type="range"] {
    flex: 1;
    appearance: none;
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(255, 157, 102, 0.9), rgba(103, 232, 255, 0.34));
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #fff4ec;
    border: 0;
    box-shadow: 0 0 0 4px rgba(255, 157, 102, 0.12);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 999px;
    background: #fff4ec;
    border: 0;
    box-shadow: 0 0 0 4px rgba(255, 157, 102, 0.12);
}

.range-value {
    min-width: 68px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    text-align: right;
    font-weight: 800;
    color: var(--muted);
}

.action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

#gradient-copy {
    color: #fff8f2;
    background: linear-gradient(180deg, var(--accent) 0%, var(--accent-strong) 100%);
    box-shadow: 0 14px 28px rgba(255, 109, 111, 0.2);
}

.ghost-button {
    color: var(--ink);
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--line);
}

.notice {
    padding: 16px 18px;
}

.success {
    color: #c9ffe5;
    background: linear-gradient(180deg, rgba(22, 63, 50, 0.96) 0%, rgba(17, 45, 36, 0.96) 100%);
}

.error {
    color: #ffd6d0;
    background: rgba(135, 53, 53, 0.22);
}

.insight-card {
    padding: 24px;
    background:
        linear-gradient(180deg, rgba(18, 23, 36, 0.96) 0%, rgba(14, 18, 29, 0.96) 100%);
}

.insight-card strong {
    display: block;
    font-size: 1.54rem;
    line-height: 1.08;
    margin-bottom: 8px;
}

.code-card .panel-head {
    margin-bottom: 14px;
}

.code-block {
    margin: 0;
    min-height: 220px;
    padding: 18px 20px;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
    color: #f6f2ff;
    font: 500 0.95rem/1.72 "SFMono-Regular", "SF Mono", "Menlo", monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

.sidebar-card {
    background:
        linear-gradient(180deg, rgba(18, 23, 36, 0.96) 0%, rgba(14, 18, 29, 0.96) 100%);
}

.sidebar-card .sidebar-title {
    font-size: 1.38rem;
    letter-spacing: -0.04em;
}

.sidebar-card .sidebar-copy,
.sidebar-card .sidebar-placeholder-note {
    color: var(--muted);
}

.sidebar-card .sidebar-ad-slot,
.sidebar-card .sidebar-ad-placeholder {
    min-height: 320px;
    margin-top: 16px;
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
}

.sidebar-card .sidebar-ad-placeholder {
    padding: 14px;
}

.sidebar-card .sidebar-ad-mock {
    min-height: 288px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background:
        radial-gradient(circle at center, rgba(255, 157, 102, 0.12), transparent 44%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.02) 100%);
}

.sidebar-card .sidebar-ad-badge {
    width: 158px;
    height: 158px;
    border-radius: 999px;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 2px;
    color: #fff8f3;
    background: linear-gradient(180deg, rgba(255, 157, 102, 0.98) 0%, rgba(255, 109, 111, 0.94) 100%);
    font-size: 1.7rem;
    font-weight: 900;
    letter-spacing: 0.08em;
}

@media (max-width: 1260px) {
    .chamber-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .shell {
        width: min(100% - 20px, 100%);
        margin: 18px auto 28px;
    }

    .chamber-intro,
    .mood-panel,
    .canvas-panel,
    .control-panel,
    .insight-card,
    .sidebar-card {
        padding: 20px;
    }

    .chamber-frame {
        min-height: 420px;
    }

    .gradient-stage {
        inset: 18px;
    }

    .preset-rack,
    .action-row {
        grid-template-columns: 1fr;
        flex-direction: column;
        align-items: stretch;
    }

    button,
    .preset-button,
    #gradient-copy,
    .ghost-button {
        width: 100%;
    }
}
