* {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
}

body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #0b0c0f;
    color: #f4f4f5;
}

button,
input {
    font: inherit;
}

button {
    cursor: pointer;
}

.site-header {
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    border-bottom: 1px solid #24262d;
    background: rgba(11, 12, 15, .92);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(14px);
}

.brand {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -.04em;
}

.site-header nav {
    display: flex;
    gap: 24px;
}

.site-header a {
    color: #a5a7ad;
    text-decoration: none;
}

.site-header a:hover {
    color: #fff;
}

.layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 24px;
    width: min(1500px, calc(100% - 40px));
    margin: 24px auto 60px;
}

.workspace {
    display: grid;
    gap: 24px;
}

.sidebar {
    display: grid;
    gap: 24px;
    align-content: start;
    position: sticky;
    top: 96px;
    height: fit-content;
}

.panel {
    background: #121419;
    border: 1px solid #252831;
    border-radius: 20px;
    padding: 22px;
    box-shadow: 0 18px 60px rgba(0,0,0,.18);
}

.panel-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 22px;
}

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

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

.theme-toggle {
    display: inline-flex;
    padding: 4px;
    border: 1px solid #30343e;
    border-radius: 12px;
    background: #0d0f13;
}

.theme-btn {
    border: 0;
    background: transparent;
    color: #8e929d;
    border-radius: 8px;
    padding: 7px 10px;
    font-weight: 700;
    font-size: .82rem;
}

.theme-btn:hover {
    color: #fff;
}

.theme-btn.active {
    background: #252933;
    color: #fff;
    box-shadow: 0 2px 10px rgba(0,0,0,.25);
}

.eyebrow {
    color: #777b86;
    font-size: .72rem;
    letter-spacing: .16em;
    font-weight: 800;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2 {
    margin-bottom: 0;
}

.panel-heading h1,
.panel-heading h2 {
    margin-top: 5px;
}

.panel-heading button,
.hex-row button,
.favorite-btn,
#copyCss {
    border: 1px solid #30343e;
    background: #1a1d24;
    color: #fff;
    border-radius: 12px;
    padding: 10px 14px;
}

.theme-toggle .theme-btn {
    border: 0;
    background: transparent;
    padding: 7px 10px;
}

.theme-toggle .theme-btn.active {
    background: #252933;
}

.picker-grid {
    display: grid;
    grid-template-columns: minmax(260px, 1fr) minmax(280px, .7fr);
    gap: 24px;
}

.color-preview {
    min-height: 360px;
    border-radius: 18px;
    background: #b11226;
    overflow: hidden;
    position: relative;
    border: 1px solid rgba(255,255,255,.08);
}

#colorPicker {
    width: 100%;
    height: 100%;
    min-height: 360px;
    opacity: 0;
    cursor: crosshair;
}

.color-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.color-info label {
    color: #848894;
    font-size: .75rem;
    letter-spacing: .14em;
    font-weight: 800;
    margin-bottom: 8px;
}

.hex-row {
    display: flex;
    gap: 10px;
}

#hexInput {
    flex: 1;
    background: #0c0e12;
    border: 1px solid #2b2e36;
    border-radius: 12px;
    color: #fff;
    padding: 14px;
    font-size: 1.15rem;
    font-weight: 700;
    text-transform: uppercase;
}

.code-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin: 16px 0;
}

.code-grid div {
    background: #0d0f13;
    border: 1px solid #252831;
    border-radius: 14px;
    padding: 14px;
}

.code-grid span,
.scheme-item small,
.color-row small {
    display: block;
    color: #818590;
    font-size: .76rem;
    margin-bottom: 5px;
}

.favorite-btn {
    width: 100%;
    margin-top: 4px;
}

.scheme-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 22px;
}

.scheme-list {
    display: grid;
    gap: 10px;
}

.scheme-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border: 1px solid #272a32;
    border-radius: 12px;
    background: #0d0f13;
    cursor: pointer;
    transition:
        transform .15s ease,
        border-color .15s ease,
        background .15s ease;
}

.scheme-item:hover {
    transform: translateY(-2px);
    border-color: #4a4f5c;
    background: #14171d;
}

.swatch {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.1);
    flex: 0 0 auto;
}

.site-preview {
    min-height: 420px;
    border-radius: 18px;
    overflow: hidden;
    padding: 24px;
    transition: background .2s, color .2s, border-color .2s;
}

.preview-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 70px;
}

.preview-hero {
    max-width: 560px;
}

.preview-hero h3 {
    font-size: clamp(2rem, 4vw, 3.8rem);
    letter-spacing: -.05em;
    line-height: .98;
    margin-bottom: 18px;
}

.preview-hero p {
    opacity: .75;
    max-width: 520px;
    line-height: 1.6;
}

.preview-hero button {
    border: 0;
    border-radius: 12px;
    padding: 13px 18px;
    font-weight: 800;
    margin-top: 8px;
    transition: background .15s ease;
}

.preview-kicker {
    font-size: .72rem;
    letter-spacing: .16em;
    font-weight: 900;
}

.preview-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 40px;
}

.preview-cards article {
    padding: 18px;
    border-radius: 14px;
    border: 1px solid;
}

.preview-cards p {
    margin: 8px 0 0;
    opacity: .7;
}

.color-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid #252831;
}

.color-row:last-child {
    border-bottom: 0;
}

.color-row > span {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,.1);
}

.muted {
    color: #828691;
    line-height: 1.5;
    margin-bottom: 0;
}

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

    .sidebar {
        position: static;
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 760px) {
    .site-header {
        padding: 0 16px;
    }

    .site-header nav {
        display: none;
    }

    .layout {
        width: min(100% - 24px, 1500px);
        margin-top: 12px;
    }

    .picker-grid,
    .scheme-layout {
        grid-template-columns: 1fr;
    }

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

    .scheme-heading {
        flex-direction: column;
    }

    .scheme-actions {
        width: 100%;
        justify-content: space-between;
    }

    .color-preview,
    #colorPicker {
        min-height: 280px;
    }

    .preview-cards {
        grid-template-columns: 1fr;
    }
}


/* ColorStack v5 */
.scheme-item {
    cursor: default;
}

.scheme-item:hover {
    transform: none;
}

.scheme-item .swatch {
    cursor: copy;
}

.scheme-item [data-value] {
    cursor: text;
    display: inline-block;
    min-width: 72px;
    border-radius: 6px;
    outline: none;
}

.scheme-item [data-value]:focus {
    background: #1b1f27;
    box-shadow: 0 0 0 1px #4a4f5c;
    padding: 2px 5px;
    margin: -2px -5px;
}

.scheme-copy-cta {
    grid-column: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 18px;
    border: 1px solid #272a32;
    border-radius: 14px;
    background: #0d0f13;
    color: #d9dbe1;
    font-weight: 650;
}

.scheme-copy-cta #copyCss {
    flex: 0 0 auto;
    border: 1px solid #30343e;
    background: #1a1d24;
    color: #fff;
    border-radius: 12px;
    padding: 10px 14px;
}

@media (max-width: 760px) {
    .scheme-copy-cta {
        grid-column: 1;
        flex-direction: column;
        align-items: stretch;
    }

    .scheme-copy-cta #copyCss {
        width: 100%;
    }
}


/* ColorStack v6 CSS export choices */
.scheme-copy-cta {
    grid-column: 2;
    display: block;
}

.copy-question {
    display: block;
    margin-bottom: 10px;
    color: #d9dbe1;
}

.css-export-choices {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

.css-export-link {
    position: relative;
    appearance: none;
    border: 0;
    padding: 2px 0;
    background: transparent;
    color: #c8cbd3;
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-decoration-color: #555b68;
    text-underline-offset: 4px;
}

.css-export-link strong {
    color: #fff;
}

.css-export-link:hover,
.css-export-link:focus-visible {
    color: #fff;
    text-decoration-color: currentColor;
    outline: none;
}

.export-divider {
    color: #555a65;
}

.css-tooltip {
    position: absolute;
    z-index: 100;
    left: 50%;
    bottom: calc(100% + 12px);
    width: min(320px, 75vw);
    padding: 10px 12px;
    border: 1px solid #343844;
    border-radius: 10px;
    background: #080a0e;
    color: #e7e8eb;
    box-shadow: 0 12px 32px rgba(0,0,0,.38);
    font-size: .78rem;
    line-height: 1.45;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(-50%, 5px);
    transition: opacity .14s ease, transform .14s ease, visibility .14s ease;
}

.css-tooltip::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: #343844;
}

.css-export-link:hover .css-tooltip,
.css-export-link:focus-visible .css-tooltip,
.css-export-link:focus .css-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
}

.copy-status {
    display: block;
    min-height: 1.2em;
    margin-top: 9px;
    color: #aeb2bc;
    font-size: .78rem;
}

@media (max-width: 760px) {
    .css-export-choices {
        align-items: flex-start;
        flex-direction: column;
    }

    .export-divider {
        display: none;
    }

    .css-export-link {
        text-align: left;
    }

    .css-tooltip {
        left: 0;
        transform: translate(0, 5px);
    }

    .css-export-link:hover .css-tooltip,
    .css-export-link:focus-visible .css-tooltip,
    .css-export-link:focus .css-tooltip {
        transform: translate(0, 0);
    }

    .css-tooltip::after {
        left: 24px;
    }
}


/* ColorStack v7 accessibility checker */
.access-intro {
    color: #9da1ac;
    line-height: 1.6;
    margin: -6px 0 18px;
}

.contrast-list {
    display: grid;
    gap: 8px;
}

.contrast-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 90px 82px;
    align-items: center;
    gap: 14px;
    padding: 13px 14px;
    background: #0d0f13;
    border: 1px solid #272a32;
    border-radius: 12px;
}

.contrast-row small {
    display: block;
    color: #777c87;
    margin-top: 3px;
    font-size: .74rem;
}

.contrast-ratio {
    text-align: right;
    font-variant-numeric: tabular-nums;
    color: #d6d8dd;
    font-weight: 750;
}

.contrast-badge {
    justify-self: end;
    min-width: 68px;
    text-align: center;
    padding: 6px 9px;
    border-radius: 999px;
    border: 1px solid #3a3e48;
    background: #181b21;
    font-size: .74rem;
    font-weight: 900;
    letter-spacing: .04em;
}

.contrast-badge.pass-aaa {
    border-color: #42684e;
    background: #17251b;
}

.contrast-badge.pass-aa {
    border-color: #6d643d;
    background: #282414;
}

.contrast-badge.fail {
    border-color: #713f45;
    background: #291619;
}

.contrast-help {
    margin-top: 16px;
    border-top: 1px solid #272a32;
    padding-top: 14px;
    color: #a7aab3;
}

.contrast-help summary {
    cursor: pointer;
    color: #e1e2e6;
    font-weight: 750;
}

.contrast-help p {
    margin: 10px 0 0;
    max-width: 850px;
    line-height: 1.65;
    font-size: .88rem;
}

@media (max-width: 620px) {
    .contrast-row {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .contrast-ratio {
        grid-column: 1;
        text-align: left;
        font-size: .8rem;
    }

    .contrast-badge {
        grid-column: 2;
        grid-row: 1 / span 2;
    }
}


/* ColorStack v8 contrast repair + undo */
.contrast-row {
    grid-template-columns: minmax(0, 1fr) 90px 82px auto;
}

.contrast-actions {
    display: none;
    align-items: center;
    gap: 7px;
    justify-self: end;
}

.contrast-row.is-fail .contrast-actions {
    display: flex;
}

.contrast-actions button {
    border: 1px solid #3b404b;
    background: #171a20;
    color: #e8e9ec;
    border-radius: 8px;
    padding: 6px 9px;
    font-size: .68rem;
    font-weight: 900;
    letter-spacing: .035em;
    cursor: pointer;
}

.contrast-actions button:hover,
.contrast-actions button:focus-visible {
    border-color: #666d7b;
    background: #20242c;
    outline: none;
}

.contrast-actions .fix-contrast {
    border-color: #42684e;
}

.contrast-actions .undo-change {
    border-color: #6d5b3d;
}

.contrast-actions .undo-change:disabled {
    opacity: .38;
    cursor: not-allowed;
}

@media (max-width: 850px) {
    .contrast-row {
        grid-template-columns: minmax(0, 1fr) auto auto;
    }

    .contrast-actions {
        grid-column: 1 / -1;
        justify-self: start;
    }
}

@media (max-width: 620px) {
    .contrast-row {
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .contrast-ratio {
        grid-column: 1;
    }

    .contrast-badge {
        grid-column: 2;
        grid-row: 1 / span 2;
    }

    .contrast-actions {
        grid-column: 1 / -1;
        grid-row: auto;
    }
}
