div#palette-input {
    margin: auto;
    max-width: 600px;
}

div#palette-label-row {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

div#palette-label-row label {
    font-weight: bold;
    font-size: 1rem;
}

/* URI HELP POPOVER: shows while the icon or popover is hovered, or the icon has focus (click/tap) */

div#palette-explorer button#palette-info-icon {
    width: 16px;
    height: 16px;
    padding: 0;
    border: 1.5px solid #77bdee;
    border-radius: 50%;
    background: white;
    color: #77bdee;
    font: bold 10px/1 serif;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* flex wrapper so the icon centers on the label line instead of sitting on the text baseline */
span#palette-uri-help-wrap { display: flex; align-items: center; }

div#palette-uri-help {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 10;
    width: 100%;
    box-sizing: border-box;
    margin-top: 6px;
    padding: 14px 18px;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    font-size: 0.875rem;
    text-align: left;
}

/* invisible strip over the gap so the mouse can move from the icon onto the popover */
div#palette-uri-help::before {
    content: "";
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 8px;
}

span#palette-uri-help-wrap:hover div#palette-uri-help,
span#palette-uri-help-wrap:focus-within div#palette-uri-help { display: block; }

div#palette-uri-help ol { padding-left: 18px; margin: 8px 0; }
div#palette-uri-help li { margin-bottom: 6px; }
div#palette-uri-help p { margin: 8px 0; }

/* the site's `.main p` sets 17px; let paragraphs here use the size of their container */
div#palette-explorer p { font-size: inherit; }
div#palette-uri-help small { display: block; margin-bottom: 12px; color: #999; font-size: 0.8125rem; }

div#palette-uri-help pre {
    background: #f4f4f4;
    border-radius: 4px;
    padding: 8px 12px;
    margin: 8px 0 12px;
    font-size: 0.8rem;
    white-space: pre;
    overflow-x: auto;
}

div#palette-uri-help pre .comment { color: #999; }

textarea#palette-uris {
    width: 100%;
    box-sizing: border-box;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-family: monospace;
    font-size: 0.8rem;
    line-height: 1.5;
    resize: vertical;
}

div#palette-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 10px 0;
    font-size: 1rem;
}

div#palette-explorer button,
div#palette-explorer a.button {
    padding: 8px 16px;
    border: none;
    border-radius: 30px;
    color: white;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    font-size: 0.875rem;
}

div#palette-explorer .primary { background-color: #77bdee; }
div#palette-explorer .spotify { background-color: #20D760; }
div#palette-explorer .note { color: #777; }

div#palette-explorer .callout {
    background-color: #f2f8fc;
    border: 1px solid #dbe9f3;
    border-radius: 8px;
    padding: 10px 16px;
    font-size: 0.875rem;
    margin-bottom: 10px;
}

details#palette-lookup summary,
details#palette-configure summary { cursor: pointer; }
span#palette-lookup-summary { color: #777; margin-left: 4px; }

ul#palette-lookup-list {
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
    font-family: monospace;
    font-size: 0.8125rem;
}

ul#palette-lookup-list li.ok::before { content: "✓ "; color: #20D760; }
ul#palette-lookup-list li.failed::before { content: "✗ "; color: #d10c10; }
ul#palette-lookup-list span.reason { color: #d10c10; }

/* GRID */

div#palette-explorer { position: relative; }

/* shrink to the widest row and center, so short rows don't hug the left edge */
div#palette-grid { width: fit-content; margin: 20px auto 10px; }

div.palette-row {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
}

div.palette-swatch, img.palette-cover {
    width: 80px;
    height: 80px;
    flex-shrink: 0;
    margin: 0;
}

/* swatch stretches to the full height of an expanded row; label fades in on hover */
div.palette-swatch {
    height: auto;
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-family: monospace;
    font-size: 0.75rem;
}

div.palette-swatch span { opacity: 0; transition: opacity 0.15s; }
div.palette-swatch:hover span { opacity: 1; }

div.palette-overflow { margin-top: 14px; }

div.palette-overflow-label {
    margin-bottom: 6px;
    font-size: 0.8125rem;
    font-weight: 600;
}

div.palette-overflow-label span { color: #666; font-weight: normal; }

div.palette-row-covers {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

img.palette-cover { cursor: pointer; }
img.palette-cover:hover { outline: 2px solid #77bdee; outline-offset: -2px; }

a.palette-more, a#palette-everything-else, a#palette-reset {
    color: #77bdee;
    cursor: pointer;
    font-size: 0.9375rem;
}

a.palette-more { align-self: center; margin-left: 4px; white-space: nowrap; }

a#palette-everything-else {
    display: block;
    text-align: center;
    margin-bottom: 20px;
}

/* mobile: smaller tiles (keep in sync with coversPerRow in grid.js) */
@media (max-width: 600px) {
    div.palette-swatch, img.palette-cover { width: 48px; height: 48px; min-height: 48px; }
}

/* CONFIGURE PANEL */

details#palette-configure {
    font-size: 1rem;
    max-width: 600px;
    margin: 0 auto;
    box-sizing: border-box;
}

details#palette-configure .section {
    border-top: 1px solid #dbe9f3;
    margin-top: 12px;
    padding-top: 4px;
}

details#palette-configure h4 {
    text-align: left;  /* site headings are centered */
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #77bdee;
    margin: 8px 0;
}

details#palette-configure label { display: block; margin-bottom: 4px; }
details#palette-configure small { color: #888; font-size: 0.8125rem; }

div.segmented {
    display: inline-flex;
    border: 1px solid #ccc;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 4px;
}

div#palette-explorer div.segmented button {
    border-radius: 0;
    background: white;
    color: #333;
}

div#palette-explorer div.segmented button.selected { background: #20D760; color: white; }

div.sliders {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px 24px;
}

div.slider label { display: flex !important; justify-content: space-between; }
div.slider input { width: 100%; accent-color: #77bdee; }
div.slider small, small.segmented-note { display: block; margin-bottom: 10px; }

p.apply-note {
    background: #fff8e1;
    border-radius: 6px;
    padding: 8px 11px;
    margin: 10px 0 4px;
}

label.toggle { display: flex !important; align-items: flex-start; gap: 10px; margin-top: 12px; }
label.toggle input { accent-color: #77bdee; margin-top: 3px; }

a#palette-reset { display: inline-block; margin-top: 14px; }

/* PALETTE BAR (hover card + methodology figure; heights set per use) */

div.palette-bar, div.palette-shares { display: flex; gap: 2px; }
div.palette-bar { border-radius: 6px; overflow: hidden; }

div.palette-bar div {
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: monospace;
    font-size: 0.8125rem;
    overflow: hidden;
}

div.palette-shares div {
    margin-top: 4px;
    text-align: center;
    color: #777;
    font-family: monospace;
    font-size: 0.75rem;
    white-space: nowrap;
}

/* HOVER CARD */

div#palette-hover-card {
    position: absolute;
    z-index: 10;
    width: 280px;
    padding: 13px;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    font-size: 0.875rem;
}

div#palette-hover-card .album {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

/* override the site's post styles (centered images, inherited text alignment) */
div#palette-hover-card { text-align: left; }
img#palette-hover-cover { width: 60px; height: 60px; margin: 0; flex-shrink: 0; }
div#palette-hover-title { font-weight: bold; }

div#palette-hover-bar { margin-bottom: 10px; }
div#palette-hover-bar div.palette-bar { height: 28px; border-radius: 4px; }

a#palette-hover-link { color: #77bdee; font-size: 0.8125rem; text-decoration: none; }

#palette-explorer .hidden { display: none; }

div#palette-uri-help code {
    background: #f4f4f4;
    border-radius: 3px;
    padding: 1px 4px;
    font-size: 0.95em;
}

/* one line per entry: the text box scrolls sideways (wrap="off"), lookup lines truncate */
textarea#palette-uris { overflow-x: auto; white-space: pre; }

ul#palette-lookup-list li {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* METHODOLOGY FIGURES */

div.palette-figure {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px 20px;
    max-width: 640px;
    margin: 24px auto;
    text-align: left;
}

div.palette-figure img.cover { width: 140px; height: 140px; margin: 0; flex-shrink: 0; }
div.palette-figure div.breakdown { flex: 1; min-width: 240px; }
div.palette-figure div.title { font-weight: bold; margin-bottom: 8px; }

div.palette-figure div.palette-bar { height: 72px; }
