:root{
  --bg:#0e0f12; --bg2:#15171c; --card:#181b21; --card2:#1e222a;
  --line:#262b34; --txt:#eef1f6; --muted:#9aa3b2; --muted2:#6b7382;
  --gold:#d7b46a; --gold-soft:#3a3320;
  --good:#4ec98a; --warn:#e0a54a; --bad:#e06a5a;
  --r:16px; --safe-t:env(safe-area-inset-top); --safe-b:env(safe-area-inset-bottom);
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%;overflow-x:clip}
body{
  background:var(--bg); color:var(--txt);
  font:15px/1.4 -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  padding-bottom:calc(24px + var(--safe-b));
}
.topbar{
  position:sticky; top:0; z-index:20; display:flex; align-items:center; gap:10px;
  padding:calc(10px + var(--safe-t)) 14px 10px; background:rgba(14,15,18,.86);
  backdrop-filter:saturate(140%) blur(12px); border-bottom:1px solid var(--line);
}
.brand{font-weight:700; letter-spacing:.2px; display:flex; align-items:center; gap:8px}
.brand .dot{width:9px;height:9px;border-radius:50%;background:var(--gold);box-shadow:0 0 10px var(--gold)}
.spot{flex:1; font-size:11.5px; color:var(--muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.icon-btn{
  width:38px;height:38px;border-radius:12px;border:1px solid var(--line);
  background:var(--card); color:var(--txt); font-size:18px; line-height:1; cursor:pointer;
}
.icon-btn:active{transform:scale(.94)}
.tabs{display:flex; gap:8px; padding:12px 14px 4px; overflow-x:auto; scrollbar-width:none}
.tabs::-webkit-scrollbar{display:none}
.tabs button{
  flex:0 0 auto; padding:8px 14px; border-radius:999px; border:1px solid var(--line);
  background:var(--card); color:var(--muted); font-weight:600; font-size:13.5px; cursor:pointer;
}
.tabs button.active{background:var(--gold); color:#1a1710; border-color:var(--gold)}
.controls{display:flex; align-items:center; gap:12px; padding:8px 14px 4px}
.minlbl{flex:1; display:flex; align-items:center; gap:10px; font-size:12.5px; color:var(--muted)}
.minlbl b{color:var(--gold); min-width:14px}
input[type=range]{flex:1; accent-color:var(--gold); height:24px}
#sort{background:var(--card); color:var(--txt); border:1px solid var(--line); border-radius:10px; padding:7px 10px; font-size:13px}
.list{padding:10px 12px; display:flex; flex-direction:column; gap:12px; max-width:720px; margin:0 auto}
.empty{color:var(--muted2); text-align:center; padding:60px 0}

.card{
  position:relative; display:flex; gap:12px; padding:10px; background:var(--card);
  border:1px solid var(--line); border-radius:var(--r); overflow:hidden;
  transition:transform .18s ease, opacity .18s ease;
}
.card.swipe{transform:translateX(-110%); opacity:0}
.thumb{
  width:96px;height:96px;flex:0 0 96px;border-radius:12px;object-fit:cover;background:var(--card2);
}
.thumb.ph{display:flex;align-items:center;justify-content:center;font-size:30px;color:var(--muted2)}
.body{flex:1; min-width:0; display:flex; flex-direction:column; gap:5px}
.row1{display:flex; align-items:flex-start; gap:8px}
.title{font-weight:600; font-size:14px; line-height:1.25; max-height:2.5em; overflow:hidden;
  display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical}
.score{
  flex:0 0 auto; width:42px;height:42px;border-radius:12px; display:flex;flex-direction:column;
  align-items:center;justify-content:center; font-weight:800; font-size:16px; line-height:1;
  border:1px solid var(--line); background:var(--card2);
}
.score small{font-size:8px;font-weight:600;color:var(--muted2);margin-top:1px}
.s-hot{background:linear-gradient(0deg,#2a2413,#332b16); border-color:var(--gold); color:var(--gold)}
.s-good{color:var(--good); border-color:#245c40}
.s-mid{color:var(--warn)}
.s-low{color:var(--muted2)}
.meta{display:flex; flex-wrap:wrap; gap:6px 10px; font-size:12px; color:var(--muted)}
.price{color:var(--txt); font-weight:700; font-size:14px}
.chip{font-size:11px; padding:2px 7px; border-radius:7px; background:var(--card2); border:1px solid var(--line); color:var(--muted)}
.chip.disc{color:var(--good); border-color:#245c40}
.chip.prem{color:var(--warn)}
.chip.near{color:var(--gold); border-color:#4a3f22}
.calc{font-size:11.5px; color:var(--muted2); overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.actions{display:flex; gap:8px; margin-top:6px}
.actions a,.actions button{
  flex:1; text-align:center; padding:8px; border-radius:10px; border:1px solid var(--line);
  background:var(--card2); color:var(--txt); font-size:12.5px; font-weight:600; text-decoration:none; cursor:pointer;
}
.actions .open{background:var(--gold); color:#1a1710; border-color:var(--gold)}
.actions .save.on{color:var(--gold); border-color:var(--gold)}

/* Sheets */
[hidden]{display:none !important}
.sheet-backdrop{position:fixed; inset:0; z-index:50; background:rgba(0,0,0,.55); display:flex; align-items:flex-end; justify-content:center}
.sheet{width:100%; max-width:560px; max-height:90vh; overflow:auto; background:var(--bg2);
  border-radius:20px 20px 0 0; border:1px solid var(--line); border-bottom:none;
  padding-bottom:calc(16px + var(--safe-b)); animation:up .22s ease}
@keyframes up{from{transform:translateY(40px);opacity:.6}to{transform:none;opacity:1}}
.sheet-head{position:sticky;top:0;background:var(--bg2);display:flex;align-items:center;justify-content:space-between;
  padding:16px 16px 10px;border-bottom:1px solid var(--line)}
.sheet-head h3{margin:0;font-size:16px}
.sheet-body{padding:14px 16px}
.sheet-body label{display:block; font-size:12.5px; color:var(--muted); margin:12px 0 0}
.sheet-body label.row{display:flex;align-items:center;gap:8px;margin-top:14px;color:var(--txt)}
.sheet-body input[type=text]{width:100%; margin-top:6px; padding:11px 12px; border-radius:10px;
  border:1px solid var(--line); background:var(--card); color:var(--txt); font-size:16px}
.btnrow{display:flex; gap:10px; margin-top:16px}
.btnrow button{flex:1; padding:11px; border-radius:11px; border:1px solid var(--line); background:var(--card2); color:var(--txt); font-weight:600; font-size:14px; cursor:pointer}
.btnrow .primary{background:var(--gold); color:#1a1710; border-color:var(--gold)}
.muted{color:var(--muted); font-size:12.5px}
.tgstatus{font-size:12.5px; margin-top:10px; min-height:16px}
.tgstatus.ok{color:var(--good)} .tgstatus.err{color:var(--bad)}
.help{margin-top:16px; font-size:12.5px; color:var(--muted)}
.help summary{cursor:pointer; color:var(--gold)}
.help ol{padding-left:18px; line-height:1.6} .help code{background:var(--card);padding:1px 5px;border-radius:5px}
hr{border:none;border-top:1px solid var(--line);margin:16px 0}
.statusgrid{display:grid;grid-template-columns:1fr 1fr;gap:8px;font-size:12px;color:var(--muted)}
.statusgrid div{background:var(--card);border:1px solid var(--line);border-radius:10px;padding:8px 10px}
.statusgrid b{color:var(--txt);display:block;font-size:13px}
.dbig{display:flex;gap:12px;flex-wrap:wrap}
.detail-img{width:100%;border-radius:12px;margin-top:10px;background:var(--card)}
.kv{display:flex;justify-content:space-between;gap:12px;padding:8px 0;border-bottom:1px solid var(--line);font-size:13px}
.kv span:first-child{color:var(--muted)}
.desc{white-space:pre-wrap;color:var(--muted);font-size:13px;margin-top:10px;max-height:40vh;overflow:auto}
.toast{position:fixed;left:50%;bottom:calc(20px + var(--safe-b));transform:translateX(-50%);z-index:80;
  background:var(--card2);border:1px solid var(--line);color:var(--txt);padding:10px 16px;border-radius:12px;font-size:13px;box-shadow:0 8px 30px rgba(0,0,0,.4)}
