/* Simple Things: ink on warm off-white, red as the accent, hairline rules, square-ish corners. */
:root {
  --ink: #171412;
  --paper: #fbfbfa;
  --surface: #ffffff;
  --red: #e6332a;
  --deep-red: #8f1d19;
  --muted: #5f5a55;
  --border: #d8d4ce;
  --stage: #f1efec;
  --radius: 4px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --ink: #fbfbfa; --paper: #171412; --surface: #201d1a; --muted: #aaa39b; --border: #393633; --stage: #26221f; }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.6 var(--font); }
a { color: inherit; text-underline-offset: 3px; }
a:hover { color: var(--red); }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
img { max-width: 100%; }

.wrap { max-width: 1120px; margin: 0 auto; padding: 0 24px; }
.band { border-bottom: 1px solid var(--border); padding: 40px 0; }
.label { font-size: 12px; line-height: 1.4; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; font-weight: 600; }
.small { font-size: 14px; color: var(--muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.masthead { padding: 56px 0 40px; }
.masthead h1 { font-size: clamp(32px, 5vw, 52px); line-height: 1.08; letter-spacing: -0.02em; margin: 0 0 16px; max-width: 16ch; }
.lede { font-size: 19px; max-width: 62ch; margin: 0; color: var(--ink); }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px; border: 1px solid var(--ink); border-radius: var(--radius);
  background: transparent; color: var(--ink); font: 600 15px/1.2 var(--font); text-decoration: none; cursor: pointer;
}
.button:hover { border-color: var(--red); color: var(--red); }
.button.primary { background: var(--red); border-color: var(--red); color: #fff; }
.button.primary:hover { background: var(--deep-red); border-color: var(--deep-red); color: #fff; }
.button.quiet { border-color: var(--border); }

.drop {
  display: grid; gap: 10px; justify-items: start; padding: 32px; cursor: pointer;
  border: 1px dashed var(--muted); border-radius: var(--radius); background: var(--surface);
}
.drop input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.drop:focus-within { outline: 2px solid var(--red); outline-offset: 2px; }
.drop.over { border-color: var(--red); border-style: solid; }
.drop-main { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; font-weight: 600; }
.drop-or { color: var(--muted); font-weight: 400; }
.drop-note { color: var(--muted); font-size: 15px; }
.note { margin: 12px 0 0; font-size: 14px; color: var(--muted); }
.status { margin: 12px 0 0; min-height: 1.6em; font-weight: 600; }
.status.error { color: var(--red); }
.busy .drop { opacity: 0.55; pointer-events: none; }
.busy .status::before { content: ""; display: inline-block; width: 12px; height: 12px; margin-right: 10px; vertical-align: -1px; border: 2px solid var(--red); border-right-color: transparent; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 40px; align-items: start; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; position: sticky; top: 16px; }
.pair figure { margin: 0; }
.photo img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius); background: var(--stage); }
.fig { position: relative; width: 100%; aspect-ratio: 1; background: var(--stage); border-radius: var(--radius); overflow: hidden; }
.fig img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.fig img[data-slot="accessory"] { transform: scaleX(-1); }
.pair figcaption { margin-top: 8px; }
.result.shared .photo { display: none; }
.result.shared .pair { grid-template-columns: 1fr; max-width: 420px; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 0 0 28px; }
.chips li { border: 1px solid var(--border); border-radius: var(--radius); padding: 4px 10px; font-size: 14px; background: var(--surface); }

.parts { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--border); }
.part { display: grid; grid-template-columns: 72px 1fr auto; gap: 4px 16px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.thumb { width: 72px; height: 72px; object-fit: contain; background: var(--stage); border-radius: var(--radius); }
.part-text { display: grid; min-width: 0; }
.part-text .slot { margin: 0; }
.part-label { font-weight: 600; }
.options { grid-column: 1 / -1; padding: 12px 0 4px; }
.options-title { margin: 0 0 8px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; margin-bottom: 12px; }
.tile { padding: 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--stage); cursor: pointer; aspect-ratio: 1; overflow: hidden; }
.tile img { width: 100%; height: 100%; object-fit: contain; display: block; }
.tile:hover, .tile[aria-pressed="true"] { border-color: var(--red); }
.tile.none { font: 600 13px/1.2 var(--font); color: var(--muted); }

.total { display: flex; justify-content: space-between; align-items: baseline; margin: 16px 0 4px; font-size: 18px; }
.total strong { font-size: 24px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.how { margin-top: 24px; border-top: 1px solid var(--border); padding-top: 12px; }
.how summary { cursor: pointer; font-weight: 600; }
.how ol { padding-left: 20px; color: var(--muted); }

.footer { border-bottom: 0; font-size: 14px; color: var(--muted); }
.footer p { max-width: 80ch; }

@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; gap: 28px; }
  .pair { position: static; }
}
@media (max-width: 480px) {
  .band { padding: 28px 0; }
  .wrap { padding: 0 16px; }
  .drop { padding: 20px; }
  .part { grid-template-columns: 56px 1fr; }
  .thumb { width: 56px; height: 56px; }
  .part .change { grid-column: 1 / -1; justify-self: start; }
}
@media (prefers-reduced-motion: reduce) {
  .busy .status::before { animation: none; }
}
