/* UpvoteDeals UI: mockup A's light theme (colours, cards, sticky search, chips) on mockup B's feed layout
   (vote column with heat, sort tabs, left category menu, right sidebar). One file, no build step. */
:root {
  --bg: #f7f8fa; --card: #fff; --ink: #0f172a; --ink2: #334155; --muted: #64748b; --faint: #94a3b8;
  --line: #e5e7eb; --line2: #f1f5f9; --soft: #f1f5f9; --blue: #2563eb; --blue-soft: #eff6ff;
  --green: #16a34a; --green-soft: #dcfce7; --orange: #ea580c; --red: #dc2626; --amber: #ca8a04;
  --radius: 16px;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; }
body { font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg);
  color: var(--ink); -webkit-font-smoothing: antialiased; line-height: 1.5; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; background: none; border: 0; color: inherit; }
img { display: block; max-width: 100%; }
[x-cloak] { display: none !important; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- header (A) ---------- */
.site-header { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.bar { max-width: 1280px; margin: auto; display: flex; align-items: center; gap: 24px; padding: 14px 24px; }
.logo { font-weight: 800; font-size: 22px; letter-spacing: -.5px; white-space: nowrap; }
.logo b { color: var(--blue); }
.search { flex: 1; display: flex; align-items: center; gap: 8px; background: var(--soft); border-radius: 12px;
  padding: 0 16px; color: var(--muted); font-size: 14px; border: 1px solid transparent; }
.search:focus-within { background: #fff; border-color: #bfdbfe; box-shadow: 0 0 0 4px rgba(37,99,235,.1); }
.search input { flex: 1; border: 0; background: none; outline: none; font: inherit; color: var(--ink); padding: 11px 0; min-width: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--blue); color: #fff;
  border-radius: 10px; padding: 10px 16px; font-weight: 600; font-size: 14px; white-space: nowrap; }
.btn:hover { background: #1d4ed8; }
.btn-block { display: flex; width: 100%; }
.btn-lg { padding: 13px 20px; font-size: 16px; border-radius: 12px; }
.ghost { color: var(--ink2); font-weight: 600; font-size: 14px; padding: 8px 10px; border-radius: 10px; white-space: nowrap; }
.ghost:hover { background: var(--soft); }
.user-menu { position: relative; }
.user-menu > button { display: flex; align-items: center; gap: 8px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--ink); color: #fff; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; text-transform: uppercase; flex-shrink: 0; }
.avatar.light { background: #e2e8f0; color: var(--ink2); width: 34px; height: 34px; }
.dropdown { position: absolute; right: 0; top: calc(100% + 8px); width: 180px; background: #fff; border: 1px solid var(--line);
  border-radius: 12px; padding: 4px; box-shadow: 0 10px 30px -10px rgba(15,23,42,.25); }
.dropdown a, .dropdown button { display: block; width: 100%; text-align: left; padding: 8px 12px; border-radius: 8px; font-size: 14px; }
.dropdown a:hover, .dropdown button:hover { background: var(--soft); }
.chips { max-width: 1280px; margin: auto; display: flex; gap: 8px; padding: 0 24px 12px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
/* The row scrolls sideways: fade the right edge so a cut-off chip reads as "more this way", not a layout bug.
   The spacer lets the last chip scroll fully out of the fade. */
.chips { mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent); -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 56px), transparent); }
.chips::after { content: ""; flex: 0 0 32px; }
.chips a { padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; color: #475569; background: var(--soft); white-space: nowrap; }
.chips a:hover { background: #e2e8f0; }
.chips a.on { background: var(--ink); color: #fff; }
.flash { max-width: 1280px; margin: 16px auto 0; padding: 0 24px; }
.flash div { background: var(--green-soft); color: #166534; border-radius: 12px; padding: 12px 16px; font-size: 14px; }

/* ---------- three-column layout (B) ---------- */
.layout { max-width: 1280px; margin: auto; padding: 24px; display: grid; grid-template-columns: 210px minmax(0, 1fr) 300px; gap: 28px; align-items: start; }
.layout.two { grid-template-columns: minmax(0, 1fr) 320px; }
.side { position: sticky; top: 132px; }
.side a { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 10px; color: #475569; font-size: 14px; font-weight: 500; }
.side a:hover { background: #fff; color: var(--ink); }
.side a.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--line); }
.side a .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side a .n { margin-left: auto; font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }
.side hr { border: 0; border-top: 1px solid var(--line); margin: 12px 0; }
.side h4 { font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; padding: 0 12px 6px; }

/* ---------- feed ---------- */
.feed-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.tabs { display: flex; gap: 4px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 4px; width: fit-content; }
.tabs a { padding: 7px 14px; border-radius: 9px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tabs a:hover { color: var(--ink); }
.tabs a.on { background: var(--ink); color: #fff; }
.feed-head small { font-size: 13px; color: var(--muted); }
.feed-head small a { color: var(--blue); font-weight: 600; }
.deal { display: grid; grid-template-columns: 56px 96px minmax(0, 1fr); gap: 16px; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px; margin-bottom: 10px; transition: box-shadow .15s, transform .15s; }
.deal:hover { box-shadow: 0 10px 30px -12px rgba(15,23,42,.2); transform: translateY(-1px); }
.thumb { width: 96px; height: 96px; border-radius: 12px; background: #fff; border: 1px solid var(--line2); padding: 6px;
  display: grid; place-items: center; font-size: 40px; position: relative; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb.empty { background: linear-gradient(135deg, #dbeafe, #e0e7ff); border: 0; }
.deal-body { min-width: 0; display: flex; flex-direction: column; }
.badges { display: flex; gap: 6px; margin-bottom: 4px; }
.badge { font-size: 11px; font-weight: 700; border-radius: 6px; padding: 2px 7px; background: #fff7ed; color: var(--orange); }
.badge.green { background: var(--green-soft); color: #15803d; }
.deal-title { font-weight: 600; font-size: 15px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.deal-title a:hover { color: var(--blue); }
.price { margin: 6px 0; display: flex; flex-wrap: wrap; gap: 10px; align-items: baseline; }
.price b { color: var(--green); font-size: 19px; letter-spacing: -.3px; }
.price s { color: var(--faint); font-size: 13px; }
.price em { font-style: normal; font-size: 12px; color: #fff; background: var(--green); font-weight: 700; border-radius: 6px; padding: 1px 6px; }
.price.big b { font-size: 34px; }
.price .ship { color: var(--muted); font-size: 12px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--muted); align-items: center; margin-top: auto; }
.meta .store { color: var(--ink2); background: var(--soft); border-radius: 6px; padding: 2px 8px; font-weight: 600; }
.meta a:hover { color: var(--blue); }
.go { margin-left: auto; background: var(--ink); color: #fff; border-radius: 8px; padding: 6px 12px; font-weight: 600; font-size: 12px; white-space: nowrap; }
.go:hover { background: var(--blue); }
.empty-state { background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); padding: 48px 24px; text-align: center; color: var(--muted); }
.pager { display: flex; justify-content: center; gap: 8px; margin-top: 20px; }
.pager a { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 16px; font-size: 14px; font-weight: 600; }
.pager a:hover { border-color: #bfdbfe; color: var(--blue); }

/* vote column: ▲ score ▼ + heat badge (B), in A's blue */
.vote-col { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.vote { display: flex; flex-direction: column; align-items: center; font-weight: 800; font-size: 15px; font-variant-numeric: tabular-nums; }
.vote :is(button, a) { width: 32px; height: 26px; border-radius: 8px; display: grid; place-items: center; color: var(--faint); font-size: 14px; }
.vote :is(button, a):hover { background: var(--blue-soft); color: var(--blue); }
.vote :is(button, a).dn:hover { background: #fef2f2; color: var(--red); }
.vote :is(button, a).up.on { background: var(--blue-soft); color: var(--blue); }
.vote :is(button, a).dn.on { background: #fef2f2; color: var(--red); }
.vote.big { flex-direction: row; gap: 10px; justify-content: center; font-size: 26px; }
.vote.big button { width: 44px; height: 40px; font-size: 18px; background: var(--soft); }
.heat { font-size: 11px; font-weight: 700; border-radius: 6px; padding: 2px 6px; margin-top: 4px; white-space: nowrap; }
.heat.blazing { background: #fee2e2; color: var(--red); }
.heat.hot { background: #ffedd5; color: var(--orange); }
.heat.warm { background: #fef9c3; color: var(--amber); }
.heat.cool { background: var(--soft); color: var(--muted); }

/* ---------- cards & sidebar (A) ---------- */
.box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.box h3 { font-size: 15px; margin-bottom: 12px; letter-spacing: -.2px; }
.box h3 small { float: right; font-size: 12px; font-weight: 500; color: var(--muted); }
.lb { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; padding: 6px 0; }
.lb span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb b { color: var(--blue); font-variant-numeric: tabular-nums; }
.store-chips a { display: inline-block; background: var(--soft); border-radius: 999px; padding: 5px 11px; font-size: 12px; font-weight: 600; margin: 0 4px 6px 0; color: var(--ink2); }
.store-chips a:hover { background: var(--blue-soft); color: var(--blue); }
.store-chips a i { font-style: normal; color: var(--faint); font-weight: 500; margin-left: 3px; }
.row { display: flex; gap: 10px; align-items: center; padding: 8px 0; font-size: 13px; line-height: 1.35; }
.row + .row { border-top: 1px solid var(--line2); }
.row .e { width: 44px; height: 44px; border-radius: 10px; flex-shrink: 0; display: grid; place-items: center; font-size: 22px; background: var(--soft); overflow: hidden; }
.row .e img { width: 100%; height: 100%; object-fit: contain; background: #fff; padding: 3px; }
.row .t { font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row:hover .t { color: var(--blue); }
.row b { color: var(--green); }
.promo { background: linear-gradient(120deg, #1e3a8a, #2563eb 60%, #38bdf8); color: #fff; border: 0; }
.promo p { opacity: .85; font-size: 13px; margin-bottom: 12px; }
.promo .btn { background: #fff; color: var(--blue); }

/* ---------- thread page ---------- */
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.crumbs a:hover { color: var(--blue); }
.notice { background: #fef9c3; color: #854d0e; border-radius: 12px; padding: 12px 16px; font-size: 14px; margin-bottom: 14px; }
.hero-deal { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; padding: 24px; }
.hero-deal .img { aspect-ratio: 1; border-radius: 12px; border: 1px solid var(--line2); background: #fff; padding: 16px; display: grid; place-items: center; font-size: 72px; }
.hero-deal .img img { width: 100%; height: 100%; object-fit: contain; }
.hero-deal h1 { font-size: 24px; line-height: 1.25; letter-spacing: -.4px; margin: 6px 0 12px; }
.hero-deal .info { display: flex; flex-direction: column; }
.store-line { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.store-line strong { color: var(--ink2); }
.fine { font-size: 12px; color: var(--faint); margin-top: 10px; }
.prose { white-space: pre-line; color: var(--ink2); line-height: 1.65; font-size: 15px; }
.comment { display: flex; gap: 12px; padding: 12px 0; }
.comment + .comment { border-top: 1px solid var(--line2); }
.comment p { font-size: 14px; }
.comment .body { white-space: pre-line; margin-top: 2px; line-height: 1.55; }
textarea, .field input, .field select, .field textarea { width: 100%; border: 1px solid #e2e8f0; border-radius: 10px; padding: 10px 12px;
  font: inherit; font-size: 14px; background: #fff; outline: none; color: var(--ink); }
textarea:focus, .field input:focus, .field select:focus, .field textarea:focus { border-color: #93c5fd; box-shadow: 0 0 0 4px rgba(37,99,235,.1); }
.form-actions { display: flex; justify-content: flex-end; margin-top: 10px; }
.coupon { display: inline-flex; align-items: center; gap: 8px; border: 1px dashed #fb923c; background: #fff7ed; color: #c2410c;
  border-radius: 8px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; padding: 3px 9px; width: fit-content; }
.coupon span + span { font-family: Inter, ui-sans-serif, system-ui, sans-serif; color: #fb923c; }
.coupon.big { font-size: 15px; padding: 7px 14px; }

/* ---------- forms & simple pages ---------- */
.narrow { max-width: 420px; margin: 0 auto; padding: 48px 24px; }
.mid { max-width: 680px; margin: 0 auto; padding: 32px 24px; }
.page-title { font-size: 26px; letter-spacing: -.5px; }
.center { text-align: center; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.field .help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.field .help ul { padding-left: 18px; }
.err { font-size: 12px; color: var(--red); margin-top: 4px; }
.err-box { background: #fef2f2; color: #b91c1c; border-radius: 10px; padding: 10px 14px; font-size: 14px; margin-bottom: 16px; }
.link { color: var(--blue); font-weight: 600; }
.link:hover { text-decoration: underline; }
.prose-page { line-height: 1.65; }
.prose-page h2 { font-size: 18px; margin: 24px 0 6px; }
.prose-page p, .prose-page li { margin: 8px 0; }
.prose-page ul { padding-left: 20px; }
.footer-links { margin-top: 8px; }
.footer-links a { color: inherit; }
.site-footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 28px 24px; text-align: center; font-size: 12px; color: var(--muted); }

/* ---------- responsive: drop the right rail, then the left menu, then compact rows ---------- */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 200px minmax(0, 1fr); }
  .layout > .rail { display: none; }
  .layout.two { grid-template-columns: minmax(0, 1fr); }
  .layout.two > .rail { display: block; }
}
@media (max-width: 820px) {
  .layout { grid-template-columns: minmax(0, 1fr); padding: 16px; gap: 16px; }
  .layout > .side { display: none; }
  .bar { gap: 12px; padding: 12px 16px; flex-wrap: wrap; }
  .search { order: 3; flex-basis: 100%; }
  .bar .push { margin-left: auto; }
  .chips { padding: 0 16px 10px; }
  .hide-sm { display: none; }
  .hero-deal { grid-template-columns: 1fr; padding: 16px; }
  .hero-deal .img { max-width: 260px; width: 100%; margin: auto; }
}
@media (max-width: 560px) {
  .deal { grid-template-columns: 40px 72px minmax(0, 1fr); gap: 12px; padding: 12px; }
  .thumb { width: 72px; height: 72px; }
  .deal-title { font-size: 14px; }
  .vote :is(button, a) { width: 28px; }
  .tabs { width: 100%; }
  .tabs a { flex: 1; text-align: center; padding: 7px 6px; }
  .go { margin-left: 0; }
}
.store-chips a.on { background: var(--blue); color: #fff; }
.store-chips a.on i { color: #bfdbfe; }
