:root {
  --bg: #0c0d0b;
  --ink: #eceae3;
  --muted: #8d8a80;
  --dim: #5c5a53;
  --line: #23241f;
  --surface: #141512;
  --lift: #1b1c18;
  --btn: #f3f1ea;
  --btn-ink: #0c0d0b;
  --sage: #b7c4a0;
  --warn: #c9a48a;
  --sans: "IBM Plex Sans", "Segoe UI", sans-serif;
  --serif: "Instrument Serif", "Times New Roman", serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --radius: 16px;
  --pad: 20px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  background: var(--bg);
}

body {
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
}

button,
input,
textarea,
summary {
  font: inherit;
  color: inherit;
}

a {
  color: var(--sage);
}

.grain {
  display: none;
}

.sheet {
  width: min(430px, 100%);
  margin: 0 auto;
  padding: 8px var(--pad) calc(120px + env(safe-area-inset-bottom));
}

.topbar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0 10px;
}

.brand,
.wordmark {
  margin: 0;
  text-decoration: none;
  color: var(--ink);
  font-size: inherit;
  font-weight: inherit;
}

.wordmark .kicker,
.brand-kicker,
.kicker {
  display: block;
  font-family: var(--sans);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.wordmark .display,
.brand-name,
.display {
  display: block;
  margin-top: 1px;
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1;
}

.topbar nav {
  display: flex;
  gap: 16px;
  font-size: 0.92rem;
}

.topbar nav a {
  color: var(--muted);
  text-decoration: none;
}

.topbar nav a.is-on,
.topbar nav a:active {
  color: var(--ink);
}

.site-nav {
  display: none;
}

.mark,
.card-rule,
.plant-note,
.notice {
  display: none;
}

.tagline {
  margin: 0 0 18px;
  color: var(--dim);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
}

.beta {
  display: inline;
  margin-left: 0.4em;
  font-size: 0.7em;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  vertical-align: 0.12em;
}

.fatal-status {
  margin: 0 0 14px;
  color: var(--warn);
  font-size: 0.85rem;
}

.progress {
  list-style: none;
  display: flex;
  gap: 4px;
  margin: 0 0 22px;
  padding: 0;
}

.progress button,
.step-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--dim);
  padding: 0 8px 8px 0;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
}

.progress button.is-on,
.step-tab.is-on {
  color: var(--ink);
}

.progress button:disabled,
.step-tab:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.card {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
  margin: 0 0 28px;
  box-shadow: none;
}

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

h2 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-size: 1.7rem;
  font-weight: 400;
  letter-spacing: -0.03em;
}

.lede {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.95rem;
}

.hint {
  margin: 8px 0 0;
  font-size: 0.84rem;
  color: var(--muted);
}

.shot-title {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: 2.4rem;
  letter-spacing: -0.04em;
  line-height: 0.95;
}

.photo-label {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.photo-label span {
  color: var(--dim);
}

.thumb,
.thumb-wide {
  aspect-ratio: 5 / 7;
  width: 100%;
  max-height: 46vh;
  margin: 0 auto;
  border-radius: 18px;
  background: var(--lift);
  overflow: hidden;
  position: relative;
  display: grid;
  place-items: center;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--lift);
}

.placeholder img {
  flex: 1;
  min-height: 0;
  object-fit: cover;
  opacity: 0.55;
}

.placeholder span,
.thumb span {
  color: var(--muted);
  font-size: 0.78rem;
  padding: 10px 12px 14px;
  text-align: center;
}

.btn-row,
.btn-row-wide {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 14px;
}

.btn {
  min-height: 48px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 14px;
  padding: 10px 14px;
  font-weight: 500;
  cursor: pointer;
}

.btn-primary,
.btn-next {
  background: var(--btn);
  border-color: var(--btn);
  color: var(--btn-ink);
  font-weight: 600;
}

.btn-next {
  min-height: 56px;
  width: 100%;
  margin-top: 16px;
  font-size: 1.12rem;
  letter-spacing: 0.01em;
}

.btn-small {
  min-height: 40px;
  font-size: 0.88rem;
  border-radius: 12px;
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.hash-line {
  margin: 10px 0 0;
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--dim);
  word-break: break-all;
}

.status {
  margin: 0 0 12px;
  font-size: 0.92rem;
  color: var(--muted);
}

.badge {
  display: inline-block;
  color: var(--sage);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.badge.is-manual {
  color: var(--warn);
}

.id-headline {
  font-family: var(--serif);
  font-size: 2rem;
  margin: 4px 0 10px;
  line-height: 1.05;
  letter-spacing: -0.03em;
}

.id-fields {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  font-size: 0.92rem;
}

.id-fields li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}

.id-fields strong {
  color: var(--ink);
  font-weight: 500;
}

.ocr-box {
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  background: var(--surface);
  border-radius: 12px;
  padding: 10px;
  max-height: 120px;
  overflow: auto;
}

.candidate-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
}

.candidate {
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
}

.candidate strong {
  display: block;
  font-family: var(--serif);
  font-size: 1.15rem;
}

.candidate span {
  font-size: 0.78rem;
  color: var(--muted);
}

.user-labels label {
  display: block;
  margin: 10px 0;
  font-size: 0.86rem;
  color: var(--muted);
}

.user-labels input,
.lookup-form input,
.search-field {
  display: block;
  width: 100%;
  margin-top: 6px;
  min-height: 52px;
  padding: 12px 14px;
  border: 0;
  border-radius: 14px;
  background: var(--lift);
  color: var(--ink);
  outline: none;
}

.user-labels input:focus,
.lookup-form input:focus,
.search-field:focus {
  box-shadow: inset 0 0 0 1px var(--sage);
}

.search-field {
  margin: 0 0 12px;
  font-size: 1.05rem;
}

details.quiet {
  margin: 18px 0;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

details.quiet > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.88rem;
  list-style: none;
}

details.quiet > summary::-webkit-details-marker {
  display: none;
}

.id-receipt {
  font-family: var(--serif);
  font-size: 1.35rem;
  margin: 0 0 8px;
}

.stage-wrap {
  margin: 8px 0 12px;
}

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 5 / 7;
  max-height: 42vh;
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  touch-action: none;
}

.stage img,
.stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.stage img {
  object-fit: contain;
}

.guide-tools,
.mode-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.seg {
  display: flex;
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
}

.seg-btn {
  flex: 1;
  min-height: 40px;
  border: 0;
  background: transparent;
  font-weight: 500;
  cursor: pointer;
}

.seg-btn.is-on {
  background: var(--ink);
  color: var(--bg);
}

.measure {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin: 10px 0 4px;
}

.pair {
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 8px;
  text-align: center;
}

.pair span {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
}

.pair strong {
  font-size: 1rem;
  font-weight: 500;
}

.slider-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 22px 0 8px;
  font-size: 1.05rem;
}

.slider-label em {
  font-style: normal;
  color: var(--warn);
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.68rem;
}

.slider-label strong {
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 400;
  letter-spacing: -0.03em;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 32px;
  background: transparent;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 2px;
  background: #3a3b36;
  border-radius: 999px;
}

input[type="range"]::-moz-range-track {
  height: 2px;
  background: #3a3b36;
  border-radius: 999px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  margin-top: -12px;
  border-radius: 50%;
  background: var(--btn);
  border: 0;
}

input[type="range"]::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--btn);
  border: 0;
}

.ticks {
  display: flex;
  justify-content: space-between;
  margin: 4px 0 0;
  font-size: 0.7rem;
  color: var(--dim);
}

.honest {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.table-wrap {
  overflow-x: auto;
  margin: 10px 0 14px;
}

.rubric {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 0.72rem;
}

.rubric th,
.rubric td {
  border-bottom: 1px solid var(--line);
  padding: 7px 6px;
  text-align: left;
}

.rubric th {
  color: var(--dim);
  font-weight: 500;
}

h3 {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 400;
  margin: 16px 0 8px;
}

.formula code {
  font-family: var(--mono);
  font-size: 0.85em;
}

.receipt {
  padding-top: 8px;
}

.receipt-kicker {
  margin: 0;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.68rem;
  color: var(--dim);
}

.receipt h2 {
  margin: 6px 0 4px;
}

.receipt-stamp {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

.big-total {
  margin: 8px 0 6px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(5.2rem, 28vw, 7rem);
  letter-spacing: -0.06em;
  line-height: 0.85;
}

.big-total small {
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--dim);
  margin-left: 6px;
  letter-spacing: 0;
}

.receipt-pillars {
  list-style: none;
  margin: 18px 0 12px;
  padding: 0;
  border-top: 1px solid var(--line);
}

.receipt-pillars li {
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.receipt-pillars li > span {
  font-size: 0.92rem;
  color: var(--muted);
}

.receipt-pillars li > strong {
  float: right;
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 400;
  letter-spacing: -0.03em;
}

.receipt-pillars .why {
  clear: both;
  padding-top: 8px;
}

.receipt-meta,
.receipt-line {
  font-size: 0.78rem;
  color: var(--dim);
  word-break: break-all;
}

.receipt-line {
  margin: 16px 0;
  color: var(--muted);
}

.json-label {
  display: block;
  margin: 8px 0 6px;
  color: var(--muted);
  font-size: 0.84rem;
}

#receipt-json {
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: var(--surface);
  color: var(--muted);
  padding: 10px;
  font-family: var(--mono);
  font-size: 0.7rem;
  line-height: 1.35;
  resize: vertical;
  min-height: 120px;
}

#copy-json,
#save-catalog,
#publish-meter,
#print-sticker,
#back-to-list,
#grade-again,
#to-front {
  width: 100%;
  margin-top: 10px;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 18px;
}

.catalog-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.catalog-item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  width: 100%;
  margin: 0;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  border-radius: 0;
}

.catalog-thumb {
  width: 56px;
  height: 78px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--lift);
}

.catalog-thumb-empty {
  display: block;
  background: var(--lift);
}

a.lookup-row {
  text-decoration: none;
}

.hint-inline {
  color: var(--dim);
  font-size: 0.8rem;
}

.lookup-form .btn {
  width: 100%;
  margin-top: 10px;
}

.catalog-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.catalog-id {
  font-weight: 500;
}

.catalog-total {
  font-family: var(--serif);
  font-size: 1.6rem;
  letter-spacing: -0.03em;
}

.catalog-total small {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--dim);
}

.catalog-pillars,
.catalog-time {
  font-size: 0.8rem;
  color: var(--muted);
}

.catalog-time {
  font-family: var(--mono);
  font-size: 0.68rem;
  word-break: break-all;
}

.saved-photos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0 16px;
}

.saved-photos figure {
  margin: 0;
}

.saved-photos img {
  display: block;
  width: 100%;
  border-radius: 12px;
  background: var(--lift);
}

.saved-photos figcaption {
  margin-top: 6px;
  text-align: center;
  font-size: 0.72rem;
  color: var(--dim);
}

.meter-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-height: 28rem;
  overflow: auto;
}

.meter-card {
  padding: 0 0 12px;
  border-bottom: 1px solid var(--line);
}

.overall {
  margin: 8px 0;
}

.meter-n,
.meter-sub,
.meter-link {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.meter-link a {
  color: var(--sage);
  text-decoration: none;
}

.meter-sub {
  margin-top: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.7rem;
}

.catalog-receipts {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 16px;
}

.catalog-pick {
  cursor: pointer;
}

.meter-row {
  padding: 4px 0 12px;
  border-bottom: 1px solid var(--line);
}

.meter-total {
  margin: 0;
  font-family: var(--serif);
  font-size: 2rem;
  letter-spacing: -0.04em;
}

.meter-total small {
  font-family: var(--sans);
  font-size: 0.8rem;
  color: var(--dim);
}

.meter-pillars,
.meter-id,
.meter-hash,
.meter-time,
.meter-notice,
.meter-empty {
  margin: 4px 0 0;
  font-size: 0.82rem;
  color: var(--muted);
}

.meter-hash,
.meter-time {
  font-family: var(--mono);
  font-size: 0.68rem;
  color: var(--dim);
  word-break: break-all;
}

.copy-status {
  text-align: center;
  color: var(--sage);
  font-size: 0.88rem;
}

.colophon {
  color: var(--dim);
  font-size: 0.78rem;
  padding: 24px 0 8px;
}

.colophon p {
  margin: 0 0 8px;
}

.dock {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(430px, 100%);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 12px var(--pad) calc(12px + env(safe-area-inset-bottom));
  background: rgba(12, 13, 11, 0.92);
  backdrop-filter: blur(18px);
  z-index: 6;
  border-top: 1px solid var(--line);
}

.dock-label,
.dock-kicker {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}

.dock-score {
  font-family: var(--serif);
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 1;
}

.dock-score small {
  font-family: var(--sans);
  font-size: 0.78rem;
  color: var(--dim);
}

.dock .btn-next {
  width: auto;
  min-width: 42%;
  margin: 0;
  min-height: 52px;
}

#to-back,
#to-grade,
#to-receipt {
  display: none;
}

.card-grades {
  max-height: none;
}

.sticker {
  width: 1.25in;
  height: 1.25in;
  margin: 16px auto;
  padding: 5px 4px 6px;
  background: #faf6eb;
  color: #1c1710;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  box-sizing: border-box;
}

.sticker-word {
  margin: 0;
  font-family: var(--serif);
  font-size: 6px;
  line-height: 1.05;
  color: #1c1710;
}

.sticker canvas {
  width: 0.95in;
  height: 0.95in;
}

.overall-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.ghost-next {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media print {
  body * {
    visibility: hidden;
  }
  .sticker,
  .sticker * {
    visibility: visible;
  }
  .sticker {
    position: absolute;
    left: 0.25in;
    top: 0.25in;
    margin: 0;
  }
  .grain,
  .dock,
  .btn,
  .btn-row,
  .guide-tools,
  .mode-row,
  .colophon {
    display: none !important;
  }
}
