:root {
  --bg: #14110d;
  --bg-2: #1c1814;
  --card: #241f19;
  --line: rgba(228, 194, 122, 0.22);
  --text: #f6f1e7;
  --muted: #b7ab9a;
  --gold: #e4c27a;
  --gold-2: #f3dfb0;
  --ink: #1a140c;
  --danger: #e7b2a4;
  --ok: #c9d7b8;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.28);
  --tap: 48px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.45 "Avenir Next", "Segoe UI", sans-serif;
  min-height: 100dvh;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.app {
  position: relative;
  max-width: 440px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(120% 40% at 50% -10%, rgba(228, 194, 122, 0.16), transparent 50%),
    var(--bg);
}
.top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: calc(14px + env(safe-area-inset-top)) 18px 8px;
}
.brand-kicker {
  margin: 0;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--gold);
}
.brand h1 {
  margin: 0;
  font-family: Palatino, "Iowan Old Style", Georgia, serif;
  font-weight: 600;
  font-size: 28px;
  letter-spacing: -0.03em;
}
.icon-btn, .tabs button, .btn, .btn-ghost, .chip {
  min-height: var(--tap);
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
}
.icon-btn { padding: 0 16px; color: var(--gold-2); }
.screen {
  flex: 1;
  padding: 8px 16px calc(92px + env(safe-area-inset-bottom));
}
.tabs {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(440px, 100%);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(20, 17, 13, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.tabs button {
  border: 0;
  border-radius: 12px;
  min-height: 44px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}
.tabs button.is-on { color: var(--ink); background: var(--gold); font-weight: 700; }
.search {
  width: 100%;
  min-height: var(--tap);
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  padding: 0 14px;
}
.search:focus, input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}
.hint { color: var(--muted); font-size: 14px; margin: 8px 2px 12px; }
input[type="file"] { max-width: 100%; font-size: 14px; }
.card, .hit, .tile, .panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  margin: 10px 0;
  box-shadow: var(--shadow);
}
.card h2, .panel h2, .hit strong { margin: 0 0 6px; font-size: 18px; }
.kicker {
  display: inline-block;
  margin: 0 0 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: rgba(228, 194, 122, 0.15);
  color: var(--gold-2);
}
.kicker.miss { background: rgba(231, 178, 164, 0.15); color: var(--danger); }
.meta { margin: 0; color: var(--muted); font-size: 14px; }
.coin-chip {
  display: inline-block;
  max-width: 100%;
  margin: 8px 0 0;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-2);
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.match { margin: 8px 0 0; color: var(--ok); font-size: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn, .btn-ghost, .chip, a.btn, a.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  background: var(--gold);
  color: var(--ink);
  font-weight: 700;
  border: 0;
  text-decoration: none;
}
h2, .meta, .hint { overflow-wrap: anywhere; }
.btn-ghost, .chip, a.btn-quiet, button.btn-quiet { background: transparent; color: var(--gold-2); border: 1px solid var(--line); font-weight: 600; }
a.btn-quiet, button.btn-quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tap);
  padding: 0 14px;
  border-radius: 999px;
  text-decoration: none;
}
.chip.is-on { background: var(--gold); color: var(--ink); }
.chip { max-width: 100%; white-space: normal; line-height: 1.2; text-align: center; padding-top: 8px; padding-bottom: 8px; }
.hole {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 6px 0;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.hole strong { margin: 0; font-size: 15px; font-weight: 600; flex: 1; min-width: 0; }
.hole .btn, .hole .btn-ghost { flex: 0 0 auto; }
.decade {
  margin: 14px 0 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--gold);
}
button:disabled { opacity: 0.55; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tile { margin: 0; min-height: 92px; text-align: left; width: 100%; }
.tile b { display: block; font-size: 15px; }
.tile span { color: var(--muted); font-size: 13px; }
.wide { grid-column: 1 / -1; }
label { display: block; margin: 10px 0 4px; color: var(--muted); font-size: 13px; }
input, select, textarea {
  width: 100%;
  min-height: var(--tap);
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  padding: 10px 12px;
}
select {
  appearance: none;
  -webkit-appearance: none;
  padding: 0 42px 0 14px;
  cursor: pointer;
  color-scheme: dark;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: 1; }
textarea { min-height: 80px; }
.results { margin-top: 8px; }
.hit { padding: 12px; }
button.hit {
  width: 100%;
  text-align: left;
  color: inherit;
  background: var(--card);
  font-weight: 400;
}
.hit strong { display: block; overflow-wrap: anywhere; }
.grade-row, .grade-steps { margin-top: 8px; }
.grade-row .chip, .grade-steps .chip { min-height: 44px; padding: 0 12px; font-size: 14px; }
.quiet { color: var(--muted); font-size: 13px; }
.toast {
  margin: 0 16px 8px;
  background: var(--gold-2);
  color: var(--ink);
  border-radius: 12px;
  padding: 12px 14px;
}
.auth-note { font-size: 15px; }
a { color: var(--gold-2); }
.thumb { display: block; width: 96px; height: 96px; object-fit: cover; border-radius: 12px; margin: 10px 0; background: #000; }
.listing { display: flex; gap: 10px; align-items: center; }
.photo-box { position: relative; min-width: 0; max-width: 100%; }
.photo-lead { margin-top: 0; }
.photo-sources { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.photo-src, .shop-shot { appearance: none; -webkit-appearance: none; }
.photo-src {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 88px;
  width: 100%;
  padding: 10px 6px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--gold-2);
  font-size: 13px;
  font-weight: 700;
}
.photo-src svg { width: 26px; height: 26px; }
.photo-src:active, .shop-shot:active { transform: translateY(1px); }
.photo-file {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.photo-preview {
  position: relative;
  margin: 0 0 10px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
}
.photo-preview img { display: block; width: 100%; max-height: 220px; object-fit: contain; background: #000; }
.photo-clear {
  position: absolute;
  top: 8px;
  right: 8px;
  min-height: 36px;
  padding: 0 12px;
  background: rgba(20, 17, 13, 0.82);
}
.shop-photos { min-width: 0; max-width: 100%; }
.photo-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  max-width: 100%;
  padding-bottom: 4px;
  -webkit-overflow-scrolling: touch;
}
.shop-shot {
  flex: 0 0 116px;
  width: 116px;
  margin: 0;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: inherit;
  text-align: left;
  font-weight: 500;
}
.shop-shot.is-on { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.shop-shot img { display: block; width: 100%; height: 88px; object-fit: cover; border-radius: 10px; background: #000; }
.shot-shop, .shot-side { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.shot-shop { margin-top: 6px; font-size: 12px; color: var(--text); }
.shot-side { font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--gold); }
.qr-plate {
  background: #fff;
  border-radius: 16px;
  padding: 12px;
  margin: 12px auto;
  width: max-content;
  max-width: 100%;
}
.qr-plate img {
  display: block;
  width: 220px;
  height: auto;
  max-width: 100%;
}
.btn-block { width: 100%; margin-top: 4px; }
.card input[type="checkbox"] { width: 22px; height: 22px; margin-top: 4px; flex: 0 0 auto; }
body.handoff .screen { padding-bottom: 32px; }
body.handoff .btn-block { margin-top: 8px; }

@media (min-width: 900px) {
  body { background: #0d0b09; }
  .app {
    height: calc(100dvh - 32px);
    min-height: 0;
    margin: 16px auto;
    border: 1px solid var(--line);
    border-radius: 28px;
    overflow: hidden;
  }
  .screen { overflow: auto; }
  .tabs { position: absolute; border-radius: 0 0 28px 28px; }
}
