/* SPDX-License-Identifier: MIT — c00d Directory
   Dark listing layout: category boxes containing ranked rows.
   Rebrand by editing the variables below. */

:root {
    --bg: #0b0b0b;
    --panel: #181818;
    --panel-head: #1a1a1a;
    --panel-hover: #111;
    --line: #444;
    --text: #f0f0f0;
    --text-dim: #bdbdbd;
    --accent: #ffe454;
    --accent-ink: #111;
    --radius: 4px;
    --wrap: 1240px;
    /* form controls — one token per theme instead of a per-input-type list */
    --input-bg: #000;
    --input-bg-disabled: #141414;
    --control-size: 18px;
    --danger: #b3372a;
    --danger-ink: #ff9d92;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

a { color: var(--accent); }
img { max-width: 100%; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 16px; }

/* ------------------------------------------------------------------ header */
.site-header { background: #0f0f0f; border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 16px; padding-top: 12px; padding-bottom: 12px; flex-wrap: wrap; }
.brand { font-size: 19px; font-weight: 700; color: var(--text); text-decoration: none; }
.brand:hover { color: var(--accent); }
.header-search { display: flex; gap: 6px; flex: 1 1 260px; max-width: 460px; }
.header-search input, .page-search input {
    /*flex: 1; min-width: 0;*/ padding: 8px 10px; border: 1px solid var(--line);
    border-radius: var(--radius); background: #000; color: var(--text); font: inherit;
}
.header-search button, .page-search button {
    padding: 8px 14px; border: 0; border-radius: var(--radius);
    background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer;
}
.header-nav { display: flex; gap: 14px; margin-left: auto; }
.header-nav a { color: var(--text-dim); text-decoration: none; font-size: 14px; }
.header-nav a:hover { color: var(--accent); }

main.wrap { padding-top: 22px; padding-bottom: 40px; min-height: 100vh; }

/* ------------------------------------------------------------------ landing */
.landing-header { text-align: center; margin: 10px 0 26px; }
.landing-header h1 { font-size: 32px; margin: 0 0 6px; }
.landing-tagline { margin: 0 0 8px; color: var(--text-dim); font-size: 17px; }
.landing-meta { margin: 0; color: var(--text-dim); font-size: 14px; }

/* --------------------------------------------------------- category boxes */
.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
    gap: 18px;
    align-items: start;
}
.category-box {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
}
.category-box--wide { max-width: 820px; margin: 0 auto; }

.category-header { border-bottom: 1px solid var(--line); background: var(--panel-head); transition: background .25s linear; }
.category-header:hover { background: var(--panel-hover); }
.category-header:hover .category-title a { color: #fff; }
.category-header:hover .category-icon svg { fill: #fff; }

.category-title {
    font-size: 19px; line-height: 1.2; margin: 0; padding: 14px 15px;
    display: flex; align-items: center; justify-content: center; gap: 10px; text-align: center;
}
.category-title a {
    display: flex; align-items: center; gap: 10px;
    color: var(--accent); text-decoration: none; transition: color .25s linear;
}
.category-icon { width: 22px; height: 22px; flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; }
.category-icon svg { width: 100%; height: 100%; fill: var(--accent); transition: fill .25s linear; }
.category-description { margin: 0; padding: 0 15px 12px; color: var(--text-dim); font-size: 13.5px; line-height: 1.4; }

.category-sites { display: flex; flex-direction: column; }

/* ------------------------------------------------------------- site rows */
.site-item { position: relative; border-bottom: 1px solid #333; transition: background .2s linear; }
.site-item:last-of-type { border-bottom: 0; }
.site-item:hover { background: var(--panel-hover); }

.site-name-link {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 9px 14px; text-decoration: none; color: var(--text); font-size: 15px;
}
.site-name-link .left { display: flex; align-items: center; gap: 9px; min-width: 0; }
.site-favicon { width: 24px; height: 24px; flex: 0 0 auto; object-fit: contain; border-radius: 3px; }
.site-favicon--placeholder {
    display: inline-flex; align-items: center; justify-content: center;
    background: #2a2a2a; color: var(--text-dim); font-size: 12px; font-weight: 700;
}
.site-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.site-item:hover .site-name { color: var(--accent); }
.badge-featured {
    flex: 0 0 auto; font-size: 10px; text-transform: uppercase; letter-spacing: .04em;
    padding: 2px 6px; border-radius: 3px; background: var(--accent); color: var(--accent-ink); font-weight: 700;
}

.rating-text { flex: 0 0 auto; display: flex; align-items: baseline; }
.rating-score-value { color: #fff; font-size: 17px; line-height: 1; transition: color .25s linear; }
.rating-score-value .dot { font-size: 9px; }
.rating-score-value .decimal { font-size: 12px; }
.site-item:hover .rating-score-value { color: var(--accent); }

/* Hover description — a fixed floater, as in the reference layout */
.site-description.floater {
    visibility: hidden; opacity: 0; position: fixed; right: 0; bottom: 0; z-index: 1000;
    width: 280px; padding: 14px; background: #000; border: 1px solid var(--line);
    border-right: 0; border-bottom: 0; color: var(--text-dim); font-size: 14px;
    pointer-events: none; transition: opacity .2s linear, visibility .2s linear;
}
.site-item:hover .site-description.floater { visibility: visible; opacity: 1; }
@media (hover: none) {
    .site-description.floater {
        position: static; visibility: visible; opacity: 1; width: auto;
        border: 0; padding: 0 14px 10px; background: none; font-size: 13px;
    }
}

.view-all-link {
    display: block; padding: 11px 14px; text-align: center; text-decoration: none;
    color: var(--accent); font-size: 14px; border-top: 1px solid #333;
}
.view-all-link:hover { background: var(--panel-hover); }
.view-all-link .arrow { display: inline-block; transition: transform .2s linear; }
.view-all-link:hover .arrow { transform: translateX(3px); }

/* ------------------------------------------------------------ page pieces */
.breadcrumbs { color: var(--text-dim); font-size: 13.5px; margin: 0 auto 14px; max-width: 820px; }
.breadcrumbs a { color: var(--text-dim); text-decoration: none; }
.breadcrumbs a:hover { color: var(--accent); }
.breadcrumbs span { margin: 0 6px; opacity: .5; }

.page-head { margin: 0 auto 18px; max-width: 820px; }
.page-head h1 { display: flex; align-items: center; gap: 10px; font-size: 27px; margin: 0 0 6px; }
.page-head-desc { color: var(--text-dim); margin: 0 0 8px; max-width: 70ch; }
.page-search { display: flex; gap: 6px; max-width: 460px; margin: 10px 0; }

.listing-detail { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; max-width: 820px; margin: 0 auto 20px; }
.listing-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.listing-favicon { width: 48px; height: 48px; border-radius: 4px; object-fit: contain; flex: 0 0 auto; }
.listing-head-text h1 { margin: 0; font-size: 25px; }
.listing-host { margin: 2px 0 0; color: var(--text-dim); font-size: 14px; }
.listing-rating { margin-left: auto; text-align: right; }
.listing-rating .rating-score-value { font-size: 27px; color: var(--accent); }
.rating-count { display: block; color: var(--text-dim); font-size: 12px; }
.listing-body { margin: 16px 0; color: var(--text-dim); }
.listing-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0 0; }
.related { margin-top: 24px; }

.btn-primary, .btn-secondary {
    display: inline-block; padding: 9px 16px; border-radius: var(--radius);
    text-decoration: none; font-weight: 600; font-size: 14px; border: 1px solid transparent; cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--line); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }

.pager { display: flex; gap: 6px; justify-content: center; margin: 22px 0; flex-wrap: wrap; }
.pager a, .pager .current, .pager .gap { padding: 6px 11px; border-radius: var(--radius); font-size: 14px; text-decoration: none; }
.pager a { color: var(--text); border: 1px solid var(--line); }
.pager a:hover { border-color: var(--accent); color: var(--accent); }
.pager .current { background: var(--accent); color: var(--accent-ink); font-weight: 600; }
.pager .gap { color: var(--text-dim); }

.flash { padding: 10px 14px; border-radius: var(--radius); margin: 0 0 16px; }
.flash-error { background: #3a1614; color: #ffb4ac; border: 1px solid #6b2a25; }
.flash-success { background: #12301f; color: #a6e9c2; border: 1px solid #245c3c; }
.empty { color: var(--text-dim); padding: 14px; }

/* --------------------------------------------------------------- forms */
.form-card {
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 20px; max-width: 660px;
    /* Centred like every other card in this design — .listing-detail and
       .category-box--wide are both margin:0 auto. Without this the card
       hugs the left of a 1240px wrap. */
    margin-left: auto; margin-right: auto;
}
.form-card.narrow { max-width: 420px; margin: 8vh auto; }
label { display: block; margin-bottom: 14px; font-size: 14px; }
label .req { color: var(--accent); }

/* Text-like controls. Listed by type rather than with a class so add-on
   templates get the same styling without knowing about it. */
input[type=text], input[type=url], input[type=email], input[type=password],
input[type=number], input[type=search], input[type=tel], input[type=date],
textarea, select {
    width: 100%; padding: 8px 10px; margin-top: 5px;
    background: var(--input-bg); color: var(--text);
    border: 1px solid var(--line); border-radius: var(--radius); font: inherit;
    transition: border-color .13s ease, box-shadow .13s ease;
}
input:hover:not(:disabled), textarea:hover:not(:disabled), select:hover:not(:disabled) { border-color: #666; }
input:focus-visible, textarea:focus-visible, select:focus-visible {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 228, 84, .16);
}
input:disabled, textarea:disabled, select:disabled {
    background: var(--input-bg-disabled); color: var(--text-dim); cursor: not-allowed; opacity: .75;
}
input::placeholder, textarea::placeholder { color: var(--text-dim); opacity: .65; }
textarea { min-height: 120px; resize: vertical; }

/* Select — native arrow replaced so it matches across browsers. The chevron is
   a data URI, so it is restated in the light theme block (an image cannot use
   currentColor). */
select {
    appearance: none; -webkit-appearance: none;
    padding-right: 32px; cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23bdbdbd'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 8px center; background-size: 16px;
}
select[multiple] { background-image: none; padding-right: 10px; min-height: 96px; }

/* Checkbox and radio — drawn with a pseudo-element so the mark uses
   var(--accent-ink) and follows the theme with no second rule. */
input[type=checkbox], input[type=radio] {
    appearance: none; -webkit-appearance: none;
    position: relative; flex: 0 0 auto; margin: 0; cursor: pointer;
    width: var(--control-size); height: var(--control-size);
    background: var(--input-bg); border: 1px solid var(--line);
    transition: background-color .13s ease, border-color .13s ease;
}
input[type=checkbox] { border-radius: 3px; }
input[type=radio] { border-radius: 50%; }
input[type=checkbox]:hover:not(:disabled), input[type=radio]:hover:not(:disabled) { border-color: var(--accent); }
input[type=checkbox]:checked, input[type=radio]:checked { background: var(--accent); border-color: var(--accent); }
input[type=checkbox]:checked::after {
    content: ""; position: absolute; left: 5px; top: 1px; width: 5px; height: 10px;
    border: solid var(--accent-ink); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
input[type=radio]:checked::after {
    content: ""; position: absolute; inset: 4px; border-radius: 50%; background: var(--accent-ink);
}
input[type=checkbox]:focus-visible, input[type=radio]:focus-visible {
    outline: none; box-shadow: 0 0 0 3px rgba(255, 228, 84, .22);
}
input[type=checkbox]:disabled, input[type=radio]:disabled { opacity: .5; cursor: not-allowed; }

/* File — the native "Choose file" button restyled to match .btn-small */
input[type=file] {
    width: 100%; margin-top: 5px; padding: 6px; font: inherit; color: var(--text-dim);
    background: var(--input-bg); border: 1px solid var(--line); border-radius: var(--radius);
}
input[type=file]::file-selector-button {
    margin-right: 10px; padding: 5px 11px; font: inherit; font-size: 13px; cursor: pointer;
    color: var(--text); background: transparent;
    border: 1px solid var(--line); border-radius: 3px;
    transition: border-color .13s ease, color .13s ease;
}
input[type=file]::file-selector-button:hover { border-color: var(--accent); color: var(--accent); }

/* Colour — remove the native chrome around the swatch */
input[type=color] {
    width: 46px; height: 32px; margin-top: 5px; padding: 3px; cursor: pointer;
    background: var(--input-bg); border: 1px solid var(--line); border-radius: var(--radius);
}
input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
input[type=color]::-webkit-color-swatch { border: 0; border-radius: 2px; }
input[type=color]::-moz-color-swatch { border: 0; border-radius: 2px; }

input[type=search]::-webkit-search-cancel-button { cursor: pointer; opacity: .55; }
input[type=search]::-webkit-search-cancel-button:hover { opacity: 1; }
input[type=date]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .55; filter: invert(1); }
input[type=date]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

.hint { color: var(--text-dim); font-size: 13px; }
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-row { display: flex; gap: 12px; flex-wrap: wrap; }
.form-row > label { flex: 1 1 180px; }

/* --------------------------------------------------------------- admin */
.admin-nav { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.admin-nav a {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 7px 11px; border-radius: var(--radius);
    border: 1px solid transparent;
    color: var(--text-dim); text-decoration: none; font-size: 14px; line-height: 1;
    transition: color .13s ease, background-color .13s ease, border-color .13s ease;
}
.admin-nav a:hover { color: var(--accent); background: var(--panel); border-color: var(--line); }
.admin-nav a.active { color: var(--accent); background: var(--panel); border-color: var(--accent); }
.admin-nav a:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 228, 84, .16); }
.admin-nav .nav-icon { width: 16px; height: 16px; flex: 0 0 auto; fill: currentColor; }
.admin-nav .nav-cta { color: var(--text); }
.admin-nav .nav-cta:hover { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.stat-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; min-width: 110px; }
.stat b { display: block; font-size: 22px; }
.stat span { color: var(--text-dim); font-size: 12.5px; }
table.admin { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
table.admin th, table.admin td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #303030; font-size: 14px; vertical-align: middle; }
table.admin th { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
table.admin tr:last-child td { border-bottom: 0; }
.inline-form { display: inline; }
.btn-small { padding: 4px 9px; font-size: 12.5px; border-radius: 3px; border: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer; text-decoration: none; }
.btn-small:hover { border-color: var(--accent); color: var(--accent); }
.btn-small.danger:hover { border-color: #b3372a; color: #ff9d92; }
.status-pill { font-size: 11px; text-transform: uppercase; padding: 2px 7px; border-radius: 3px; letter-spacing: .03em; }
.status-published { background: #12301f; color: #a6e9c2; }
.status-pending { background: #3a3113; color: #ffe08a; }
.status-rejected { background: #3a1614; color: #ffb4ac; }
.scroll-x { overflow-x: auto; }

/* --------------------------------------------------------------- footer */
.site-footer { border-top: 1px solid var(--line); padding: 18px 0; color: var(--text-dim); font-size: 13.5px; text-align: center; }
.site-footer p { margin: 4px 0; }
.site-footer a { color: var(--text-dim); }
.site-footer a:hover { color: var(--accent); }

@media (max-width: 620px) {
    .header-inner { gap: 10px; }
    .header-search { order: 3; max-width: none; flex-basis: 100%; }
    .landing-header h1 { font-size: 26px; }
    .category-grid { grid-template-columns: 1fr; }
}

/* settings: checkbox rows */
label.check { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; cursor: pointer; }
/* Only text-like inputs need the width reset here — checkbox and radio get
   their size from the control rules above, so must not be caught by this. */
label.check input:not([type=checkbox]):not([type=radio]) { width: auto; margin: 0; }
label.check span { line-height: 1.2; }
label.check:hover input[type=checkbox]:not(:disabled),
label.check:hover input[type=radio]:not(:disabled) { border-color: var(--accent); }

/* ---------------------------------------------------------- light theme */
:root[data-theme="light"] {
    --bg: #f6f7f9;
    --panel: #ffffff;
    --panel-head: #f0f2f5;
    --panel-hover: #eef1f5;
    --line: #d8dde3;
    --text: #1b1f24;
    --text-dim: #5b636d;
    --accent: #9a7b00;
    --accent-ink: #ffffff;
    --input-bg: #ffffff;
    --input-bg-disabled: #eef0f3;
    --danger: #b3372a;
    --danger-ink: #8c1d13;
}
:root[data-theme="light"] .site-header { background: #ffffff; }
:root[data-theme="light"] .site-item { border-bottom-color: #e6e9ee; }
:root[data-theme="light"] .site-favicon--placeholder { background: #e8ebf0; color: #5b636d; }
:root[data-theme="light"] .rating-score-value { color: #1b1f24; }
:root[data-theme="light"] .site-description.floater { background: #ffffff; color: #3d434b; box-shadow: 0 6px 24px rgba(0,0,0,.12); }
:root[data-theme="light"] .header-search input, :root[data-theme="light"] .page-search input { background: var(--input-bg); color: var(--text); }
/* Focus rings and the select chevron are literal colours, so they are the only
   control styles that need restating for the light theme. */
:root[data-theme="light"] input:focus-visible,
:root[data-theme="light"] textarea:focus-visible,
:root[data-theme="light"] select:focus-visible { box-shadow: 0 0 0 3px rgba(154, 123, 0, .18); }
:root[data-theme="light"] input[type=checkbox]:focus-visible,
:root[data-theme="light"] input[type=radio]:focus-visible { box-shadow: 0 0 0 3px rgba(154, 123, 0, .24); }
:root[data-theme="light"] .admin-nav a:focus-visible { box-shadow: 0 0 0 3px rgba(154, 123, 0, .18); }
:root[data-theme="light"] input:hover:not(:disabled),
:root[data-theme="light"] textarea:hover:not(:disabled),
:root[data-theme="light"] select:hover:not(:disabled) { border-color: #a9b2bd; }
:root[data-theme="light"] select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%235b636d'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
}
:root[data-theme="light"] input[type=date]::-webkit-calendar-picker-indicator { filter: none; }
:root[data-theme="light"] .view-all-link:hover { background: var(--panel-hover); }
:root[data-theme="light"] .flash-error { background: #fdeceb; color: #8c1d13; border-color: #f3bdb8; }
:root[data-theme="light"] .flash-success { background: #e7f6ee; color: #14603a; border-color: #b5e2c9; }
:root[data-theme="light"] .status-published { background: #e7f6ee; color: #14603a; }
:root[data-theme="light"] .status-pending { background: #fdf3d9; color: #7a5a00; }
:root[data-theme="light"] .status-rejected { background: #fdeceb; color: #8c1d13; }

/* theme toggle button */
.theme-toggle {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; padding: 0; border-radius: var(--radius);
    border: 1px solid var(--line); background: transparent; color: var(--text-dim);
    cursor: pointer; line-height: 1;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }
.theme-toggle svg { width: 16px; height: 16px; fill: currentColor; }
:root[data-theme="light"] .theme-toggle .icon-sun,
:root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }

/* -------------------------------------------------- custom fields / terms */
.field-chip {
    flex: 0 0 auto; font-size: 10.5px; padding: 2px 7px; border-radius: 10px;
    background: rgba(127,127,127,.18); color: var(--text-dim); white-space: nowrap;
}
.listing-meta {
    display: grid; grid-template-columns: minmax(120px, auto) 1fr; gap: 8px 18px;
    margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line);
}
.listing-meta dt { color: var(--text-dim); font-size: 13.5px; }
.listing-meta dd { margin: 0; }
.term {
    display: inline-block; padding: 2px 9px; border-radius: 11px; font-size: 13px;
    background: rgba(127,127,127,.16); color: var(--text); text-decoration: none;
}
a.term:hover { background: var(--accent); color: var(--accent-ink); }

.filter-bar { max-width: 820px; margin: 0 auto 14px; display: flex; flex-direction: column; gap: 8px; }
.filter-group { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-label { color: var(--text-dim); font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; margin-right: 2px; }
.filter-chip {
    padding: 4px 10px; border-radius: 12px; border: 1px solid var(--line);
    color: var(--text); text-decoration: none; font-size: 13px;
}
.filter-chip:hover { border-color: var(--accent); color: var(--accent); }
.filter-chip.active { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.filter-chip .count { opacity: .65; font-size: 11.5px; }
@media (max-width: 620px) { .listing-meta { grid-template-columns: 1fr; gap: 2px 0; } .listing-meta dd { margin-bottom: 8px; } }



/* ------------------------------------------------------- hamburger menu */
.header-inner { justify-content: space-between; }
.menu { position: relative; margin-left: auto; }
.menu-button {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border: 1px solid var(--line); border-radius: var(--radius);
    color: var(--text); cursor: pointer; list-style: none; user-select: none;
}
.menu-button::-webkit-details-marker { display: none; }
.menu-button:hover { border-color: var(--accent); color: var(--accent); }
.menu-button svg { width: 20px; height: 20px; fill: currentColor; }
.menu:not([open]) .icon-close, .menu[open] .icon-burger { display: none; }

.menu-panel {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 1200;
    width: min(320px, calc(100vw - 32px)); padding: 14px;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: 0 10px 34px rgba(0,0,0,.45);
    display: flex; flex-direction: column; gap: 12px;
}
:root[data-theme="light"] .menu-panel { box-shadow: 0 10px 34px rgba(0,0,0,.14); }
.menu-search { display: flex; gap: 6px; }
.menu-search input {
    flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--line);
    border-radius: var(--radius); background: var(--bg); color: var(--text); font: inherit;
}
.menu-search button {
    padding: 8px 12px; border: 0; border-radius: var(--radius);
    background: var(--accent); color: var(--accent-ink); font: inherit; font-weight: 600; cursor: pointer;
}
.menu-links { display: flex; flex-direction: column; }
.menu-links a {
    padding: 9px 4px; color: var(--text); text-decoration: none; font-size: 14.5px;
    border-bottom: 1px solid rgba(127,127,127,.16);
}
.menu-links a:last-child { border-bottom: 0; }
.menu-links a:hover { color: var(--accent); }
.menu-theme { width: auto; height: auto; gap: 8px; padding: 8px 10px; justify-content: flex-start; }
.menu-theme .theme-label { font-size: 14px; }

.footer-links a { color: var(--text-dim); }

/* ------------------------------------------------------------ static pages */
.static-page { max-width: 820px; margin: 0 auto; }
.static-page h1 { font-size: 28px; margin: 0 0 14px; }
.page-body { color: var(--text-dim); }
.page-body h2 { color: var(--text); font-size: 19px; margin: 22px 0 8px; }
.page-body p { margin: 0 0 12px; }
.page-body ul { margin: 0 0 12px; padding-left: 20px; }
.page-updated { margin-top: 22px; }

/* ------------------------------------------------------------- sorting */
.sort-wrap { max-width: 820px; margin: 0 auto 12px; display: flex; justify-content: flex-end; }
.sortmenu { position: relative; }
.sortmenu-button {
    display: inline-flex; align-items: center; gap: 7px; cursor: pointer; list-style: none;
    padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius);
    color: var(--text-dim); font-size: 13.5px; user-select: none; white-space: nowrap;
}
.sortmenu-button::-webkit-details-marker { display: none; }
.sortmenu-button:hover { border-color: var(--accent); color: var(--accent); }
.sortmenu-icon { display: inline-flex; width: 15px; height: 15px; flex: 0 0 auto; }
.sortmenu-icon svg { width: 100%; height: 100%; fill: currentColor; }
.sortmenu-caret { width: 13px; height: 13px; fill: currentColor; opacity: .7; transition: transform .2s linear; }
.sortmenu[open] .sortmenu-caret { transform: rotate(180deg); }

.sortmenu-panel {
    position: absolute; right: 0; top: calc(100% + 6px); z-index: 900; min-width: 186px;
    background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: 0 8px 26px rgba(0,0,0,.4); padding: 5px; display: flex; flex-direction: column;
}
:root[data-theme="light"] .sortmenu-panel { box-shadow: 0 8px 26px rgba(0,0,0,.13); }
.sortmenu-item {
    display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 3px;
    color: var(--text); text-decoration: none; font-size: 14px; white-space: nowrap;
}
.sortmenu-item:hover { background: var(--panel-hover); color: var(--accent); }
.sortmenu-item.active { color: var(--accent); font-weight: 600; }
@media (max-width: 620px) { .sortmenu-current { display: none; } }

/* ------------------------------------------------------------- import */
.import-errors { margin: 6px 0 0; padding-left: 18px; color: var(--text-dim); font-size: 13.5px; }
.import-errors li { margin-bottom: 3px; }

/* read-only demo banner */
.flash-demo {
    background: #2a2410; color: #ffe08a; border: 1px solid #5a4a15;
    border-radius: var(--radius); padding: 10px 13px; margin-bottom: 14px; font-size: 14px;
}
:root[data-theme="light"] .flash-demo { background: #fdf3d9; color: #7a5a00; border-color: #e6cf8a; }

/* Arrows are SVG now, not text glyphs — they need a box and a fill. */
.arrow { width: 15px; height: 15px; fill: currentColor; vertical-align: -2px; flex: 0 0 auto; }

/* category icon generator */
.icon-ai { margin: -6px 0 14px; }
.icon-ai-row { display: flex; gap: 8px; flex-wrap: wrap; }
.icon-ai-row input { flex: 1 1 240px; }
.icon-ai-row button { flex: 0 0 auto; align-self: flex-start; margin-top: 5px; }
.icon-ai .hint.is-error { color: #ff9d92; }
.icon-ai-preview { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.icon-ai-preview .category-icon { width: 26px; height: 26px; }
.icon-ai-preview .category-icon svg { width: 100%; height: 100%; fill: var(--accent); }
