/* WineGrade — burgundy / ivory, serif wordmark, mobile-first */
:root {
  --wine: #7a1131;
  --wine-deep: #5a0b23;
  --wine-soft: #f6e9ec;
  --gold: #c9a24a;
  --ivory: #faf6f0;
  --paper: #ffffff;
  --ink: #2a1b1d;
  --muted: #7a6b6e;
  --line: #e9dcd9;
  --ok: #2f7a45;
  --ok-bg: #e6f4ea;
  --warn: #a2761f;
  --bad: #9c3a32;
  --radius: 16px;
  --serif: Georgia, 'Times New Roman', 'Noto Serif', serif;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ivory); color: var(--ink); font-family: var(--sans); -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { opacity: .5; cursor: not-allowed; }
h1, h2, h3 { font-family: var(--serif); color: var(--wine); margin: 0; font-weight: 700; }
[hidden] { display: none !important; }

#app { max-width: 520px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.screen { display: flex; flex-direction: column; flex: 1; padding: 0 18px 24px; }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 60px; }
.topbar h2 { font-size: 20px; flex: 1; text-align: center; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--wine); }
.brand-icon { width: 34px; height: 34px; }
.wordmark { font-family: var(--serif); font-size: 24px; font-weight: 700; letter-spacing: -.5px; }
.wordmark .tld { font-size: 14px; font-weight: 400; color: #9b6b74; }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--wine); font-size: 24px; text-decoration: none; }
.icon-btn:hover { background: var(--wine-soft); }

/* Home */
.hero { padding: 18px 0 10px; }
.eyebrow { font-size: 11px; letter-spacing: 2.4px; color: #9b5669; font-weight: 600; }
.hero h1 { font-size: 34px; line-height: 1.12; margin: 10px 0 10px; }
.hero p { color: var(--muted); line-height: 1.55; margin: 0; }
.options { display: grid; gap: 12px; margin-top: 22px; }
.option { display: flex; align-items: center; gap: 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; text-align: left; box-shadow: 0 6px 20px rgba(90,11,35,.06); }
.option:hover { border-color: var(--wine); }
.option-icon { width: 46px; height: 46px; border-radius: 50%; background: var(--wine); color: #fff; display: grid; place-items: center; font-size: 20px; flex: none; }
.option-pro .option-icon { background: #d9cfd1; color: #8a6c73; }
.option-text { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.option-text strong { font-size: 17px; }
.option-text small { color: var(--muted); font-size: 13px; }
.chev { color: var(--wine); font-size: 26px; }
.home-art { flex: 1; min-height: 90px; margin: 24px -18px 0; background: linear-gradient(180deg, rgba(250,246,240,0) 0%, rgba(122,17,49,.10) 100%); }
.fineprint { font-size: 11.5px; color: var(--muted); line-height: 1.5; margin: 14px 0 0; }

/* Scan */
.screen.dark { background: #1d1416; color: #f3eceb; margin: 0 -0px; }
.screen.dark .topbar h2, .screen.dark .icon-btn { color: #f3eceb; }
.scan-stage { flex: 1; display: flex; flex-direction: column; }
.scan-frame { position: relative; flex: 1; min-height: 320px; border-radius: 18px; background: #2a1e21; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.corner { position: absolute; width: 28px; height: 28px; border: 3px solid #fff; opacity: .9; }
.corner.tl { top: 14px; left: 14px; border-right: 0; border-bottom: 0; border-radius: 6px 0 0 0; }
.corner.tr { top: 14px; right: 14px; border-left: 0; border-bottom: 0; border-radius: 0 6px 0 0; }
.corner.bl { bottom: 14px; left: 14px; border-right: 0; border-top: 0; border-radius: 0 0 0 6px; }
.corner.br { bottom: 14px; right: 14px; border-left: 0; border-top: 0; border-radius: 0 0 6px 0; }
.scan-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; color: #d8cccd; padding: 20px; }
.scan-glyph { font-size: 44px; color: #fff; }
.scan-empty strong { color: #fff; }
.scan-empty span:last-child { font-size: 13px; }
.previews { position: absolute; inset: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 24px; }
.previews:empty { display: none; }
.preview { position: relative; border-radius: 10px; overflow: hidden; background: #000; min-height: 120px; }
.preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview button { position: absolute; top: 6px; right: 6px; width: 28px; height: 28px; border-radius: 50%; background: rgba(0,0,0,.65); color: #fff; font-size: 18px; }
.scan-help { color: #d8cccd; font-size: 13px; line-height: 1.5; margin: 10px 4px 0; }
.scan-controls { display: flex; align-items: center; justify-content: space-between; padding: 16px 28px 8px; }
.ctrl-btn { width: 44px; height: 44px; display: grid; place-items: center; color: #fff; font-size: 22px; cursor: pointer; border-radius: 50%; background: rgba(255,255,255,.08); }
.shutter { width: 70px; height: 70px; border-radius: 50%; border: 4px solid #fff; display: grid; place-items: center; cursor: pointer; }
.shutter span { width: 52px; height: 52px; border-radius: 50%; background: #fff; }
.segmented { display: flex; background: rgba(255,255,255,.12); border-radius: 999px; padding: 4px; margin: 8px 0; }
.screen:not(.dark) .segmented { background: #eadfdc; }
.seg { flex: 1; border-radius: 999px; padding: 10px 8px; font-weight: 600; font-size: 14px; color: inherit; }
.seg.active { background: var(--wine); color: #fff; }
.screen:not(.dark) .seg { color: var(--wine); }
.screen:not(.dark) .seg.active { color: #fff; }
.prefs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; background: rgba(255,255,255,.07); border-radius: 12px; padding: 12px; margin: 6px 0; }
.prefs label { font-size: 12px; color: #d8cccd; display: flex; flex-direction: column; gap: 4px; }
.prefs input, .prefs select { background: #fff; color: var(--ink); border: 0; border-radius: 8px; padding: 9px 10px; min-width: 0; }
.scan-footer { padding-top: 10px; }

/* Buttons */
.primary { width: 100%; background: var(--wine); color: #fff; border-radius: 14px; padding: 16px; font-weight: 700; font-size: 16px; box-shadow: 0 8px 20px rgba(122,17,49,.25); }
.primary:not(:disabled):hover { background: var(--wine-deep); }
.ghost { width: 100%; background: var(--paper); color: var(--wine); border: 1px solid var(--line); border-radius: 14px; padding: 14px; font-weight: 600; }
.text-btn { color: var(--wine); font-weight: 600; padding: 10px; width: 100%; }
.error { background: #fdeceb; color: var(--bad); border-radius: 10px; padding: 10px 12px; font-size: 13.5px; margin-bottom: 10px; line-height: 1.45; }
.notice { background: #fff6ea; border-left: 3px solid var(--gold); color: #6a4c2a; padding: 10px 12px; border-radius: 6px; font-size: 13px; line-height: 1.5; margin: 8px 0 12px; }
.lead { color: var(--muted); line-height: 1.5; margin: 4px 0 12px; }

/* Review */
.review-list { display: grid; gap: 12px; }
.wine-row { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; grid-template-columns: 28px 1fr auto; gap: 8px 10px; align-items: start; }
.wine-row.unselected { opacity: .55; }
.wine-row input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--wine); margin-top: 10px; }
.wine-row .fields { display: grid; gap: 8px; min-width: 0; }
.wine-row .name { font-weight: 700; font-size: 15px; }
.wine-row input:not([type=checkbox]), .wine-row select { width: 100%; border: 1px solid var(--line); border-radius: 9px; padding: 9px 10px; background: #fff; min-width: 0; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row-3 { display: grid; grid-template-columns: 1.1fr 1fr 1fr; gap: 8px; }
.field { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .3px; }
.wine-row .more { min-width: 0; }
.wine-row details summary { font-size: 12.5px; color: var(--wine); cursor: pointer; font-weight: 600; margin: 2px 0 6px; }
.wine-row .note { grid-column: 2 / 4; font-size: 12px; color: var(--warn); margin: 0; }
.wine-row .del { color: var(--bad); font-size: 20px; width: 32px; height: 32px; border-radius: 50%; }
.lowread { border-color: #f0d6a7; }
.sticky-footer { position: sticky; bottom: 0; background: linear-gradient(180deg, rgba(250,246,240,0), var(--ivory) 30%); padding: 16px 0 8px; margin-top: 12px; }

/* Report */
.report-list { display: grid; gap: 12px; }
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 14px; }
.card.best { border-color: var(--gold); box-shadow: 0 8px 24px rgba(201,162,74,.18); }
.card-head { display: flex; gap: 12px; align-items: flex-start; }
.rank { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: #efe6e4; color: var(--muted); display: inline-block; margin-bottom: 6px; }
.rank.best { background: var(--gold); color: #fff; }
.card-title { flex: 1; min-width: 0; }
.card-title h3 { font-size: 17px; line-height: 1.25; color: var(--ink); }
.card-title .meta { color: var(--muted); font-size: 13px; margin-top: 3px; }
.card-title .price { font-weight: 700; margin-top: 6px; }
.grade-badge { width: 54px; height: 54px; border-radius: 12px; display: grid; place-items: center; font-family: var(--serif); font-size: 28px; font-weight: 700; flex: none; }
.g-A { background: #e3f3e6; color: #2f7a45; }
.g-B { background: #e9f1e3; color: #4f7f31; }
.g-C { background: #fbf0d8; color: #9a7a1b; }
.g-D { background: #fde6dc; color: #b3542a; }
.g-F { background: #fbe0e0; color: #a4322e; }
.g-none { background: #f0ecea; color: #8a7b7e; font-size: 22px; }
.score { font-size: 13px; color: var(--muted); text-align: center; margin-top: 4px; }
.why { margin-top: 12px; background: var(--wine-soft); border-radius: 12px; padding: 10px 12px; }
.why h4 { margin: 0 0 6px; font-size: 13px; color: var(--wine); }
.why p { margin: 0 0 8px; font-size: 13.5px; line-height: 1.5; }
.ev { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; font-size: 13px; }
.ev li { display: flex; gap: 8px; align-items: flex-start; line-height: 1.4; }
.ev .mark { flex: none; width: 18px; text-align: center; font-weight: 700; }
.ev .observed .mark { color: var(--ok); }
.ev .estimated .mark { color: var(--warn); }
.ev .unavailable .mark { color: var(--bad); }
.ev .tag { font-size: 11px; color: var(--muted); margin-left: 4px; }
.missing { font-size: 12.5px; color: var(--bad); margin: 8px 0 0; }
.conf { font-size: 12px; color: var(--muted); margin-top: 8px; }
.report-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.legend { font-size: 12px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; margin: 4px 0 10px; }

/* Modals */
dialog { border: 0; border-radius: 22px; padding: 0; width: min(92vw, 400px); box-shadow: 0 30px 80px rgba(0,0,0,.35); background: var(--paper); color: var(--ink); }
dialog::backdrop { background: rgba(30,12,18,.72); }
.modal { padding: 28px 24px 20px; text-align: center; position: relative; display: grid; gap: 10px; }
.modal-close { position: absolute; top: 10px; right: 14px; font-size: 28px; color: var(--muted); }
.crown { font-size: 36px; color: var(--gold); }
.modal h2 { font-size: 26px; line-height: 1.2; }
.modal p { color: var(--muted); margin: 0; line-height: 1.5; }
.checks { list-style: none; padding: 0; margin: 6px 0 10px; text-align: left; display: grid; gap: 8px; font-size: 14px; }
.checks li::before { content: '✓'; color: var(--wine); font-weight: 700; margin-right: 10px; }
.modal input { border: 1px solid var(--line); border-radius: 10px; padding: 12px; width: 100%; font-size: 16px; }

@media (min-width: 560px) {
  #app { box-shadow: 0 0 60px rgba(90,11,35,.08); background: var(--ivory); }
  .screen.dark { border-radius: 0; }
}
body.dark-bg { background: #1d1416; }

.waitlist { display: grid; gap: 8px; }
.waitlist .radio { font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; justify-content: center; }
.waitlist .radio input { width: auto; accent-color: var(--wine); }
.quality { display: inline-block; font-size: 12px; font-weight: 600; color: var(--wine); background: var(--wine-soft); border-radius: 999px; padding: 3px 9px; margin-top: 6px; }
.quality.unknown { color: var(--muted); background: #f0ecea; }
.markup { font-size: 13px; color: var(--ink); margin-top: 4px; }
.over { font-size: 12px; color: var(--bad); font-weight: 600; }
.compare { display: inline-block; margin-top: 10px; font-size: 13px; color: var(--wine); font-weight: 600; text-decoration: none; }
