:root {
  --bg: #110d0a; --panel: #1a1410; --card: #1d1611; --card2: #221a14; --line: rgba(255,229,196,.12); --line2: rgba(255,229,196,.22);
  --text: #f6eee4; --muted: #c2b19c; --soft: #d9c9b4; --amber: #e7a94b; --amber2: #f3c37a; --ink: #1a1205;
  --ok: #8fdcb4; --warn: #f0c85f; --bad: #f5a192;
  --radius: 14px; --display: 'Fraunces', Georgia, serif; --body: 'Figtree', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); font-size: 16px; -webkit-text-size-adjust: 100%; }
a { color: var(--amber); text-decoration: none; } a:hover { color: var(--amber2); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--amber2); outline-offset: 2px; }
.muted { color: var(--muted); } .soft { color: var(--soft); } .ok { color: var(--ok); } .warn { color: var(--warn); } .bad { color: var(--bad); } .amber { color: var(--amber2); }
h1, h2, h3 { margin: 0; }
.display { font-family: var(--display); font-weight: 600; }

/* Shell */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: clamp(16px, 2.4vw, 48px); padding: 0 clamp(16px, 2.2vw, 56px); height: 72px; background: #15100c; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 12px; font-family: var(--display); font-weight: 600; font-size: 24px; color: var(--text); }
.topnav { display: flex; gap: 6px; }
.topnav a { padding: 10px 16px; border-radius: 10px; color: var(--muted); font-weight: 500; }
.topnav a.on { background: rgba(231,169,75,.16); color: var(--text); font-weight: 600; }
.topmeta { margin-left: auto; display: flex; gap: 20px; align-items: center; color: var(--muted); font-size: 15px; }
.pill { padding: 8px 14px; border-radius: 10px; border: 1px solid rgba(231,169,75,.4); color: var(--amber2); font-weight: 600; white-space: nowrap; }
.bottomnav { display: none; }
main { padding: clamp(16px, 2vw, 48px) clamp(16px, 2.2vw, 56px) 48px; }

/* Auction layout */
.auction { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: clamp(24px, 2vw, 40px); }
.auction.has-rail { grid-template-columns: 300px minmax(0, 1fr) 460px; }
.filters { display: flex; flex-direction: column; gap: 24px; position: sticky; top: 104px; align-self: start; max-height: calc(100vh - 128px); overflow: auto; padding-bottom: 12px; }
.filters h3 { font-size: 14px; color: var(--muted); font-weight: 500; margin-bottom: 10px; }
.search { width: 100%; height: 48px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line2); background: var(--card); color: var(--text); font-size: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line2); background: transparent; color: var(--text); font-size: 15px; }
.chip.on { background: var(--amber); border-color: var(--amber); color: var(--ink); font-weight: 600; }
.check { display: flex; align-items: center; gap: 12px; min-height: 40px; font-size: 16px; }
.check input { width: 22px; height: 22px; accent-color: var(--amber); }
.select { width: 100%; height: 44px; border-radius: 12px; border: 1px solid var(--line2); background: var(--card); padding: 0 12px; }
.range-row { display: flex; gap: 10px; }
.range-row input { width: 100%; height: 44px; border-radius: 12px; border: 1px solid var(--line2); background: var(--card); padding: 0 12px; }
.note { padding: 16px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); font-size: 14px; line-height: 1.5; color: var(--muted); }

.results-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.results-head h1 { font-family: var(--display); font-size: clamp(26px, 2vw, 40px); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: clamp(16px, 1.2vw, 28px); }

.card { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); color: var(--text); }
.card:hover { border-color: rgba(231,169,75,.45); color: var(--text); }
.card.dim { opacity: .55; }
.card-top { display: flex; gap: 16px; }
.photo { flex-shrink: 0; width: 120px; height: 140px; border-radius: 12px; background: #fff; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.photo img { width: 100%; height: 100%; object-fit: contain; }
.card h2 { font-size: 17px; font-weight: 600; line-height: 1.3; }
.card .meta { font-size: 14px; color: var(--muted); margin-top: 6px; }
.card .cask { font-size: 14px; color: var(--soft); margin-top: 4px; line-height: 1.35; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 4px 9px; border-radius: 8px; font-size: 13px; font-weight: 600; background: rgba(231,169,75,.16); color: var(--amber2); }
.tag.ok { background: rgba(111,207,159,.14); color: var(--ok); } .tag.warn { background: rgba(240,200,95,.14); color: var(--warn); } .tag.bad { background: rgba(240,132,112,.14); color: var(--bad); }
.card-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); margin-top: auto; }
.k { font-size: 13px; color: var(--muted); } .v { font-size: 22px; font-weight: 700; } .v.sm { font-size: 16px; }
.right { text-align: right; }
.more { margin: 28px auto 0; display: block; height: 48px; padding: 0 28px; border-radius: 12px; border: 1px solid var(--line2); background: transparent; color: var(--text); }

/* Rail */
.rail { position: sticky; top: 104px; align-self: start; display: flex; flex-direction: column; gap: 14px; padding: 22px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); max-height: calc(100vh - 128px); overflow: auto; }
.rail h2 { font-family: var(--display); font-size: 26px; }
.sl-item { padding: 14px; border-radius: 12px; background: var(--card2); display: flex; flex-direction: column; gap: 8px; color: var(--text); }
.sl-row { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.bar { height: 7px; border-radius: 4px; background: #33281f; overflow: hidden; } .bar > i { display: block; height: 100%; border-radius: 4px; background: var(--amber); }

/* Lot detail */
.back { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; margin-bottom: 12px; }
.lot { display: grid; grid-template-columns: minmax(320px, 520px) minmax(0, 1fr) minmax(320px, 560px); gap: clamp(24px, 2vw, 48px); }
.gallery .main-photo { border-radius: 20px; background: #fff; overflow: hidden; aspect-ratio: 1 / 1; }
.gallery .main-photo img { width: 100%; height: 100%; object-fit: contain; }
.thumbs { display: flex; gap: 10px; margin-top: 12px; }
.thumbs button { width: 80px; height: 80px; padding: 0; border-radius: 12px; border: 2px solid transparent; background: #fff; overflow: hidden; }
.thumbs button.on { border-color: var(--amber); }
.thumbs img { width: 100%; height: 100%; object-fit: contain; }
.specs { display: grid; grid-template-columns: 150px minmax(0, 1fr); row-gap: 10px; margin: 20px 0 0; font-size: 16px; }
.specs dt { color: var(--muted); } .specs dd { margin: 0; }
.lot h1 { font-family: var(--display); font-size: clamp(28px, 2.4vw, 48px); line-height: 1.15; margin-bottom: 20px; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { padding: 18px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; }
.stat.hi { background: rgba(231,169,75,.12); border-color: rgba(231,169,75,.45); }
.stat .v { font-size: clamp(22px, 2vw, 34px); }
.panel { padding: 22px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.panel h2 { font-size: 21px; font-weight: 600; }
.prow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 15px; }
.prow:first-of-type { border-top: 0; }
.prow .src { font-weight: 600; } .prow .sub { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
.callout { padding: 14px 16px; border-radius: 12px; background: rgba(240,200,95,.1); line-height: 1.5; }
.callout.ok { background: rgba(111,207,159,.1); }
.desc { font-size: 15px; line-height: 1.6; color: var(--soft); white-space: pre-line; }
.field { display: flex; flex-direction: column; gap: 8px; color: var(--muted); font-size: 15px; }
.field input, .field textarea { min-height: 52px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line2); background: var(--card); color: var(--text); font-size: 20px; font-weight: 700; }
.field textarea { padding: 12px 16px; font-size: 16px; font-weight: 400; min-height: 90px; }
.btns { display: flex; gap: 12px; flex-wrap: wrap; }
.btn { flex: 1 1 180px; min-height: 52px; padding: 0 18px; border-radius: 12px; border: 0; background: var(--amber); color: var(--ink); font-weight: 700; font-size: 17px; display: inline-flex; align-items: center; justify-content: center; }
.btn.ghost { background: transparent; border: 1px solid rgba(231,169,75,.5); color: var(--amber); font-weight: 600; }
.btn.small { flex: 0 0 auto; min-height: 44px; font-size: 15px; }

/* Palate */
.palate { display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 720px); gap: clamp(24px, 2vw, 48px); }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.pick { padding: 22px; border-radius: 16px; border: 1px solid var(--line2); background: var(--card2); color: var(--text); text-align: left; font-size: 19px; font-weight: 700; min-height: 110px; }
.scores { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.scores button, .tagpick button { min-height: 48px; border-radius: 12px; border: 1px solid var(--line2); background: var(--card2); color: var(--text); font-weight: 600; }
.scores button.on, .tagpick button.on { background: var(--amber); color: var(--ink); border-color: var(--amber); }
.tagpick { display: flex; flex-wrap: wrap; gap: 8px; } .tagpick button { padding: 0 14px; font-weight: 500; min-height: 40px; border-radius: 999px; }
.log-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }

.empty, .loading { padding: 48px 0; text-align: center; color: var(--muted); }
.signin { max-width: 440px; margin: 12vh auto; text-align: center; display: flex; flex-direction: column; gap: 18px; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: #2b2119; border: 1px solid var(--line2); padding: 12px 18px; border-radius: 12px; z-index: 50; }

/* Big screens: keep lines readable, use the width for more cards, not wider ones. */
@media (min-width: 2200px) { html, body { font-size: 17px; } .grid { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); } }

/* Tablet / narrow desktop */
@media (max-width: 1500px) { .auction.has-rail { grid-template-columns: 280px minmax(0, 1fr); } .rail { display: none; } .lot { grid-template-columns: minmax(280px, 420px) minmax(0, 1fr); } .lot .side { grid-column: 1 / -1; } }

/* Phone */
@media (max-width: 860px) {
  .topbar { height: 60px; } .topnav, .topmeta .hide-sm { display: none; } .brand { font-size: 21px; }
  main { padding: 14px 16px 104px; }
  .auction, .auction.has-rail { grid-template-columns: 1fr; }
  .filters { position: static; max-height: none; gap: 14px; }
  .filters .adv { display: none; } .filters.open .adv { display: flex; flex-direction: column; gap: 14px; }
  .chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .chip { flex-shrink: 0; }
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .photo { width: 84px; height: 104px; }
  .card { padding: 12px; } .card h2 { font-size: 15.5px; } .v { font-size: 19px; }
  .lot, .palate { grid-template-columns: 1fr; }
  .gallery .main-photo { aspect-ratio: 4 / 3; }
  .stats { gap: 8px; } .stat { padding: 12px; }
  .pair { grid-template-columns: 1fr; }
  .bottomnav { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(68px + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: #15100c; border-top: 1px solid var(--line); }
  .bottomnav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 12px; color: var(--muted); }
  .bottomnav a.on { color: var(--amber); font-weight: 600; }
}

/* A .btn directly in a column panel must not grow (flex-basis would become its height). */
.panel > .btn { flex: none; }
@media (max-width: 860px) { .lot > section:nth-child(2) { order: -1; } .gallery .main-photo { aspect-ratio: 16 / 10; } .specs { grid-template-columns: 110px minmax(0, 1fr); } }

/* My bids */
.mybids { max-width: 1400px; margin: 0 auto; display: flex; flex-direction: column; gap: 28px; }
.mybids-head { display: flex; flex-direction: column; gap: 16px; }
.mybids-head h1 { font-size: clamp(28px, 2.4vw, 44px); }
.mybids .stats { margin: 0; }
.bidsec { display: flex; flex-direction: column; gap: 12px; }
.bidsec h2 { font-size: 20px; font-weight: 600; }
.bidrow { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 16px; padding: 16px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); }
.bidrow .photo { width: 96px; height: 112px; }
.bidrow.compact { grid-template-columns: 56px minmax(0, 1fr); padding: 12px; gap: 12px; background: var(--card2); }
.bidrow.compact .photo { width: 56px; height: 68px; }
.bidrow-main { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.bidrow-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.bidrow-name { color: var(--text); font-weight: 600; font-size: 16px; line-height: 1.3; }
.bidrow.compact .bidrow-name { font-size: 14px; }
.bidrow-top .tag { flex-shrink: 0; }
.bidrow-nums { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px 16px; }
.bidrow-nums > div { display: flex; flex-direction: column; gap: 2px; }
.bidrow-nums strong { font-size: 17px; }
.bidrow.compact .bidrow-nums strong { font-size: 14px; }
.bidrow .btns .btn { flex: 0 0 auto; }
.sumline { display: flex; gap: 14px; font-weight: 600; font-size: 15px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 4px; border-radius: 12px; background: var(--card); border: 1px solid var(--line); }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 44px; padding: 4px 8px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg input:checked + span { background: var(--amber); color: var(--ink); }
.seg input:focus-visible + span { outline: 2px solid var(--amber2); outline-offset: 2px; }
@media (max-width: 860px) { .mybids .stats { grid-template-columns: 1fr 1fr 1fr; } .bidrow { grid-template-columns: 72px minmax(0, 1fr); padding: 12px; } .bidrow .photo { width: 72px; height: 88px; } .bidrow-nums { grid-template-columns: repeat(3, 1fr); } }

/* My-bids drawer (replaces the always-open side rail) */
.bids-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line2); background: transparent; color: var(--text); font-weight: 600; font-size: 15px; white-space: nowrap; }
.bids-btn:hover, .bids-btn[aria-expanded="true"] { border-color: var(--amber); }
.bids-btn .count { padding: 2px 8px; border-radius: 999px; background: rgba(231,169,75,.18); color: var(--amber2); font-size: 13px; }
.bids-btn .count.bad { background: rgba(240,132,112,.2); color: var(--bad); }
.bids-btn.alert { border-color: rgba(240,132,112,.6); }
.drawer { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,0); transition: background .2s; }
.drawer.open { background: rgba(0,0,0,.45); }
.drawer-panel { position: absolute; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); overflow: auto; display: flex; flex-direction: column; gap: 14px; padding: 24px; background: var(--panel); border-left: 1px solid var(--line); transform: translateX(100%); transition: transform .2s ease; }
.drawer.open .drawer-panel { transform: none; }
.drawer-panel h2 { font-family: var(--display); font-size: 26px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--amber); font: inherit; font-weight: 600; min-height: 32px; }
@media (prefers-reduced-motion: reduce) { .drawer, .drawer-panel { transition: none; } }
@media (max-width: 860px) { .bids-btn { display: none; } }
