/* Shared styles for the spreadsheet-backed list pages (/games/, /projects/) */
:root {
    --bg: #fefefe; --fg: #000; --accent: #FFC30B; --line: #000; --shadow: #000;
    --card: #fff; --soft: #f5f5f5; --muted: #555; --hover: #fff6d6;
    --grid: rgba(0,0,0,0.07); --ease: cubic-bezier(.2,.8,.2,1);
    --ok: #a8ecc0; --mid: #ffe08a; --part: #ffc9a3; --open: #cfe0ff;
}
html.dark-mode {
    --bg: #121212; --fg: #fff; --line: #fff; --shadow: #f5f5f5;
    --card: #1b1b1b; --soft: #242424; --muted: #aaa; --hover: #2c2716;
    --grid: rgba(255,255,255,0.06);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
    margin: 0; min-height: 100vh; color: var(--fg); background-color: var(--bg);
    background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
    background-size: 40px 40px;
    font-family: "Rockwell", "Courier New", serif;
    transition: background-color .3s, color .3s;
}
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 110px 24px 80px; }

/* Corner keys (same as Notes) */
.key { display: inline-flex; align-items: center; justify-content: center; background: #fff; color: #000; border: 2px solid #000; box-shadow: 0 5px 0 #000; transition: transform .12s, box-shadow .12s; }
.key:hover { transform: translateY(2px); box-shadow: 0 3px 0 #000; }
.key:active { transform: translateY(5px); box-shadow: 0 0 0 #000; }
.home-key { position: fixed; top: 22px; left: 20px; z-index: 100; width: 52px; height: 44px; overflow: hidden; }
.home-key svg { position: absolute; left: 50%; top: 50%; width: 24px; height: 24px; margin: -12px 0 0 -12px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .35s var(--ease); }
.home-key .back { transform: translateY(150%); }
.home-key:hover .notes { transform: translateY(-150%); }
.home-key:hover .back { transform: translateY(0); }
.toggle { position: fixed; top: 22px; right: 20px; z-index: 100; width: 84px; height: 42px; padding: 0; cursor: pointer; background: #fff; border: 2px solid #000; box-shadow: 0 5px 0 #000; transition: transform .12s, box-shadow .12s; }
.toggle:hover { transform: translateY(2px); box-shadow: 0 3px 0 #000; }
.toggle .knob { position: absolute; top: 4px; left: 4px; width: 34px; height: 30px; background: #000; transition: transform .4s var(--ease); }
.dark-mode .toggle .knob { transform: translateX(38px); }
.toggle svg { position: absolute; top: 10px; width: 18px; height: 18px; fill: none; stroke: #000; stroke-width: 2.4; stroke-linecap: round; }
.toggle .sun { left: 11px; stroke: var(--accent); }
.toggle .moon { right: 11px; }
.dark-mode .toggle .sun { stroke: #000; }
.dark-mode .toggle .moon { stroke: var(--accent); }

/* Header */
.crumb { margin: 0; font-size: .95rem; font-weight: bold; text-transform: uppercase; letter-spacing: 2px; }
.crumb a { color: inherit; text-decoration: none; }
.crumb a:hover { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 3px; }
.crumb b { border-bottom: 3px solid var(--accent); padding-bottom: 3px; }
h1 { font-size: clamp(2.8rem, 7vw, 4.6rem); line-height: .9; text-transform: uppercase; letter-spacing: -2px; margin: 26px 0 14px; }
h1 span { display: inline-block; background: var(--accent); color: #000; padding: 6px 20px; border: 3px solid var(--line); box-shadow: 8px 8px 0 var(--shadow); transform: rotate(-2deg); }
.lede { max-width: 640px; margin: 28px 0 40px; font-size: 1.1rem; line-height: 1.5; color: var(--muted); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 40px; }
.stat { background: var(--card); border: 3px solid var(--line); box-shadow: 6px 6px 0 var(--shadow); padding: 18px 20px 16px; }
.stat b { display: block; font-size: 2.3rem; line-height: 1; font-variant-numeric: tabular-nums; }
.stat span { display: block; margin-top: 8px; font-size: .78rem; font-weight: bold; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); }
.stat small { font-size: .5em; margin-left: 2px; }
.stat.hl { background: var(--accent); color: #000; }
.stat.hl span { color: #000; }

/* Toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-bottom: 18px; }
.search { position: relative; flex: 1 1 300px; }
.search svg { position: absolute; left: 14px; top: 50%; width: 20px; height: 20px; margin-top: -10px; fill: none; stroke: var(--fg); stroke-width: 2.6; stroke-linecap: round; }
.search input { width: 100%; font: inherit; font-size: 1.05rem; padding: 13px 14px 13px 44px; color: var(--fg); background: var(--card); border: 3px solid var(--line); box-shadow: 4px 4px 0 var(--shadow); outline: none; border-radius: 0; -webkit-appearance: none; }
.search input::placeholder { color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { font: inherit; font-size: .85rem; font-weight: bold; text-transform: uppercase; letter-spacing: 1px; padding: 10px 14px; cursor: pointer; color: var(--fg); background: var(--card); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--shadow); transition: transform .1s, box-shadow .1s, background .15s; }
.chip:hover { transform: translateY(2px); box-shadow: 0 2px 0 var(--shadow); }
.chip[aria-pressed="true"] { background: var(--accent); color: #000; transform: translateY(4px); box-shadow: 0 0 0 var(--shadow); }
.chip em { font-style: normal; opacity: .6; margin-left: 4px; }
.sort { display: none; flex: 1 1 100%; font: inherit; font-size: 1rem; font-weight: bold; padding: 12px 14px; color: var(--fg); background: var(--card); border: 3px solid var(--line); box-shadow: 4px 4px 0 var(--shadow); border-radius: 0; }
.count { margin: 0 0 12px; font-size: .85rem; font-weight: bold; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); }

/* Table */
.panel { background: var(--card); border: 3px solid var(--line); box-shadow: 8px 8px 0 var(--shadow); }
.scroll { overflow: auto; max-height: 78vh; }
table { width: 100%; border-collapse: collapse; }
thead th { position: sticky; top: 0; z-index: 2; background: var(--accent); color: #000; border-bottom: 3px solid #000; padding: 0; text-align: left; white-space: nowrap; }
thead th button { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: 8px; width: 100%; padding: 14px 16px; cursor: pointer; font-family: inherit; font-size: .9rem; font-weight: 900; text-transform: uppercase; letter-spacing: 1px; }
thead th button:hover { background: #000; color: var(--accent); }
thead th[aria-sort] button { background: #000; color: var(--accent); }
thead th.idx button { cursor: default; }
thead th.idx button:hover { background: none; color: #000; }
thead th button:focus-visible { outline: 3px solid #000; outline-offset: -3px; }
th .arr { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; font-size: .7rem; line-height: 1; border: 2px solid currentColor; box-shadow: 2px 2px 0 currentColor; transition: transform .12s, box-shadow .12s; }
thead th button:hover .arr { transform: translate(1px, 1px); box-shadow: 1px 1px 0 currentColor; }
th .arr svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.hint { margin-left: 10px; font-weight: normal; letter-spacing: 1px; }
.hint kbd { font: inherit; font-weight: bold; padding: 1px 6px; border: 2px solid var(--line); box-shadow: 2px 2px 0 var(--shadow); color: var(--fg); }

/* Scrollbars: chunky brutalist thumb in brand yellow */
@supports not selector(::-webkit-scrollbar) { .scroll { scrollbar-width: thin; scrollbar-color: var(--accent) transparent; } }
.scroll::-webkit-scrollbar { width: 12px; height: 12px; }
.scroll::-webkit-scrollbar-track { background: transparent; }
.scroll::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 999px; border: 3px solid transparent; background-clip: padding-box; min-height: 40px; }
.scroll::-webkit-scrollbar-thumb:hover { background: #e6ac00; background-clip: padding-box; border-width: 2px; }
.scroll::-webkit-scrollbar-corner { background: transparent; }
th.num button { justify-content: flex-end; }
tbody td { padding: 13px 16px; border-bottom: 1px solid color-mix(in srgb, var(--line) 22%, transparent); vertical-align: middle; font-size: 1rem; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: var(--hover); }
td.idx { width: 56px; text-align: center; font-weight: bold; color: var(--muted); font-variant-numeric: tabular-nums; }
td.name { font-weight: 900; font-size: 1.05rem; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.note { color: var(--muted); line-height: 1.4; min-width: 240px; max-width: 420px; }
td.dim { white-space: nowrap; }
.empty { padding: 50px 20px; text-align: center; font-weight: bold; text-transform: uppercase; letter-spacing: 1.5px; color: var(--muted); }

/* Cells */
.meter { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.meter i { position: relative; display: block; width: 84px; height: 12px; border: 2px solid var(--line); background: var(--soft); }
.meter i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); background: var(--c, var(--accent)); }
.meter b { min-width: 2.2em; text-align: right; font-variant-numeric: tabular-nums; }
.bar { display: inline-flex; align-items: center; justify-content: flex-end; gap: 10px; }
.bar i { display: block; height: 8px; width: var(--w); min-width: 2px; background: var(--fg); opacity: .8; }
.badge { display: inline-block; padding: 4px 9px; font-size: .74rem; font-weight: 900; text-transform: uppercase; letter-spacing: 1px; white-space: nowrap; color: #000; background: var(--b, transparent); border: 2px solid #000; }
.badge.ghost { color: var(--fg); border: 2px dashed var(--line); }
.tag { display: inline-block; padding: 3px 8px; font-size: .85rem; font-weight: bold; border: 2px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums; }
mark { background: var(--accent); color: #000; padding: 0 1px; }

footer.note { margin-top: 30px; font-size: .85rem; color: var(--muted); }
footer.note a { color: inherit; text-decoration-color: var(--accent); text-decoration-thickness: 2px; }

/* Phones: rows become cards */
@media (max-width: 760px) {
    .wrap { padding: 96px 16px 60px; }
    .stats { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .stat b { font-size: 1.8rem; }
    .panel { box-shadow: 5px 5px 0 var(--shadow); }
    .scroll { max-height: none; overflow: visible; }
    thead { display: none; }
    .hint { display: none; }
    .sort { display: block; }
    table, tbody { display: block; }
    tbody tr { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; padding: 16px; border-bottom: 2px solid var(--line); }
    tbody tr:last-child { border-bottom: 0; }
    tbody td { padding: 0; border: 0; }
    td.idx { display: none; }
    td.name { grid-column: 1 / -1; font-size: 1.15rem; }
    td.note { grid-column: 1 / -1; min-width: 0; max-width: none; }
    td.num { text-align: left; }
    td[data-label]::before { content: attr(data-label); display: block; font-size: .68rem; font-weight: bold; text-transform: uppercase; letter-spacing: 1.2px; color: var(--muted); margin-bottom: 4px; }
    td.name::before, td.note::before { display: none; }
    .bar { justify-content: flex-start; flex-direction: row-reverse; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
