/* =====================================================================
   Warframe Collection — shared stylesheet
   Colors keep the original palette:
     #163e57 (deep blue)  #5bb7e5 (light blue)  #141e26 (dark page)  #eeeeee (light page)
   ===================================================================== */

:root,
[data-theme="dark"] {
    --page-bg: #141e26;
    --panel-bg: #18262f;
    --panel-bg-2: #1d2f3b;
    --header-bg: #163e57;
    --header-text: #eeeeee;
    --border-color: #163e57;
    --border-strong: #2a5f80;
    --accent: #5bb7e5;
    --accent-contrast: #0b1a24;
    --text-color: #eeeeee;
    --text-muted: #9fb6c6;
    --text-color-invert: #000000;
    --overlay-bg: rgba(20, 20, 20, 0.85);
    --icon-bg: #5bb7e5;
    --icon-bg-off: rgba(91, 183, 229, 0.18);
    --icon-ring: #eeeeee;
    --input-bg: #0f171d;
    --text-shadow: 0 0 2px #000;
    --card-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
    --danger: #ff6b6b;
    --good: #3aa76d;        /* finished / full / match (swapped by the colour-blind palettes below) */
    --warn: #e0a24a;        /* mismatch / needs a look */
    color-scheme: dark;
}

[data-theme="light"] {
    --page-bg: #eeeeee;
    --panel-bg: #f8fafb;
    --panel-bg-2: #e2eef5;
    --header-bg: #5bb7e5;
    --header-text: #000000;
    --border-color: #5bb7e5;
    --border-strong: #3c9fd0;
    --accent: #163e57;
    --accent-contrast: #eeeeee;
    --text-color: #000000;
    --text-muted: #4b6474;
    --text-color-invert: #eeeeee;
    --overlay-bg: rgba(255, 255, 255, 0.78);
    --icon-bg: #163e57;
    --icon-bg-off: rgba(22, 62, 87, 0.18);
    --icon-ring: #000000;
    --input-bg: #ffffff;
    --text-shadow: 0 0 2px #fff;
    --card-shadow: 0 2px 8px rgba(22, 62, 87, 0.18);
    --danger: #c0392b;
    color-scheme: light;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    background: var(--page-bg);
    color: var(--text-color);
    font-family: 'Roboto', system-ui, sans-serif;
    font-size: 15px;
    line-height: 1.4;
    min-height: 100vh;
}

h1, h2, .brand, .nav-tab, .filter-heading, .sidebar-title, .btn, .stat-label {
    font-family: 'Quantico', 'Roboto', sans-serif;
}

button, input, select { font: inherit; color: inherit; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Top bar ---------- */
.topbar {
    --topbar-h: 58px;
    position: sticky;
    top: 0;
    z-index: 50;
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    gap: 18px;
    padding: 0 16px;
    background: var(--header-bg);
    color: var(--header-text);
    border-bottom: 1px solid var(--border-strong);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: inherit;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    flex-shrink: 0;
}
.brand img { width: 30px; height: 30px; }
.brand .site-icon { width: 30px; height: 30px; flex: none; }
.brand-text { display: flex; flex-direction: column; justify-content: center; min-width: 0; line-height: 1.15; }
/* The signed-in name, small under the site name (the bar keeps its height) */
.brand .user-name { font-size: .72rem; font-weight: 500; letter-spacing: .02em; text-transform: none; opacity: .8;
    max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.nav {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
    padding: 4px 10px;
}
/* The tabs and the buttons after them scroll together, sideways, when they don't fit */
.nav-track {
    position: relative;
    display: flex;
    align-items: center;
    gap: 18px;
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
    scroll-behavior: smooth;
    overscroll-behavior-x: contain;
}
.nav-track::-webkit-scrollbar { display: none; }
.nav-track > .topbar-actions { margin-left: auto; }   /* at the right end when there's room, as before */

/* Tabs scroll sideways when they don't fit; arrows + edge fades appear only then */
.nav-wrap { position: relative; display: flex; align-items: center; flex: 1 1 auto; min-width: 0; }
.nav-scroll {
    display: none;
    flex-shrink: 0;
    width: 26px; height: 34px;
    padding: 0;
    border: 0; border-radius: 6px;
    background: var(--page-bg);
    color: var(--text-color);
    font-size: 1.4rem; line-height: 1;
    cursor: pointer;
    z-index: 1;
}
.nav-scroll:hover { filter: brightness(1.2); }
.nav-wrap.can-prev .nav-scroll.prev, .nav-wrap.can-next .nav-scroll.next { display: block; }
.nav-wrap.can-prev .nav-track { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 22px); mask-image: linear-gradient(to right, transparent 0, #000 22px); }
.nav-wrap.can-next .nav-track { -webkit-mask-image: linear-gradient(to left, transparent 0, #000 22px); mask-image: linear-gradient(to left, transparent 0, #000 22px); }
.nav-wrap.can-prev.can-next .nav-track { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%); mask-image: linear-gradient(to right, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%); }

/* Skewed tabs — carried over from the original menu style */
.nav-tab {
    position: relative;
    padding: 8px 20px;
    color: var(--header-text);
    text-decoration: none;
    font-weight: 700;
    font-size: 1.02rem;
    white-space: nowrap;
    isolation: isolate;
}
.nav-tab::before {
    content: "";
    position: absolute;
    inset: 0;
    border: 2px solid var(--page-bg);
    border-radius: 4px;
    transform: skew(-18deg);
    z-index: -1;
    opacity: 0.55;
    transition: background-color .15s, opacity .15s;
}
.nav-tab:hover::before { opacity: 1; background: color-mix(in srgb, var(--page-bg) 25%, transparent); }
.nav-tab.active { color: var(--text-color); }
.nav-tab.active::before { background: var(--page-bg); opacity: 1; }
button.nav-tab { background: none; border: 0; font-family: inherit; cursor: pointer; line-height: inherit; }
.nav-more span::after { content: ''; display: inline-block; margin-left: 7px; vertical-align: middle; border: 5px solid transparent;
    border-top-color: currentColor; border-bottom-width: 0; transition: transform .15s; }
.nav-more.is-open span::after { transform: rotate(180deg); }
.nav-more.is-open::before { opacity: 1; background: color-mix(in srgb, var(--page-bg) 25%, transparent); }
.nav-menu { position: fixed; z-index: 200; min-width: 200px; padding: 6px; display: flex; flex-direction: column; gap: 2px;
    background: var(--panel-bg); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--card-shadow); }
.nav-menu[hidden] { display: none; }
.nav-menu-item { padding: 9px 14px; border-radius: 7px; color: var(--text-color); text-decoration: none; font-weight: 700; white-space: nowrap; }
.nav-menu-item:hover, .nav-menu-item:focus-visible { background: var(--icon-bg-off); outline: none; }
.nav-menu-item.active { background: var(--accent); color: var(--accent-contrast); }

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.topbar-actions form { margin: 0; }

.icon-btn {
    width: 36px; height: 36px;
    display: grid; place-items: center;
    border-radius: 8px;
    border: 1px solid transparent;
    background: var(--page-bg);
    cursor: pointer;
    padding: 0;
}
.icon-btn:hover { border-color: var(--page-bg); filter: brightness(1.15); }
.icon-btn img { width: 22px; height: 22px; display: block; }
[data-theme="dark"]  .theme-icon-light { display: none; }
[data-theme="light"] .theme-icon-dark  { display: none; }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 6px;
    border: 1px solid var(--border-strong);
    background: var(--page-bg);
    color: var(--text-color);
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn-ghost { background: transparent; }
.logout-btn { border-color: transparent; }

/* ---------- Layout ---------- */
.layout {
    --sidebar-w: 264px;
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: calc(100vh - 58px);
    transition: grid-template-columns .2s ease;
}
.sidebar-collapsed .layout { --sidebar-w: 52px; }

.main { min-width: 0; padding: 18px 22px 40px; }

/* ---------- Sidebar ---------- */
.sidebar {
    position: sticky;
    top: 58px;
    height: calc(100vh - 58px);
    background: var(--panel-bg);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 30;
}

.sidebar-head { padding: 10px; border-bottom: 1px solid var(--border-color); }

.sidebar-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 6px;
    background: none;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    color: var(--text-color);
}
.sidebar-toggle:hover { background: var(--panel-bg-2); }
.sidebar-title { font-weight: 700; font-size: 1.05rem; letter-spacing: .03em; }
.sidebar-toggle .chev { margin-left: auto; transition: transform .2s; }

.filter-count {
    min-width: 20px; height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: var(--accent);
    color: var(--accent-contrast);
    font-size: .75rem; font-weight: 700;
    display: inline-grid; place-items: center;
}
.filter-count[hidden] { display: none; }

.sidebar-body { flex: 1; overflow-y: auto; padding: 12px 14px 24px; }

.sidebar-collapsed .sidebar-body,
.sidebar-collapsed .sidebar-title { display: none; }
.sidebar-collapsed .sidebar-toggle { flex-direction: column; gap: 6px; }
.sidebar-collapsed .sidebar-toggle .chev { margin-left: 0; transform: rotate(180deg); }

.filters { display: flex; flex-direction: column; gap: 12px; }

.filter-heading {
    margin-top: 8px;
    padding-bottom: 4px;
    font-size: .8rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--accent);
    border-bottom: 1px solid var(--border-color);
}
.filter-heading:first-child { margin-top: 0; }

.filter { display: flex; flex-direction: column; gap: 4px; }
.filter-label { font-size: .85rem; font-weight: 500; color: var(--text-muted); }
.filter.is-active .filter-label { color: var(--text-color); font-weight: 700; }
.filter.is-active .filter-label::after { content: " •"; color: var(--accent); }

.filters input[type="search"],
.filters input[type="number"],
.select-wrap select {
    width: 100%;
    padding: 7px 10px;
    background: var(--input-bg);
    color: var(--text-color);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    font-size: .92rem;
    min-width: 0;
}
.select-wrap { position: relative; min-width: 0; flex: 1; }
.select-wrap select { appearance: none; padding-right: 28px; cursor: pointer; }
.select-wrap::after {
    content: "";
    position: absolute;
    right: 11px; top: 50%;
    width: 7px; height: 7px;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: translateY(-70%) rotate(45deg);
    pointer-events: none;
}
.filter.is-active select, .filter.is-active input { border-color: var(--accent); }

.range { display: flex; align-items: center; gap: 6px; }
.range input { flex: 1; }
.range-sep { font-size: .8rem; color: var(--text-muted); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { position: relative; cursor: pointer; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    font-size: .88rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: background-color .15s, color .15s;
}
.chip input:checked + span { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); font-weight: 700; }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.reset-btn { width: 100%; justify-content: center; margin-top: 18px; }

.sidebar-scrim { display: none; }
.mobile-filter-btn { display: none; }

/* ---------- Toolbar + stats ---------- */
.toolbar { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar h1 { margin: 0; font-size: 1.6rem; letter-spacing: .02em; }
.result-count { color: var(--text-muted); font-size: .95rem; }

.stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.stat {
    display: grid;
    grid-template-columns: auto auto;
    align-items: baseline;
    column-gap: 10px;
    padding: 8px 12px 10px;
    border-radius: 8px;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    min-width: 140px;
}
.stat-label { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.stat-value { justify-self: end; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-bar { grid-column: 1 / -1; height: 4px; margin-top: 6px; border-radius: 2px; background: var(--icon-bg-off); overflow: hidden; }
.stat-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .25s; }

.empty-state {
    padding: 40px; text-align: center;
    color: var(--text-muted);
    border: 1px dashed var(--border-strong);
    border-radius: 10px;
}
.empty-state[hidden] { display: none; }

/* ---------- Card grid ---------- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, 190px);
    gap: 22px clamp(18px, 3%, 36px);
    justify-content: start;
}

.card {
    position: relative;
    width: 190px;
    height: 200px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    background: var(--panel-bg);
    box-shadow: var(--card-shadow);
    color: var(--text-color);
    text-shadow: var(--text-shadow);
    transition: transform .12s, border-color .12s;
}
.card:hover { border-color: var(--accent); }
.card[hidden] { display: none; }

.card-art {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Corner icon columns (replace the old absolute-position grid) */
.card-icons { position: absolute; top: 6px; display: flex; gap: 6px; z-index: 2; }
.card-icons.left  { left: 6px; }
.card-icons.right { right: 6px; flex-direction: row-reverse; }
.card-icons .col { display: flex; flex-direction: column; gap: 6px; }

.sbtn {
    position: relative;
    width: 28px; height: 28px;
    padding: 2px;
    border-radius: 50%;
    border: 1px solid var(--icon-ring);
    background: var(--page-bg);
    cursor: pointer;
    display: grid; place-items: center;
    transition: transform .1s, box-shadow .15s;
}
.sbtn::before {
    content: "";
    position: absolute;
    inset: 1px;
    border-radius: 50%;
    background: var(--icon-bg-off);
    transition: background-color .15s;
}
.sbtn img { position: relative; width: 22px; height: 22px; opacity: .55; transition: opacity .15s; }
.sbtn[aria-pressed="true"]::before { background: var(--icon-bg); }
.sbtn[aria-pressed="true"] img { opacity: 1; }
.sbtn[aria-pressed="true"] { box-shadow: 0 0 6px color-mix(in srgb, var(--icon-bg) 70%, transparent); }
.sbtn:hover { transform: scale(1.12); }
.sbtn:active { transform: scale(.95); }
.sbtn.is-busy { pointer-events: none; opacity: .6; }
/* Adversary element / % buttons: highlighted only once the weapon is marked owned
   (or always, if the user has hidden "Owned" tracking) */
.card[data-owned="1"] .sbtn.adv-btn img,
.grid.no-owned .sbtn.adv-btn img { opacity: 1; }
.card[data-owned="1"] .sbtn.adv-btn::before,
.grid.no-owned .sbtn.adv-btn::before { background: var(--icon-bg); }
.card[data-owned="1"] .sbtn.adv-btn,
.grid.no-owned .sbtn.adv-btn { box-shadow: 0 0 6px color-mix(in srgb, var(--icon-bg) 70%, transparent); }
.sbtn.adv-btn .badge { opacity: .6; }
.card[data-owned="1"] .sbtn.adv-btn .badge,
.grid.no-owned .sbtn.adv-btn .badge { opacity: 1; }

.sbtn .badge {
    position: absolute;
    inset: 0;
    display: grid; place-items: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-color);
    text-shadow: 1px 1px 0 var(--text-color-invert), -1px -1px 0 var(--text-color-invert), 1px -1px 0 var(--text-color-invert), -1px 1px 0 var(--text-color-invert);
    pointer-events: none;
}
.sbtn:not(.pct-btn) .badge:empty { display: none; }
.sbtn.pct-btn .badge { font-size: 9.5px; }
.sbtn.pct-btn:not(.has-value) .badge::before { content: "%"; opacity: .7; }

/* Name plate */
.plate {
    position: absolute;
    left: 2px; right: 2px; bottom: 2px;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 6px;
    background: var(--overlay-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 700;
}
.plate:hover { border-color: var(--accent); }
.plate-name {
    flex: 1;
    min-width: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    text-align: center;
    line-height: 1.1em;
    min-height: 2.2em;
    word-break: break-word;
}
.plate-sub { font-size: .8em; font-weight: 500; opacity: .85; }
.plate-icon { width: 22px; height: 22px; flex-shrink: 0; }
.plate-icon.outline {
    filter: drop-shadow(1px 0 0 var(--text-color)) drop-shadow(-1px 0 0 var(--text-color)) drop-shadow(0 1px 0 var(--text-color)) drop-shadow(0 -1px 0 var(--text-color));
}
.plate-icon.outline-invert {
    filter: drop-shadow(1px 0 0 var(--text-color-invert)) drop-shadow(-1px 0 0 var(--text-color-invert)) drop-shadow(0 1px 0 var(--text-color-invert)) drop-shadow(0 -1px 0 var(--text-color-invert));
}
.plate-mr { display: flex; flex-direction: column; align-items: center; width: 24px; flex-shrink: 0; line-height: 1; font-size: .9em; }
.plate-mr img { width: 20px; height: 20px; }

/* Arcane rank selector */
.rank-select {
    position: absolute;
    top: 6px; left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    width: 72px;
    padding: 3px 4px;
    font-size: .85rem;
    font-weight: 700;
    text-align: center;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: var(--overlay-bg);
    color: var(--text-color);
    cursor: pointer;
}
.card[data-status="maxed"] .rank-select { border-color: var(--accent); box-shadow: 0 0 6px color-mix(in srgb, var(--accent) 60%, transparent); }
.card[data-status="missing"] .card-art { filter: grayscale(.7) brightness(.8); }
.rarity-pip {
    position: absolute; top: 8px; right: 8px; z-index: 2;
    width: 10px; height: 10px; border-radius: 50%;
    border: 1px solid var(--icon-ring);
}
.rarity-Common    { background: #b07a4a; }
.rarity-Uncommon  { background: #c0c0c0; }
.rarity-Rare      { background: #e6c35c; }
.rarity-Legendary { background: #e8e8ff; box-shadow: 0 0 6px #b9b9ff; }
.rarity-Other     { background: var(--icon-bg); }

/* ---------- Popover (adversary pickers) ---------- */
.popover {
    position: absolute;
    z-index: 100;
    min-width: 150px;
    padding: 8px;
    background: var(--panel-bg);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
    font-size: .9rem;
}
.popover-title { font-family: 'Quantico', sans-serif; font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); margin: 0 4px 6px; }
.popover-list { display: flex; flex-direction: column; gap: 2px; }
.popover-list.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.popover-option {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 8px;
    border: 1px solid transparent;
    border-radius: 6px;
    background: none;
    text-align: left;
    cursor: pointer;
}
.popover-option:hover, .popover-option:focus-visible { background: var(--panel-bg-2); }
.popover-option.selected { border-color: var(--accent); font-weight: 700; }
.popover-option img { width: 20px; height: 20px; }
.popover-row { display: flex; gap: 6px; }
.popover-row input {
    width: 90px; padding: 6px 8px;
    background: var(--input-bg); border: 1px solid var(--border-strong); border-radius: 6px;
}
.popover-row .btn { padding: 6px 10px; }

/* ---------- Toast ---------- */
.toast {
    position: fixed;
    left: 50%; bottom: 24px;
    transform: translate(-50%, 20px);
    padding: 10px 16px;
    border-radius: 8px;
    background: var(--danger);
    color: #fff;
    font-weight: 500;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s, transform .2s;
    z-index: 200;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Auth pages (login / register) ---------- */
.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background:
        radial-gradient(1200px 600px at 20% -10%, color-mix(in srgb, var(--header-bg) 70%, transparent), transparent 60%),
        var(--page-bg);
}
.auth-card {
    width: min(360px, 100%);
    padding: 28px 26px;
    background: var(--panel-bg);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, .35);
}
.auth-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 6px; }
.auth-brand img { width: 40px; height: 40px; }
.auth-brand .site-icon { width: 40px; height: 40px; flex: none; }
.auth-brand span { font-family: 'Quantico', 'Roboto', sans-serif; font-weight: 700; font-size: 1.3rem; letter-spacing: .04em; }
.auth-card h1 { text-align: center; margin: 0 0 20px; font-size: 1.4rem; letter-spacing: .04em; text-transform: uppercase; }
.auth-card label { display: block; font-size: .85rem; color: var(--text-muted); margin-bottom: 4px; }
.auth-card input {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 14px;
    background: var(--input-bg);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
}
.auth-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.auth-card .btn-primary {
    width: 100%; justify-content: center;
    padding: 11px; margin-top: 4px;
    background: var(--accent); color: var(--accent-contrast); border-color: var(--accent);
    font-size: 1rem;
}
.auth-card .btn-primary:hover { filter: brightness(1.1); }
.auth-alt { text-align: center; margin: 18px 0 0; font-size: .9rem; color: var(--text-muted); }
.auth-alt a { color: var(--accent); font-weight: 700; text-decoration: none; }
.auth-alt a:hover { text-decoration: underline; }
.message { padding: 9px 12px; border-radius: 6px; margin-bottom: 14px; font-size: .9rem; text-align: center; }
.message.error { color: var(--danger); border: 1px solid var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.message.success { color: var(--accent); border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }

/* ---------- Settings page ---------- */
.settings-btn { color: var(--text-color); text-decoration: none; }
.settings-btn.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }

.layout.no-sidebar, .sidebar-collapsed .layout.no-sidebar { grid-template-columns: 1fr; }
.no-sidebar .main { width: 100%; max-width: 760px; margin: 0 auto; }

.settings-msg { text-align: left; max-width: 760px; }
.settings-panel {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 18px 20px 20px;
}
.settings-section {
    margin: 0 0 6px;
    font-size: .8rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--accent);
}
.setting-row {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 14px 0;
    border-top: 1px solid var(--border-color);
    cursor: pointer;
}
.settings-section + .setting-row, .settings-intro + .setting-row { border-top: 0; }
.setting-text { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.setting-label { font-weight: 700; }
.setting-help { font-size: .88rem; color: var(--text-muted); }

.switch { position: relative; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-track {
    display: block;
    width: 46px; height: 26px;
    border-radius: 13px;
    background: var(--icon-bg-off);
    border: 1px solid var(--border-strong);
    transition: background-color .15s;
}
.switch-thumb {
    display: block;
    width: 20px; height: 20px;
    margin: 2px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: transform .15s, background-color .15s;
}
.switch input:checked + .switch-track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(20px); background: var(--accent-contrast); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }

.settings-actions { margin-top: 10px; display: flex; justify-content: flex-end; }
.btn-primary { background: var(--accent); color: var(--accent-contrast); border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.1); }

/* Settings tabs + account import */
.settings-tabs { display: flex; gap: 4px; margin: 0 0 16px; border-bottom: 1px solid var(--border-color); }
.settings-tab {
    padding: 9px 16px;
    margin-bottom: -1px;
    border: 1px solid transparent;
    border-radius: 8px 8px 0 0;
    color: var(--text-muted);
    text-decoration: none;
    font-family: 'Quantico', 'Roboto', sans-serif;
    font-weight: 700;
}
.settings-tab:hover { color: var(--text-color); }
.settings-tab.active { color: var(--text-color); background: var(--panel-bg); border-color: var(--border-color); border-bottom-color: var(--panel-bg); }
/* Narrow screens: one row that scrolls sideways instead of wrapping the tab names */
@media (max-width: 700px) {
    .settings-tabs { overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
    .settings-tabs::-webkit-scrollbar { display: none; }
    .settings-tab { white-space: nowrap; flex: none; }
}
.settings-panel + .settings-panel { margin-top: 16px; }
.settings-intro { margin: 0 0 4px; }
.setting-block { display: flex; flex-direction: column; gap: 6px; padding-top: 6px; }
.setting-block .setting-help { margin: 0; }
.setting-howto { font-size: .9rem; }
.setting-howto summary { cursor: pointer; color: var(--accent); font-weight: 500; width: fit-content; }
.setting-howto ol { margin: 8px 0 4px; padding-left: 22px; color: var(--text-muted); line-height: 1.6; }
code, kbd {
    font-family: ui-monospace, Consolas, monospace;
    font-size: .85em;
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--panel-bg-2);
    color: var(--text-color);
}
kbd { border: 1px solid var(--border-strong); }
.account-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.account-row input {
    flex: 1 1 240px;
    min-width: 0;
    padding: 8px 10px;
    font-family: ui-monospace, Consolas, monospace;
    background: var(--input-bg);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
}
.account-row input:focus { outline: none; border-color: var(--accent); }
.btn[disabled] { opacity: .7; cursor: progress; }
.setting-row.is-locked { cursor: default; }
.setting-row.is-locked .switch-track { opacity: .55; }
.muted { color: var(--text-muted); }

.import-summary {
    margin: -6px 0 16px;
    padding: 12px 16px;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-size: .92rem;
}
.import-stats { list-style: none; margin: 0 0 6px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.import-summary details { margin-top: 6px; }
.import-summary summary { cursor: pointer; color: var(--accent); font-weight: 500; }
.import-summary p { margin: 6px 0; font-size: .88rem; }
.import-list { columns: 3 160px; margin: 6px 0 0; padding-left: 18px; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
    .topbar { gap: 6px; padding: 0 8px; }
    .brand { display: none; }
    .nav-track { gap: 6px; }
    .nav { padding: 4px 6px; gap: 2px; }
    .nav-tab { padding: 7px 11px; font-size: .9rem; }
    .nav-tab::before { transform: skew(-12deg); }
    .icon-btn { width: 34px; height: 34px; }
    .logout-btn { padding: 7px 9px; font-size: .85rem; }

    .layout, .sidebar-collapsed .layout { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        left: 0; top: 58px; bottom: 0;
        height: auto;
        width: min(300px, 86vw);
        transform: translateX(-100%);
        transition: transform .2s ease;
        box-shadow: 4px 0 20px rgba(0, 0, 0, .35);
    }
    .sidebar-open .sidebar { transform: none; }
    .sidebar-collapsed .sidebar-body, .sidebar-collapsed .sidebar-title { display: block; }
    .sidebar-collapsed .sidebar-toggle { flex-direction: row; }
    .sidebar-toggle .chev { transform: none !important; }
    .sidebar-scrim { position: fixed; inset: 58px 0 0 0; background: rgba(0,0,0,.4); z-index: 25; }
    .sidebar-open .sidebar-scrim { display: block; }
    .mobile-filter-btn { display: inline-flex; }

    .main { padding: 14px 12px 32px; }
    .toolbar h1 { font-size: 1.3rem; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; justify-content: center; }
    .card { width: 100%; }
}

@media (max-width: 400px) {
    .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .nav-tab { padding: 6px 8px; font-size: .82rem; }
    .stat { min-width: 0; flex: 1 1 calc(50% - 5px); }
}
.setting-howto a { color: var(--accent); font-weight: 500; }
.setting-howto p { margin: 4px 0 0; font-size: .88rem; }
.paste-import textarea {
    width: 100%;
    margin-top: 8px;
    padding: 8px 10px;
    font-family: ui-monospace, Consolas, monospace;
    font-size: .85rem;
    background: var(--input-bg);
    color: var(--text-color);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    resize: vertical;
}
.paste-import textarea:focus { outline: none; border-color: var(--accent); }

/* Contextual totals */
.stat[hidden] { display: none; }
.sidebar-display { margin-top: 22px; }
.setting-row.compact { gap: 12px; padding: 8px 0 0; border-top: 0; }
.setting-row.compact .setting-label { font-size: .9rem; }
.setting-row.compact .setting-help { font-size: .8rem; }

/* ---------- Admin: item updates ---------- */
.no-sidebar .main:has(.upd-group, .img-table) { max-width: 1100px; }
.admin-toolbar { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.admin-toolbar .setting-help { flex: 1 1 400px; margin: 0; }
.upd-group { margin-bottom: 22px; }
.upd-group .settings-section { margin-bottom: 10px; }
.upd-item {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 16px;
    padding: 14px;
    margin-bottom: 12px;
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
}
.upd-item.has-error { border-color: var(--danger); }
.upd-item.is-off { opacity: .55; }
.upd-preview { width: 120px; height: 120px; border-radius: 8px; background: var(--panel-bg-2); display: grid; place-items: center; overflow: hidden; }
.upd-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.upd-preview img.broken, .img-prev img.broken { visibility: hidden; }
.upd-preview:has(img.broken)::after { content: "no preview"; font-size: .8rem; color: var(--text-muted); }
.upd-fields { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.upd-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.upd-include { display: flex; align-items: center; gap: 6px; font-weight: 700; cursor: pointer; }
.upd-name { flex: 1 1 220px; font-size: 1.05rem; font-weight: 700; }
.upd-link { color: var(--accent); text-decoration: none; font-weight: 500; white-space: nowrap; }
.upd-ignore { padding: 6px 10px; font-size: .85rem; }
.upd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 14px; align-items: end; }
.upd-grid label, .upd-image label { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; color: var(--text-muted); }
.upd-item input[type=text], .upd-item input[type=url], .upd-item input[type=number], .upd-item input[type=date],
.img-table input[type=text], .img-table input[type=url] {
    width: 100%; min-width: 0;
    padding: 7px 9px;
    background: var(--input-bg); color: var(--text-color);
    border: 1px solid var(--border-strong); border-radius: 6px;
    font-size: .9rem;
}
.upd-item select { width: 100%; padding: 7px 28px 7px 9px; background: var(--input-bg); color: var(--text-color); border: 1px solid var(--border-strong); border-radius: 6px; appearance: none; font-size: .9rem; }
.upd-item input:focus, .upd-item select:focus, .img-table input:focus { outline: none; border-color: var(--accent); }
label.upd-check { flex-direction: row !important; align-items: center; gap: 8px !important; color: var(--text-color) !important; font-size: .88rem !important; padding-bottom: 8px; cursor: pointer; }
.upd-hint { grid-column: 1 / -1; margin: 0; font-size: .8rem; color: var(--text-muted); }
.upd-image { display: grid; grid-template-columns: auto 1fr 1fr; gap: 10px 14px; align-items: end; padding-top: 10px; border-top: 1px dashed var(--border-color); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: .82rem !important; }
.upd-errors { margin: 0; padding: 8px 12px 8px 26px; border-radius: 6px; color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); font-size: .88rem; }
.upd-needs { margin: 0; padding: 6px 12px; border-radius: 6px; font-size: .85rem; color: var(--text-color); background: color-mix(in srgb, var(--accent) 14%, transparent); border-left: 3px solid var(--accent); }
.upd-submit {
    position: sticky; bottom: 0;
    display: flex; align-items: center; justify-content: flex-end; gap: 14px; flex-wrap: wrap;
    padding: 12px 0; margin-top: 8px;
    background: var(--page-bg); border-top: 1px solid var(--border-color);
}
.img-table { width: 100%; border-collapse: collapse; background: var(--panel-bg); border: 1px solid var(--border-color); border-radius: 10px; overflow: hidden; }
.img-table th, .img-table td { padding: 8px 10px; border-bottom: 1px solid var(--border-color); text-align: left; vertical-align: middle; font-size: .9rem; }
.img-table th { font-family: 'Quantico', sans-serif; font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.img-table td:nth-child(3) { width: 34%; } .img-table td:nth-child(4) { width: 28%; }
.img-prev img { width: 48px; height: 48px; object-fit: contain; }
/* Missing images: collapsible groups per kind */
.img-groups-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.img-groups-bar .btn-sm { padding: 4px 10px; font-size: .8rem; }
.img-group { margin-bottom: 8px; }
.img-group > summary { cursor: pointer; padding: 10px 14px; background: var(--panel-bg); border: 1px solid var(--border-color); border-radius: 10px;
    font-family: 'Quantico', sans-serif; font-weight: 700; list-style-position: inside; }
.img-group > summary:hover { border-color: var(--accent); }
.img-group[open] > summary { border-radius: 10px 10px 0 0; border-bottom-color: transparent; }
.img-group[open] > .img-table { border-radius: 0 0 10px 10px; }
.img-group-sel { font-family: inherit; font-weight: 500; font-size: .85rem; }
/* Upload a file instead of a link (Admin › Missing images) */
.img-upload { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.img-upload .btn-sm { padding: 4px 10px; font-size: .8rem; }
.img-upload label.btn { cursor: pointer; }
.img-upload label.btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.img-upload [data-img-file-name] { font-size: .8rem; overflow-wrap: anywhere; }
.img-table input[type=url]:disabled { opacity: .45; }
/* Admin › Existing images */
.exi-search { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 12px; }
.exi-search .clear-wrap { flex: 1 1 320px; max-width: 520px; }
.exi-search input { width: 100%; box-sizing: border-box; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border-color);
    background: var(--input-bg, var(--panel-bg)); color: var(--text-color); font: inherit; }
.exi-search input:focus { outline: none; border-color: var(--accent); }
.exi-list { background: var(--panel-bg); border: 1px solid var(--border-color); border-radius: 10px; overflow: hidden; }
.exi-row { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--border-color); }
.exi-row:last-child { border-bottom: 0; }
.exi-prev { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 6px; background: rgba(127, 127, 127, .14); }
#exiMore[hidden] { display: none; }
.exi-prev img { max-width: 52px; max-height: 52px; object-fit: contain; display: block; }
.exi-info { min-width: 0; }
.exi-name { font-size: .88rem; overflow-wrap: anywhere; }
.exi-meta { font-size: .78rem; overflow-wrap: anywhere; }
.exi-msg { font-size: .8rem; }
.exi-msg:empty { display: none; }
.exi-msg.is-good { color: var(--good); } .exi-msg.is-bad { color: var(--danger); }
.exi-acts { display: flex; gap: 6px; }
.exi-del:hover { border-color: var(--danger); color: var(--danger); }
.exi-panel { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 0 4px; }
.exi-panel input[type=url] { flex: 1 1 260px; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--border-color);
    background: var(--input-bg, var(--panel-bg)); color: var(--text-color); font: inherit; font-size: .85rem; }
.exi-panel input[type=url]:disabled { opacity: .45; }
.exi-panel .btn-sm { padding: 4px 10px; font-size: .8rem; }
.exi-panel label.btn { cursor: pointer; }
.exi-white { display: inline-flex; align-items: center; gap: 4px; font-size: .85rem; }
.exi-fname { font-size: .8rem; overflow-wrap: anywhere; }
@media (max-width: 600px) { .exi-row { grid-template-columns: 48px 1fr; } .exi-acts { grid-column: 1 / -1; } }
.import-list.single { columns: 1; }
@media (max-width: 700px) {
    .upd-item { grid-template-columns: 1fr; }
    .upd-preview { width: 100%; height: 140px; }
    .upd-image { grid-template-columns: 1fr; }
    .img-table thead { display: none; }
    .img-table tr { display: grid; grid-template-columns: auto 1fr; gap: 6px 10px; padding: 10px; border-bottom: 1px solid var(--border-color); }
    .img-table td { border: 0; padding: 0; width: auto !important; }
    .img-table td:nth-child(3), .img-table td:nth-child(4) { grid-column: 1 / -1; }
}

/* ---------- Security / two-factor ---------- */
.btn-danger { color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.badge-on { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; font-size: .75rem; background: var(--accent); color: var(--accent-contrast); vertical-align: middle; }
.totp-action { padding: 14px 0 4px; border-top: 1px solid var(--border-color); margin-top: 6px; }
.totp-action .setting-label { display: block; margin-bottom: 2px; }
.totp-action .setting-help { margin: 0 0 4px; }
.totp-action input { max-width: 200px; letter-spacing: .08em; }
.totp-steps { margin: 4px 0 10px; padding-left: 20px; color: var(--text-muted); font-size: .92rem; }
.totp-setup { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.totp-qr { width: 200px; height: 200px; padding: 6px; background: #fff; border-radius: 8px; flex-shrink: 0; }
.totp-qr svg { width: 100%; height: 100%; display: block; }
.totp-manual { flex: 1 1 240px; }
.totp-secret { display: inline-block; padding: 8px 10px; font-size: 1rem; letter-spacing: .06em; word-break: break-all; }
.recovery-panel { border-color: var(--accent); margin-bottom: 16px; }
.recovery-codes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px 16px; margin: 10px 0; padding-left: 24px; }
.recovery-codes code { font-size: 1rem; letter-spacing: .05em; }
.auth-help { margin: 0 0 14px; font-size: .92rem; color: var(--text-muted); text-align: center; }
.date-input.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 2px color-mix(in srgb, var(--danger) 25%, transparent); }

/* ---------- Category chips hint ---------- */
.filter-hint { margin: 6px 0 0; font-size: .75rem; color: var(--text-muted); }

/* ---------- Edit mode (admins) ---------- */
.sbtn[hidden] { display: none; }
.edit-mode-btn { margin-left: auto; align-self: center; }
.edit-mode-btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.edit-banner { margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; font-size: .88rem;
    background: color-mix(in srgb, var(--accent) 14%, transparent); border-left: 3px solid var(--accent); }
.edit-track { display: none; }
.grid.edit-mode .edit-track {
    position: absolute; left: 50%; bottom: 50px; transform: translateX(-50%); z-index: 3;
    display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
    padding: 4px 9px 4px 5px; border-radius: 999px; cursor: pointer; font: inherit; font-size: .75rem; font-weight: 600;
    color: var(--text-color); background: var(--panel-bg); border: 1px solid var(--border-strong); box-shadow: var(--card-shadow);
}
.grid.edit-mode .card { outline: 1px dashed color-mix(in srgb, var(--accent) 60%, transparent); outline-offset: 2px; }
.edit-switch { position: relative; width: 26px; height: 15px; border-radius: 999px; background: var(--icon-bg-off); transition: background .15s; }
.edit-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: #fff; transition: transform .15s; }
.edit-track[aria-pressed="true"] .edit-switch { background: var(--accent); }
.edit-track[aria-pressed="true"] .edit-switch::after { transform: translateX(11px); }
.edit-track.is-busy { opacity: .6; pointer-events: none; }

/* ---------- Totals page ---------- */
.tot-intro { margin: -4px 0 14px; color: var(--text-muted); font-size: .92rem; }
.tot-tiles { margin-bottom: 0; }
.tot-tile { position: relative; }
.tot-pct { font-size: .78rem; font-weight: 700; color: var(--text-muted); }
.tot-wrap { overflow-x: auto; border: 1px solid var(--border-color); border-radius: 10px; background: var(--panel-bg); margin-bottom: 22px; }
.tot-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tot-table.tot-narrow { max-width: 560px; }
.tot-table th, .tot-table td { padding: 8px 12px; text-align: left; white-space: nowrap; border-bottom: 1px solid var(--border-color); }
.tot-table thead th { background: var(--panel-bg); font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); font-weight: 700; cursor: help; }
.tot-table tbody th a, .tot-table tfoot th { color: var(--text-color); text-decoration: none; }
.tot-table tr[data-href] { cursor: pointer; }
.tot-table tr[data-href]:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.tot-head th { font-weight: 700; font-size: .98rem; }
.tot-head { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.tot-sub th { font-weight: 500; padding-left: 28px; }
.tot-section + .tot-section .tot-head > * { border-top: 2px solid var(--border-strong); }
.tot-grand > * { font-weight: 800; border-top: 2px solid var(--accent); border-bottom: 0; }
.tot-cell { min-width: 96px; }
.tot-num { display: block; font-variant-numeric: tabular-nums; }
.tot-num b { font-weight: 700; }
.tot-bar { display: block; height: 4px; margin-top: 4px; border-radius: 2px; background: var(--icon-bg-off); overflow: hidden; }
.tot-bar span { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.tot-cell.is-full .tot-bar span { background: var(--good); }
.tot-na { color: var(--text-muted); opacity: .5; }
.tot-h2 { font-size: 1.15rem; margin: 6px 0 10px; }
.no-sidebar .main:has(.tot-table) { max-width: 1500px; }
.no-sidebar .main:has(.syn-grid) { max-width: 1800px; }
.tot-table thead th { white-space: normal; min-width: 70px; vertical-align: bottom; line-height: 1.25; }
.tot-table th, .tot-table td { padding: 8px 10px; }
.tot-cell { min-width: 80px; }
.tot-table thead th { position: relative; z-index: 2; will-change: transform; }
.tot-table thead.is-stuck th { box-shadow: 0 3px 6px -2px rgba(0, 0, 0, .25), inset 0 -1px 0 var(--border-strong); }

/* Kitgun / Zaw entries on the Weapons page: counted in the totals, never displayed */
.card.card-ghost, .card.card-ghost[hidden] { display: none !important; }
.tot-actions { display: flex; gap: 8px; justify-content: flex-end; margin: -6px 0 8px; }
.tot-head.has-rows { cursor: pointer; }
.tot-toggle { display: inline-block; vertical-align: middle; margin: -2px 8px 0 0; width: 22px; height: 22px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--input-bg); cursor: pointer; position: relative; padding: 0; }
.tot-toggle::before { content: ''; position: absolute; left: 50%; top: 50%; width: 0; height: 0; border-style: solid;
    border-width: 5px 0 5px 7px; border-color: transparent transparent transparent var(--text-color); transform: translate(-40%, -50%); transition: transform .15s; }
.tot-toggle[aria-expanded="true"]::before { transform: translate(-50%, -40%) rotate(90deg); }
.tot-head:not(.has-rows) th { padding-left: 40px; }
.tot-sub th { padding-left: 52px; }
.tot-actions { align-items: center; }
.tot-cols { position: relative; }
.tot-cols > summary { list-style: none; cursor: pointer; }
.tot-cols > summary::-webkit-details-marker { display: none; }
.tot-cols > summary::after { content: ' ▾'; font-size: .8em; }
.tot-cols-menu { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; min-width: 220px; padding: 10px 12px;
    background: var(--panel-bg); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--card-shadow);
    display: flex; flex-direction: column; gap: 6px; }
.tot-cols-title { margin: 0 0 2px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.tot-cols-opt { display: flex; align-items: center; gap: 8px; font-size: .9rem; cursor: pointer; white-space: nowrap; }
.tot-cols-reset { margin-top: 4px; align-self: flex-start; }

/* ---------- Totals bars: one scrollable line ---------- */
.stats-wrap { position: relative; display: flex; align-items: center; gap: 4px; margin-bottom: 18px; }
.stats-wrap .stats { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; overflow-x: auto; margin-bottom: 0; scroll-behavior: smooth; scrollbar-width: none; padding: 2px 0; }
.stats-wrap .stats::-webkit-scrollbar { display: none; }
.stats-wrap .stat { flex: none; }
.stats-wrap .nav-scroll { height: 48px; }
.stats-wrap.can-prev .nav-scroll.prev, .stats-wrap.can-next .nav-scroll.next { display: block; }
.stats-wrap.can-prev .stats { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 22px); mask-image: linear-gradient(to right, transparent 0, #000 22px); }
.stats-wrap.can-next .stats { -webkit-mask-image: linear-gradient(to left, transparent 0, #000 22px); mask-image: linear-gradient(to left, transparent 0, #000 22px); }
.stats-wrap.can-prev.can-next .stats { -webkit-mask-image: linear-gradient(to right, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%); mask-image: linear-gradient(to right, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%); }

/* ---------- Footer / version ---------- */
.site-footer { margin-top: 32px; padding-top: 12px; border-top: 1px solid var(--border-color); font-size: .78rem; color: var(--text-muted); text-align: center; }
.auth-tagline { margin: -4px 0 14px; font-size: .9rem; color: var(--text-muted); text-align: center; }
.auth-version { margin: 12px 0 0; font-size: .75rem; color: var(--text-muted); text-align: center; }
.auth-page { align-content: center; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 55%, var(--border-color)); }
.users-actions { white-space: nowrap; text-align: right; } .users-table th[scope=row] { font-weight: 600; }
.reset-pw { display: inline-block; position: relative; }
.reset-pw > summary { list-style: none; cursor: pointer; display: inline-block; }
.reset-pw > summary::-webkit-details-marker { display: none; }
.reset-pw-box { position: fixed; z-index: 200; visibility: hidden; width: 280px; padding: 12px; text-align: left; white-space: normal;
    background: var(--panel-bg); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--card-shadow); display: flex; flex-direction: column; gap: 8px; }
.reset-pw-box label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; font-weight: 600; }
.reset-pw-box .muted { margin: 0; font-size: .8rem; }

/* ---------- Stacked form fields (Settings › Security) ---------- */
.form-fields { display: flex; flex-direction: column; gap: 14px; margin-top: 4px; }
.form-field { display: flex; flex-direction: column; gap: 6px; max-width: 380px; }
.form-field label { font-weight: 600; }
.form-field input {
    width: 100%;
    padding: 9px 11px;
    font: inherit;
    color: var(--text-color);
    background: var(--input-bg);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
}
.form-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.form-field .setting-help { margin: 0; }
/* Two-factor code boxes: same look as the other Security fields */
.totp-action .account-row input, .totp-setup .account-row input { font-family: inherit; padding: 9px 11px; color: var(--text-color); }
.totp-action .account-row input:focus, .totp-setup .account-row input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.auth-remember { display: flex; align-items: center; gap: 8px; margin: -4px 0 14px; font-weight: 400; cursor: pointer; }
.auth-card .auth-remember input { width: auto; margin: 0; padding: 0; box-shadow: none; accent-color: var(--accent); }
.reset-pw-box .reset-pw-check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
/* Admin › Users › Reset password: one-time password box in the site's input style */
.reset-pw-box input[type=text] {
    width: 100%;
    padding: 9px 11px;
    font: inherit;
    font-weight: 400;
    color: var(--text-color);
    background: var(--input-bg);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
}
.reset-pw-box input[type=text]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.reset-pw-box input[type=checkbox] { accent-color: var(--accent); }
/* The reset bubble floats above the page; admin.php's script places it next to its button */
.reset-pw-box.placed { visibility: visible; }
.reset-pw-box::before { content: ''; position: absolute; left: calc(var(--arrow, 260px) - 5px); width: 10px; height: 10px; background: var(--panel-bg);
    border: 1px solid var(--border-strong); transform: rotate(45deg); }
.reset-pw-box:not(.above)::before { top: -6px; border-right: 0; border-bottom: 0; }
.reset-pw-box.above::before { bottom: -6px; border-left: 0; border-top: 0; }
.reset-pw[open] > summary { border-color: var(--accent); color: var(--accent); }

/* ---------------- Mastery page ---------------- */
:root { --steel: #d4493f; --railjack: #e0a24a; --drifter: #8fb98a; }
[data-theme="light"] { --steel: #b5352c; --railjack: #a8670e; --drifter: #3f7a39; }
.mr-hero { display: grid; grid-template-columns: auto 1fr auto auto; gap: 18px 24px; align-items: center; padding: 16px 20px; margin-bottom: 18px;
    border: 1px solid var(--border-strong); border-radius: 12px; box-shadow: var(--card-shadow);
    background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--accent) 16%, var(--panel-bg)) 0%, var(--panel-bg) 60%); }
.mr-badge { position: relative; width: 72px; height: 72px; display: grid; place-items: center; }
.mr-badge img { width: 72px; height: 72px; object-fit: contain; filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 45%, transparent)); }
.mr-legend { position: absolute; right: -6px; bottom: -4px; padding: 1px 6px; border-radius: 8px; font: 700 .75rem 'Quantico', sans-serif;
    background: var(--railjack); color: #111; }
.mr-main, .mr-total { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.mr-total { text-align: right; }
.mr-caption { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); }
.mr-rank, .mr-total strong { font: 700 1.7rem/1.1 'Quantico', sans-serif; font-variant-numeric: tabular-nums; }
.mr-bar { display: block; height: 6px; border-radius: 3px; background: var(--icon-bg-off); overflow: hidden; margin: 4px 0 2px; max-width: 420px; }
.mr-bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .25s; }
.mr-next { font-size: .85rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
    .mr-hero { grid-template-columns: auto 1fr; }
    .mr-total { grid-column: 1 / -1; text-align: left; }
}
.tot-wrap:has(.mastery-table) { max-width: 760px; }
.mastery-table .tot-cell { min-width: 150px; }

/* Intrinsics */
.intr-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; margin-bottom: 26px; }
.intr-panel { --tree: var(--railjack); border: 1px solid var(--border-strong); border-radius: 12px; overflow: hidden; background: var(--panel-bg); box-shadow: var(--card-shadow); scroll-margin-top: 80px; }
.intr-drifter { --tree: var(--drifter); }
.intr-head { position: relative; display: flex; gap: 14px; align-items: center; padding: 14px 16px; min-height: 108px;
    background: linear-gradient(100deg, color-mix(in srgb, var(--tree) 28%, var(--panel-bg-2)) 0%, var(--panel-bg-2) 70%);
    border-bottom: 2px solid var(--tree); }
.intr-art { width: 132px; height: 84px; object-fit: contain; flex: none; filter: drop-shadow(0 2px 6px rgba(0,0,0,.4)); }
.intr-art.is-missing { display: block; border-radius: 8px; background: color-mix(in srgb, var(--tree) 18%, transparent); border: 1px dashed color-mix(in srgb, var(--tree) 60%, transparent); }
.intr-title h3 { margin: 0; font: 700 1.3rem 'Quantico', sans-serif; letter-spacing: .04em; text-transform: uppercase; color: var(--tree); }
.intr-tag { margin: 2px 0 6px; font-size: .82rem; color: var(--text-muted); }
.intr-sum { margin: 0; font-size: .88rem; font-variant-numeric: tabular-nums; }
.intr-list { list-style: none; margin: 0; padding: 6px 0; }
.intr-row { display: grid; grid-template-columns: 40px minmax(90px, 1fr) auto auto; gap: 12px; align-items: center; padding: 8px 16px; }
.intr-row + .intr-row { border-top: 1px solid color-mix(in srgb, var(--border-color) 60%, transparent); }
.intr-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%;
    background: color-mix(in srgb, var(--tree) 78%, #000); border: 1px solid var(--tree);
    box-shadow: 0 0 6px color-mix(in srgb, var(--tree) 45%, transparent); }
.intr-img { width: 30px; height: 30px; object-fit: contain; }
.intr-img { filter: drop-shadow(0 0 1px rgba(0, 0, 0, .5)); }
.intr-img.is-missing { width: 14px; height: 14px; border-radius: 50%; background: #fff; opacity: .6; filter: none; }
.intr-name { font-weight: 700; }
.intr-pips { display: flex; gap: 3px; }
.intr-pip { width: 13px; height: 20px; padding: 0; border: 1px solid color-mix(in srgb, var(--tree) 55%, transparent); border-radius: 3px;
    background: var(--input-bg); cursor: pointer; transform: skewX(-12deg); transition: background .12s; }
.intr-pip.on { background: var(--tree); border-color: var(--tree); }
.intr-pip:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--tree) 35%, transparent); }
.intr-row.is-max .intr-name::after { content: ' MAX'; font-size: .7rem; color: var(--tree); letter-spacing: .06em; }
.intr-step { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; background: var(--input-bg); }
.intr-btn { width: 28px; height: 30px; border: 0; background: transparent; color: var(--text-color); font-size: 1.05rem; cursor: pointer; }
.intr-btn:hover { background: var(--icon-bg-off); }
.intr-input { width: 40px; height: 30px; border: 0; border-left: 1px solid var(--border-color); border-right: 1px solid var(--border-color);
    background: transparent; color: var(--text-color); text-align: center; font: inherit; font-weight: 700; -moz-appearance: textfield; }
.intr-input::-webkit-outer-spin-button, .intr-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
@media (max-width: 560px) {
    .intr-row { grid-template-columns: 36px 1fr auto; }
    .intr-pips { grid-column: 1 / -1; order: 5; justify-content: space-between; }
    .intr-pip { flex: 1; }
    .intr-art { width: 92px; height: 64px; }
}

/* Star Chart */
.sc-toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.sc-seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 8px; overflow: hidden; margin-right: auto; }
.sc-seg-btn { padding: 7px 10px; border: 0; background: transparent; color: var(--text-color); font: inherit; font-size: .88rem; cursor: pointer; }
.sc-seg-btn + .sc-seg-btn { border-left: 1px solid var(--border-strong); }
.sc-seg-btn.active { background: var(--accent); color: var(--accent-contrast); font-weight: 700; }
.sc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); gap: 12px; align-items: start; margin-bottom: 26px; }
.sc-planet { border: 1px solid var(--border-color); border-radius: 10px; background: var(--panel-bg); scroll-margin-top: 80px; }
.sc-planet[open] { border-color: var(--border-strong); }
.sc-planet.is-finished { opacity: .55; }
.sc-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px; cursor: pointer; list-style: none; }
.sc-head::-webkit-details-marker { display: none; }
.sc-head::before { content: ''; border: 5px solid transparent; border-left-color: var(--text-muted); margin-right: 2px; transition: transform .15s; transform-origin: 25% 50%; }
.sc-planet[open] > .sc-head::before { transform: rotate(90deg); }
.sc-planet-name { font: 700 1rem 'Quantico', sans-serif; letter-spacing: .03em; margin-right: auto; }
.sc-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 10px; font-size: .8rem; font-variant-numeric: tabular-nums;
    background: var(--icon-bg-off); --c: var(--accent); }
.sc-badge.sp { --c: var(--steel); background: color-mix(in srgb, var(--steel) 14%, transparent); }
.sc-dot { width: 8px; height: 8px; border-radius: 50%; border: 1.5px solid var(--c); }
.sc-badge.is-full .sc-dot { background: var(--c); }
.sc-bulk { display: flex; gap: 6px; padding: 0 14px 8px; flex-wrap: wrap; }
.sc-bulk .btn { padding: 4px 10px; font-size: .78rem; }
.sc-bulk .btn.sp { color: var(--steel); border-color: color-mix(in srgb, var(--steel) 55%, transparent); }
.sc-nodes { list-style: none; margin: 0; padding: 0 0 6px; }
.sc-node { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; align-items: center; padding: 6px 14px; border-top: 1px solid color-mix(in srgb, var(--border-color) 55%, transparent); }
.sc-node[hidden] { display: none; }
.sc-node-name { display: flex; flex-direction: column; min-width: 0; font-weight: 500; line-height: 1.2; }
.sc-node-name small { font-size: .74rem; color: var(--text-muted); font-weight: 400; }
.sc-node.is-junction .sc-node-name { font-weight: 700; }
.sc-pts { font-size: .8rem; color: var(--text-muted); font-variant-numeric: tabular-nums; min-width: 36px; text-align: right; }
.sc-toggle { --c: var(--accent); min-width: 54px; padding: 4px 9px; border-radius: 14px; border: 1.5px solid color-mix(in srgb, var(--c) 60%, transparent);
    background: transparent; color: var(--text-muted); font: inherit; font-size: .76rem; font-weight: 700; cursor: pointer; transition: background .12s, color .12s; }
.sc-toggle.sp { --c: var(--steel); }
.sc-toggle.on { background: var(--c); border-color: var(--c); color: var(--accent-contrast); }
.sc-toggle.sp.on { color: #fff; }
.sc-toggle:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--c) 30%, transparent); }
.sc-node.done-normal.done-steel .sc-node-name { opacity: .7; }

/* Clear (×) button inside search boxes */
.clear-wrap { position: relative; display: block; min-width: 0; }
.clear-wrap > input { width: 100%; padding-right: 30px !important; }
.clear-wrap > input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; display: none; }
.clear-btn { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; padding: 0;
    border: 0; border-radius: 50%; background: var(--icon-bg-off); color: var(--text-muted); font-size: 16px; line-height: 22px;
    cursor: pointer; display: none; }
.clear-wrap.has-value .clear-btn { display: block; }
.clear-btn:hover { background: var(--accent); color: var(--accent-contrast); }
.sc-node.is-zero { background: repeating-linear-gradient(135deg, transparent 0 8px, color-mix(in srgb, var(--text-muted) 6%, transparent) 8px 16px); }
.sc-node.is-zero .sc-node-name { color: var(--text-muted); font-style: italic; }
.sc-node.is-zero .sc-toggle { border-style: dashed; }
.sc-node.is-zero .sc-toggle.on { border-style: solid; opacity: .75; }
.sc-none { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; opacity: .8; }
.sc-planet.is-zero { border-style: dashed; }
.sc-zero-tag { margin-left: 6px; padding: 1px 6px; border-radius: 8px; font: 700 .65rem 'Roboto', sans-serif; text-transform: uppercase;
    letter-spacing: .05em; color: var(--text-muted); border: 1px dashed var(--text-muted); vertical-align: middle; }
.sc-badge, .sc-zero-tag { white-space: nowrap; }
.sc-planet-name { min-width: 0; }

/* Star Chart wiki links */
.sc-wiki { font-size: .74rem; color: var(--text-muted); text-decoration: none; padding: 2px 6px; border-radius: 6px; white-space: nowrap; }
.sc-wiki:hover { color: var(--accent); background: var(--icon-bg-off); }
.sc-node-name a { color: inherit; text-decoration: none; }
.sc-node-name a:hover { color: var(--accent); text-decoration: underline; }
.sc-node-name a::after { content: ' ↗'; font-size: .7em; opacity: 0; }
.sc-node-name a:hover::after { opacity: .8; }

/* Faction icons (Star Chart): white icon on a round badge like the item buttons */
.sc-node { grid-template-columns: 26px 1fr auto auto auto; }
.fac-icon { width: 26px; height: 26px; flex: none; display: inline-grid; place-items: center; border-radius: 50%;
    border: 1px solid var(--icon-ring); background: var(--icon-bg); box-shadow: 0 0 5px color-mix(in srgb, var(--icon-bg) 55%, transparent);
    font: 700 .72rem 'Quantico', sans-serif; color: #fff; text-shadow: 0 0 2px rgba(0, 0, 0, .6); }
.fac-icon img { width: 18px; height: 18px; object-fit: contain; filter: drop-shadow(0 0 1px rgba(0, 0, 0, .55)); }
.fac-icon.is-none { border: 0; background: none; box-shadow: none; }
.fac-planet { width: 28px; height: 28px; }
.fac-planet img { width: 20px; height: 20px; }
/* Star Chart totals bubbles beside the To Do buttons */
.sc-toolbar .sc-seg { margin-right: 0; }
.sc-totals { display: flex; flex-wrap: wrap; gap: 6px; margin-right: auto; }
.sc-total { padding: 5px 10px; font-size: .82rem; border-radius: 14px; }

/* Faction key above the Star Chart */
.fac-key { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0 0 12px; padding: 10px 14px;
    border: 1px solid var(--border-color); border-radius: 10px; background: var(--panel-bg); }
.fac-key-item { display: inline-flex; align-items: center; gap: 7px; font-size: .86rem; font-weight: 500; white-space: nowrap; }
.fac-key .fac-icon { width: 24px; height: 24px; }
.fac-key .fac-icon img { width: 16px; height: 16px; }

/* Highest possible Mastery Rank (Mastery page) */
.mr-max { display: flex; flex-direction: column; gap: 3px; min-width: 0; text-align: right; padding-left: 22px; border-left: 1px solid var(--border-color); }
.mr-max-rank { display: inline-flex; align-items: center; justify-content: flex-end; gap: 8px; }
.mr-max-rank img { width: 30px; height: 30px; object-fit: contain; }
.mr-max-rank strong { font: 700 1.25rem/1.1 'Quantico', sans-serif; }
.mr-founders { font-size: .75rem; opacity: .8; }
@media (max-width: 900px) {
    .mr-hero { grid-template-columns: auto 1fr auto; }
    .mr-max { grid-column: 1 / -1; text-align: left; padding: 10px 0 0; border-left: 0; border-top: 1px solid var(--border-color); }
    .mr-max-rank { justify-content: flex-start; }
}
@media (max-width: 640px) { .mr-hero { grid-template-columns: auto 1fr; } }

/* Mastery page: category table and intrinsics side by side when there's room */
.mastery-split { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 28px; align-items: start; }
.mastery-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 6px 14px; margin-bottom: 8px; }
.mastery-head .tot-intro { margin: 0; max-width: 620px; }
.mastery-head .tot-actions { margin: 0; }
.mastery-main .tot-wrap { max-width: 760px; }
@media (min-width: 1320px) {
    .mastery-split { grid-template-columns: minmax(560px, 760px) minmax(420px, 1fr); }
    .mastery-main .tot-wrap { max-width: none; }
    .mastery-side .intr-grid { grid-template-columns: 1fr; }
}
.sc-toggle:disabled { cursor: default; box-shadow: none; }
.sc-node.no-sp .sc-toggle.sp { border-style: dotted; }

.toast.is-action { pointer-events: auto; background: var(--accent); color: var(--accent-contrast); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* ---------------- Factions page ---------------- */
.syn-stats { margin-bottom: 4px; }
.syn-group { margin-bottom: 26px; }
.syn-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 270px), 1fr)); gap: 12px; }
.syn-card { --syn: var(--accent); position: relative; display: flex; flex-direction: column; gap: 12px; padding: 14px 16px 14px 18px;
    border: 1px solid var(--border-color); border-radius: 12px; overflow: hidden; box-shadow: var(--card-shadow);
    background: linear-gradient(110deg, color-mix(in srgb, var(--syn) 16%, var(--panel-bg)) 0%, var(--panel-bg) 55%); }
.syn-card::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--syn); }
.syn-card.is-max { border-color: color-mix(in srgb, var(--syn) 60%, var(--border-color)); }
.syn-head { display: flex; align-items: center; gap: 12px; }
.syn-badge { width: 52px; height: 52px; flex: none; display: grid; place-items: center; border-radius: 50%;
    background: color-mix(in srgb, var(--syn) 22%, #10171d); border: 1px solid color-mix(in srgb, var(--syn) 70%, transparent); }
.syn-icon { width: 38px; height: 38px; object-fit: contain; }
.syn-icon.is-missing { display: grid; place-items: center; font: 700 1.2rem 'Quantico', sans-serif; color: #fff; }
.syn-title { min-width: 0; }
.syn-title h3 { margin: 0; font: 700 1.05rem 'Quantico', sans-serif; letter-spacing: .02em; }
.syn-title h3 a { color: inherit; text-decoration: none; }
.syn-title h3 a:hover { color: var(--accent); text-decoration: underline; }
.syn-rank { margin: 2px 0 0; font-size: .9rem; font-weight: 700; color: color-mix(in srgb, var(--syn) 55%, var(--text-color)); }
[data-theme="light"] .syn-rank { color: color-mix(in srgb, var(--syn) 35%, var(--text-color)); }
.syn-rank-num { margin-left: 4px; font-size: .75rem; font-weight: 500; color: var(--text-muted); }
.syn-card.is-negative .syn-rank { color: var(--danger); }
.syn-steps { display: flex; gap: 4px; }
.syn-step { flex: 1; min-width: 0; height: 26px; padding: 0; border-radius: 5px; border: 1px solid color-mix(in srgb, var(--syn) 50%, var(--border-strong));
    background: var(--input-bg); color: var(--text-muted); font: 700 .74rem 'Quantico', sans-serif; cursor: pointer; transform: skewX(-12deg);
    transition: background .12s, color .12s; }
.syn-step.on { background: color-mix(in srgb, var(--syn) 70%, #000); border-color: var(--syn); color: #fff; }
.syn-step.neg.on { background: color-mix(in srgb, var(--danger) 75%, #000); border-color: var(--danger); }
.syn-step.zero.on:not(.current) { background: var(--input-bg); color: var(--text-muted); border-color: color-mix(in srgb, var(--syn) 50%, var(--border-strong)); }
.syn-step.current { box-shadow: 0 0 0 2px color-mix(in srgb, var(--syn) 45%, transparent); }
.syn-step:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--syn) 35%, transparent); }
.syn-standing { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .8rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.syn-standing-row { display: inline-flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; }
.syn-input { width: 120px; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--border-strong); background: var(--input-bg);
    color: var(--text-color); font: inherit; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.syn-cap { font-size: .85rem; font-weight: 500; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.syn-card .syn-input { width: 110px; }
.syn-standing { flex-direction: column; align-items: flex-start; gap: 4px; }

/* Standing bar: the number sits on a bar that fills as the rank fills */
.syn-standing { align-items: stretch; }
.syn-meter { position: relative; display: flex; align-items: center; gap: 6px; width: 100%; height: 34px; padding: 0 10px 0 2px;
    border: 1px solid color-mix(in srgb, var(--syn) 45%, var(--border-strong)); border-radius: 8px; background: var(--input-bg); overflow: hidden;
    text-transform: none; letter-spacing: 0; }
.syn-meter-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; transition: width .25s;
    background: linear-gradient(90deg, color-mix(in srgb, var(--syn) 30%, transparent), color-mix(in srgb, var(--syn) 60%, transparent)); }
.syn-meter.is-negative .syn-meter-fill { background: linear-gradient(90deg, color-mix(in srgb, var(--danger) 25%, transparent), color-mix(in srgb, var(--danger) 55%, transparent)); }
.syn-meter .syn-input { position: relative; flex: 1; width: auto; min-width: 0; height: 100%; padding: 0 4px 0 8px; border: 0; background: transparent;
    text-align: left; text-shadow: var(--text-shadow); }
.syn-meter .syn-input:focus { outline: none; }
.syn-meter:focus-within { box-shadow: 0 0 0 2px color-mix(in srgb, var(--syn) 45%, transparent); }
.syn-meter .syn-cap { position: relative; color: var(--text-color); font-weight: 700; text-shadow: var(--text-shadow); white-space: nowrap; }
.syn-meter[data-no-cap] { padding-right: 2px; }

/* Negative rank: the syndicate's name turns red too */
.syn-card.is-negative .syn-title h3, .syn-card.is-negative .syn-title h3 a { color: var(--danger); }
.syn-card.is-negative { border-color: color-mix(in srgb, var(--danger) 55%, var(--border-color)); }

/* Syndicate colours stay visible on both themes: a contrasting edge around coloured parts */
:root { --syn-edge: rgba(255, 255, 255, .45); --syn-edge-soft: rgba(255, 255, 255, .22); }
[data-theme="light"] { --syn-edge: rgba(0, 0, 0, .45); --syn-edge-soft: rgba(0, 0, 0, .2); }
.syn-card::before { box-shadow: inset -1px 0 0 var(--syn-edge), inset 0 0 0 1px var(--syn-edge-soft); }
.syn-badge { box-shadow: 0 0 0 1px var(--syn-edge-soft); }
.syn-step.on { border-color: var(--syn-edge); }
.syn-step.neg.on { border-color: var(--syn-edge); }
.syn-meter-fill { box-shadow: inset -2px 0 0 var(--syn-edge); }
.syn-meter-fill[style*="width:0"], .syn-meter-fill[style*="width: 0"] { box-shadow: none; }
.syn-rank { text-shadow: 0 0 1px var(--syn-edge-soft), 0 0 2px var(--syn-edge-soft); }
[data-theme="light"] .syn-rank { text-shadow: none; color: color-mix(in srgb, var(--syn) 30%, #000); }

/* Every card has the same three rows (rank line, rank steps, bar) so cards line up whatever they track */
.syn-card { justify-content: flex-start; }
.syn-rank-none { color: var(--text-muted) !important; font-weight: 500; }
.syn-steps-none { display: flex; align-items: center; height: 26px; margin: 0; font-size: .8rem; color: var(--text-muted); font-style: italic; }
.syn-card .syn-standing { margin-top: auto; }
.syn-meter-ranks { padding: 0 10px; }
.syn-meter-text { position: relative; font-weight: 700; font-size: .9rem; text-shadow: var(--text-shadow); }
:root:not([data-theme="light"]) .syn-rank:not(.syn-rank-none) { color: color-mix(in srgb, var(--syn) 50%, #fff); }
.syn-card.is-negative .syn-rank { color: var(--danger) !important; }

/* Icons on the totals bars (pages and the Totals page): on a round badge, beside the bar */
.stat-bar-row { grid-column: 1 / -1; display: flex; align-items: center; gap: 7px; margin-top: 6px; }
.stat-bar-row .stat-bar { flex: 1; margin-top: 0; position: relative; }
.stat-icon { width: 22px; height: 22px; flex: none; display: inline-grid; place-items: center; border-radius: 50%;
    background: var(--icon-bg); border: 1px solid var(--icon-ring); }
.stat-icon img { width: 16px; height: 16px; object-fit: contain; }
.stat { align-items: center; }
/* Two counts on one bar: blue first count, green second count drawn on top */
.stat-bar.is-dual > span:first-child { background: var(--accent); }
.stat-bar .stat-bar2 { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--good); transition: width .25s; }
.stat-value .dual-a { color: var(--accent); }
.stat-value .dual-b { color: var(--good); }

/* Factions: standing is typed, not stepped one at a time */
.syn-input::-webkit-outer-spin-button, .syn-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.syn-input { -moz-appearance: textfield; appearance: textfield; }

/* Mastery page: what isn't mastered yet */
.mastery-missing { margin: 4px 0 22px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--panel-bg); }
.mastery-missing > summary { padding: 10px 14px; cursor: pointer; font-weight: 700; list-style: none; display: flex; align-items: center; gap: 8px; }
.mastery-missing > summary::-webkit-details-marker, .miss-group > summary::-webkit-details-marker { display: none; }
.mastery-missing > summary::before, .miss-group > summary::before { content: ''; border: 5px solid transparent; border-left-color: var(--text-muted); transition: transform .15s; transform-origin: 25% 50%; }
.mastery-missing[open] > summary::before, .miss-group[open] > summary::before { transform: rotate(90deg); }
.mastery-missing .muted { font-weight: 500; }
.miss-groups { padding: 0 14px 12px; display: flex; flex-direction: column; gap: 4px; }
.miss-group > summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; padding: 5px 0; font-weight: 500; }
.miss-group ul { list-style: none; margin: 2px 0 8px 18px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.miss-group li a { display: inline-block; padding: 3px 9px; border-radius: 12px; border: 1px solid var(--border-strong); color: var(--text-color);
    text-decoration: none; font-size: .85rem; background: var(--input-bg); }
.miss-group li a:hover { border-color: var(--accent); color: var(--accent); }
.miss-group li small { color: var(--text-muted); margin-left: 4px; }

.miss-actions { display: flex; gap: 6px; margin-left: auto; }
.miss-actions .btn { padding: 4px 10px; font-size: .78rem; }

/* "Not mastered yet" with pictures: small item cards */
.miss-art { display: none; }
.mastery-missing.show-images .miss-group ul { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin-right: 0; }
.mastery-missing.show-images .miss-group li a { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; padding: 8px 8px 9px;
    border-radius: 10px; text-align: center; background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 10%, var(--input-bg)), var(--input-bg)); }
.mastery-missing.show-images .miss-art { display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; border-radius: 7px;
    background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%); }
.mastery-missing.show-images .miss-art img { max-width: 100%; max-height: 100%; object-fit: contain; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .35)); }
.mastery-missing.show-images .miss-art:empty::after { content: '?'; font: 700 1.6rem 'Quantico', sans-serif; color: var(--text-muted); opacity: .5; }
.mastery-missing.show-images .miss-name { font-size: .8rem; font-weight: 700; line-height: 1.2; }
.mastery-missing.show-images .miss-name small { display: block; margin: 2px 0 0; }
.miss-img-toggle[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }

/* Settings › Credits */
.credits-heading { margin: 18px 0 8px; font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.credits-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.credits-list li { padding: 10px 12px; border: 1px solid var(--border-color); border-radius: 8px; background: var(--input-bg); }
.credits-list p { margin: 4px 0 0; font-size: .88rem; }
.credits-name { font-weight: 700; color: var(--text-color); text-decoration: none; }
.credits-name:hover { color: var(--accent); text-decoration: underline; }

/* Intrinsic points (Mastery page) */
.intr-points { margin: 3px 0 0; font-size: .82rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.intr-points b { color: var(--text-color); }
.intr-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.intr-cost { font-size: .72rem; font-weight: 500; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.intr-row.is-max .intr-name-text::after { content: ' MAX'; font-size: .7rem; color: var(--tree); letter-spacing: .06em; }
.intr-row.is-max .intr-name::after { content: none; }

/* Factions: last sync notice and per-card notes */
.sync-note { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; margin: 0 0 14px; padding: 10px 14px;
    border: 1px solid var(--border-color); border-left: 4px solid var(--accent); border-radius: 8px; background: var(--panel-bg); font-size: .88rem; }
.sync-note.is-never { border-left-color: var(--text-muted); }
.syn-note { margin: 0; font-size: .8rem; color: var(--text-muted); }
.syn-note b { color: var(--text-color); font-variant-numeric: tabular-nums; }

/* Settings: hidden account ID, in-game MR check */
.secret-wrap { display: inline-flex; flex: 1; min-width: 0; gap: 6px; }
.secret-wrap input { flex: 1; min-width: 0; }
input.is-masked { -webkit-text-security: disc; text-security: disc; }
.secret-toggle { padding: 6px 12px; }
.mr-check { margin-top: 12px; padding: 10px 12px; border: 1px solid var(--border-color); border-left: 4px solid var(--accent); border-radius: 8px;
    background: var(--input-bg); display: grid; gap: 4px; font-size: .9rem; }
.mr-check.is-match { border-left-color: var(--good); }
.mr-check.is-mismatch { border-left-color: var(--warn); }
.mr-check .setting-label { display: inline; margin-right: 6px; }
.mr-check-result { margin: 4px 0 0; }
.mr-check.is-match .mr-check-result { color: var(--good); font-weight: 700; }

.syn-card .syn-note { margin-top: -4px; }

.stat-pct { grid-column: 1 / -1; font-size: .78rem; font-weight: 700; margin-top: 2px; }
.tot-pct .dual-a, .stat-pct .dual-a { color: var(--accent); }
.tot-pct .dual-b, .stat-pct .dual-b { color: var(--good); }

.tot-hide-done { gap: 10px; margin-right: auto; }
.tot-hide-done:has(input:checked) { border-color: var(--accent); }
/* A smaller switch for button rows */
.switch-sm .switch-track { width: 34px; height: 20px; border-radius: 10px; }
.switch-sm .switch-thumb { width: 14px; height: 14px; }
.switch-sm input:checked + .switch-track .switch-thumb { transform: translateX(14px); }

/* ---------- Read-only share link (Settings › General, and the shared view itself) ---------- */
.share-row input { flex: 1 1 320px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .85rem; }
.share-left { margin-top: 8px; }
.share-left strong { font-variant-numeric: tabular-nums; }
.btn-link { margin-left: 6px; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; }
.share-badge { padding: 4px 10px; border: 1px solid var(--border-strong); border-radius: 999px; font-size: .8rem; font-weight: 700;
    color: var(--text-muted); white-space: nowrap; }
.share-banner { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; margin: 0 0 14px; padding: 10px 14px;
    border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); border-radius: 10px;
    background: color-mix(in srgb, var(--accent) 10%, transparent); font-size: .9rem; }
.share-banner.is-expired { border-color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.is-shared :is(.sbtn, .intr-pip, .intr-btn, .sc-toggle, .syn-step) { cursor: default; }
.is-shared :is(.sc-all, .intr-btn) { display: none; }
.is-shared :is(.rank-select, .intr-input, .syn-input):disabled { opacity: 1; color: inherit; -webkit-text-fill-color: currentColor; cursor: default; }

/* A totals bar at 100% turns green, like the finished rows on Totals and Mastery */
.stat-bar.is-full > span:first-child, .stat-bar.is-full.is-dual > span:first-child { background: var(--good); }

/* Star Chart: Steel Path goal filters (Unlock Steel Path, Steel Path Rewards) */
.sc-seg-n { display: inline-block; min-width: 20px; margin-left: 4px; padding: 0 6px; border-radius: 9px; background: color-mix(in srgb, currentColor 14%, transparent); font-size: .74rem; font-weight: 700; line-height: 18px; text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sc-seg-btn.is-complete .sc-seg-n { color: var(--good); font-weight: 700; opacity: 1; }
.sc-seg-btn.active.is-complete .sc-seg-n { color: inherit; }
.sc-goal-notes { margin: -4px 0 12px; }
.sc-goal-notes:not(:has(.sc-goal-note:not([hidden]))) { display: none; }
.sc-goal-note { display: block; font-size: .82rem; color: var(--text-muted); }
.sc-goal-note[hidden] { display: none; }

/* Mastery rank button: right-click / long press opens the rank picker (assets/app.js) */
.mastery-btn { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.popover-rank { margin-top: 8px; }
.popover-rank input { width: 70px; }

/* Profile sync limits (Settings › General) */
.sync-status strong { color: var(--text-color); }
.sync-warning { margin: 10px 0; padding: 10px 12px; border: 1px solid var(--danger); border-left-width: 4px; border-radius: 8px;
    background: color-mix(in srgb, var(--danger) 9%, transparent); font-size: .88rem; }
.sync-warning strong { display: block; margin-bottom: 4px; color: var(--danger); }

/* ---------- World State page ---------- */
.ws-warning { margin: 0 0 14px; padding: 10px 14px; border: 1px solid var(--danger); border-left-width: 4px; border-radius: 8px;
    background: color-mix(in srgb, var(--danger) 9%, transparent); font-size: .9rem; }
.ws-warning strong { color: var(--danger); }
.ws-admin { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px 16px; margin: 0 0 14px; padding: 10px 14px;
    border: 1px dashed var(--border-strong); border-radius: 10px; font-size: .86rem; }
.ws-admin-status { display: grid; gap: 2px; flex: 1 1 360px; }
.ws-ok { color: var(--good); font-weight: 700; }
.ws-fail { color: var(--danger); font-weight: 700; }
.no-sidebar .main:has(.ws-grid) { max-width: 1200px; }
.ws-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: 12px; margin-bottom: 22px; }
.ws-card { --ws: var(--accent); padding: 14px 16px; border: 1px solid var(--border-color); border-left: 4px solid var(--ws); border-radius: 10px; background: var(--panel-bg); }
.ws-card h2 { margin: 0; font-family: 'Quantico', sans-serif; font-size: 1.05rem; }
.ws-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.ws-badge { flex: 0 0 auto; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; overflow: hidden;
    border: 2px solid color-mix(in srgb, var(--ws, var(--accent)) 60%, transparent); background: var(--panel-bg-2); }
.ws-badge img { width: 100%; height: 100%; object-fit: cover; }
.ws-badge.is-missing { font-family: 'Quantico', sans-serif; font-weight: 700; font-size: 1.1rem; color: var(--text-muted); }
.ws-sub { margin: 0; font-size: .78rem; color: var(--text-muted); }
.ws-state { display: flex; align-items: center; gap: 8px; margin: 0; font-family: 'Quantico', sans-serif; font-size: 1.35rem; font-weight: 700; color: var(--ws); }
.ws-glyph { display: inline-grid; place-items: center; width: 26px; height: 26px; }
.ws-glyph img { width: 24px; height: 24px; object-fit: contain; }
.ws-glyph .ws-fac { width: 26px; height: 26px; }
/* Time left in this phase, over a bar that fills as the phase goes on */
.ws-timer { position: relative; margin: 6px 0 10px; height: 28px; border: 1px solid var(--border-strong); border-radius: 7px; overflow: hidden; background: var(--input-bg); }
.ws-fill { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--ws) 38%, transparent); transition: width 1s linear; }
.ws-timer-text { position: relative; display: flex; align-items: center; gap: 4px; height: 100%; padding: 0 10px; font-size: .88rem; }
.ws-timer-text b { font-variant-numeric: tabular-nums; }
.ws-left { margin: 2px 0 8px; font-size: .9rem; }
.ws-left b { font-variant-numeric: tabular-nums; }
.ws-next { display: grid; gap: 2px; margin: 0; padding: 8px 0 0; list-style: none; border-top: 1px solid var(--border-color); font-size: .82rem; color: var(--text-muted); }
.ws-next li { display: flex; justify-content: space-between; gap: 10px; }
.ws-next time { font-variant-numeric: tabular-nums; }
.ws-wait, .ws-note { margin: 4px 0; font-size: .84rem; color: var(--text-muted); font-style: italic; }
.ws-card[data-state="day"], .ws-card[data-state="warm"], .ws-card[data-state="fass"], .ws-card[data-state="joy"] { --ws: #e0a53a; }
.ws-card[data-state="night"], .ws-card[data-state="cold"] { --ws: #6c8cd5; }
.ws-card[data-state="grineer"], .ws-card[data-state="anger"] { --ws: #d5604e; }
.ws-card[data-state="vome"] { --ws: #4fb6d8; }
.ws-card[data-state="corpus"], .ws-card[data-state="sorrow"] { --ws: #4a9eda; }
.ws-card[data-state="envy"] { --ws: #3aa76d; }
.ws-card[data-state="fear"] { --ws: #9a74c9; }
.ws-baro { padding: 14px 16px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--panel-bg); margin-bottom: 26px; }
.ws-baro .tot-h2 { margin: 0; }
.ws-baro .ws-badge { --ws: #d7b44a; }
.ws-baro .ws-state { color: var(--text-color); }
.ws-baro .ws-here { color: #d7b44a; }
.ws-inv { width: 100%; max-width: 640px; margin-top: 8px; border-collapse: collapse; font-size: .86rem; }
.ws-inv th, .ws-inv td { padding: 5px 8px; border-bottom: 1px solid var(--border-color); text-align: left; }
.ws-inv td:not(:first-child), .ws-inv th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }

/* World State: each place's picture behind its card (Icons/WorldState/, in .ws-bg), framed per picture.
   Cards with a picture always use light text on a darkened image, in both themes. */
.ws-card.has-art, .ws-baro.has-art {
    --text-color: #eef3f8; --text-muted: rgba(226, 235, 244, .78); --border-color: rgba(255, 255, 255, .16); --border-strong: rgba(255, 255, 255, .28);
    --input-bg: rgba(6, 10, 16, .55);
    position: relative; isolation: isolate; overflow: hidden; color: var(--text-color); background: #0b1118; min-height: 230px;
}
.ws-bg { position: absolute; inset: 0; z-index: -2; background: center / cover no-repeat; }
/* Darken towards the bottom, where the countdown and times are */
.ws-card.has-art::after {
    content: ""; position: absolute; inset: 0; z-index: -1;
    background: linear-gradient(180deg, rgba(6, 10, 16, .30) 0%, rgba(6, 10, 16, .55) 38%, rgba(6, 10, 16, .88) 72%, rgba(6, 10, 16, .95) 100%);
}
.ws-card.has-art h2, .ws-card.has-art .ws-state, .ws-baro.has-art .tot-h2, .ws-baro.has-art .ws-state { text-shadow: 0 1px 3px rgba(0, 0, 0, .85); }
.ws-card.has-art .ws-sub { color: rgba(236, 242, 248, .85); text-shadow: 0 1px 2px rgba(0, 0, 0, .9); }
.ws-card.has-art .ws-head { margin-bottom: 26px; }
.ws-card.has-art .ws-timer { backdrop-filter: blur(2px); }
.ws-card.has-art .ws-fill { background: color-mix(in srgb, var(--ws) 55%, transparent); }
.ws-card.has-art .ws-next { border-top-color: rgba(255, 255, 255, .18); }
/* A small see-through backing behind text that sits on a picture (titles, the state, the upcoming list, Baro's lines),
   so it stays readable over bright parts like the Zariman Corpus picture. Padding is offset by a negative margin so
   the text stays lined up with the rest of the card. */
.ws-card.has-art, .ws-card.has-figure, .ws-baro.has-art { --ws-backing: rgba(6, 10, 16, .58); }
.ws-card.has-art .ws-head > div, .ws-card.has-figure .ws-head > div,
.ws-card.has-art .ws-state, .ws-card.has-figure .ws-state,
.ws-baro.has-art .ws-head h2, .ws-baro.has-art .ws-state, .ws-baro.has-art .ws-left, .ws-baro.has-art .ws-note {
    width: fit-content; max-width: 100%; box-sizing: border-box; margin-left: -8px; padding: 2px 8px; border-radius: 7px;
    background: var(--ws-backing); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
.ws-card.has-art .ws-state, .ws-card.has-figure .ws-state { display: inline-flex; }
.ws-card.has-art .ws-next, .ws-card.has-figure .ws-next {
    margin: 10px -8px 0; padding: 6px 8px; border-top: 0; border-radius: 7px;
    background: var(--ws-backing); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
}
[data-theme="dark"] .ws-card.has-figure:not(.has-art), :root:not([data-theme="light"]) .ws-card.has-figure:not(.has-art) { --text-color: #eef3f8; }
/* The countdown bar spans the same width as the backing behind the upcoming list */
.ws-card.has-art .ws-timer, .ws-card.has-figure .ws-timer { margin-left: -8px; margin-right: -8px; }

/* Landscapes (300 × 169): fill the card, framed on the interesting part */
.ws-art-cetus .ws-bg   { background-position: 50% 35%; }
.ws-art-cambion .ws-bg { background-position: 55% 40%; }   /* the glowing moon */
.ws-art-vallis .ws-bg  { background-position: 70% 35%; }   /* the tower */
.ws-art-duviri .ws-bg  { background-position: 50% 25%; }   /* the statue */
/* Zariman (300 × 450, portrait): the ship's hull and rings */
.ws-art-zariman .ws-bg { background-position: 50% 42%; }
/* Earth (planet on a transparent background): a plain dark backdrop with the planet rising from the right edge */
.ws-card.ws-art-earth { background: #070b12; }
.ws-art-earth .ws-bg { background-size: auto 112%; background-position: calc(100% + 115px) 30%; }
.ws-card.ws-art-earth::after { background: linear-gradient(90deg, rgba(6, 10, 16, .55) 0%, rgba(6, 10, 16, .2) 60%, transparent 100%),
                                           linear-gradient(180deg, transparent 45%, rgba(6, 10, 16, .85) 80%); }
/* Baro (square portrait): on the right of his section, fading into the text */
.ws-baro.has-art { min-height: 260px; }
.ws-baro.has-art .ws-bg { left: auto; width: min(340px, 60%); background-position: 50% 20%;
    -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 55%); mask-image: linear-gradient(90deg, transparent 0%, #000 55%); }
.ws-baro.has-art .ws-body { position: relative; max-width: 640px; }
.ws-baro.has-art .ws-head { margin-bottom: 10px; }
.ws-baro.has-art .ws-inv { background: rgba(6, 10, 16, .55); }

/* Top bar / sidebar: the word shown until the button's picture is downloaded (includes/layout.php SITE_ICONS) */
.icon-btn:has(.icon-word) { width: auto; padding: 0 10px; }
.icon-word { font-size: .82rem; font-weight: 700; white-space: nowrap; }
/* Downloaded button icons (Icons/Utility/, SITE_ICONS): the picture's shape, filled white in the dark theme and black
   in the light theme so it's always visible */
.site-icon { display: block; width: 22px; height: 22px; background: #fff;
    -webkit-mask-position: center; mask-position: center; -webkit-mask-size: contain; mask-size: contain;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; }
[data-theme="light"] .site-icon { background: #000; }
.sidebar-toggle .site-icon { width: 18px; height: 18px; }
.sidebar-toggle .chev { font-size: 1.3rem; line-height: 1; }

/* ---------- World State: states shown by colour (no pictures) ---------- */
.ws-card .ws-head, .ws-card .ws-body, .ws-card .ws-preview-bar { position: relative; z-index: 1; }
/* Orb Vallis: frosted blue edges when cold, hot orange edges when warm. The glow is a layer (::before) above the
   picture and its fade (.ws-bg, ::after) and below the text, so the picture doesn't hide it. */
.ws-card[data-cycle="vallis"]::before {
    content: ""; position: absolute; inset: 0; z-index: 0; border-radius: inherit; pointer-events: none; transition: box-shadow .6s; }
.ws-card[data-cycle="vallis"] { transition: border-color .6s; }
.ws-card[data-cycle="vallis"][data-state="cold"] { border-color: rgba(190, 228, 255, .95); }
.ws-card[data-cycle="vallis"][data-state="cold"]::before {
    box-shadow: inset 0 0 0 2px rgba(210, 236, 255, .65), inset 0 0 26px 4px rgba(190, 228, 255, .7), inset 0 0 70px 18px rgba(110, 185, 255, .55); }
.ws-card[data-cycle="vallis"][data-state="warm"] { border-color: rgba(255, 165, 70, .95); }
.ws-card[data-cycle="vallis"][data-state="warm"]::before {
    box-shadow: inset 0 0 0 2px rgba(255, 190, 110, .6), inset 0 0 26px 4px rgba(255, 150, 50, .65), inset 0 0 70px 18px rgba(255, 110, 20, .5); }
/* Earth: no glow, the backdrop behind the planet itself is the colour: dark blue at night, orange by day. Only a
   light fade at the bottom keeps the times readable. */
.ws-card[data-cycle="earth"] { transition: background-color .6s; }
.ws-card.ws-art-earth[data-state="night"] { background: #1c3f8c; --ws: #a9c4ff; }   /* lighter state colour, readable on the blue */
.ws-card.ws-art-earth[data-state="day"] { background: #b8611f; --ws: #ffd27a; }
.ws-card.ws-art-earth::after { background: linear-gradient(180deg, transparent 55%, rgba(6, 10, 16, .45) 100%); }

/* Light theme: the same pictures, toned down and washed light (still a bit dull, so text stays readable), with dark
   text on light see-through backings. State colours are darkened so they read on the light backings. */
[data-theme="light"] .ws-card.has-art, [data-theme="light"] .ws-baro.has-art, [data-theme="light"] .ws-card.has-figure {
    --text-color: #0b1a24; --text-muted: rgba(16, 32, 44, .78); --border-color: rgba(11, 26, 36, .16); --border-strong: rgba(11, 26, 36, .28);
    --input-bg: rgba(255, 255, 255, .6); --ws-backing: rgba(246, 249, 251, .72);
}
[data-theme="light"] .ws-card.has-art, [data-theme="light"] .ws-baro.has-art { background: #dfe6eb; }
[data-theme="light"] .ws-bg { filter: saturate(.7) brightness(1.06); }
[data-theme="light"] .ws-card.has-art::after {
    background: linear-gradient(180deg, rgba(238, 243, 246, .38) 0%, rgba(238, 243, 246, .58) 38%, rgba(238, 243, 246, .86) 72%, rgba(238, 243, 246, .94) 100%);
}
[data-theme="light"] .ws-card.has-art h2, [data-theme="light"] .ws-card.has-art .ws-state,
[data-theme="light"] .ws-baro.has-art .tot-h2, [data-theme="light"] .ws-baro.has-art .ws-state { text-shadow: 0 1px 2px rgba(255, 255, 255, .7); }
[data-theme="light"] .ws-card.has-art .ws-sub { color: rgba(16, 32, 44, .85); text-shadow: none; }
[data-theme="light"] .ws-card.has-art .ws-state, [data-theme="light"] .ws-card.has-figure .ws-state { color: color-mix(in srgb, var(--ws) 62%, #000); }
[data-theme="light"] .ws-card.has-art .ws-fill { background: color-mix(in srgb, var(--ws) 45%, transparent); }
[data-theme="light"] .ws-baro.has-art .ws-inv { background: rgba(246, 249, 251, .72); }
[data-theme="light"] .ws-baro .ws-here { color: #8a6a00; }
/* Earth in the light theme: a pale blue sky at night and a pale orange one by day */
[data-theme="light"] .ws-card.ws-art-earth { background: #c9d6e6; }
[data-theme="light"] .ws-card.ws-art-earth[data-state="night"] { background: #a9bde6; --ws: #1d3f8f; }
[data-theme="light"] .ws-card.ws-art-earth[data-state="day"] { background: #f1bb8a; --ws: #8a3c00; }
[data-theme="light"] .ws-card.ws-art-earth::after { background: linear-gradient(180deg, transparent 55%, rgba(238, 243, 246, .55) 100%); }
/* Plains of Eidolon: just the border, in the day / night colour */
.ws-card[data-cycle="cetus"] { border: 2px solid var(--ws); border-left-width: 4px; transition: border-color .6s; }

/* ---------- World State: state pictures as part of the card (.ws-figure, set by worldstate.js) ---------- */
.ws-figure { position: absolute; z-index: 0; pointer-events: none; }
.ws-figure img { display: block; width: 100%; height: 100%; }
/* Cambion Drift: the Fass / Vome figure (256 × 512 cut-out) stands on the right, behind the bar and times (which
   keep the card's full width, like the other cards) */
.ws-card[data-cycle="cambion"] .ws-figure { top: 8px; right: 6px; bottom: 8px; width: 96px; }
.ws-card[data-cycle="cambion"] .ws-figure img { object-fit: contain; object-position: 50% 100%; filter: drop-shadow(0 0 10px color-mix(in srgb, var(--ws) 60%, transparent)); }
/* Duviri: the mood (a square scene) through a round, soft-edged window at the top right */
.ws-card[data-cycle="duviri"] .ws-figure { top: 12px; right: 14px; width: 92px; height: 92px; border-radius: 50%; overflow: hidden;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--ws) 70%, transparent), 0 0 18px color-mix(in srgb, var(--ws) 45%, transparent); }
.ws-card[data-cycle="duviri"] .ws-figure img { object-fit: cover; transform: scale(1.12);
    -webkit-mask-image: radial-gradient(circle, #000 58%, transparent 72%); mask-image: radial-gradient(circle, #000 58%, transparent 72%); }
.ws-card[data-cycle="duviri"].has-figure .ws-head, .ws-card[data-cycle="duviri"].has-figure .ws-state { margin-right: 100px; }   /* room for the picture (a margin, so the text backing stops short of it) */
/* Zariman: the Corpus / Grineer picture (transparent, striped) at the top right, its stripes faded out at the edges */
.ws-card[data-cycle="zariman"] .ws-figure { top: 4px; right: 6px; width: 112px; height: 112px; }
.ws-card[data-cycle="zariman"] .ws-figure img { object-fit: contain; opacity: .95;
    -webkit-mask-image: radial-gradient(circle, #000 45%, transparent 70%); mask-image: radial-gradient(circle, #000 45%, transparent 70%); }
.ws-card[data-cycle="zariman"].has-figure .ws-head, .ws-card[data-cycle="zariman"].has-figure .ws-state { margin-right: 104px; }

/* ---------- World State: admin preview ---------- */
.ws-preview-tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; background: #d7b44a; color: #1a1306;
    font: 700 .68rem 'Roboto', sans-serif; letter-spacing: .04em; text-transform: uppercase; vertical-align: middle; text-shadow: none; }
.ws-baro > .ws-body > .ws-preview-tag { margin: 0 0 6px; }
.ws-preview-bar { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 10px; padding-top: 8px;
    border-top: 1px dashed var(--border-strong); font-size: .85rem; font-weight: 700; }
.ws-preview-bar .btn { padding: 2px 12px; font-size: 1.1rem; line-height: 1.2; }
.ws-preview-bar span { min-width: 70px; text-align: center; }

/* ---------- Colour-blind palettes (Settings › Display › Colours; <html data-cvd>) ----------
   Each palette is a whole alternate theme: the buttons, tabs, header, borders and panels take the palette's own hue,
   and the colours that carry meaning (finished --good, mismatch --warn, Steel Path / Railjack / Drifter, Duviri's Envy)
   are chosen to stay clearly apart from that hue and from --danger. Picked with a colour-blindness simulation
   (Machado et al. 2009): every pair that matters is at least 33 apart (CIELAB) for that type, and text keeps at least
   4.5:1 contrast. The surfaces keep the standard theme's lightness, with the hue changed.
     Red-green (protanopia / deuteranopia): indigo theme; finished gold (dark) / blue (light).
     Blue-yellow (tritanopia): teal theme; finished violet. */
[data-cvd="redgreen"] {
    --page-bg: #141626; --panel-bg: #181b2f; --panel-bg-2: #1d213b; --header-bg: #161f57; --border-color: #161f57;
    --border-strong: #2a3580; --accent: #7b8cff; --accent-contrast: #0b0e24; --text-muted: #9fa4c6; --input-bg: #0f111d;
    --icon-bg: #7b8cff; --icon-bg-off: rgba(123, 140, 255, 0.18);
    --good: #f2c94c; --warn: #97e4f7; --steel: #dcdcdc; --railjack: #f2c94c; --drifter: #4fb6f2;
}
[data-cvd="redgreen"][data-theme="light"], [data-theme="light"] .cv-sample[data-cvd="redgreen"] {
    --panel-bg-2: #e2e5f5; --header-bg: #5b6de5; --border-color: #5b6de5; --border-strong: #3c50d0; --accent: #2b2380;
    --accent-contrast: #eeeeee; --text-muted: #4b5074; --icon-bg: #2b2380; --icon-bg-off: rgba(43, 35, 128, 0.18);
    --card-shadow: 0 2px 8px rgba(43, 35, 128, 0.18); --page-bg: #eeeeee; --panel-bg: #f8fafb; --input-bg: #ffffff;
    --good: #1a2ad0; --warn: #691637; --steel: #4d4d4d; --railjack: #8a6a00; --drifter: #1f6fb0;
}
[data-cvd="tritan"] {
    --page-bg: #142622; --panel-bg: #182f29; --panel-bg-2: #1d3b34; --header-bg: #165747; --border-color: #165747;
    --border-strong: #2a806a; --accent: #5de5c3; --accent-contrast: #0b2420; --text-muted: #9fc6bc; --input-bg: #0f1d1a;
    --icon-bg: #5de5c3; --icon-bg-off: rgba(93, 229, 195, 0.18);
    --good: #a77bf5; --warn: #eec72b;
}
[data-cvd="tritan"][data-theme="light"], [data-theme="light"] .cv-sample[data-cvd="tritan"] {
    --panel-bg-2: #e2f5f0; --header-bg: #5be5c2; --border-color: #5be5c2; --border-strong: #3cd0ab; --accent: #155646;
    --accent-contrast: #eeeeee; --text-muted: #4b746a; --icon-bg: #155646; --icon-bg-off: rgba(21, 86, 70, 0.18);
    --card-shadow: 0 2px 8px rgba(21, 86, 70, 0.18); --page-bg: #eeeeee; --panel-bg: #f8fafb; --input-bg: #ffffff;
    --good: #7a2fc9; --warn: #691643;
}
[data-cvd="redgreen"] .ws-card[data-state="envy"] { --ws: #2fd3c5; }
[data-cvd="tritan"] .ws-card[data-state="envy"] { --ws: #e9e9e9; }
/* The Standard sample shows the standard colours whatever palette is on */
.cv-sample[data-cvd=""] { --accent: #5bb7e5; --good: #3aa76d; --warn: #e0a24a; }
[data-theme="light"] .cv-sample[data-cvd=""] { --accent: #163e57; }

/* Settings › Display › Colours: one option per palette, each with a sample of its colours */
.cv-options { display: grid; gap: 8px; margin: 6px 0 4px; }
.cv-option { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 10px 12px;
    border: 1px solid var(--border-color); border-radius: 10px; cursor: pointer; }
.cv-option:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.cv-option input { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }
.cv-text { display: grid; gap: 2px; }
.cv-sample { display: inline-flex; gap: 4px; }
.cv-chip { width: 18px; height: 18px; border-radius: 4px; border: 1px solid color-mix(in srgb, var(--text-color) 25%, transparent); }
.cv-note { margin-top: 8px; }
@media (max-width: 520px) { .cv-option { grid-template-columns: auto 1fr; } .cv-sample { grid-column: 2; } }

/* ---------- Contributors (contribute.php, Admin › Submissions; includes/submissions.php) ---------- */
.icon-btn { position: relative; }
.icon-count { position: absolute; top: -5px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    background: var(--warn); color: #111; font: 700 .7rem/18px 'Roboto', sans-serif; text-align: center; }
.contribute-btn:has(.icon-word) { width: auto; padding: 0 12px; font-weight: 700; }   /* the word, until the icon is downloaded */
.tab-count { display: inline-block; min-width: 18px; padding: 0 6px; margin-left: 4px; border-radius: 9px; background: var(--warn);
    color: #111; font: 700 .72rem/18px 'Roboto', sans-serif; text-align: center; vertical-align: 1px; }
.badge-contrib { background: color-mix(in srgb, var(--good) 22%, transparent); color: var(--text-color); }
.ctb-search { flex: 1 1 260px; max-width: 420px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--border-color);
    background: var(--input-bg); color: var(--text-color); }
.img-groups-bar .clear-wrap { flex: 1 1 260px; max-width: 420px; }
.img-groups-bar .clear-wrap .ctb-search { width: 100%; max-width: none; }
.img-group[hidden], .ctb-row[hidden] { display: none; }
.ctb-rows { background: var(--panel-bg); border: 1px solid var(--border-color); border-top: 0; border-radius: 0 0 10px 10px; }
.ctb-row { display: grid; grid-template-columns: minmax(180px, 1.4fr) minmax(200px, 1.4fr) auto 56px minmax(150px, 1fr); gap: 10px 14px;
    align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--border-color); }
.ctb-row:last-child { border-bottom: 0; }
.ctb-item { display: grid; gap: 2px; }
.ctb-white { display: inline-flex; align-items: center; gap: 4px; font-size: .85rem; white-space: nowrap; }
.ctb-send { display: grid; gap: 6px; justify-items: start; }
.ctb-status { font-size: .8rem; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ctb-status.is-bad { color: var(--danger); }
.ctb-waiting { color: var(--good); font-weight: 600; }
.ctb-thumb { width: 40px; height: 40px; object-fit: contain; border-radius: 4px; background: rgba(127, 127, 127, .14); }
.ctb-mine-h { margin-top: 28px; }
.ctb-st { font-weight: 600; }
.ctb-st-pending { color: var(--warn); } .ctb-st-approved { color: var(--good); } .ctb-st-rejected { color: var(--danger); }
.ctb-st-replaced, .ctb-st-superseded { color: var(--text-muted); }
@media (max-width: 860px) {
    .ctb-row { grid-template-columns: 1fr 56px; }
    .ctb-item, .ctb-input, .ctb-send { grid-column: 1 / -1; }
    .ctb-white { grid-column: 1; }
}

/* Admin › Submissions */
.subs-list { display: grid; gap: 10px; margin-bottom: 24px; }
.subs-row { display: grid; grid-template-columns: auto auto 1fr auto; gap: 14px; align-items: center; padding: 12px 14px;
    background: var(--panel-bg); border: 1px solid var(--border-color); border-radius: 10px; }
.subs-prev { display: grid; place-items: center; width: 96px; height: 96px; border-radius: 8px; background: rgba(127, 127, 127, .14); }
.subs-prev img { max-width: 90px; max-height: 90px; object-fit: contain; }
.subs-current { opacity: .75; outline: 1px dashed var(--border-strong); }
.subs-row > .subs-info { grid-column: 3; }
.subs-row:not(:has(.subs-current)) > .subs-info { grid-column: 2 / 4; }
.subs-info { display: grid; gap: 3px; min-width: 0; font-size: .88rem; }
.subs-dest, .subs-src { overflow-wrap: anywhere; font-size: .8rem; }
.subs-warn { color: var(--warn); font-size: .82rem; font-weight: 600; }
.subs-acts { display: grid; gap: 6px; justify-items: stretch; min-width: 190px; }
.subs-acts input { padding: 6px 8px; border-radius: 6px; border: 1px solid var(--border-color); background: var(--input-bg); color: var(--text-color); }
@media (max-width: 760px) {
    .subs-row { grid-template-columns: auto 1fr; }
    .subs-row > .subs-info, .subs-row:not(:has(.subs-current)) > .subs-info { grid-column: 1 / -1; }
    .subs-acts { grid-column: 1 / -1; }
}

/* Admin › Users: search and each account's private note */
.users-search { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 10px; }
.users-search .clear-wrap { flex: 1 1 260px; max-width: 420px; }
.users-search input { width: 100%; padding: 7px 10px; border-radius: 8px; border: 1px solid var(--border-color); background: var(--input-bg); color: var(--text-color); }
.users-table tbody tr[hidden] { display: none; }
.user-note { margin-top: 4px; font-weight: 400; }
.user-note > summary { cursor: pointer; font-size: .8rem; width: fit-content; }
.user-note-preview { color: var(--text-muted); font-style: italic; }
.user-note[open] > summary .user-note-preview { display: none; }
.user-note[open] > summary::after { content: 'Note'; font-size: .8rem; color: var(--text-muted); }
.user-note textarea { display: block; width: min(420px, 100%); margin: 6px 0; padding: 6px 8px; border-radius: 6px; resize: vertical;
    border: 1px solid var(--border-color); background: var(--input-bg); color: var(--text-color); font: inherit; font-size: .85rem; }
.user-note .btn-sm { padding: 4px 10px; font-size: .8rem; }

/* Replacement requests (Admin › Existing images › Ask for a better one; Contribute › Needs a better picture) */
.exi-req { font-size: .8rem; color: var(--warn); font-weight: 600; }
.exi-req[hidden] { display: none; }
.exi-only { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; white-space: nowrap; }
.exi-panel input[type=text] { flex: 1 1 260px; padding: 6px 8px; border-radius: 6px; border: 1px solid var(--border-color);
    background: var(--input-bg); color: var(--text-color); font: inherit; font-size: .85rem; }
.ctb-note { font-size: .82rem; color: var(--warn); font-style: italic; }
.subs-req { color: var(--warn); font-size: .82rem; font-weight: 600; }
.exi-unused { font-size: .8rem; color: var(--text-muted); font-style: italic; }
#exiRemoveShown[hidden] { display: none; }
.exi-ask[hidden] { display: none; }

/* ---------- World State: folding sections, Nightwave, the 1999 calendar, Varzia and Teshin ---------- */
.ws-sect { margin-bottom: 18px; }
.ws-sect > summary { display: flex; align-items: center; gap: 8px; cursor: pointer; list-style: none; margin-bottom: 10px; width: fit-content; }
.ws-sect > summary::-webkit-details-marker, .ws-compact > summary::-webkit-details-marker { display: none; }
.ws-sect > summary::before, .ws-compact > summary::before { content: '▸'; color: var(--text-muted); transition: transform .15s; }
.ws-sect[open] > summary::before, .ws-compact[open] > summary::before { transform: rotate(90deg); }
.ws-sect > summary .tot-h2 { margin: 0; }
.ws-compact { margin-bottom: 10px; border: 1px solid var(--border-color); border-radius: 10px; background: var(--panel-bg); }
.ws-compact > summary { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; padding: 10px 14px; cursor: pointer; list-style: none; }
.ws-compact-name { font-family: 'Quantico', sans-serif; font-weight: 700; }
.ws-sum { font-size: .85rem; }
.ws-compact > .ws-body { padding: 0 14px 12px; }
.ws-compact + .ws-baro, .ws-sect + .ws-baro { margin-top: 18px; }
.ws-baro { margin-bottom: 14px; }
.ws-sub-h { margin: 10px 0 4px; font-size: .78rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }

/* A list kept to about Baro's usual size, with "Show all" when it's longer */
.ws-clamp { max-height: 10.5rem; overflow: hidden; position: relative; max-width: 640px;
    -webkit-mask-image: linear-gradient(180deg, #000 78%, transparent); mask-image: linear-gradient(180deg, #000 78%, transparent); }
.ws-clamp:not(:has(+ .ws-clamp-btn:not([hidden]))), .ws-clamp.is-open { -webkit-mask-image: none; mask-image: none; }
.ws-clamp.is-open { max-height: none; }
.ws-clamp .ws-inv { margin-top: 4px; }
.ws-clamp-btn { margin-top: 6px; padding: 4px 10px; font-size: .8rem; }
.ws-clamp-btn[hidden] { display: none; }

.ws-baro .ws-varzia { color: #c9a3ff; }
.ws-baro .ws-steel { color: var(--text-color); }
.ws-cost { font-family: 'Roboto', sans-serif; font-size: .85rem; font-weight: 500; color: var(--text-muted); }
[data-theme="light"] .ws-baro .ws-varzia { color: #6a3fb0; }

/* Nightwave */
.nw-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nw-list li { display: grid; grid-template-columns: minmax(140px, 220px) 1fr auto; gap: 10px; align-items: baseline; padding: 5px 0;
    border-bottom: 1px solid var(--border-color); font-size: .88rem; }
.nw-title { font-weight: 600; }
.nw-desc { color: var(--text-muted); }
.nw-rep { font-variant-numeric: tabular-nums; color: var(--text-muted); font-size: .82rem; }
.nw-all { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; font-size: .84rem; color: var(--text-muted); }
@media (max-width: 600px) { .nw-list li { grid-template-columns: 1fr auto; } .nw-desc { grid-column: 1 / -1; grid-row: 2; } }

/* 1999 calendar */
.cal-list { list-style: none; margin: 0; padding: 0; }
.cal-list li { display: grid; grid-template-columns: 4.5rem 1fr; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border-color); font-size: .88rem; }
.cal-day { font-weight: 700; font-variant-numeric: tabular-nums; }
.cal-evs { display: grid; gap: 2px; }
.cal-ev b { font-weight: 600; }
.cal-bigprize b { color: var(--warn); }
.cal-ev [title] { text-decoration: underline dotted; text-underline-offset: 3px; cursor: help; }
.ws-weeks td:nth-child(2), .ws-weeks th:nth-child(2) { text-align: left; }
.nw-desc:empty { display: block; }

/* Varzia: the Prime Warframes her stock is built around, side by side */
.vz-gear { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 18px 28px; margin-top: 10px; }
.nw-pending { font-style: italic; opacity: .75; }
/* Trader lines ("Here now at …", "Prime Resurgence at …") wrap as ordinary text, not as a row of separate pieces */
.ws-baro .ws-state { display: block; }

/* The Circuit (World State): this week's Steel Path Incarnons, and the other versions each one fits */
.circ-list { display: flex; flex-wrap: nowrap; gap: 10px; margin-top: 10px; }
.circ-more { position: absolute; top: 6px; right: 6px; font-size: .72rem; padding: 1px 6px; border-radius: 999px; background: var(--accent); color: var(--accent-contrast); }
/* Nightwave: admin-written descriptions */
.nw-src { font-size: .78rem; color: var(--text-muted); font-style: normal; }
.nw-edit { font-size: .78rem; margin-left: 4px; font-style: normal; background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; }
.nw-form .btn-sm { padding: 3px 10px; font-size: .8rem; }
.nw-form .link-btn { background: none; border: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font-size: .8rem; }
.nw-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.nw-form input { flex: 1 1 200px; min-width: 0; }
.nw-msg { font-size: .8rem; color: var(--text-muted); }
/* The Circuit with Incarnon tracking: owned / total on the base tile, and a mark on each version in the menu */
.circ-count.is-done { background: var(--good); color: var(--page-bg); }

/* World State Warframe / weapon cards (Varzia, the Circuit), shaped like the collection pages' cards (190 × 200): the
   whole picture fills the card and the name sits in its own bubble (.plate) over the bottom */
.ws-wcard { --w: 120px; position: relative; display: block; width: var(--w); aspect-ratio: 190 / 200; flex-shrink: 0; padding: 0; margin: 0;
    border: 1px solid var(--border-color); border-radius: 10px; overflow: hidden; background: var(--panel-bg); box-shadow: var(--card-shadow);
    color: var(--text-color); font: inherit; text-align: center; }
.ws-wcard > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ws-wcard-none { position: absolute; inset: 0 0 30% 0; display: grid; place-items: center; color: var(--text-muted); font: 700 2.2rem 'Quantico', sans-serif; }
.ws-wcard .plate { font-size: .8rem; padding: 2px 4px; }
.ws-wcard .plate-name { min-height: 2.2em; }
.ws-baro.has-art .ws-wcard { background: var(--ws-backing); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }   /* over Varzia's picture */
/* Varzia: Warframes, then the weapons to their right in two rows no taller than the Warframes (below them on phones) */
.vz-frames { display: flex; flex-wrap: wrap; gap: 12px; }
.vz-frame { --w: 178px; }
.vz-frame .plate { font-size: .9rem; }
.vz-weapons { display: grid; grid-template-rows: repeat(2, auto); grid-auto-flow: column; gap: 6px; }
.vz-weapon { --w: 88px; }
.vz-weapon .plate { font-size: .64rem; padding: 1px 3px; left: 1px; right: 1px; bottom: 1px; border-radius: 6px; }
.vz-weapon .ws-wcard-none { font-size: 1.5rem; }
@media (max-width: 700px) {
    .vz-frame { --w: 150px; }
    .vz-weapons { grid-template-rows: none; grid-auto-flow: row; grid-template-columns: repeat(2, auto); gap: 12px; }
    .vz-weapon { --w: 150px; }
    .vz-weapon .plate { font-size: .85rem; padding: 2px 4px; left: 2px; right: 2px; bottom: 2px; border-radius: 8px; }
}
/* The Circuit: this week's base weapons (buttons) and every version in the opened menu */
.circ-tile { --w: 140px; cursor: pointer; }
/* All of the week's weapons on one line: the Circuit's content may run wider than the other sections' (its cards have
   their own backing, so they can sit over the picture), and the cards shrink a little before they'd wrap */
#wsCircuit.has-art .ws-body { max-width: 760px; }
.circ-list > .circ-tile { width: auto; flex: 0 1 var(--w); min-width: 0; }
@media (max-width: 560px) {
    .circ-list { flex-wrap: wrap; }
    .circ-list > .circ-tile { --w: 104px; flex: 0 0 var(--w); }   /* three to a row on phones */
    .circ-list > .circ-tile .plate { font-size: .72rem; }
}
.circ-tile:hover, .circ-tile:focus-visible { border-color: var(--accent); }
.circ-tile.is-open { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.circ-tile .plate { font-family: 'Quantico', sans-serif; }
.circ-more { z-index: 3; }
.circ-variants { display: flex; flex-wrap: wrap; gap: 12px; }
.circ-var { --w: 124px; }
.circ-var.is-owned { border-color: var(--good); box-shadow: 0 0 0 1px var(--good) inset; }
.circ-own { color: var(--good); font-size: .72rem; }
.circ-own.is-not { color: var(--text-muted); font-weight: 400; }
@media (max-width: 420px) { .circ-tile, .circ-var { --w: 132px; } }
/* The Circuit's versions bubble: floats under the opened tile, over the page */
.circ-pop { position: absolute; z-index: 60; width: max-content; max-width: min(640px, calc(100vw - 16px)); box-sizing: border-box;
    padding: 10px 12px 12px; border-radius: 12px; border: 1px solid var(--accent); background: var(--panel-bg);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.circ-pop-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.circ-pop-head .ws-sub-h { margin: 0; }
.circ-pop-x { background: none; border: 0; padding: 2px 4px; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; font-size: .8rem; }
/* Name bubbles that link to the item's page */
a.plate:hover .plate-name { text-decoration: underline; }

/* ---------- World State: sections in each account's order (Customize), and the newer sections ---------- */
.ws-sections { display: flex; flex-direction: column; gap: 12px; }
.ws-slot > .ws-sect, .ws-slot > .ws-compact, .ws-slot > .ws-baro { margin: 0; }
.ws-slot > .ws-sect > summary { margin-bottom: 10px; }
/* Customize sits next to the page title (in .toolbar), small enough not to make the title line taller */
.ws-customize-btn { padding: 3px 10px; font-size: .8rem; align-self: center; }
.ws-hidden-note { font-size: .82rem; align-self: center; }
.ws-custom { margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--accent); border-radius: 10px; background: var(--panel-bg); }
.ws-custom-head { margin: 0 0 8px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.ws-custom-head .muted { font-size: .85rem; }
.ws-custom-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-width: 520px; }
.ws-custom-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 8px; border-radius: 8px; background: var(--panel-bg-2); }
.ws-custom-row label { display: flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 600; }
.ws-custom-row.is-off label { opacity: .55; font-weight: 400; }
.ws-custom-move { display: flex; gap: 4px; }
.ws-custom-move .btn { min-width: 34px; justify-content: center; padding: 3px 8px; }
.ws-custom-foot { margin: 10px 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ws-custom-msg { font-size: .85rem; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; }

/* Fold-outs inside a section (Events / Alerts / Invasions) */
.ws-group-body { padding: 0 14px 12px; }
.ws-group-tools { margin: 0 0 8px; font-size: .85rem; display: flex; gap: 6px; align-items: center; }
.ws-fold { border-top: 1px solid var(--border-color); }
.ws-fold > summary { display: flex; align-items: baseline; gap: 8px; padding: 8px 0; cursor: pointer; list-style: none; }
.ws-fold > summary::-webkit-details-marker { display: none; }
.ws-fold > summary::before { content: '▸'; color: var(--text-muted); transition: transform .15s; }
.ws-fold[open] > summary::before { transform: rotate(90deg); }
.ws-fold-name { font-weight: 700; }
.ws-fold > .ws-body { padding: 0 0 10px; display: grid; gap: 8px; }

/* One event / alert / invasion */
.ws-item { padding: 10px 12px; border: 1px solid var(--border-color); border-radius: 9px; background: var(--panel-bg-2); }
.ws-item-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px; }
.ws-item-head h3 { margin: 0; font-size: 1rem; font-family: 'Quantico', sans-serif; }
.ws-left { font-size: .85rem; color: var(--text-muted); white-space: nowrap; }
.ws-desc { display: block; margin: 3px 0 0; font-size: .85rem; color: var(--text-muted); }
.ws-meta { margin: 4px 0 0; font-size: .86rem; color: var(--text-muted); }
.ws-chips { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 6px; }
.ws-chips li { padding: 2px 8px; border-radius: 999px; border: 1px solid var(--border-strong); font-size: .82rem; font-weight: 600; }
.ws-prog-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: .84rem; }
.ws-prog-row > span { white-space: nowrap; color: var(--text-muted); }
.ws-prog { flex: 1 1 auto; height: 8px; border-radius: 999px; background: var(--border-color); overflow: hidden; }
.ws-prog > span { display: block; height: 100%; background: var(--accent); }
.ws-prog.is-split { background: color-mix(in srgb, var(--text-muted) 45%, transparent); }
.ws-sides { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: start; margin-top: 6px; }
.ws-side-fac { display: block; font-weight: 700; font-size: .88rem; }
.ws-side .ws-chips { margin-top: 3px; }
.ws-side.is-def { text-align: right; }
.ws-side.is-def .ws-chips { justify-content: flex-end; }
.ws-vs { align-self: center; font-size: .78rem; color: var(--text-muted); text-transform: uppercase; }

/* Sortie & Archon Hunt, and the two Archimedeas: side by side when there's room */
.ws-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 10px; }
.ws-panel { padding: 10px 12px; border: 1px solid var(--border-color); border-radius: 9px; background: var(--panel-bg-2); min-width: 0; }
.ws-steps { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 8px; }
.ws-steps > li { padding-left: 2px; }
.ws-mod { margin-top: 2px; font-size: .88rem; font-weight: 600; }
.ws-label { margin: 6px 0 2px; font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.ws-mods { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: .88rem; }
.ws-tag { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px; border: 1px solid var(--warn); color: var(--warn); font-size: .72rem; font-weight: 700; }
.ws-shard { display: inline-block; padding: 0 8px; border-radius: 999px; border: 1px solid; font-weight: 700; color: var(--text-color); }
.ws-shard.is-crimson { border-color: #d0443e; background: color-mix(in srgb, #d0443e 22%, transparent); }
.ws-shard.is-amber   { border-color: #e3a52a; background: color-mix(in srgb, #e3a52a 22%, transparent); }
.ws-shard.is-azure   { border-color: #3d8bfd; background: color-mix(in srgb, #3d8bfd 22%, transparent); }

/* Void Fissures: three groups, each a short list soonest-to-close first */
.fis-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px; }
.fis-group h3 { margin: 0 0 6px; font-size: .95rem; font-family: 'Quantico', sans-serif; }
.fis-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.fis-row { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 8px; background: var(--panel-bg-2); }
.fis-tier { font-weight: 700; font-size: .84rem; text-align: center; padding: 1px 0; border-radius: 6px; border: 1px solid var(--border-strong); }
.fis-group.is-steel .fis-tier { border-color: var(--steel, var(--warn)); }
.fis-group.is-storm .fis-tier { border-color: var(--railjack, var(--accent)); }
.fis-what { display: flex; flex-direction: column; min-width: 0; font-size: .88rem; }
.fis-what .muted { font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fis-left { font-size: .84rem; font-variant-numeric: tabular-nums; color: var(--text-muted); white-space: nowrap; }

/* Simaris: one line */
.ws-line { display: flex; align-items: baseline; gap: 10px; padding: 10px 14px; }
.ws-line > .ws-body { padding: 0; }
@media (max-width: 560px) {
    .ws-sides { grid-template-columns: 1fr; }
    .ws-side.is-def { text-align: left; }
    .ws-side.is-def .ws-chips { justify-content: flex-start; }
    .ws-vs { display: none; }
}
/* While World State updates are failing: a note at the top of each section whose contents change between updates */
.ws-stale { margin: 0 0 8px; padding: 8px 10px; border: 1px solid var(--warn); border-radius: 8px; font-size: .86rem;
    background: color-mix(in srgb, var(--warn) 12%, transparent); }
.ws-stale strong { color: var(--warn); }
.ws-stale-links { white-space: nowrap; }
.ws-stale-inline { font-size: .82rem; color: var(--warn); }
.ws-pair > .ws-stale { grid-column: 1 / -1; }

/* ---------- World State colour cues (relic tiers, factions, Nightwave groups, calendar types) ----------
   Each colour only adds to a written label. Every set was checked the same way as the colour-blind palettes above:
   each pair at least 26 apart in CIELAB (30 for the 3-colour sets) as seen by that palette's colour blindness
   (Machado et al. 2009: protanopia + deuteranopia for red-green, tritanopia for blue-yellow; normal vision for the
   standard colours), and at least 3:1 against the panel. */
:root {
    --t-lith: #c58a4f; --t-meso: #a9bccd; --t-neo: #e8cd55; --t-axi: #4fd1c1; --t-requiem: #e8605d; --t-omnia: #b48af0;
    --f-grineer: #e2703a; --f-corpus: #4fa3e8; --f-infested: #7dc95b; --f-orokin: #e3c46a; --f-other: #b38be8;
    --nw-daily: #4fa3e8; --nw-weekly: #7dc95b; --nw-elite: #e3a24a;
    --cal-todo: #4fa3e8; --cal-prize: #e3c46a; --cal-override: #b38be8;
}
[data-theme="light"] {
    --t-lith: #895423; --t-meso: #56697b; --t-neo: #8b7100; --t-axi: #00756a; --t-requiem: #b3261e; --t-omnia: #6c3fb8;
    --f-grineer: #a8431a; --f-corpus: #1b62a8; --f-infested: #3c7a1e; --f-orokin: #7d6400; --f-other: #6a3fb0;
    --nw-daily: #1b62a8; --nw-weekly: #3c7a1e; --nw-elite: #9a5a00;
    --cal-todo: #1b62a8; --cal-prize: #7d6400; --cal-override: #6a3fb0;
}
[data-cvd="redgreen"] {
    --t-lith: #a87532; --t-meso: #d5c7b4; --t-neo: #f2d34c; --t-axi: #49b4f1; --t-requiem: #5d6bff; --t-omnia: #ffd9ff;
    --f-grineer: #e2703a; --f-corpus: #3099e5; --f-infested: #7fd682; --f-orokin: #fad55c; --f-other: #eebaee;
    --nw-daily: #4fa3e8; --nw-weekly: #9cf195; --nw-elite: #d79637;
    --cal-todo: #a5c0df; --cal-prize: #e3c46a; --cal-override: #a184e6;
}
[data-cvd="redgreen"][data-theme="light"] {
    --t-lith: #694600; --t-meso: #5c5c5c; --t-neo: #9a7d00; --t-axi: #1b86e1; --t-requiem: #2d2bbf; --t-omnia: #882395;
    --f-grineer: #a95252; --f-corpus: #1c61a5; --f-infested: #4e8611; --f-orokin: #4d3900; --f-other: #3f3ebf;
    --nw-daily: #1b62a8; --nw-weekly: #289162; --nw-elite: #9c5c02;
    --cal-todo: #5f6892; --cal-prize: #7d6400; --cal-override: #6a3fb0;
}
[data-cvd="tritan"] {
    --t-lith: #c38b59; --t-meso: #d0d0d0; --t-neo: #f2769d; --t-axi: #5de5c3; --t-requiem: #fa5455; --t-omnia: #a77bf5;
    --f-grineer: #e2703a; --f-corpus: #4fa3e8; --f-infested: #96d05f; --f-orokin: #e3c46a; --f-other: #b38be8;
    --nw-daily: #4fa3e8; --nw-weekly: #a3d361; --nw-elite: #e3a24a;
    --cal-todo: #4fa3e8; --cal-prize: #ecc86e; --cal-override: #b38be8;
}
[data-cvd="tritan"][data-theme="light"] {
    --t-lith: #834817; --t-meso: #5a5a5a; --t-neo: #b0306a; --t-axi: #00705a; --t-requiem: #c01818; --t-omnia: #7e27bc;
    --f-grineer: #a8431a; --f-corpus: #1f66ad; --f-infested: #2d4b07; --f-orokin: #7d6400; --f-other: #6a3fb0;
    --nw-daily: #2f81d0; --nw-weekly: #446505; --nw-elite: #9a5a00;
    --cal-todo: #1b62a8; --cal-prize: #7f6402; --cal-override: #6539ab;
}
.tier-lith { --tier: var(--t-lith); } .tier-meso { --tier: var(--t-meso); } .tier-neo { --tier: var(--t-neo); }
.tier-axi { --tier: var(--t-axi); } .tier-requiem { --tier: var(--t-requiem); } .tier-omnia { --tier: var(--t-omnia); }
.tier-other { --tier: var(--border-strong); }
.fac-grineer { --fc: var(--f-grineer); } .fac-corpus { --fc: var(--f-corpus); } .fac-infested { --fc: var(--f-infested); }
.fac-orokin { --fc: var(--f-orokin); } .fac-other { --fc: var(--f-other); }
.fac-a-grineer { --fa: var(--f-grineer); } .fac-a-corpus { --fa: var(--f-corpus); } .fac-a-infested { --fa: var(--f-infested); } .fac-a-orokin { --fa: var(--f-orokin); } .fac-a-other { --fa: var(--f-other); }
.fac-d-grineer { --fd: var(--f-grineer); } .fac-d-corpus { --fd: var(--f-corpus); } .fac-d-infested { --fd: var(--f-infested); } .fac-d-orokin { --fd: var(--f-orokin); } .fac-d-other { --fd: var(--f-other); }

/* Shared pieces: a coloured stripe per kind of item, a bold title, time left (highlighted when nearly over),
   mission / place / faction tags, reward chips that stand out (credits stay plain), and labelled callouts */
.ws-item { border-left: 4px solid var(--stripe, var(--border-strong)); }
.ws-item.is-event { --stripe: var(--accent); }
.ws-item.is-alert { --stripe: var(--warn); }
.ws-item-title { font-weight: 700; font-size: 1.02rem; }
.ws-left b { font-variant-numeric: tabular-nums; color: var(--text-color); }
.ws-left.is-soon, .ws-left.is-soon b { color: var(--warn); }
.ws-lead { margin: 4px 0 0; font-size: .9rem; }
.ws-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; margin-top: 6px; font-size: .86rem; }
.ws-mission { padding: 1px 8px; border-radius: 6px; background: var(--icon-bg-off); font-weight: 700; }
.ws-node { font-weight: 600; }
.ws-level, .ws-noreward { color: var(--text-muted); }
.ws-boss { font-weight: 700; font-size: .95rem; }
.ws-fac { padding: 0 8px 0 6px; border-radius: 6px; border-left: 3px solid var(--fc, var(--border-strong));
    background: color-mix(in srgb, var(--fc, var(--border-strong)) 16%, transparent); font-weight: 600; font-size: .84rem; }
.ws-chips li { border-radius: 10px; border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.ws-chips li.is-credits { border-color: var(--border-strong); background: none; font-weight: 500; color: var(--text-muted); }
.ws-pct { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text-color); }
.ws-side { padding: 6px 8px; border-radius: 7px; border-top: 3px solid var(--fc, var(--border-strong));
    background: color-mix(in srgb, var(--fc, var(--border-strong)) 8%, transparent); }
.ws-side > .ws-fac { display: block; border-left: 0; padding: 0; background: none; font-size: .9rem; }
.ws-prog.is-split { background: var(--fd, var(--border-strong)); height: 10px; }
.ws-prog.is-split > span { background: var(--fa, var(--accent)); border-right: 2px solid var(--panel-bg-2); }
.ws-steps > li::marker { font-weight: 700; color: var(--accent); }
.ws-step-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.ws-callout { margin-top: 6px; padding: 5px 9px; border-radius: 7px; border-left: 3px solid var(--co, var(--border-strong));
    background: color-mix(in srgb, var(--co, var(--border-strong)) 10%, transparent); font-size: .88rem; }
.ws-callout .ws-desc { margin-top: 1px; }
.ws-callout.is-mod, .ws-callout.is-risk { --co: var(--warn); }
.ws-callout.is-dev { --co: var(--accent); }
.ws-callout.is-personal { --co: var(--text-muted); margin-top: 10px; }
.ws-callout-k { display: block; margin-bottom: 2px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }
.ws-callout .ws-mods { gap: 5px; }
.ws-tag { border-color: var(--steel, var(--warn)); color: var(--steel, var(--warn)); }
.ws-panel h3 { font-size: 1.05rem; }
.ws-panel.is-sortie, .ws-panel.is-archon, .ws-panel.is-arch { border-top: 3px solid var(--accent); }

/* Fissures: each row striped and badged in its relic tier's colour */
.fis-group h3 { display: flex; align-items: center; gap: 8px; padding-bottom: 4px; border-bottom: 2px solid var(--gc, var(--accent)); }
.fis-group.is-steel { --gc: var(--steel, var(--warn)); }
.fis-group.is-storm { --gc: var(--railjack, var(--accent)); }
.fis-count { padding: 0 8px; border-radius: 999px; background: color-mix(in srgb, var(--gc, var(--accent)) 22%, transparent); font-size: .8rem; }
.fis-row { border-left: 4px solid var(--tier, var(--border-strong)); }
.fis-tier { border-color: var(--tier, var(--border-strong)); background: color-mix(in srgb, var(--tier, var(--border-strong)) 22%, transparent); }
.fis-where { color: var(--text-muted); font-size: .8rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fis-row .ws-left { font-size: .84rem; }

/* Nightwave: each group (daily, weekly, elite weekly) with its own colour; standing as a badge */
.nw-group { --nwc: var(--nw-daily); margin: 0 0 12px; padding-left: 10px; border-left: 4px solid var(--nwc); }
.nw-group.nw-weekly { --nwc: var(--nw-weekly); }
.nw-group.nw-elite { --nwc: var(--nw-elite); }
.nw-group-h { margin: 0 0 4px; font-size: .84rem; }
.nw-kind { font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--nwc); }
.nw-group .nw-list li { border-bottom-color: color-mix(in srgb, var(--nwc) 18%, var(--border-color)); }
.nw-rep { padding: 1px 9px; border-radius: 999px; border: 1px solid var(--nwc); background: color-mix(in srgb, var(--nwc) 16%, transparent);
    color: var(--text-color); font-weight: 700; font-size: .8rem; }

/* 1999 calendar: each entry's type as a coloured label; choices as chips with "or" between them */
.cal-list li { align-items: start; padding: 8px 0; }
.cal-day { padding: 1px 6px; border-radius: 6px; background: var(--icon-bg-off); text-align: center; }
.cal-evs { gap: 6px; }
.cal-ev { --cc: var(--border-strong); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.cal-ev.cal-todo { --cc: var(--cal-todo); } .cal-ev.cal-prize { --cc: var(--cal-prize); } .cal-ev.cal-override { --cc: var(--cal-override); }
.cal-type { padding: 0 8px; border-radius: 6px; border-left: 3px solid var(--cc); background: color-mix(in srgb, var(--cc) 16%, transparent);
    font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.cal-pick { font-size: .76rem; font-style: italic; color: var(--text-muted); }
.cal-todo-t { font-weight: 700; }
.cal-todo-d { color: var(--text-muted); }
.cal-opts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.cal-opt { padding: 1px 8px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--cc) 60%, transparent); font-weight: 600; }
.cal-ev .cal-opt[title] { text-decoration: none; }
.cal-or { font-size: .74rem; color: var(--text-muted); text-transform: uppercase; }

/* ---------- Equipment (equipment.php) ---------- */
/* Filters, headings and chip groups for categories that aren't showing */
.filter[hidden], .filter-heading[hidden], .chip-group[hidden], .eq-group-head[hidden] { display: none; }
.chip-group + .chip-group { margin-top: 8px; }
.chip-group-label { margin: 2px 0 4px; font-size: .75rem; font-weight: 600; letter-spacing: .03em; color: var(--text-muted); }

/* "Showing" picker, next to the title (the toolbar lines up on the text baseline; this sits centred instead) */
.eq-picker { position: relative; align-self: center; }
.eq-picker-btn { padding: 4px 10px; font-size: .85rem; font-weight: 600; gap: 4px; max-width: min(60vw, 420px); }
.eq-picker-word { color: var(--text-muted); font-weight: 500; }
.eq-picker-label { overflow: hidden; text-overflow: ellipsis; }
.eq-chev { font-size: .75rem; color: var(--text-muted); transition: transform .15s; }
.eq-picker.is-open .eq-chev { transform: rotate(180deg); }
.eq-picker.is-open .eq-picker-btn { border-color: var(--accent); }
.eq-picker-pop {
    position: absolute; z-index: 120; top: calc(100% + 6px); left: 0;
    width: 280px; max-width: calc(100vw - 32px); padding: 10px;
    background: var(--panel-bg); border: 1px solid var(--border-strong); border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .35); font-size: .9rem;
}
.eq-picker-pop[hidden] { display: none; }
.eq-picker-head { display: flex; justify-content: space-between; align-items: baseline; margin: 0 2px 6px;
    font-size: .8rem; font-weight: 700; letter-spacing: .03em; color: var(--text-muted); text-transform: uppercase; }
.eq-pick-row { display: flex; align-items: center; gap: 6px; border-radius: 6px; }
.eq-pick-row:hover { background: var(--panel-bg-2); }
.eq-pick { flex: 1; display: flex; align-items: center; gap: 8px; padding: 6px; cursor: pointer; min-width: 0; }
.eq-pick input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); flex: none; }
.eq-pick-name { flex: 1; font-weight: 600; }
.eq-pick-count { color: var(--text-muted); font-size: .8rem; font-variant-numeric: tabular-nums; }
.eq-picker .link-btn, .eq-link-banner .link-btn {
    background: none; border: 0; padding: 4px 6px; color: var(--accent); cursor: pointer;
    font: inherit; font-size: .8rem; text-decoration: underline; text-underline-offset: 2px; text-transform: none; letter-spacing: 0;
}
.eq-only { opacity: .75; }
.eq-pick-row:hover .eq-only, .eq-only:focus-visible { opacity: 1; }
.eq-picker-note { margin: 8px 2px 0; font-size: .75rem; color: var(--text-muted); }

/* A link's view (old page addresses, links from Totals / Mastery / World State) */
.eq-link-banner { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; justify-content: space-between;
    margin: 0 0 14px; padding: 8px 12px; border: 1px solid var(--accent); border-radius: 8px;
    background: color-mix(in srgb, var(--accent) 8%, transparent); font-size: .88rem; }
.eq-link-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.eq-link-banner .btn-sm { padding: 4px 10px; font-size: .8rem; }

/* Group headings across the whole grid row */
.eq-group-head {
    grid-column: 1 / -1; display: flex; align-items: baseline; gap: 10px;
    margin-top: 6px; padding: 0 2px 5px; border-bottom: 1px solid var(--border-strong);
}
.eq-group-head:first-child { margin-top: 0; }
.eq-group-name { font-size: 1.05rem; font-weight: 700; letter-spacing: .02em; }
.eq-group-count { color: var(--text-muted); font-size: .82rem; font-variant-numeric: tabular-nums; }
@media (max-width: 860px) {
    .eq-picker-btn { max-width: calc(100vw - 150px); }
}
.eq-link-banner a.btn { text-decoration: none; }

/* ---------- Folding sidebar sections and result groups ---------- */
button.filter-heading {
    display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; cursor: pointer;
    background: none; border: 0; border-bottom: 1px solid var(--border-color); border-radius: 0;
    font-family: inherit; padding: 0 0 4px;
}
button.filter-heading:hover .fh-label, button.filter-heading:focus-visible .fh-label { text-decoration: underline; text-underline-offset: 3px; }
.fh-label { flex: 1; }
.fh-count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: var(--accent-contrast, var(--page-bg));
    font-size: .7rem; letter-spacing: 0; display: inline-grid; place-items: center; }
.fh-count[hidden] { display: none; }
.fh-chev, .eq-group-chev { font-size: .75rem; transition: transform .15s; }
.filter-heading.is-folded-head .fh-chev, .eq-group-head.is-collapsed .eq-group-chev { transform: rotate(-90deg); }
.filters > .is-folded { display: none; }
.card.is-collapsed { display: none; }
.eq-group-toggle { display: flex; align-items: baseline; gap: 8px; padding: 0; background: none; border: 0; color: inherit;
    font: inherit; cursor: pointer; text-align: left; }
.eq-group-toggle:hover .eq-group-name, .eq-group-toggle:focus-visible .eq-group-name { text-decoration: underline; text-underline-offset: 3px; }
.eq-group-chev { color: var(--text-muted); width: 12px; display: inline-block; }
.eq-group-head.is-collapsed { opacity: .8; }

/* Equipment: Collapse all / Expand all, by the item count */
.eq-fold-all { display: inline-flex; align-items: baseline; gap: 4px; font-size: .85rem; color: var(--text-muted); }
.eq-fold-all[hidden] { display: none; }
.eq-fold-all .link-btn { background: none; border: 0; padding: 0 2px; color: var(--accent); cursor: pointer; font: inherit;
    text-decoration: underline; text-underline-offset: 2px; }

/* World State: alerts, invasions and events marked done */
.ws-item-side { display: inline-flex; align-items: baseline; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.ws-done-btn { padding: 1px 8px; border: 1px solid var(--border-strong); border-radius: 999px; background: transparent;
    color: var(--text-muted); font: inherit; font-size: .75rem; font-weight: 600; cursor: pointer; white-space: nowrap; }
.ws-done-btn:hover, .ws-done-btn:focus-visible { border-color: var(--accent); color: var(--text-color); }
.ws-done-btn[aria-pressed="true"] { border-color: var(--good); color: var(--good); }
.ws-item.is-done { opacity: .6; }
.ws-item.is-done .ws-item-title { text-decoration: line-through; text-decoration-thickness: 1px; }
/* "Show N completed" at the end of the section's title line (no extra line) */
.ws-done-toggle { margin-left: auto; background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer;
    font: inherit; font-size: .8rem; text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.ws-done-toggle[hidden] { display: none; }

/* Until the filters have run (assets/app.js), the results and totals wait behind "Loading…" */
.loading-state { display: none; }
.ft-pending .loading-state { display: block; padding: 40px 0; text-align: center; color: var(--text-muted); }
.ft-pending #grid, .ft-pending .stats-wrap, .ft-pending #resultCount, .ft-pending #eqFoldAll { visibility: hidden; }
.ft-pending #grid { height: 0; overflow: hidden; }

/* ---------- Beta site (is_beta()) ---------- */
.beta-badge { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 4px; vertical-align: 2px;
    background: var(--warn); color: var(--page-bg); font-size: .6rem; letter-spacing: .08em; text-transform: uppercase; }
.beta-note { border: 1px solid var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }

/* ---------- Streamlined Equipment (v0.14.0) ---------- */
/* View button: what's showing, and how it's arranged, in one place */
.eq-picker-btn { gap: 6px; }
.eq-picker-word { color: var(--text-muted); font-weight: 500; }
.eq-picker-sub { color: var(--text-muted); font-weight: 400; font-size: .8rem; overflow: hidden; text-overflow: ellipsis; }
.eq-picker-sub:empty { display: none; }
.eq-picker-sub::before { content: '·'; margin-right: 6px; }
.eq-picker-pop { width: 300px; }
.eq-picker-head2 { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border-color); }
.eq-view-arrange { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 2px; }
.eq-view-arrange .filter-label { font-size: .78rem; }
.eq-picker .eq-fold-all { display: flex; margin: 10px 2px 0; }
.eq-picker .eq-fold-all[hidden] { display: none; }

/* Sidebar: "More filters" between the everyday sections and the folded ones */
.filter-divider { margin-top: 6px; font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
    color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.filter-divider::after { content: ''; flex: 1; border-top: 1px dashed var(--border-strong); }
.filter-divider[hidden] { display: none; }

/* Filters in use, above the results */
.active-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 14px; }
.active-chips[hidden] { display: none; }
.af-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 10px; border-radius: 999px;
    border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--text-color);
    font: inherit; font-size: .8rem; cursor: pointer; }
.af-chip:hover, .af-chip:focus-visible { background: color-mix(in srgb, var(--accent) 24%, transparent); }
.af-x { display: inline-grid; place-items: center; width: 16px; height: 16px; border-radius: 50%; font-size: .85rem; line-height: 1;
    color: var(--text-muted); }
.af-chip:hover .af-x { color: var(--text-color); }
.active-chips .af-clear { background: none; border: 0; padding: 0 4px; color: var(--accent); cursor: pointer; font: inherit;
    font-size: .8rem; text-decoration: underline; text-underline-offset: 2px; }

/* Slimmer totals and group headings on Equipment */
[data-page="equipment"] .stats { gap: 8px; margin-bottom: 12px; }
[data-page="equipment"] .stat { padding: 5px 10px 7px; min-width: 118px; }
[data-page="equipment"] .stat-label { font-size: .7rem; }
[data-page="equipment"] .stat-value { font-size: .9rem; }
[data-page="equipment"] .stat-bar-row { margin-top: 3px; gap: 6px; }
[data-page="equipment"] .stat-icon { width: 18px; height: 18px; }
[data-page="equipment"] .stat-icon img { width: 13px; height: 13px; }
.eq-group-head { border-bottom-color: var(--border-color); padding-bottom: 3px; }
.eq-group-name { font-size: .98rem; }
.eq-group-count { font-size: .78rem; opacity: .85; }
.eq-link-banner, .edit-banner { padding: 6px 12px; font-size: .85rem; }
@media (max-width: 860px) {
    .eq-picker-sub { display: none; }
}
