:root {
    --bg-1: #050816;
    --bg-2: #0b1224;
    --bg-3: #111827;
    --card: rgba(15, 23, 42, 0.72);
    --card-2: rgba(255, 255, 255, 0.06);
    --stroke: rgba(255, 255, 255, 0.10);
    --stroke-2: rgba(255, 255, 255, 0.16);
    --text: #e5eefc;
    --muted: #92a0b8;
    --accent: #22c55e;
    --accent-2: #06b6d4;
    --danger: #ef4444;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
    --radius: 24px;
}

* {
    box-sizing: border-box;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

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

body {
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(34, 197, 94, 0.18), transparent 28%),
        radial-gradient(circle at top right, rgba(6, 182, 212, 0.18), transparent 26%),
        radial-gradient(circle at bottom center, rgba(168, 85, 247, 0.16), transparent 25%),
        linear-gradient(135deg, var(--bg-1), var(--bg-2) 45%, var(--bg-3));
    overflow-x: hidden;
    position: relative;
    padding: 24px;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(circle at center, black 30%, transparent 90%);
    opacity: 0.12;
}

.app {
    max-width: 1180px;
    margin: 0 auto;
    display: grid;
    gap: 18px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 20px;
    border: 1px solid var(--stroke);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    backdrop-filter: blur(18px);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.brand-badge {
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.95), rgba(6, 182, 212, 0.9));
    box-shadow: 0 12px 30px rgba(6, 182, 212, 0.25);
    flex: 0 0 auto;
}

.brand h1 {
    margin: 0;
    font-size: 20px;
    line-height: 1.1;
    letter-spacing: 0.2px;
}

.brand p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 13px;
}

.top-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.chip-btn,
.btn {
    border: 1px solid var(--stroke);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border-radius: 14px;
    padding: 10px 14px;
    cursor: pointer;
    transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.20);
    font-weight: 600;
    letter-spacing: 0.2px;
}

.chip-btn:hover,
.btn:hover {
    transform: translateY(-1px);
    border-color: rgba(255, 255, 255, 0.24);
    background: rgba(255, 255, 255, 0.10);
}

.btn-primary {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.95), rgba(6, 182, 212, 0.95));
    border-color: transparent;
    color: #03111a;
}

.btn-primary:hover {
    box-shadow: 0 12px 30px rgba(6, 182, 212, 0.20);
}

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.8fr);
    gap: 18px;
    align-items: start;
}

.panel {
    border: 1px solid var(--stroke);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
    backdrop-filter: blur(18px);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.panel-inner {
    padding: 18px;
}

.section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.section-title h2 {
    margin: 0;
    font-size: 16px;
    letter-spacing: 0.2px;
}

.section-title span {
    color: var(--muted);
    font-size: 13px;
}

.picker-stage {
    display: grid;
    gap: 16px;
}

.sv-wrap {
    position: relative;
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02));
    height: 360px;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.sv-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
    touch-action: none;
}

.sv-hint {
    position: absolute;
    left: 14px;
    bottom: 14px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(2, 6, 23, 0.52);
    border: 1px solid rgba(255, 255, 255, 0.10);
    color: #d9e6ff;
    font-size: 12px;
    backdrop-filter: blur(12px);
    pointer-events: none;
}

.control-block {
    display: grid;
    gap: 12px;
}

.slider-card {
    padding: 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.slider-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    align-items: center;
}

.slider-head label {
    font-size: 13px;
    color: var(--muted);
}

.slider-head strong {
    font-size: 13px;
    color: var(--text);
    font-weight: 700;
}

input[type="range"] {
    width: 100%;
    appearance: none;
    height: 14px;
    border-radius: 999px;
    outline: none;
    background: transparent;
}

input[type="range"]::-webkit-slider-runnable-track {
    height: 14px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.08));
    border: 1px solid rgba(255, 255, 255, 0.08);
}

input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 24px;
    height: 24px;
    margin-top: -6px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.9);
    background: linear-gradient(135deg, #fff, #dbeafe);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    cursor: pointer;
}

input[type="range"]::-moz-range-track {
    height: 14px;
    border-radius: 999px;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.08));
    border: 1px solid rgba(255, 255, 255, 0.08);
}

input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.9);
    background: linear-gradient(135deg, #fff, #dbeafe);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
    cursor: pointer;
}

.hue-range::-webkit-slider-runnable-track {
    background: linear-gradient(90deg, #ff004c, #ff7a00, #ffd400, #35d07f, #00d4ff, #5b5cff, #ff4fd8, #ff004c);
}

.hue-range::-moz-range-track {
    background: linear-gradient(90deg, #ff004c, #ff7a00, #ffd400, #35d07f, #00d4ff, #5b5cff, #ff4fd8, #ff004c);
}

.alpha-range::-webkit-slider-runnable-track {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.65));
}

.alpha-range::-moz-range-track {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.65));
}

.mini-row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 2px;
}

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

.swatch {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.22);
    position: relative;
    overflow: hidden;
    transition: transform .16s ease, box-shadow .16s ease;
}

.swatch:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 16px 30px rgba(0, 0, 0, 0.26);
}

.swatch::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), transparent 45%);
    pointer-events: none;
}

.right-panel {
    display: grid;
    gap: 16px;
}

.hero-preview {
    position: relative;
    min-height: 220px;
    padding: 18px;
    border-radius: 22px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.20), transparent 28%),
        linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(6, 182, 212, 0.18), rgba(168, 85, 247, 0.16));
}

.hero-preview::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 30%),
        radial-gradient(circle at 70% 20%, rgba(255, 255, 255, 0.12), transparent 22%);
    pointer-events: none;
}

.preview-slab {
    position: relative;
    height: 132px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    display: grid;
    place-items: center;
    font-weight: 800;
    letter-spacing: 0.4px;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.16);
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 18px 30px rgba(0, 0, 0, 0.22);
    user-select: none;
    transition: background .12s linear;
    margin-top: 12px;
}

.hero-copy {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.hero-copy h3 {
    margin: 0;
    font-size: 22px;
    line-height: 1.1;
}

.hero-copy p {
    margin: 0;
    color: rgba(229, 238, 252, 0.76);
    font-size: 13px;
}

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

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

.field-grid .wide {
    grid-column: 1 / -1;
}

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

.field label {
    font-size: 12px;
    color: var(--muted);
    padding-left: 3px;
}

.text-input {
    width: 100%;
    padding: 13px 14px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    outline: none;
    background: rgba(2, 6, 23, 0.30);
    color: var(--text);
    font-size: 14px;
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.text-input:focus {
    border-color: rgba(34, 197, 94, 0.55);
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.12);
    background: rgba(2, 6, 23, 0.42);
}

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

.status {
    color: var(--muted);
    font-size: 13px;
}

.status strong {
    color: #dfffe7;
}

.footer-note {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.quick-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.quick-card {
    padding: 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 78px;
    display: grid;
    align-content: center;
    gap: 4px;
}

.quick-card span {
    color: var(--muted);
    font-size: 12px;
}

.quick-card strong {
    font-size: 14px;
    word-break: break-word;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 22px;
    transform: translateX(-50%) translateY(20px);
    opacity: 0;
    pointer-events: none;
    padding: 12px 16px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.88);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(14px);
    transition: opacity .2s ease, transform .2s ease;
    z-index: 99;
    font-size: 14px;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.back-link {
    color: #9be7ff;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}

.back-link:hover {
    text-decoration: underline;
}

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

    .sv-wrap {
        height: 320px;
    }

    .quick-list {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    body {
        padding: 14px;
    }

    .topbar {
        padding: 16px;
        flex-direction: column;
        align-items: stretch;
    }

    .top-actions {
        justify-content: flex-start;
    }

    .panel-inner {
        padding: 14px;
    }

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

    .hero-copy h3 {
        font-size: 19px;
    }
}