/* archivesniperbot: a slate data site. Raised panels with coloured header strips, rarity-style
   tiers for deals (green great, blue under typical, red drop, gold ending), dense one-line rows. */
:root {
  --page: #272b30;
  --panel: #33383d;
  --row-hover: #3a3f45;
  --inset: #2b2f34;
  --bar: #3a3f44;
  --ctrl: #3a3f44;
  --ctrl-hi: #52575c;
  --head: #7a8288;
  --line: #2a2e33;
  --edge: #4b5157;
  --text: #e9ecef;
  --soft: #c8cdd2;
  --muted: #aaaaaa;
  --label: #7a8288;
  --blue: #008ec1;
  --green: #00aa4c;
  --red: #d9534f;
  --gold: #e8a317;
  --action: #4a86e8;
  --shadow: 2px 2px 3px 1px rgba(0, 0, 0, 0.28);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Hiragino Sans", "Noto Sans JP", "Noto Sans KR", sans-serif;
  --nav: 58px;
  --top: env(safe-area-inset-top, 0px);
  --bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--page); color: var(--muted); }
body { font: 14.5px/1.4 var(--sans); -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: contain; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
img { display: block; }
h2, h3 { color: var(--text); }
.mono { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.pad { padding: 12px; }
.ico { display: inline-flex; width: 22px; height: 22px; }
.ico svg { width: 100%; height: 100%; }

/* ---------- navbar ---------- */
.navbar {
  position: sticky; top: 0; z-index: 20; background: var(--bar); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  padding-top: var(--top);
}
.navbar-in { max-width: 1120px; margin: 0 auto; height: 56px; padding: 0 14px; display: flex; align-items: center; gap: 8px; }
.brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-weight: 700; font-size: 16.5px; letter-spacing: -0.01em; margin-right: 14px; }
.brand img { width: 28px; height: 28px; border-radius: 6px; }
.nav-top { display: flex; height: 100%; }
.nav-item {
  border: 0; background: none; cursor: pointer; color: var(--muted); display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px; padding: 0 16px; font-size: 12px; position: relative;
}
.nav-item:hover { color: var(--text); }
.nav-item[aria-current="page"] { color: var(--text); }
.nav-item[aria-current="page"]::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 3px; background: var(--blue); border-radius: 2px 2px 0 0; }
.nav-tools { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--label); }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--label); }
.live.on { color: var(--soft); }
.live.on i { background: var(--green); box-shadow: 0 0 0 3px rgba(0, 170, 76, 0.18); }
.live.off i { background: var(--red); }
.icon-btn {
  width: 36px; height: 36px; border: 0; border-radius: 4px; background: none; color: var(--muted); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn .ico { width: 19px; height: 19px; }
.icon-btn:hover { background: rgba(255, 255, 255, 0.07); color: var(--text); }
.icon-btn.spin .ico { animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.nav-bottom { display: none; }

/* ---------- page frame ---------- */
.shell { max-width: 1120px; margin: 0 auto; padding: 14px 14px 32px; min-height: 100vh; }
.page { display: flex; flex-direction: column; gap: 14px; }
.ptr { height: 0; overflow: hidden; display: flex; align-items: center; justify-content: center; color: var(--label); font-size: 12.5px; transition: height 0.2s; }
.ptr.pulling { transition: none; }

/* ---------- panels ---------- */
.panel { background: var(--panel); border-radius: 4px; box-shadow: var(--shadow); overflow: hidden; }
.page > .panel, main > .panel { margin: 0; }
.panel-head {
  display: flex; align-items: center; gap: 10px; min-height: 30px; padding: 4px 12px; background: var(--head); color: #fff;
}
.panel-head h2 { margin: 0; font-size: 14px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-head.blue { background: var(--blue); }
.panel-head.green { background: var(--green); }
.panel-head.red { background: var(--red); }
.head-note { margin-left: auto; font-size: 12px; color: rgba(255, 255, 255, 0.78); white-space: nowrap; }
.head-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.head-right .head-note { margin-left: 0; }

/* ---------- feed controls: labelled blocks ---------- */
.controls { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 14px; align-items: flex-end; }
.control > label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.control.grow { flex: 1; min-width: 200px; }
.seg { display: inline-flex; background: var(--ctrl); border-radius: 4px; box-shadow: var(--shadow); overflow: hidden; }
.seg button { height: 36px; padding: 0 16px; border: 0; background: none; color: var(--soft); cursor: pointer; white-space: nowrap; }
.seg button:hover { background: rgba(255, 255, 255, 0.05); }
.seg button[aria-pressed="true"] { background: var(--ctrl-hi); color: #fff; font-weight: 600; }
.seg.small button { height: 28px; padding: 0 12px; font-size: 13px; }
.ctrl {
  height: 36px; width: 100%; min-width: 160px; border: 0; border-radius: 4px; background: var(--ctrl); color: var(--text);
  padding: 0 10px; box-shadow: var(--shadow); outline: none;
}
.ctrl:focus { box-shadow: var(--shadow), 0 0 0 2px var(--blue); }
.ctrl::placeholder { color: var(--label); }

/* ---------- feed rows: one line each, a tier edge, stats on the right ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid; grid-template-columns: 50px minmax(0, 1fr) 132px 118px; grid-template-areas: "pic main stats side" "details details details details";
  column-gap: 14px; align-items: center; padding: 6px 12px 6px 15px; border-bottom: 1px solid var(--line); position: relative;
}
.row:last-child { border-bottom: 0; }
.row:hover, .row.open { background: var(--row-hover); }
.row::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; }
.row.tier-great::before { background: var(--green); }
.row.tier-deal::before { background: var(--blue); }
.row.tier-drop::before { background: var(--red); }
.row.tier-ending::before { background: var(--gold); }
.row.fresh { animation: flash 4s ease-out; }
@keyframes flash { from { background: rgba(0, 142, 193, 0.28); } to { background: transparent; } }
.pic { grid-area: pic; }
.thumb { width: 50px; height: 50px; border-radius: 4px; object-fit: cover; background: var(--inset); }
.thumb.none { display: flex; align-items: center; justify-content: center; color: var(--label); font-size: 10px; text-align: center; }
.main { grid-area: main; min-width: 0; }
.title { margin: 0; font-size: 14.5px; font-weight: 500; line-height: 1.3; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.main a:hover .title { text-decoration: underline; text-decoration-color: var(--edge); text-underline-offset: 3px; }
.meta { display: flex; align-items: center; gap: 12px; margin-top: 3px; font-size: 12.5px; color: var(--label); white-space: nowrap; min-width: 0; }
.meta .site { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); flex: none; }
.meta .site i { width: 7px; height: 7px; border-radius: 50%; }
.meta .kw { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.note { font-weight: 600; flex: none; }
.note.drop { color: #ff8a85; }
.note.ending { color: var(--gold); }
.stats { grid-area: stats; text-align: right; font-variant-numeric: tabular-nums; }
.price { font-size: 15px; font-weight: 700; color: #fff; white-space: nowrap; }
.approx { font-size: 12px; color: var(--label); white-space: nowrap; }
.side { grid-area: side; display: flex; align-items: center; justify-content: flex-end; gap: 8px; }
.tag { font-size: 11.5px; font-weight: 700; padding: 2px 6px; border-radius: 3px; color: #fff; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tag.great { background: var(--green); }
.tag.deal { background: var(--blue); }
.tag.drop { background: var(--red); }
.tag.ending { background: var(--gold); color: #1f1f1f; }
.age { font-size: 12px; color: var(--label); min-width: 30px; text-align: right; font-variant-numeric: tabular-nums; }
.more { width: 28px; height: 28px; border: 0; border-radius: 4px; background: none; color: var(--muted); cursor: pointer; font-size: 18px; line-height: 1; }
.more:hover, .more[aria-expanded="true"] { background: rgba(255, 255, 255, 0.08); color: var(--text); }
.details { grid-area: details; margin-top: 8px; padding: 10px 12px; background: var(--inset); border-radius: 4px; font-size: 13px; display: flex; flex-direction: column; gap: 8px; }
.deal-line { color: var(--soft); }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.partner a { color: #7fb0ff; font-weight: 600; font-size: 13px; }
.disclose { font-size: 11.5px; color: var(--label); }
.end, .empty { padding: 18px 12px; text-align: center; color: var(--label); font-size: 13px; }

/* newer posts */
.new-pill {
  position: fixed; left: 50%; transform: translateX(-50%); top: calc(var(--top) + 70px); z-index: 15;
  border: 0; border-radius: 999px; padding: 7px 16px; background: var(--action); color: #fff; font-weight: 600; font-size: 13px;
  cursor: pointer; box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

/* ---------- buttons and fields ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 16px; border: 0; border-radius: 4px;
  background: var(--ctrl-hi); color: #fff; font-weight: 600; font-size: 13.5px; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: 0.5; cursor: default; filter: none; }
.btn.primary { background: var(--action); }
.btn.pill { border-radius: 999px; }
.btn.sm { height: 28px; padding: 0 11px; font-size: 12.5px; }
.btn.danger { background: rgba(217, 83, 79, 0.16); color: #ff8a85; }
.text-btn { border: 0; background: none; cursor: pointer; padding: 6px 0; font-weight: 600; color: #7fb0ff; }
.input, .select {
  width: 100%; height: 38px; border: 1px solid var(--edge); border-radius: 4px; background: var(--inset); color: var(--text);
  padding: 0 10px; min-width: 0; outline: none;
}
.input:focus, .select:focus { border-color: var(--blue); }
.input::placeholder { color: var(--label); }
.inline { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline .select { width: auto; flex: none; }
.inline .input { flex: 1; width: auto; }
.field { margin: 0 0 14px; }
.field > label { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 5px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 2px 14px; margin-top: 8px; }
.check { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 13.5px; color: var(--soft); cursor: pointer; }
.check input { accent-color: var(--blue); width: 16px; height: 16px; margin: 0; }
.err { color: #ff8a85; font-size: 12px; margin-top: 2px; }

/* switch */
.switch { appearance: none; -webkit-appearance: none; width: 38px; height: 22px; border-radius: 11px; background: var(--edge); position: relative; cursor: pointer; flex: none; margin: 0; transition: background 0.15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.switch:checked { background: var(--green); }
.switch:checked::after { transform: translateX(16px); }
.switch:disabled { opacity: 0.4; cursor: default; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--soft); cursor: pointer; }

/* ---------- watches ---------- */
.items { }
.item { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.item:last-child { border-bottom: 0; }
.item:hover, .item.open { background: var(--row-hover); }
.item .head { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.item .name { font-weight: 600; color: var(--text); word-break: break-word; }
.item .sub { font-size: 12.5px; color: var(--label); margin-top: 2px; }
.item.paused .name, .item.paused .sub { opacity: 0.5; }
.item .edit { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }

/* key / value rows, status numbers */
.kv { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; color: var(--soft); }
.kvs .kv:last-child, .pad .kv:last-of-type { border-bottom: 0; }
.kv .v { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.site-name i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { padding: 12px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.stat:last-child { border-right: 0; }
.stat-label { font-size: 12px; color: var(--label); }
.stat-value { font-size: 21px; font-weight: 700; color: #fff; font-variant-numeric: tabular-nums; }
.page p { margin: 0 0 10px; }

/* ---------- new-watch form, over the page ---------- */
.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(18, 20, 23, 0.72); overflow: auto; padding: calc(var(--top) + 4vh) 12px calc(var(--bottom) + 24px); }
.sheet .inner { max-width: 560px; margin: 0 auto; background: var(--panel); border-radius: 4px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45); overflow: hidden; }
.sheet .panel-head h2 { flex: 1; font-size: 15px; }

/* ---------- sign-in ---------- */
.signin { max-width: 400px; margin: 0 auto; padding: calc(var(--top) + 14vh) 16px 40px; }
.brand.big { justify-content: center; font-size: 21px; margin: 0 0 16px; }
.brand.big img { width: 36px; height: 36px; }
.signin form { display: flex; flex-direction: column; gap: 10px; }
.signin .code { font: 600 21px ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: 0.14em; text-transform: uppercase; text-align: center; height: 50px; }
.signin p { color: var(--soft); margin: 0 0 14px; }
.signin .how { font-size: 13px; color: var(--muted); margin: 14px 0 0; }
.signin .how b { color: #fff; }
.signin .how a { color: var(--blue); }
.signin .join { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--edge); }
.signin .join-title { color: var(--text); font-weight: 600; margin: 0 0 8px; }
.signin .steps { margin: 0 0 16px; padding-left: 20px; color: var(--soft); font-size: 14px; line-height: 1.6; }
.signin .steps b { color: #fff; }
.btn.discord { display: flex; width: 100%; height: 44px; gap: 10px; background: #5865f2; font-size: 15px; }
.btn.discord svg { width: 22px; height: 22px; }
.center { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; font-size: 13px; }
.spinner { width: 24px; height: 24px; border-radius: 50%; border: 3px solid var(--edge); border-top-color: var(--blue); animation: spin 0.8s linear infinite; }

#toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(12px);
  background: #e9ecef; color: #272b30; padding: 9px 14px; border-radius: 4px; font-size: 13.5px; font-weight: 600; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  opacity: 0; pointer-events: none; transition: opacity 0.18s, transform 0.18s; z-index: 50; max-width: calc(100% - 32px); text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- phones: sections move to a bottom bar, rows wrap to two lines ---------- */
@media (max-width: 720px) {
  .nav-top { display: none; }
  .navbar-in { height: 50px; }
  .brand { font-size: 15.5px; margin-right: 0; }
  .brand img { width: 26px; height: 26px; }
  .nav-bottom {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--bar);
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.3); padding-bottom: var(--bottom);
  }
  .nav-bottom .nav-item { flex: 1; height: var(--nav); font-size: 11.5px; }
  .nav-bottom .nav-item[aria-current="page"]::after { top: 0; bottom: auto; left: 30%; right: 30%; border-radius: 0 0 2px 2px; }
  .shell { padding: 10px 8px calc(var(--nav) + var(--bottom) + 16px); }
  .controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
  .control > label { display: none; }
  .control:first-child { grid-column: 1 / -1; }
  .control:first-child .seg { display: flex; }
  .control:first-child .seg button { flex: 1; padding: 0 8px; }
  .ctrl { min-width: 0; }
  .control.grow { min-width: 0; }
  .row {
    grid-template-columns: 48px minmax(0, 1fr) auto; grid-template-areas: "pic main stats" "pic main side" "details details details";
    column-gap: 10px; row-gap: 2px; padding: 7px 8px 7px 11px;
  }
  .thumb { width: 48px; height: 48px; }
  .title { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 14px; }
  .meta { gap: 8px; }
  .stats { align-self: end; }
  .side { align-self: start; gap: 6px; }
  .price { font-size: 14.5px; }
  .more { width: 24px; height: 22px; font-size: 16px; }
  #toast { bottom: calc(var(--nav) + var(--bottom) + 12px); }
  .new-pill { top: calc(var(--top) + 62px); }
  .stat-value { font-size: 18px; }
}
@media (prefers-reduced-motion: reduce) { .row.fresh { animation: none; } .spinner, .icon-btn.spin .ico { animation-duration: 2s; } }
