* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
    --bg: #f5f5f4; --card-bg: #ffffff; --text: #1c1917; --text-secondary: #78716c;
    --border: #e7e5e4; --radius: 20px; --shadow: 0 1px 3px rgba(0,0,0,0.04);
    --accent: #dc2626; --accent-soft: rgba(220,38,38,0.10); --ink-soft: #a8a29e;
    --fun: #dc2626; --boring: #a8a29e; --targa: #2563eb;
}
:root.dark {
    --bg: #0a0a0a; --card-bg: #141414; --text: #fafafa; --text-secondary: #a3a3a3;
    --border: #262626; --shadow: 0 1px 3px rgba(0,0,0,0.2);
    --accent: #f87171; --accent-soft: rgba(248,113,113,0.14); --ink-soft: #525252;
    --fun: #f87171; --boring: #737373; --targa: #60a5fa;
}
body {
    font-family: 'Space Grotesk', sans-serif; background: var(--bg); color: var(--text);
    min-height: 100vh; padding: 1.5rem 1rem 3rem; transition: background .4s, color .4s;
}
.container { width: 100%; max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; gap: 1rem; }
.header { display: flex; align-items: center; justify-content: space-between; padding: .5rem 0; }
.logo { font-family: 'Space Mono', monospace; font-size: .85rem; font-weight: 700; letter-spacing: -.02em; color: var(--text); text-decoration: none; }
.logo-sub { color: var(--accent); }
.header-right { display: flex; align-items: center; gap: .75rem; }
.time { font-family: 'Space Mono', monospace; font-size: .8rem; color: var(--text-secondary); }
.theme-toggle { background: none; border: 1px solid var(--border); color: var(--text); border-radius: 999px; width: 2rem; height: 2rem; cursor: pointer; font-size: 1rem; }
.intro { font-size: .95rem; line-height: 1.55; color: var(--text-secondary); }
.intro strong { color: var(--text); font-weight: 600; }
.legend { display: block; margin-top: .35rem; font-family: 'Space Mono', monospace; font-size: .72rem; }
.muted { color: var(--text-secondary); font-size: .8rem; font-family: 'Space Mono', monospace; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; }
.stat { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .15rem; }
.stat-num { font-family: 'Space Mono', monospace; font-size: 1.35rem; font-weight: 700; }
.stat-label { font-size: .72rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .06em; }
.warn { background: var(--accent-soft); border: 1px solid var(--accent); color: var(--text); border-radius: 12px; padding: .6rem .9rem; font-size: .85rem; }

.section { display: flex; flex-direction: column; gap: .75rem; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
h2 { font-size: 1.05rem; font-weight: 600; }
.chips { display: flex; gap: .35rem; flex-wrap: wrap; }
.chip { background: var(--card-bg); border: 1px solid var(--border); color: var(--text-secondary); border-radius: 999px; padding: .25rem .7rem; font: inherit; font-size: .78rem; cursor: pointer; }
.chip.active { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: .75rem; }
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.lcard { display: flex; flex-direction: column; text-decoration: none; color: inherit; transition: transform .15s; }
.lcard:hover { transform: translateY(-2px); }
.lcard.hot { border-color: var(--accent); }
.lcard .photo { aspect-ratio: 3 / 2; background: var(--border); position: relative; }
.lcard .photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge { position: absolute; top: .6rem; left: .6rem; background: rgba(0,0,0,.65); color: #fff; font-family: 'Space Mono', monospace; font-size: .68rem; padding: .2rem .5rem; border-radius: 999px; backdrop-filter: blur(4px); }
.badge.stars { left: auto; right: .6rem; background: rgba(255,255,255,.85); color: #000; }
.badge.new { top: auto; bottom: .6rem; background: var(--accent); }
.lcard .body { padding: .8rem .9rem .9rem; display: flex; flex-direction: column; gap: .35rem; }
.lcard .title { font-weight: 600; font-size: .92rem; line-height: 1.3; }
.lcard .row { display: flex; justify-content: space-between; gap: .5rem; font-size: .8rem; color: var(--text-secondary); align-items: baseline; }
.lcard .price { font-family: 'Space Mono', monospace; font-weight: 700; color: var(--text); font-size: .95rem; }
.swatch { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; border: 1px solid rgba(0,0,0,.2); vertical-align: -1px; margin-right: .3rem; }
.lcard .note { font-size: .74rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { color: var(--text-secondary); font-size: .85rem; padding: 1rem; grid-column: 1 / -1; }

.chart-card { padding: .9rem 1rem .6rem; }
#chart { width: 100%; height: auto; display: block; }
#chart text { font-family: 'Space Mono', monospace; font-size: 10px; fill: var(--text-secondary); }
#chart .grid { stroke: var(--border); stroke-width: 1; }
#chart .pt { cursor: pointer; }
#chart .pt.fun { fill: var(--fun); }
#chart .pt.boring { fill: var(--boring); }
#chart .pt.unsold { fill: none !important; stroke-width: 1.5; }
#chart .pt.unsold.fun { stroke: var(--fun); }
#chart .pt.unsold.boring { stroke: var(--boring); }
#chart .ring { fill: none; stroke: var(--targa); stroke-width: 2; }
#chart .tip { font-size: 10px; fill: var(--text); }
#chart .tipbg { fill: var(--card-bg); stroke: var(--border); }
.chart-legend { font-family: 'Space Mono', monospace; font-size: .68rem; color: var(--text-secondary); padding-top: .4rem; display: flex; gap: .4rem; flex-wrap: wrap; align-items: center; }
.dot { display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; }
.dot.fun { background: var(--fun); } .dot.boring { background: var(--boring); }
.dot.targa { border: 2px solid var(--targa); } .dot.unsold { border: 1.5px solid var(--boring); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th, td { text-align: left; padding: .55rem .75rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-secondary); font-weight: 500; }
tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-family: 'Space Mono', monospace; white-space: nowrap; }
td a { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--ink-soft); }
td a:hover { border-bottom-color: var(--accent); }
tr.sold td.num.result { font-weight: 700; }
tr.unsold td { color: var(--text-secondary); }
.mono { font-family: 'Space Mono', monospace; font-size: .75rem; white-space: nowrap; }
.footer { font-size: .75rem; color: var(--text-secondary); line-height: 1.5; padding-top: .5rem; }
.footer a { color: inherit; }
@media (max-width: 600px) {
    .stats { grid-template-columns: repeat(2, 1fr); }
    body { padding: 1rem .75rem 2.5rem; }
}

/* filter bar */
.filters { padding: .8rem 1rem; display: flex; flex-direction: column; gap: .5rem; }
.fgroup { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.flabel { font-family: 'Space Mono', monospace; font-size: .68rem; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .06em; width: 4.2rem; flex-shrink: 0; }
.fsel { background: var(--card-bg); border: 1px solid var(--border); color: var(--text); border-radius: 999px; padding: .25rem .6rem; font: inherit; font-size: .78rem; }
.chip.ghost { border-style: dashed; }
.fsummary { font-family: 'Space Mono', monospace; font-size: .72rem; color: var(--text-secondary); padding-top: .2rem; border-top: 1px solid var(--border); }
.fsummary span { color: var(--text); }
.lcard .spec, td .spec { font-family: 'Space Mono', monospace; font-size: .7rem; color: var(--text-secondary); }
td .spec { margin-top: .15rem; }
#chart .trend { fill: none; stroke: var(--text); stroke-width: 1.5; stroke-dasharray: 4 3; opacity: .6; }
.trend-key { display: inline-block; width: 1.2rem; border-top: 2px dashed var(--text); opacity: .6; }
