﻿/* =========================================================
   Color Wheel Spinner — Design tokens
   ========================================================= */
:root {
    /* Palette */
    --c-red: #FF3B5C;
    --c-orange: #FF8C42;
    --c-yellow: #FFD23F;
    --c-green: #2ECC71;
    --c-cyan: #00D4D4;
    --c-blue: #3D5AFE;
    --c-purple: #7C3AED;
    --c-pink: #FF6FB5;
    /* Surfaces */
    --bg: #FFFFFF;
    --surface: #F7F8FB;
    --surface-alt: #F1F2F8;
    --border: #E7E9F0;
    /* Text */
    --ink: #1A1B25;
    --ink-soft: #4B4D5E;
    --muted: #80849A;
    /* Glass panel */
    --glass-bg: rgba(255, 255, 255, 0.66);
    --glass-border: rgba(255, 255, 255, 0.5);
    /* Brand gradient */
    --gradient-rainbow: conic-gradient(from 0deg, var(--c-red), var(--c-orange), var(--c-yellow), var(--c-green), var(--c-cyan), var(--c-blue), var(--c-purple), var(--c-pink), var(--c-red));
    /* Type */
    --font-display: "Outfit", "Inter", sans-serif;
    --font-body: "Inter", system-ui, sans-serif;
    /* Shape & motion */
    --radius-sm: 10px;
    --radius-md: 16px;
    --radius-lg: 28px;
    --shadow-sm: 0 2px 8px rgba(26, 27, 37, 0.06);
    --shadow-md: 0 12px 32px rgba(26, 27, 37, 0.10);
    --shadow-lg: 0 24px 64px rgba(26, 27, 37, 0.16);
    --ease-spin: cubic-bezier(.18, .77, .26, 1);
}

body.dark-mode {
    --bg: #14151F;
    --surface: #1B1C29;
    --surface-alt: #20222F;
    --border: #2E3042;
    --ink: #F4F5FA;
    --ink-soft: #C7CADC;
    --muted: #8E92AB;
    --glass-bg: rgba(28, 29, 42, 0.6);
    --glass-border: rgba(255, 255, 255, 0.08);
}

/* =========================================================
   Reset & base
   ========================================================= */
* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
    transition: background-color .3s ease, color .3s ease;
}

img, svg {
    display: block;
    max-width: 100%;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    line-height: 1.15;
    margin: 0 0 .5em;
    letter-spacing: -0.01em;
}

p {
    line-height: 1.7;
    color: var(--ink-soft);
    margin: 0 0 1em;
}

a {
    color: var(--c-blue);
    text-decoration: none;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.skip-link {
    position: absolute;
    left: -999px;
    top: 0;
    background: var(--ink);
    color: #fff;
    padding: .5rem 1rem;
    border-radius: 0 0 var(--radius-sm) 0;
    z-index: 1000;
}

    .skip-link:focus {
        left: 0;
    }

:focus-visible {
    outline: 3px solid var(--c-blue);
    outline-offset: 2px;
}

/* =========================================================
   Buttons
   ========================================================= */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: .95rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: .65rem 1.1rem;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease, color .15s ease;
    background: var(--surface-alt);
    color: var(--ink);
}

    .btn:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-sm);
    }

    .btn:active {
        transform: translateY(0);
    }

.btn-primary {
    background: linear-gradient(135deg, var(--c-purple), var(--c-blue));
    color: #fff;
    box-shadow: 0 8px 24px rgba(124, 58, 237, .28);
}

    .btn-primary:hover {
        box-shadow: 0 12px 28px rgba(124, 58, 237, .36);
    }

.btn-soft {
    background: var(--surface-alt);
    color: var(--ink-soft);
    border-color: var(--border);
}

    .btn-soft:hover {
        background: var(--surface);
        color: var(--ink);
    }

.btn-ghost {
    background: transparent;
    color: var(--ink-soft);
}

    .btn-ghost:hover {
        background: var(--surface-alt);
    }

.btn-lg {
    padding: .9rem 1.8rem;
    font-size: 1.05rem;
}

.btn-sm {
    padding: .45rem .8rem;
    font-size: .85rem;
}

/* =========================================================
   Header
   ========================================================= */
.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--glass-bg);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

.header-inner {
    max-width: 1320px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .85rem 1.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: .6rem;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.2rem;
    color: var(--ink);
}

.logo-text strong {
    font-weight: 800;
    color: var(--c-purple);
}

.primary-nav {
    display: flex;
    gap: 1.75rem;
    font-weight: 600;
    font-size: .95rem;
}

    .primary-nav a {
        color: var(--ink-soft);
        position: relative;
        padding: .25rem 0;
    }

        .primary-nav a:hover {
            color: var(--ink);
        }

        .primary-nav a::after {
            content: "";
            position: absolute;
            left: 0;
            right: 100%;
            bottom: -4px;
            height: 2px;
            background: var(--gradient-rainbow);
            transition: right .25s ease;
        }

        .primary-nav a:hover::after {
            right: 0;
        }

.header-actions {
    display: flex;
    align-items: center;
    gap: .75rem;
}

.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
}

    .menu-toggle span {
        display: block;
        height: 2px;
        width: 18px;
        margin: 0 auto;
        background: var(--ink);
        border-radius: 2px;
    }

.mobile-nav {
    display: none;
    flex-direction: column;
    padding: .5rem 1.5rem 1rem;
    gap: .25rem;
    border-top: 1px solid var(--border);
}

    .mobile-nav a {
        padding: .65rem 0;
        font-weight: 600;
        color: var(--ink-soft);
        border-bottom: 1px solid var(--border);
    }

    .mobile-nav.is-open {
        display: flex;
    }

/* Nav dropdowns (Fun Tools / Image Wheel / Blog) */
.nav-dropdown {
    position: relative;
}

.primary-nav .dropdown-toggle {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    background: none;
    border: none;
    padding: .25rem 0;
    margin: 0;
    font: inherit;
    font-weight: 600;
    color: var(--ink-soft);
    cursor: pointer;
    position: relative;
}

    .primary-nav .dropdown-toggle:hover {
        color: var(--ink);
    }

    .primary-nav .dropdown-toggle::before {
        content: "";
        position: absolute;
        left: 0;
        right: 100%;
        bottom: -4px;
        height: 2px;
        background: var(--gradient-rainbow);
        transition: right .25s ease;
    }

    .primary-nav .dropdown-toggle:hover::before,
    .nav-dropdown.is-open .dropdown-toggle::before {
        right: 0;
    }

.dropdown-caret {
    width: 8px;
    height: 8px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
    margin-top: -3px;
    transition: transform .2s ease;
    flex-shrink: 0;
}

.nav-dropdown:hover .dropdown-caret,
.nav-dropdown:focus-within .dropdown-caret,
.nav-dropdown.is-open .dropdown-caret {
    transform: rotate(225deg);
    margin-top: 3px;
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 16px);
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    min-width: 260px;
    max-height: 70vh;
    overflow-y: auto;
    margin: 0;
    padding: .5rem;
    list-style: none;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
    z-index: 150;
}

.nav-dropdown:hover .dropdown-menu,
.nav-dropdown:focus-within .dropdown-menu,
.nav-dropdown.is-open .dropdown-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.dropdown-menu .dropdown-item {
    display: block;
    padding: .5rem .75rem;
    border-radius: 8px;
    font-size: .9rem;
    font-weight: 500;
    color: var(--ink-soft);
    white-space: normal;
    line-height: 1.35;
}

    .dropdown-menu .dropdown-item:hover {
        background: var(--surface-alt);
        color: var(--ink);
    }

.dropdown-divider {
    display: block;
    height: 1px;
    background: var(--border);
    margin: .4rem .25rem;
    list-style: none;
}

/* Mobile collapsible groups (Fun Tools / Image Wheel / Blog) */
.mobile-nav-group {
    border-bottom: 1px solid var(--border);
}

    .mobile-nav-group summary {
        padding: .65rem 0;
        font-weight: 600;
        color: var(--ink-soft);
        cursor: pointer;
        list-style: none;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

        .mobile-nav-group summary::-webkit-details-marker {
            display: none;
        }

        .mobile-nav-group summary::after {
            content: "+";
            font-size: 1.2rem;
            color: var(--c-purple);
            line-height: 1;
        }

    .mobile-nav-group[open] summary::after {
        content: "\2212";
    }

    .mobile-nav-group a {
        display: block;
        padding: .55rem 0 .55rem 1rem;
        font-size: .9rem;
        font-weight: 500;
        color: var(--ink-soft);
        border-top: 1px solid var(--border);
    }

        .mobile-nav-group a:first-of-type {
            border-top: 1px solid var(--border);
        }

        .mobile-nav-group a:hover {
            color: var(--c-purple);
        }

/* Breadcrumb */
.breadcrumb {
    max-width: 1320px;
    margin: 0 auto;
    padding: .9rem 1.5rem 0;
    font-size: .85rem;
}

    .breadcrumb ol {
        display: flex;
        gap: .4rem;
        list-style: none;
        margin: 0;
        padding: 0;
        flex-wrap: wrap;
    }

    .breadcrumb li {
        color: var(--muted);
    }

        .breadcrumb li:not(:last-child)::after {
            content: "/";
            margin-left: .4rem;
            color: var(--border);
        }

    .breadcrumb a {
        color: var(--muted);
        font-weight: 600;
    }

        .breadcrumb a:hover {
            color: var(--c-purple);
        }

    .breadcrumb li[aria-current] {
        color: var(--ink);
        font-weight: 600;
    }

/* =========================================================
   Hero & Wheel
   ========================================================= */
.hero {
    padding: 2.5rem 1.5rem 1rem;
}

.hero-inner {
    max-width: 1320px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) 340px;
    grid-template-areas:
        "copy copy copy"
        "actions wheel panel";
    gap: 1.75rem;
    align-items: start;
}

.hero-copy {
    grid-area: copy;
    max-width: 760px;
}

    .hero-copy .eyebrow {
        display: inline-block;
        font-weight: 700;
        font-size: .8rem;
        letter-spacing: .08em;
        text-transform: uppercase;
        color: var(--c-purple);
        margin-bottom: .75rem;
    }

    .hero-copy h1 {
        font-size: clamp(2.4rem, 5vw, 3.6rem);
        font-weight: 800;
        background: linear-gradient(120deg, var(--c-red), var(--c-purple) 55%, var(--c-blue));
        -webkit-background-clip: text;
        background-clip: text;
        color: transparent;
    }

    .hero-copy p {
        font-size: 1.1rem;
        max-width: 56ch;
    }

.floating-actions {
    grid-area: actions;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    position: sticky;
    top: 6rem;
}

.fab {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--ink-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform .15s ease, color .15s ease, box-shadow .15s ease;
}

    .fab:hover {
        transform: translateY(-2px) scale(1.05);
        color: var(--c-purple);
        box-shadow: var(--shadow-md);
    }

    .fab[aria-pressed="false"] {
        color: var(--muted);
        opacity: .6;
    }

.wheel-stage {
    grid-area: wheel;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.wheel-wrap {
    position: relative;
    width: min(100%, 480px);
    aspect-ratio: 1 / 1;
    margin-inline: auto;
}

.wheel-glow {
    position: absolute;
    inset: -6%;
    border-radius: 50%;
    background: var(--gradient-rainbow);
    filter: blur(38px);
    opacity: .35;
    z-index: 0;
    animation: glow-pulse 6s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% {
        opacity: .25;
        transform: scale(1);
    }

    50% {
        opacity: .45;
        transform: scale(1.04);
    }
}

.wheel-svg {
    position: relative;
    z-index: 1;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--bg);
    box-shadow: var(--shadow-lg), 0 0 0 8px var(--bg), 0 0 0 9px var(--border);
    transition: transform 4s var(--ease-spin);
    transform: rotate(0deg);
}

    .wheel-svg.is-spinning {
        cursor: progress;
    }

    .wheel-svg .segment-label {
        font-family: var(--font-display);
        font-weight: 700;
        fill: #fff;
        paint-order: stroke;
        stroke: rgba(0,0,0,.18);
        stroke-width: 2px;
        pointer-events: none;
    }

    .wheel-svg .segment-hex {
        font-family: var(--font-body);
        font-weight: 500;
        fill: rgba(255,255,255,.85);
        pointer-events: none;
    }

    .wheel-svg .segment-path {
        cursor: pointer;
        transition: filter .15s ease;
    }

        .wheel-svg .segment-path:hover {
            filter: brightness(1.08) saturate(1.1);
        }

.wheel-pointer {
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 3;
    color: var(--ink);
    filter: drop-shadow(0 4px 8px rgba(26,27,37,.25));
}

    .wheel-pointer svg {
        fill: var(--ink);
    }

.spin-hub {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    width: 22%;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
    border: 4px solid var(--bg);
    background: linear-gradient(135deg, var(--c-purple), var(--c-pink));
    color: #fff;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: clamp(.8rem, 2.4vw, 1.15rem);
    letter-spacing: .08em;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}

    .spin-hub:hover {
        transform: translate(-50%, -50%) scale(1.06);
        box-shadow: var(--shadow-lg);
        filter: saturate(1.2);
    }

    .spin-hub:active {
        transform: translate(-50%, -50%) scale(.97);
    }

    .spin-hub:disabled {
        cursor: progress;
        opacity: .85;
    }

.wheel-controls {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.wheel-controls-secondary {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .6rem;
}

/* =========================================================
   Control panel
   ========================================================= */
.control-panel {
    grid-area: panel;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(16px);
    box-shadow: var(--shadow-md);
    padding: 1.1rem;
    position: sticky;
    top: 6rem;
    max-height: calc(100vh - 8rem);
    display: flex;
    flex-direction: column;
}

.panel-tabs {
    display: flex;
    gap: .35rem;
    background: var(--surface-alt);
    border-radius: var(--radius-sm);
    padding: .25rem;
    margin-bottom: 1rem;
}

.panel-tab {
    flex: 1;
    border: none;
    background: transparent;
    padding: .55rem .5rem;
    border-radius: 8px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: .9rem;
    color: var(--muted);
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, box-shadow .15s ease;
}

    .panel-tab.is-active {
        background: var(--bg);
        color: var(--ink);
        box-shadow: var(--shadow-sm);
    }

.panel-content {
    overflow-y: auto;
    padding-right: .25rem;
}

    .panel-content h2 {
        font-size: .85rem;
        text-transform: uppercase;
        letter-spacing: .06em;
        color: var(--muted);
        margin: 1.1rem 0 .6rem;
    }

        .panel-content h2:first-child {
            margin-top: 0;
        }

.search-box {
    display: flex;
    align-items: center;
    gap: .5rem;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .55rem .75rem;
    color: var(--muted);
    margin-bottom: .75rem;
}

    .search-box input {
        border: none;
        background: transparent;
        outline: none;
        font: inherit;
        color: var(--ink);
        width: 100%;
    }

.add-color-form {
    display: grid;
    grid-template-columns: auto 1fr auto auto;
    gap: .4rem;
    margin-bottom: .6rem;
}

    .add-color-form input[type="text"] {
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        padding: .5rem .6rem;
        font: inherit;
        background: var(--bg);
        color: var(--ink);
        min-width: 0;
    }

    .add-color-form input[type="color"] {
        width: 40px;
        height: 40px;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        padding: 2px;
        background: var(--bg);
        cursor: pointer;
    }

#add-color-hexcode {
    width: 78px;
}

.import-box {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: .5rem .75rem;
    margin-bottom: .9rem;
    background: var(--surface-alt);
}

    .import-box summary {
        cursor: pointer;
        font-weight: 600;
        font-size: .9rem;
    }

    .import-box textarea {
        width: 100%;
        margin: .6rem 0;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
        font: inherit;
        padding: .5rem;
        resize: vertical;
        background: var(--bg);
        color: var(--ink);
    }

    .import-box .hint {
        font-size: .8rem;
        margin: .5rem 0 0;
        color: var(--muted);
    }

.color-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

    .color-list li {
        display: grid;
        grid-template-columns: auto auto 1fr auto auto auto;
        align-items: center;
        gap: .55rem;
        padding: .45rem .5rem;
        border-radius: var(--radius-sm);
        border: 1px solid var(--border);
        background: var(--bg);
    }

        .color-list li.is-hidden {
            opacity: .45;
        }

    .color-list .drag-handle {
        cursor: grab;
        color: var(--muted);
        display: flex;
        gap: 2px;
    }

    .color-list .swatch {
        width: 26px;
        height: 26px;
        border-radius: 50%;
        border: 1px solid var(--border);
        flex-shrink: 0;
    }

    .color-list .meta {
        display: flex;
        flex-direction: column;
        min-width: 0;
    }

        .color-list .meta input[type="text"] {
            border: none;
            background: transparent;
            font: inherit;
            font-weight: 600;
            color: var(--ink);
            padding: 0;
            width: 100%;
        }

        .color-list .meta .hex {
            font-size: .75rem;
            color: var(--muted);
        }

    .color-list button.icon-btn {
        border: none;
        background: transparent;
        cursor: pointer;
        color: var(--muted);
        width: 28px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 6px;
    }

        .color-list button.icon-btn:hover {
            background: var(--surface-alt);
            color: var(--ink);
        }

.empty-state {
    text-align: center;
    color: var(--muted);
    font-size: .9rem;
    padding: 1.5rem 0;
}

/* Results tab */
.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: .5rem;
}

    .results-header h2 {
        margin: 0;
    }

.results-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: .4rem;
}

    .results-list li {
        display: flex;
        align-items: center;
        gap: .6rem;
        padding: .5rem .6rem;
        border: 1px solid var(--border);
        border-radius: var(--radius-sm);
    }

    .results-list .swatch {
        width: 24px;
        height: 24px;
        border-radius: 50%;
        border: 1px solid var(--border);
        flex-shrink: 0;
    }

    .results-list .result-meta {
        display: flex;
        flex-direction: column;
    }

        .results-list .result-meta strong {
            font-size: .9rem;
        }

        .results-list .result-meta span {
            font-size: .75rem;
            color: var(--muted);
        }

    .results-list time {
        margin-left: auto;
        font-size: .75rem;
        color: var(--muted);
    }

.export-row {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-top: 1rem;
}

/* Settings tab */
.field-row {
    display: flex;
    flex-direction: column;
    gap: .35rem;
    margin-bottom: .85rem;
    font-size: .9rem;
    font-weight: 600;
}

    .field-row span {
        display: flex;
        justify-content: space-between;
        color: var(--ink-soft);
    }

    .field-row em {
        color: var(--c-purple);
        font-style: normal;
    }

    .field-row input[type="range"] {
        width: 100%;
        accent-color: var(--c-purple);
    }

.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: .5rem 0;
    font-size: .9rem;
    font-weight: 500;
    color: var(--ink-soft);
    border-bottom: 1px solid var(--border);
}

    .toggle-row:last-of-type {
        border-bottom: none;
    }

    .toggle-row input[type="checkbox"] {
        width: 40px;
        height: 22px;
        appearance: none;
        -webkit-appearance: none;
        background: var(--surface-alt);
        border: 1px solid var(--border);
        border-radius: 999px;
        position: relative;
        cursor: pointer;
        transition: background-color .15s ease;
        flex-shrink: 0;
    }

        .toggle-row input[type="checkbox"]::after {
            content: "";
            position: absolute;
            top: 2px;
            left: 2px;
            width: 16px;
            height: 16px;
            border-radius: 50%;
            background: #fff;
            box-shadow: var(--shadow-sm);
            transition: transform .15s ease;
        }

        .toggle-row input[type="checkbox"]:checked {
            background: linear-gradient(135deg, var(--c-purple), var(--c-blue));
            border-color: transparent;
        }

            .toggle-row input[type="checkbox"]:checked::after {
                transform: translateX(18px);
            }

/* =========================================================
   Winner modal
   ========================================================= */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: rgba(20, 21, 31, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    backdrop-filter: blur(4px);
}

    .modal-overlay[hidden] {
        display: none;
    }

.modal-card {
    position: relative;
    background: var(--bg);
    border-radius: var(--radius-lg);
    padding: 2.5rem 2rem 2rem;
    max-width: 420px;
    width: 100%;
    text-align: center;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    animation: modal-pop .35s var(--ease-spin);
}

@keyframes modal-pop {
    from {
        opacity: 0;
        transform: scale(.92) translateY(12px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

#confetti-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.modal-close {
    position: absolute;
    top: .85rem;
    right: .85rem;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--surface-alt);
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    color: var(--muted);
    z-index: 1;
}

    .modal-close:hover {
        color: var(--ink);
    }

.modal-eyebrow {
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    font-size: .8rem;
    color: var(--c-purple);
    margin-bottom: .75rem;
    position: relative;
    z-index: 1;
}

.winner-swatch {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    border: 6px solid var(--bg);
    box-shadow: var(--shadow-md);
    position: relative;
    z-index: 1;
}

.modal-card h2 {
    position: relative;
    z-index: 1;
    font-size: 1.6rem;
}

.winner-meta {
    display: flex;
    justify-content: center;
    gap: 1.25rem;
    margin: .75rem 0 1.5rem;
    position: relative;
    z-index: 1;
}

    .winner-meta div {
        display: flex;
        flex-direction: column;
    }

    .winner-meta dt {
        font-size: .7rem;
        text-transform: uppercase;
        letter-spacing: .06em;
        color: var(--muted);
    }

    .winner-meta dd {
        margin: 0;
        font-weight: 700;
        font-family: var(--font-display);
    }

.modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    justify-content: center;
    position: relative;
    z-index: 1;
}

/* =========================================================
   Content sections
   ========================================================= */
.section {
    padding: 4rem 1.5rem;
}

.section-alt {
    background: var(--surface);
}

.section-inner {
    max-width: 1100px;
    margin: 0 auto;
}

    .section-inner h2 {
        font-size: clamp(1.5rem, 3vw, 2.1rem);
    }

.section-lead {
    max-width: 64ch;
    font-size: 1.05rem;
    margin-bottom: 2rem;
}

.why-grid, .use-case-grid, .category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.25rem;
}

.why-card, .use-case-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    transition: transform .15s ease, box-shadow .15s ease;
}

    .why-card:hover, .use-case-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-md);
    }

    .why-card h3, .use-case-card h3 {
        font-size: 1.05rem;
    }

    .why-card p, .use-case-card p {
        margin: 0;
        font-size: .92rem;
    }

.why-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    font-size: 1.25rem;
    margin-bottom: .85rem;
}

.category-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    text-align: left;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
    font-family: inherit;
}

    .category-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-md);
    }

    .category-card h3 {
        font-size: 1rem;
        margin-bottom: .15rem;
    }

    .category-card p {
        margin: 0;
        font-size: .85rem;
    }

.swatch-row {
    display: flex;
    gap: .35rem;
    margin-bottom: .85rem;
}

    .swatch-row span {
        width: 28px;
        height: 28px;
        border-radius: 50%;
        border: 1px solid var(--border);
    }

.related-slider {
    display: flex;
    gap: 1.25rem;
    overflow-x: auto;
    padding-bottom: .75rem;
    scroll-snap-type: x mandatory;
}

.related-card {
    flex: 0 0 200px;
    scroll-snap-align: start;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--bg);
    transition: transform .15s ease, box-shadow .15s ease;
}

    .related-card:hover {
        transform: translateY(-4px);
        box-shadow: var(--shadow-md);
    }

.related-thumb {
    display: block;
    width: 100%;
    height: 120px;
}

.related-card h3 {
    font-size: .95rem;
    padding: .75rem;
    color: var(--ink);
}

/* Palette generator */
.palette-tool {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
}

.palette-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    margin-bottom: 1rem;
}

    .palette-controls label {
        font-weight: 600;
    }

    .palette-controls input[type="color"] {
        width: 44px;
        height: 44px;
        border-radius: var(--radius-sm);
        border: 1px solid var(--border);
        padding: 2px;
        cursor: pointer;
        background: var(--bg);
    }

.palette-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
}

.palette-output {
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    min-height: 64px;
}

.palette-swatch {
    flex: 1 1 100px;
    border-radius: var(--radius-sm);
    padding: .75rem;
    color: #fff;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: .85rem;
    display: flex;
    flex-direction: column;
    gap: .25rem;
    cursor: pointer;
    border: none;
    text-align: left;
    min-height: 90px;
    justify-content: flex-end;
}

    .palette-swatch small {
        font-weight: 500;
        opacity: .85;
        font-size: .75rem;
    }

/* SEO content */
.seo-content h2:not(:first-child) {
    margin-top: 2.25rem;
}

.seo-content p {
    max-width: 70ch;
}

/* FAQ */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.faq-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    background: var(--bg);
}

    .faq-item summary {
        cursor: pointer;
        font-family: var(--font-display);
        font-weight: 600;
        list-style: none;
        display: flex;
        align-items: center;
        justify-content: space-between;
    }

        .faq-item summary::after {
            content: "+";
            font-size: 1.3rem;
            color: var(--c-purple);
        }

    .faq-item[open] summary::after {
        content: "\2212";
    }

    .faq-item p {
        margin-top: .75rem;
        margin-bottom: 0;
    }

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    margin-top: 2rem;
}

.footer-inner {
    max-width: 1320px;
    margin: 0 auto;
    padding: 3rem 1.5rem;
    display: grid;
    grid-template-columns: 1.4fr 2fr;
    gap: 2rem;
}

.footer-brand p {
    max-width: 32ch;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

    .footer-links h3 {
        font-size: .85rem;
        text-transform: uppercase;
        letter-spacing: .06em;
        color: var(--muted);
    }

    .footer-links a {
        display: block;
        color: var(--ink-soft);
        padding: .3rem 0;
        font-size: .9rem;
    }

        .footer-links a:hover {
            color: var(--c-purple);
        }

.footer-bottom {
    border-top: 1px solid var(--border);
    padding: 1rem 1.5rem;
    text-align: center;
}

    .footer-bottom p {
        margin: 0;
        font-size: .85rem;
        color: var(--muted);
    }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1100px) {
    .hero-inner {
        grid-template-columns: 1fr;
        grid-template-areas:
            "copy"
            "wheel"
            "panel"
            "actions";
    }

    .floating-actions {
        flex-direction: row;
        position: static;
        justify-content: center;
    }

    .control-panel {
        position: static;
        max-height: none;
    }

    .footer-inner {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .primary-nav {
        display: none;
    }

    .menu-toggle {
        display: flex;
    }

    .header-actions .btn-ghost span {
        display: none;
    }

    .footer-links {
        grid-template-columns: 1fr 1fr;
    }

    .add-color-form {
        grid-template-columns: auto 1fr;
    }

    #add-color-hexcode {
        grid-column: span 2;
        width: 100%;
    }

    .add-color-form .btn {
        grid-column: span 2;
        justify-content: center;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .wheel-glow {
        animation: none;
    }

    .wheel-svg {
        transition: none;
    }

    .modal-card {
        animation: none;
    }
}
