/* ============================================================
   Cobalt Deck theme -- dark palette (default) and light palette
   (:root[data-theme="light"], picked via the "Тема"/Theme setting in
   #settings-overlay -- see includes/user_repository.php's
   theme_preference). Design source: the "Cobalt Deck" artifact,
   https://claude.ai/artifact/5cviFGPPM4BcazPgYq7Qkn -- both :root
   token blocks were copied in as-is.

   Overlays (Settings, Add game, CSV export, every confirm-*-overlay)
   were kept out of scope for the main-screen redesign pass and still
   use their original plain styling, not yet reworked for this
   palette -- see docs/BACKLOG.md.

   Every id/class/data-attribute assets/js/app.js depends on
   (sorting, inline editing, filtering, the collection tick, ...) is
   unchanged by this file -- it only ever controls appearance, never
   selectors.
   ============================================================ */

:root {
    --row-hover: rgba(255, 255, 255, 0.07);
    --bg: #0b1220;
    --bg-tint: #0e1728;
    --surface: #121c30;
    --surface-alt: #16233a;
    --border: #253254;
    --border-strong: #33447a;
    --text: #e7edfa;
    --text-muted: #9aabd0;
    --text-faint: #6d7fa6;
    --accent: #6c93f5;
    --accent-hover: #8badff;
    --accent-soft: #1d2b4d;
    --accent-soft-text: #aec3fb;
    --success: #35d6a3;
    --success-soft: #123527;
    --warning: #f0b13e;
    --warning-soft: #3a2c11;
    --ring: rgba(108, 147, 245, 0.4);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 28px -14px rgba(0, 0, 0, 0.6);
    --radius-lg: 16px;
    --radius-md: 10px;
    --radius-sm: 7px;
    color-scheme: dark;
}

/* Light palette, from the same design source's shelved light :root block.
   public/index.php resolves the effective theme_preference server-side
   and renders it as <html data-theme="...">; a successful save in
   #settings-overlay also applies it instantly client-side (see
   assets/js/app.js's `fieldName === 'theme_preference'` branch). */
:root[data-theme="light"] {
    --row-hover: rgba(15, 35, 80, 0.07);
    --bg: #eef2fa;
    --bg-tint: #e4ecfb;
    --surface: #ffffff;
    --surface-alt: #f3f6fc;
    --border: #dbe3f2;
    --border-strong: #c3d1e8;
    --text: #16213a;
    --text-muted: #5b6b8c;
    --text-faint: #8b98b3;
    --accent: #2f6fed;
    --accent-hover: #2456bf;
    --accent-soft: #e2ebff;
    --accent-soft-text: #1d4ed8;
    --success: #0f9d78;
    --success-soft: #dff6ef;
    --warning: #b6720a;
    --warning-soft: #fdefd8;
    --ring: rgba(47, 111, 237, 0.35);
    --shadow-sm: 0 1px 2px rgba(22, 33, 58, 0.06);
    --shadow-md: 0 8px 24px -12px rgba(22, 33, 58, 0.22);
    color-scheme: light;
}

* {
    box-sizing: border-box;
}

body {
    font-family: "Public Sans", system-ui, sans-serif;
    margin: 0;
    padding: 16px 16px 16px;
    background: linear-gradient(180deg, var(--bg-tint) 0%, var(--bg) 340px);
    color: var(--text);
    /* With little/no content (no library loaded yet), .site-footer's auto
       top margin absorbs the leftover space and pins it to the viewport
       bottom. Once content-wrapper grows past 100vh there's no extra space
       left to give, so the footer falls back to sitting right after the
       content and scrolls away normally -- it never overlays content or
       stays fixed on screen. */
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.content-wrapper {
    display: block;
    width: 100%;
    max-width: none;
}

.page-header h1 {
    margin: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-icon {
    height: 48px;
    width: 48px;
    margin-right: 10px;
    flex-shrink: 0;
}

.brand-logo {
    height: 45px;
    width: auto;
}

/* Source SVGs' white (.cls-2) fill is invisible against the light theme's
   light background, so swap it for a visible grey there. */
:root[data-theme="light"] .brand-icon .cls-2 {
    fill: #4e4848;
}

/* The logo's "My" + "Tracker" layer has its own class (.logo-plain, not the
   generic .cls-2 the icon's global <style> also defines -- a generic class
   would let the icon's rules override the logo's colours). */
:root[data-theme="light"] .brand-logo .logo-plain {
    fill: #2d2d2d;
}

.page-header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.menu {
    position: relative;
    align-self: center;
}

.menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 38px;
    height: 38px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    color: var(--text-muted);
    cursor: pointer;
}

.menu-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    /* Same accent tint as .menu-item-icon and .library-owner .icon-btn --
       overrides .menu-btn's own text color so the icon stays accent-colored
       in both the signed-out and .menu-btn--user (signed-in) states. */
    color: var(--accent);
}

.menu-btn--user {
    width: auto;
    padding: 4px 12px 4px 4px;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text);
}

.menu-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.menu-username {
    font-size: 0.85em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
}

.menu-btn.active,
.menu-btn:hover {
    background: var(--accent-soft);
    border-color: var(--border-strong);
    color: var(--accent-soft-text);
}

.menu-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    display: flex;
    flex-direction: column;
    min-width: 180px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    z-index: 10;
    overflow: hidden;
}

.menu-dropdown[hidden] {
    display: none;
}

.menu-item {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 10px 14px;
    border: none;
    background: none;
    font: inherit;
    font-size: 0.85rem;
    text-align: left;
    text-decoration: none;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
}

.menu-item-icon {
    display: inline-flex;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    /* Same accent tint as the library-owner toolbar icons
       (.library-owner .icon-btn) -- both use fill="currentColor" SVGs, so
       the two icon groups read as one consistent language. */
    color: var(--accent);
}

.menu-item-icon svg {
    width: 100%;
    height: 100%;
}

.menu-item:hover {
    background: var(--accent-soft);
    color: var(--accent-soft-text);
}

.menu-item:hover .menu-item-icon {
    color: var(--accent-soft-text);
}

.menu-item[aria-disabled="true"] {
    opacity: 0.45;
    cursor: default;
}

.menu-item[aria-disabled="true"]:hover {
    background: none;
}

.menu-logout-form {
    margin: 0;
}

.menu-lang-switcher {
    display: flex;
    gap: 0.5rem;
    padding: 10px 14px;
    border-top: 1px solid var(--border);
}

.lang-switch {
    display: inline-flex;
    opacity: 0.45;
}

.lang-switch.active {
    opacity: 1;
}

.lang-switch svg {
    width: 20px;
    height: 20px;
    border-radius: 3px;
}

.lang-switch:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.error-message {
    color: #f28b8b;
    font-weight: bold;
}

/* ---------- SteamID control ---------- */
.steamid-form {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 16px 18px;
}

.steamid-form label {
    font-family: "JetBrains Mono", monospace;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--text-faint);
    white-space: nowrap;
}

.steamid-form input[type="text"] {
    flex: 1 1 240px;
    min-width: 0;
    font-family: "JetBrains Mono", monospace;
    font-size: 0.92rem;
    padding: 10px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-strong);
    background: var(--surface-alt);
    color: var(--text);
}

.steamid-form input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--ring);
}

button {
    padding: 0.4rem 0.8rem;
    cursor: pointer;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface-alt);
    color: var(--text-muted);
    cursor: pointer;
}

.icon-btn svg {
    width: 19px;
    height: 19px;
}

.icon-btn .refresh-arrows {
    animation: none;
}

.icon-btn--load {
    background: var(--accent);
    border-color: transparent;
    color: #fff;
}

.icon-btn--load svg {
    width: 20px;
    height: 20px;
}

/* Specificity bumped above .icon-btn:hover:not(:disabled) (which would
   otherwise win and paint this background/color pair instead, same as it
   does for every other .icon-btn) so this actually takes effect -- keeps
   the icon white and uses the same var(--accent-hover) the library-owner
   toolbar icons (.library-owner .icon-btn:hover) switch their own color
   to, so both hover states read as the same "darker accent" language. */
.icon-btn.icon-btn--load:hover:not(:disabled) {
    background: var(--accent-hover);
    color: #fff;
    border-color: transparent;
}

/* Dark theme only -- the icon reads better as var(--surface) (near-black)
   against the accent circle than plain white; the circle's own
   background/hover color is untouched, this only overrides color (which
   the load_library.svg icon inherits via fill="currentColor"). */
:root[data-theme="dark"] .icon-btn--load,
:root[data-theme="dark"] .icon-btn.icon-btn--load:hover:not(:disabled) {
    color: var(--surface);
}

.icon-btn--price svg {
    width: 19px;
    height: 19px;
}

.icon-btn:hover:not(:disabled) {
    background: var(--accent-soft);
    color: var(--accent-soft-text);
    border-color: var(--border-strong);
}

.icon-btn:disabled {
    opacity: 0.4;
    cursor: default;
}

.icon-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Toolbar icons (sync/add-game/complete-prices/update-hltb/export-csv):
   no circle -- the button box stays 40x40 (so layout/spacing/the
   has-badge dot position are unaffected) but its background/border
   are dropped and the icon grows to fill that box directly. The
   SteamID form's Load button (.icon-btn--load) keeps its filled-circle
   look; this override only targets the library-owner row. */
.library-owner .icon-btn {
    border: none;
    border-radius: 0;
    background: none;
    /* Literally the same value as .icon-btn--load's background
       (var(--accent)) -- reads darker here due to simultaneous contrast
       (thin icon strokes on the dark card vs. a large solid disc with a
       white icon on top), but per the user this is the color to use. */
    color: var(--accent);
}

.library-owner .icon-btn svg {
    width: 40px;
    height: 40px;
}

/* price.svg's disc fills its whole viewBox edge-to-edge (r=64 of a 128
   box), unlike export.svg/add_game.svg's disc (r=10 of a 24 box, ~17%
   inset) -- since this row has no CSS-drawn circle background (see
   .library-owner .icon-btn above), the icon's own disc IS the visible
   "circle", so at the same 40px render its circle reads visibly bigger.
   33px brings its rendered disc back in line with the inset family's
   effective diameter (40px * 20/24 ~= 33.3px). */
.library-owner .icon-btn--price svg {
    width: 33px;
    height: 33px;
}

.library-owner .icon-btn:hover:not(:disabled) {
    background: none;
    border-color: transparent;
    /* Mirrors .icon-btn--load's own accent -> accent-hover hover step. */
    color: var(--accent-hover);
}

/* ---------- library-owner identity + action toolbar row ---------- */
/* A single flex row -- #add-game-btn's margin-left: auto (below) pushes
   it and everything after it (complete-prices/update-hltb/export-csv) to
   the right edge. The sync button (no id) intentionally stays inline
   right after the name, not part of that right-pushed group. */
.library-owner {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    margin: 0 0 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 14px 18px;
    font-size: inherit;
    font-weight: normal;
    color: var(--text);
}

.library-owner__avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2px solid var(--surface);
    outline: 2px solid var(--accent);
    object-fit: cover;
    flex-shrink: 0;
}

.identity-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin-right: 4px;
}

.identity-eyebrow {
    font-family: "JetBrains Mono", monospace;
    font-size: 10.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.identity-name {
    font-family: "Manrope", sans-serif;
    font-weight: 800;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    color: var(--text);
}

.identity-last-sync {
    font-size: 0.6rem;
    color: var(--text-faint);
}

/* Groups every action button (sync included) into one right-aligned
   cluster, regardless of which ones render for a given viewer. It's a
   single flex item of .library-owner, so when the row is too narrow the
   whole cluster wraps below the avatar/name together instead of
   individual buttons peeling off. margin-left: auto keeps it on the right
   while it shares a row with the name; once it has wrapped below, app.js
   (applyLibraryOwnerWrap) adds .is-wrapped and it goes left-aligned
   instead. CSS alone can't tell "wrapped" from "not wrapped", and any
   fixed breakpoint would guess at the owner name's length. */
.library-owner__actions {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
}

.library-owner__actions.is-wrapped {
    margin-left: 0;
}

/* ---------- filter / notes row ---------- */
.table-notes {
    display: flex;
    align-items: center;
    font-size: 0.78rem;
    color: var(--text-faint);
    margin: 0;
    line-height: 1.5;
    min-height: 3em; /* reserves 2 lines so .table-controls stays the same height whether the currency note is shown or not; align-items: center keeps the inner <span> (1 or 2 lines) vertically centered in that reserved space -- the <br> must stay inside a single flex-item <span>, since a <br> as a direct flex child becomes its own flex item and stops acting as a line break */
}

.table-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 10px; /* moved off .table-notes -- a margin there sat inside its flex-item box and threw off centering against .table-filter */
}

.table-filter {
    display: flex;
    align-items: center;
    align-self: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 14px 6px 12px;
    box-shadow: var(--shadow-sm);
    font-size: 0.83rem;
    white-space: nowrap;
}

.table-filter__icon {
    display: inline-flex;
    align-items: center;
    color: var(--accent);
    cursor: pointer;
}

.table-filter__icon svg {
    display: block;
    width: 15px;
    height: 15px;
    /* transform doesn't participate in layout, so the icon renders bigger
       without growing the 15x15 box the pill's flex sizing/padding is
       based on -- the control itself stays the same size. */
    transform: scale(1.6);
}

.table-filter select {
    border: none;
    background: transparent;
    font: inherit;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
}

.table-filter select:focus {
    outline: none;
}

/* Dark theme only. */
:root[data-theme="dark"] .table-filter {
    background: var(--surface);
    border-color: var(--border-strong);
}

/* Same color as the library-owner toolbar's action icons (.library-owner
   .icon-btn) so the filter icon reads as part of the same icon language. */
:root[data-theme="dark"] .table-filter__icon {
    color: var(--accent);
}

:root[data-theme="dark"] .table-filter select {
    background: var(--surface);
    color: #fff;
}

/* The closed pill's colors above don't reach the native open option list --
   that needs its own background-color/color on <option>. The
   browser-native hover/highlighted row, however, uses the OS's own
   selection color and can't be reliably restyled via CSS in any browser. */
:root[data-theme="dark"] .table-filter select option {
    background-color: var(--surface);
    color: #fff;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------- games table: traditional bordered grid ---------- */
/* border-collapse: collapse means every cell's own 1px border merges
   with its neighbours, so the outer edge cells already draw the
   table's outline -- no extra wrapper/container needed for the
   bordered-card look the mockup uses. */
.games-table {
    border-collapse: collapse;
    width: 100%;
    table-layout: fixed;
}

/* Wide screens: the wrapper is inert, the table scrolls with the page and
   its sticky header sticks to the window. The table's min-width (other
   columns + a 250px name column) is set from app.js, so when the window is
   narrower than that the page scrolls sideways instead of the name column
   collapsing (.content-wrapper gets that min-width, so the page itself
   scrolls sideways). No element between the table and the window may have
   overflow set, or position: sticky on the header would stop following the
   window -- that is why there is no scroll box, and the header stays
   native-sticky (no JS) at every width.

   Everything in .content-wrapper except the table (header, SteamID form,
   library row, table controls) is pinned to the left edge at the visible
   window width, so those panels keep filling the screen while only the
   table moves sideways. --panel-width is set by app.js. */
.content-wrapper > :not(.games-table-scroll):not(#tab-panel),
#tab-panel > :not(.games-table-scroll) {
    position: sticky;
    left: 16px;
    width: var(--panel-width, auto);
}

/* position: sticky always creates a stacking context, which traps the menu
   dropdown (z-index: 10, inside .page-header) at the header panel's own
   level -- so the later sticky panels (SteamID form...) painted over it.
   Raising the header panel above its siblings puts the dropdown on top. */
.content-wrapper > .page-header {
    z-index: 5;
}

/* ---------- tabs (Main Data / Totals) ---------- */
/* #tab-panel holds one tab at a time and must itself stay un-pinned: the
   games table inside it still has to scroll sideways with the page. Its
   children (table controls, Totals cards, status line) are pinned by the
   sticky rule above, exactly like the panels that sit directly in
   .content-wrapper. */
.tabs {
    display: flex;
    gap: 4px;
    padding: 0 6px;
    margin: 0 0 10px;
    /* The strip's bottom line is an inset shadow, not a border, and the tabs
       carry no negative margin: a tab overlapping a border by 1px counts as
       vertical overflow and shows a vertical scrollbar next to the tab row. */
    box-shadow: inset 0 -2px 0 var(--border);
    overflow-x: auto;
    overflow-y: hidden;
}

.tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-tint);
    border: 2px solid var(--border);
    border-radius: 8px 8px 0 0;
    padding: 8px 17px;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
    cursor: pointer;
}

.tab:hover {
    background: var(--surface-alt);
    color: var(--accent-soft-text);
}

/* Dark theme: --bg-tint is nearly the same as --bg there, so inactive tabs
   would look like the active one. Use a lighter fill and a stronger border. */
:root:not([data-theme="light"]) .tab:not([aria-selected="true"]) {
    background: var(--surface-alt);
    border-color: var(--border-strong);
}

:root:not([data-theme="light"]) .tab:not([aria-selected="true"]):hover {
    background: var(--accent-soft);
}

/* The selected tab is a raised folder tab: page background colour and the same border
   colour as the strip's bottom line. Its
   opaque background covers the strip's bottom line, so it joins the content. */
.tab[aria-selected="true"] {
    background: var(--bg);
    border-color: var(--border);
    border-bottom: 0;
    color: var(--accent-hover);
}

.tab:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: -2px;
}

.tab__count {
    font-family: "JetBrains Mono", monospace;
    font-size: 10.5px;
    font-weight: 500;
    padding: 1px 7px;
    border-radius: 999px;
    background: var(--surface-alt);
    border: 1px solid var(--border);
    color: var(--text-faint);
}

.tab[aria-selected="true"] .tab__count {
    background: var(--accent-soft);
    border-color: var(--border-strong);
    color: var(--accent-soft-text);
}

/* Shown inside #tab-panel while a tab is loading, and when loading failed. */
.tab-panel__status {
    padding: 16px 4px;
    font-size: 0.85rem;
    color: var(--text-faint);
}

.tab-panel__retry {
    margin-left: 8px;
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-weight: 600;
    color: var(--accent);
    text-decoration: underline;
    cursor: pointer;
}

.totals {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.totals__row {
    display: grid;
    gap: 10px;
    /* Four cards per row, filling the whole width; any further cards in a
       row wrap onto the next line on the same four columns. Fewer columns
       on narrow windows. */
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 900px) {
    .totals__row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 520px) {
    .totals__row {
        grid-template-columns: minmax(0, 1fr);
    }
}

.stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 14px 18px;
}

.stat__eyebrow {
    font-family: "JetBrains Mono", monospace;
    font-size: 10.5px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.stat__value {
    font-family: "Manrope", sans-serif;
    font-weight: 800;
    font-size: 1.7rem;
    letter-spacing: -0.02em;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

.stat__value small {
    margin-left: 3px;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-muted);
}

.stat--accent .stat__value {
    color: var(--accent-hover);
}

.stat__note {
    font-size: 0.72rem;
    color: var(--text-faint);
}

/* Stats by year tab: a plain table in the games table's look. #tab-panel > * is
   already pinned to the window width by the rule above, so a wide table scrolls
   inside .years instead of widening the page. */
.years {
    overflow-x: auto;
}

.years-table {
    width: auto;
    border-collapse: collapse;
    background: var(--surface);
}

.years-table th,
.years-table td {
    border: 1px solid var(--border);
    padding: 8px 14px;
    font-size: 0.86rem;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.years-table th {
    padding: 12px;
    background: var(--surface-alt);
    border-color: var(--border-strong);
    font-family: "Public Sans", sans-serif;
    font-weight: 700;
    font-size: 0.76rem;
    line-height: 1.25;
    color: var(--text-muted);
    text-align: center;
}

.years-table td:first-child {
    font-weight: 700;
    text-align: center;
}

/* A count with games behind it: looks like a link, opens the lightbox below. */
.years-link {
    padding: 0;
    border: 0;
    background: none;
    font: inherit;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    text-decoration: none;
    cursor: pointer;
}

.years-link:hover,
.years-link:focus-visible {
    color: var(--accent-hover);
}

.years-games-overlay__message {
    width: 92vw;
    max-width: 520px;
}

/* Game titles can contain symbols like (tm)/(r), which Public Sans renders
   oddly -- same system font stack as the games table's name column. */
.years-games-list {
    font-family: system-ui, sans-serif;
    margin: 0;
    padding-left: 22px;
    line-height: 1.7;
    color: var(--text);
}

/* Sortable headers, like the games table's: pointer + hover tint, and the
   same arrow above the title of the sorted column. */
.years-table th.sortable {
    position: relative;
    cursor: pointer;
    user-select: none;
}

.years-table th.sortable:hover {
    background: var(--accent-soft);
    color: var(--accent-soft-text);
}

.years-table th.sortable::after {
    content: '';
    display: none;
    position: absolute;
    top: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    background-repeat: no-repeat;
    background-size: contain;
    filter: invert(1);
    opacity: 0.4;
    pointer-events: none;
}

.years-table th.sort-asc::after {
    display: block;
    background-image: url('../img/up-arrow.svg');
}

.years-table th.sort-desc::after {
    display: block;
    background-image: url('../img/down-arrow.svg');
}

.years-table th.sort-asc,
.years-table th.sort-desc {
    color: var(--accent-soft-text);
}

:root[data-theme="light"] .years-table th.sortable::after {
    filter: none;
    opacity: 0.55;
}

.games-table th,
.games-table td {
    border: 1px solid var(--border);
    padding: 5px 10px;
    text-align: left;
    font-size: 0.86rem;
    vertical-align: middle;
}

.games-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: var(--surface-alt);
    border-color: var(--border-strong);
    text-align: center;
    font-family: "Public Sans", sans-serif;
    font-weight: 700;
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.25;
    padding: 10px;
}

/* Predicted-time column's HLTB style picker (#hltb-style-select), matching
   the Cobalt Deck mockup's .style-select: a small tinted pill instead of a
   bare native dropdown. */
#hltb-style-select {
    display: block;
    margin: 4px auto 0;
    font: inherit;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--accent-soft-text);
    background: var(--accent-soft);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    padding: 3px 6px;
    cursor: pointer;
}

.games-table th.sortable {
    cursor: pointer;
    user-select: none;
}

.games-table th.sortable:hover {
    background: var(--accent-soft);
    color: var(--accent-soft-text);
}

.games-table th.sortable::after {
    content: '';
    display: none;
    position: absolute;
    top: 3px;
    left: 50%;
    transform: translateX(-50%);
    width: 10px;
    height: 10px;
    background-repeat: no-repeat;
    background-size: contain;
    filter: invert(1);
    opacity: 0.4;
    pointer-events: none;
}

.games-table th.sort-asc::after {
    display: block;
    background-image: url('../img/up-arrow.svg');
}

.games-table th.sort-desc::after {
    display: block;
    background-image: url('../img/down-arrow.svg');
}

.games-table th.sort-asc,
.games-table th.sort-desc {
    color: var(--accent-soft-text);
}

/* Light theme's header background is pale, so the inverted (white) arrow
   from .sortable::after is nearly invisible -- keep the SVG's native black
   and raise the opacity instead of inverting it. */
:root[data-theme="light"] .games-table th.sortable::after {
    filter: none;
    opacity: 0.55;
}

.games-table .col-right {
    text-align: right;
}

.games-table .col-center {
    text-align: center;
}

.games-table .predicted-time-tick {
    text-align: center;
    color: var(--success);
    font-weight: 700;
}

.games-table .col-time {
    width: 110px;
}

.games-table .col-year {
    width: 90px;
    color: var(--text-muted);
}

.games-table .col-narrow {
    width: 80px;
}

/* Завършена (Completed) shares .col-narrow with Backlog/Collection/
   Include-in-forecast, so widening that class would widen all four.
   Targets the header specifically via its unique data-field-key --
   under table-layout: fixed, the thead row's cell widths are what
   actually size the column, not the td's (which doesn't reliably carry
   data-field="completed": that attribute sits on the checkbox <input>
   instead, whenever the viewer can edit). */
.games-table th[data-field-key="completed"] {
    width: 90px;
}

.games-table .col-price {
    width: 80px;
}

.games-table .col-appid {
    width: 80px;
}

/* Faint/small styling is for the appid value only -- scoped to td so it
   can't outrank .games-table thead th's color/font-size on the header
   label (both .col-appid rules are 2-class selectors, so an unscoped
   version here would win over the 1-class+2-element thead th rule). */
.games-table td.col-appid {
    color: var(--text-faint);
    font-size: 0.82em;
}

/* The appid of a Steam game links to its store page; it keeps the faint
   colour and only shows an underline on hover. */
.games-table td.col-appid a {
    color: inherit;
    text-decoration: none;
}

.games-table td.col-appid a:hover,
.games-table td.col-appid a:focus-visible {
    text-decoration: underline;
}

/* col-name has no width rule anymore: with table-layout: fixed, the one
   column left without an explicit width (formerly predicted-time, now
   this one) absorbs all remaining space once every other column's fixed
   width is subtracted. */

/* Game titles come straight from Steam and can contain symbols like (tm)/(r)
   -- Public Sans (the body's brand font) renders those oddly, so this
   column falls back to the system font stack instead, same as the old
   theme uses everywhere. */
.games-table .col-name {
    font-family: system-ui, sans-serif;
}

/* .col-name-inner (a <div> wrapping the input + delete button, td only) --
   NOT display: flex directly on the <td> itself: .games-table uses
   border-collapse: collapse, which only merges borders between genuine
   table-cell boxes. Overriding a <td>'s own display drops it out of that
   box type, so its border stopped collapsing with its neighbours and
   rendered visibly thicker than every other column. th.col-name (the
   sticky, sortable column header) is also never touched here for the same
   reason as before -- it has no wrapper div at all. */
.col-name-inner {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Scoped to col-name only -- .editable-field's own width: 100% rule (used
   as-is by every other editable column) would otherwise push
   .delete-game-btn onto its own line below the input instead of sitting
   next to it. */
.col-name-inner .editable-field {
    flex: 1 1 auto;
    min-width: 0;
    width: auto;
}

/* Only ever rendered for an is_owned = 0 row's own owner (see public/
   index.php's .col-name cell) -- reuses .overlay-close's circular-icon-
   button language at a smaller size for inline table use, with the same
   danger red already used elsewhere (.overlay-titlebar--danger,
   .editable-field.save-error) since this is a destructive action. */
.delete-game-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    padding: 0;
    border: 1px solid #585c63;
    border-radius: 50%;
    background: transparent;
    color: var(--text-faint);
    cursor: pointer;
}

.delete-game-btn svg {
    width: 10px;
    height: 10px;
    display: block;
}

.delete-game-btn:hover {
    background: rgba(224, 92, 92, 0.14);
    border-color: #e05c5c;
    color: #e05c5c;
}

.delete-game-btn:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* Light theme only -- #585c63's default border is tuned for the dark
   background and reads too dark/low-contrast against the light theme's
   pale row backgrounds. */
:root[data-theme="light"] .delete-game-btn {
    border-color: #a4a6aa;
}

/* Dark theme only -- lighter than the base rule's #585c63 for better
   contrast against the dark theme's row backgrounds. */
:root[data-theme="dark"] .delete-game-btn {
    border-color: #75787f;
}

/* Predicted-time has no distinguishing class (its <th>/<td> only carry
   sortable/col-right/col-center etc.), but it's always the last column in
   the fixed 15-column layout, so :last-child targets it reliably. */
.games-table th:last-child,
.games-table td:last-child {
    width: 140px;
}


.games-table .col-right .editable-field {
    text-align: right;
}

.games-table tbody tr:nth-child(even) {
    background: var(--surface-alt);
}

/* Text-only dimming for is_owned = 0 rows -- deliberately NOT opacity, which
   would also wash out the row background (including a completed-row's green),
   checkbox accent-color, and editable-field borders. Only foreground text
   color is muted; everything else renders at full strength. */
.games-table tr.not-owned td {
    color: var(--text-faint);
}

.games-table tr.not-owned .editable-field {
    color: var(--text-faint);
}

/* .delete-game-btn already defaults to --text-faint (see its own rule
   above), but its :hover red needs reasserting here: that rule's specificity
   (two classes, no type selectors) loses to the blanket td rule above (two
   classes plus the tr/td type selectors), which would otherwise mute the
   hover feedback on a not-owned row's delete button. */
.games-table tr.not-owned .delete-game-btn:hover {
    color: #e05c5c;
}

/* Ticks keep their own color even on a not-owned row -- unlike ordinary
   cell text, a tick IS the information (owned/collected, or "done, no
   prediction needed"), not a de-emphasized label next to it. */
.games-table tr.not-owned .collection-cell {
    color: var(--text);
}

.games-table tr.not-owned .predicted-time-tick {
    color: var(--success);
}

.games-table tr.completed-row,
.games-table tr.completed-row:nth-child(even) {
    background-color: var(--success-soft);
}

/* Light theme only -- a brighter, more saturated green than
   --success-soft's pale default, requested specifically for this row. */
:root[data-theme="light"] .games-table tr.completed-row {
    background-color: #aae9a1;
}

/* Dark theme only -- same idea as the light-theme override above. */
:root[data-theme="dark"] .games-table tr.completed-row {
    background-color: #1e561f;
}

.games-table input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--accent);
    vertical-align: middle;
}

.games-table input[type="checkbox"][data-field="completed"] {
    accent-color: var(--success);
}

.editable-field {
    /* transparent lets the row's own background (odd rows: page bg, even
       rows: --surface-alt) show through exactly, whichever it is -- only
       the border marks this as an editable control, not a fill color. */
    width: 100%;
    box-sizing: border-box;
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: 4px;
    color: var(--text);
    font: inherit;
    padding: 0 6px; /* was 3px 6px -- vertical padding removed so own rows match the compact read-only rows of another user's library */
}

.editable-field:hover {
    border-color: var(--accent);
}

.editable-field:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--ring);
}

.editable-field.save-error {
    outline: 2px solid #e05c5c;
    outline-offset: 1px;
}

/* Idle (not yet activated) text cell -- a plain <span> that borrows every
   visual from .editable-field (see public/index.php and
   docs/firefox-freeze-investigation.md: ~9000 real text inputs froze Firefox).
   It becomes a real <input> on first click/focus (assets/js/app.js). */
.editable-field--idle {
    display: block;
    overflow: hidden;
    white-space: pre;           /* keep leading/trailing spaces, exactly like an input's value */
    text-overflow: ellipsis;
    cursor: text;
}

/* An empty span has no line box, so it would collapse to just padding + border.
   A zero-width space gives it the same height as an empty input. */
.editable-field--idle:empty::before {
    content: "\200b";
}

/* -----------------------------------------------------------------
   The scrim below (.loading-overlay, its [hidden] state, and every
   .loader-* rule for the sync/load/hltb/prices spinner) is intentionally
   UNCHANGED -- the loading overlay itself was kept as-is on purpose.

   Everything from .loading-overlay__message down is the Cobalt Deck
   pass for the other 8 overlays (Settings, Add game, CSV export, every
   confirm-*-overlay, the error overlay): a title bar (own overlay's
   name, e.g. the triggering button's label) with a close X, over a
   scrollable body. The X fires the same handler as an overlay's "No"
   button where one exists (see assets/js/app.js).
   ----------------------------------------------------------------- */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-overlay[hidden] {
    display: none;
}

.loading-overlay__message {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    display: flex;
    flex-direction: column;
    max-height: min(640px, 88vh);
    overflow: hidden;
}

.overlay-titlebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 8px 8px 14px;
    background: var(--surface-alt);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.overlay-titlebar h2 {
    margin: 0;
    font-family: "Manrope", sans-serif;
    font-size: 0.88rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--text);
}

/* Used by the error overlay only -- a faint red tint on the same band,
   reusing the app's existing ad hoc error red (.error-message,
   .editable-field.save-error) rather than inventing a new token. */
.overlay-titlebar--danger {
    background: rgba(224, 92, 92, 0.14);
}

.overlay-titlebar--danger h2 {
    color: #f2a0a0;
}

/* Same recipe as .menu-btn (the header hamburger button): visible
   border/surface/shadow at rest, not just on hover, and the icon itself
   stays accent-colored in every state via .overlay-close svg's own
   color -- only the button's border/background shift on hover, same as
   .menu-btn.active/.menu-btn:hover leaves .menu-btn svg's colour alone. */
.overlay-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    color: var(--text-muted);
    cursor: pointer;
}

.overlay-close:hover {
    background: var(--accent-soft);
    border-color: var(--border-strong);
    color: var(--accent-soft-text);
}

.overlay-close:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.overlay-close svg {
    width: 12px;
    height: 12px;
    display: block;
    color: var(--accent);
}

.overlay-body {
    padding: 18px 20px 20px;
    overflow-y: auto;
}

.loader-spinner {
    width: 400px;
    height: 400px;
    max-width: 90vw;
    max-height: 90vw;
}

.loader-stack {
    display: grid;
}

.loader-stack > * {
    grid-area: 1 / 1;
    place-self: center;
}

/* Progress line ("N games left") directly under the spinner. A grid item
   pinned to the stack's bottom edge, then pushed just below it with a
   negative margin so it never covers the spinner artwork. */
.loader-stack > .loader-progress {
    place-self: end center;
    margin-bottom: -2.4em;
    color: #fff;
    font-size: 1.1em;
    white-space: nowrap;
}

.loader-progress[hidden] {
    display: none;
}

.loader-icon {
    display: none;
    width: 38%;
    color: #fff;
    --refresh-spin-duration: 5s;
}

@media (prefers-reduced-motion: reduce) {
    .loader-icon .refresh-arrows {
        animation: refresh-spin var(--refresh-spin-duration, 1.4s) linear infinite;
    }
}

.loading-overlay[data-action="load"] .loader-icon--load,
.loading-overlay[data-action="sync"] .loader-icon--sync,
.loading-overlay[data-action="hltb"] .loader-icon--hltb,
.loading-overlay[data-action="prices"] .loader-icon--prices {
    display: block;
}

.loader-icon svg {
    display: block;
    width: 100%;
    height: auto;
}

.loader-spinner svg {
    width: 100%;
    height: 100%;
}

.error-overlay {
    cursor: pointer;
}

/* ---------- confirm-*-overlay (hltb, prices, logout, country) ---------- */

.confirm-overlay__message {
    width: 92vw;
    max-width: 420px;
}

.confirm-copy {
    margin: 0;
    text-align: center;
    line-height: 1.55;
    color: var(--text);
}

.confirm-copy .muted {
    color: var(--text-muted);
}

.confirm-overlay__actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
}

/* ---------- generic overlay action buttons ---------- */

.btn {
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 9px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 1px solid transparent;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-primary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn-secondary {
    background: transparent;
    border-color: var(--border-strong);
    color: var(--text-muted);
}

.btn-secondary:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent-soft-text);
}

.btn-secondary:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

/* ---------- add-game-overlay ---------- */

/* Only this overlay sits 1/3 down the screen instead of vertically
   centered (.loading-overlay's shared default) -- every other overlay is
   unaffected. */
#add-game-overlay {
    align-items: flex-start;
}

.add-game-overlay__message {
    width: 92vw;
    max-width: 420px;
    margin-top: 33vh;
}

.add-game-search-row {
    display: flex;
    gap: 8px;
}

.add-game-search-input-wrap {
    position: relative;
    flex: 1;
    min-width: 0;
}

.add-game-search-input-wrap input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    /* Room for #add-game-search-spinner without it overlapping typed text. */
    padding-right: 32px;
}

#add-game-search-input,
#add-game-manual-name,
#add-game-manual-hltb-id {
    font: inherit;
    font-size: 0.88rem;
    padding: 8px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-strong);
    background: var(--surface-alt);
    color: var(--text);
}

#add-game-search-input:focus,
#add-game-manual-name:focus,
#add-game-manual-hltb-id:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--ring);
}

/* Shown only while a search request is in flight (runAddGameSearch in
   app.js) -- a small spinning ring inside the input's own right edge,
   rather than reusing the big SVG loading-overlay spinner, which would be
   wildly out of scale here. */
.search-spinner {
    position: absolute;
    top: 50%;
    right: 10px;
    width: 14px;
    height: 14px;
    margin-top: -7px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: search-spinner-rotate 0.7s linear infinite;
}

@keyframes search-spinner-rotate {
    to {
        transform: rotate(360deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .search-spinner {
        animation: none;
    }
}

/* position: fixed and deliberately NOT a descendant of #add-game-overlay
   (see public/index.php) -- .loading-overlay__message has overflow:hidden
   to clip its own rounded corners, which would clip this list too if it
   were nested inside. Left/top/width are set from JS
   (positionAddGameResults() in assets/js/app.js), which tracks
   .add-game-search-row's on-screen position. z-index must clear
   .loading-overlay's own 1000 to actually draw above the overlay. */
#add-game-results {
    position: fixed;
    z-index: 1001;
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 300px;
    overflow-y: auto;
    background: var(--surface-alt);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

#add-game-results li {
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-size: 0.88rem;
}

#add-game-results li:last-child {
    border-bottom: none;
}

#add-game-results li:hover,
#add-game-results li.is-active {
    background: var(--accent-soft);
    color: var(--accent-soft-text);
}

#add-game-results li.add-game-manual-option {
    font-style: italic;
    color: var(--text-muted);
}

#add-game-results .add-game-result-name {
    font-weight: 600;
}

#add-game-results .add-game-result-appid {
    color: var(--text-faint);
    font-size: 0.82em;
}

#add-game-results li.add-game-group-label {
    cursor: default;
    padding: 8px 10px 4px;
    border-bottom: none;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
}

#add-game-results li.add-game-group-label:hover {
    background: none;
    color: var(--text-faint);
}

.add-game-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 8px 0;
}

#add-game-manual-step label {
    display: block;
    margin-top: 10px;
    margin-bottom: 4px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* The first label's own margin-top has no preceding sibling to collapse
   against, so it collapses with #add-game-manual-step's margin instead,
   pushing space above the whole step rather than just below its own
   heading -- reads as one big gap above just this label. Needs the
   #add-game-manual-step prefix to outrank the label rule above (both are
   1-class-equivalent + type, but ID + type + attribute beats ID + type). */
#add-game-manual-step label[for="add-game-manual-name"] {
    margin-top: 0;
}

#add-game-manual-step input {
    width: 100%;
    box-sizing: border-box;
}

#add-game-manual-submit {
    margin-top: 12px;
}

.add-game-error {
    color: #f28b8b;
    font-size: 0.85rem;
    margin-top: 8px;
}

/* ---------- settings-overlay & csv-export-overlay shared field rows ---------- */

.settings-overlay__message {
    width: 92vw;
    max-width: 530px;
}

/* Info overlay: a long read-only text. Wider than Settings so the lines stay
   readable, and the body (.overlay-body) scrolls inside the capped height. */
.info-overlay__message {
    width: 92vw;
    max-width: 720px;
}

.info-body {
    line-height: 1.55;
    font-size: 0.92rem;
}

.info-body h3 {
    margin: 22px 0 8px;
    font-family: "Manrope", sans-serif;
    font-size: 1rem;
    font-weight: 800;
    color: var(--text);
}

.info-body h3:first-child {
    margin-top: 0;
}

.info-body p {
    margin: 0 0 12px;
}

.info-body a {
    color: var(--accent);
}

.settings-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.settings-row label {
    flex: 1;
    min-width: 0;
    line-height: 1.3;
    font-size: 0.88rem;
    color: var(--text);
}

/* Caps how wide a Settings label can grow before it wraps to a second
   line, instead of relying on however much space happens to be left in
   the row (which a long label like "allow_others_sync" rarely filled). */
.settings-overlay .settings-row label {
    max-width: 240px;
}

.settings-row select,
.settings-row input[type="text"] {
    font: inherit;
    font-size: 0.85rem;
    padding: 7px 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-strong);
    background: var(--surface-alt);
    color: var(--text);
}

/* Every Settings dropdown lines up at the same width, regardless of how
   long its own options are (the country list runs much longer than
   language/HLTB-source/theme) -- scoped to .settings-overlay so the
   CSV-export overlay's own (unrelated) .settings-row selects are unaffected. */
.settings-overlay .settings-row select {
    width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Same idea for the CSV-export overlay's own two dropdowns (data scope,
   respect sort) -- equal width regardless of their own option text. */
.csv-export-overlay .settings-row select {
    width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* csv_export.select_all.label now reads as this list's section heading
   ("Included data"), not a per-checkbox label -- set apart with the same
   mono face the Settings visibility section's own heading uses
   (.settings-section h3). */
label[for="csv-export-select-all"] {
    font-size: 0.75rem;
    font-family: "JetBrains Mono", monospace;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
}

/* Lines a lone checkbox row (e.g. allow_others_sync) up with the dropdown
   rows above/below it -- same 220px slot as .settings-row select, with the
   checkbox itself pinned to its right edge instead of stretched to fill it. */
.settings-control-slot {
    display: flex;
    justify-content: flex-end;
    width: 220px;
    flex-shrink: 0;
}

.settings-row select:focus,
.settings-row input[type="text"]:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--ring);
}

.settings-row input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin: 0;
    accent-color: var(--accent);
    cursor: pointer;
}

.settings-section {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
}

.settings-section h3 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    font-size: 0.75rem;
    font-family: "JetBrains Mono", monospace;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-faint);
}

/* Visibility checkboxes -- two columns so the long list doesn't dominate
   the overlay's height, same layout the Cobalt Deck mockup used. */
.checkbox-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2px 20px;
}

.checkbox-grid .settings-row {
    margin-bottom: 8px;
}

/* Narrower cap than the general .settings-overlay .settings-row label
   rule -- each grid column is roughly half as wide as a full settings
   row, so 240px would barely ever wrap here. */
.checkbox-grid .settings-row label {
    max-width: 200px;
}

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

/* ---------- csv-export-overlay ---------- */

.csv-export-overlay__message {
    width: 92vw;
    max-width: 560px;
}

/* Field checkboxes -- two columns, same idea as the Settings overlay's
   .checkbox-grid, but the item count here varies per viewer's visibility
   settings (see $csvExportFields' array_filter above), so a CSS grid with
   a fixed row count isn't an option. column-count naturally fills the
   first column top-to-bottom before spilling into the second (and puts
   the odd item in the first column when the count is uneven), which is
   exactly "split at the midpoint, rounded up" without PHP needing to
   compute that split itself. */
.csv-fields-columns {
    columns: 2;
    column-gap: 20px;
}

.csv-fields-columns .settings-row {
    break-inside: avoid-column;
    margin-bottom: 8px;
}

/* No max-width here (unlike the Settings overlay's .checkbox-grid) --
   letting the label's flex:1 fill its whole column pushes the checkbox
   flush against that column's right edge, which for the second column
   is the same edge the select-all checkbox and the dropdowns above
   already sit flush against. A capped label would leave the checkbox
   short of that edge instead. Long labels still wrap: the column's own
   width still bounds how far the label can grow. */

@media (max-width: 480px) {
    .csv-fields-columns {
        columns: 1;
    }
}

.csv-export-overlay__actions {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
}

#csv-export-submit {
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    padding: 9px 16px;
    border-radius: var(--radius-md);
    cursor: pointer;
    border: 1px solid transparent;
    background: var(--accent);
    color: #fff;
}

#csv-export-submit:hover {
    background: var(--accent-hover);
}

.info-icon {
    display: inline-flex;
    cursor: help;
    color: var(--text-faint);
    flex-shrink: 0;
}

.site-footer {
    max-width: 720px;
    margin: auto auto 0;
    padding-top: 16px;
    text-align: center;
    color: var(--text-faint);
    font-size: 0.8rem;
    line-height: 1.6;
}

.site-footer p {
    margin: 0;
}

.info-icon svg {
    display: block;
    width: 16px;
    height: 16px;
}

/* Main Data table: the row under the pointer gets a faint tint so a long row
   is easy to follow across its width. A semi-transparent layer (background-image)
   over the row's own background-color, so zebra stripes and the green
   completed-row keep their colour. Lighter in the dark theme, darker in the
   light one (--row-hover per theme). Hover-capable devices only. */
@media (hover: hover) {
    .games-table tbody tr:hover {
        background-image: linear-gradient(var(--row-hover), var(--row-hover));
    }
}
