/* Layout: one narrow column on a shop-counter ground; each question is a
   manila price tag with a string hole, the price stamped in price-gun ink. */
:root {
  --counter: #d5ddd6;        /* page ground: painted shop counter */
  --counter-line: #c3cdc5;
  --fg: #1f2a26;             /* text on the counter */
  --muted: #56645e;
  --tag: #efdfb6;            /* manila tag stock, same in both themes */
  --tag-edge: #d6c393;
  --tag-ink: #2b2519;        /* pencil and print on the tag */
  --tag-muted: #6f634a;
  --stamp: #4a3c99;          /* price-gun violet */
  --stamp-soft: rgba(74, 60, 153, 0.12);
  --string: #9c7b4f;
  --good: #2f7a4b;
  --ok: #a77a12;
  --bad: #a8462f;
  --field: #fbf4e0;
  --mark: #4a3c99;           /* wordmark accent and focus ring on the counter */
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.06), 0 8px 18px -10px rgba(25, 35, 30, 0.45);

  --font-display: "Alfa Slab One", "Rockwell", "Roboto Slab", Georgia, serif;
  --font-body: "Libre Franklin", "Helvetica Neue", Arial, sans-serif;
  --font-stamp: "Special Elite", "Courier New", Courier, monospace;

  --step--1: 0.8125rem;
  --step-0: 1rem;
  --step-1: 1.25rem;
  --step-2: 1.6rem;
  --step-3: 2.4rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --counter: #18211e;
    --counter-line: #222d29;
    --fg: #e4ebe6;
    --muted: #9aa8a1;
    --tag: #e3d1a3;
    --tag-edge: #b9a674;
    --stamp: #4a3c99;
    --stamp-soft: rgba(74, 60, 153, 0.14);
    --string: #b8955f;
    --field: #f4e9cb;
    --mark: #e3d1a3;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 10px 22px -10px rgba(0, 0, 0, 0.8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --counter: #18211e;
  --counter-line: #222d29;
  --fg: #e4ebe6;
  --muted: #9aa8a1;
  --tag: #e3d1a3;
  --tag-edge: #b9a674;
  --stamp: #4a3c99;
  --stamp-soft: rgba(74, 60, 153, 0.14);
  --string: #b8955f;
  --field: #f4e9cb;
  --mark: #e3d1a3;
  --shadow: 0 1px 0 rgba(0, 0, 0, 0.3), 0 10px 22px -10px rgba(0, 0, 0, 0.8);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background-color: var(--counter);
  background-image: repeating-linear-gradient(0deg, transparent 0 46px, var(--counter-line) 46px 47px);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: var(--step-0);
  line-height: 1.5;
}
button, input { font: inherit; }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--mark); outline-offset: 2px; }

.wrap {
  max-width: 34rem;
  margin: 0 auto;
  padding-block: 20px 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Header */
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--step-2);
  letter-spacing: 0.01em;
  line-height: 1;
}
.wordmark span { color: var(--mark); }
.edition {
  margin: 4px 0 0;
  font-size: var(--step--1);
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.icon-btn {
  border: 1.5px solid currentColor;
  background: transparent;
  color: var(--fg);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}
.icon-btn:hover { background: var(--fg); color: var(--counter); }

/* Progress strip: six mini tags */
.strip {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.strip li {
  height: 34px;
  border-radius: 4px 4px 4px 4px;
  background: transparent;
  border: 1.5px dashed var(--muted);
  display: grid;
  place-items: center;
  font-family: var(--font-stamp);
  font-size: var(--step--1);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.strip li.current { border-style: solid; border-color: var(--fg); color: var(--fg); }
.strip li.done { background: var(--tag); border: 1.5px solid var(--tag-edge); color: var(--tag-ink); }
.strip li.done.t-good { box-shadow: inset 0 -4px 0 var(--good); }
.strip li.done.t-ok { box-shadow: inset 0 -4px 0 var(--ok); }
.strip li.done.t-bad { box-shadow: inset 0 -4px 0 var(--bad); }

/* The tag */
.tag {
  position: relative;
  background: var(--tag);
  color: var(--tag-ink);
  border: 1px solid var(--tag-edge);
  /* clipped top corners, like a die-cut tag */
  clip-path: polygon(28px 0, calc(100% - 28px) 0, 100% 28px, 100% 100%, 0 100%, 0 28px);
  padding: 44px 24px 24px;
  filter: drop-shadow(0 6px 10px rgba(20, 30, 25, 0.25));
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.tag-wrap { position: relative; padding-top: 26px; }
.tag-wrap::before {
  /* the string */
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 2px;
  height: 42px;
  background: var(--string);
  transform: translateX(-1px) rotate(4deg);
  transform-origin: top;
  z-index: 2;
}
.tag::before {
  /* the reinforced string hole */
  content: "";
  position: absolute;
  top: 14px;
  left: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  border-radius: 50%;
  background: var(--counter);
  box-shadow: 0 0 0 5px var(--tag-edge);
}
.tag-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tag-muted);
  border-bottom: 1px dashed var(--tag-edge);
  padding-bottom: 10px;
}
.item {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: var(--step-1);
  line-height: 1.2;
  text-wrap: balance;
}
.unit { font-family: var(--font-body); font-size: var(--step--1); color: var(--tag-muted); font-weight: 600; letter-spacing: 0.04em; }

/* Price-gun label: the 2025 price */
.label-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.price-label {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  background: #fffdf6;
  border: 1px solid var(--tag-edge);
  padding: 6px 12px 4px;
  transform: rotate(-1.5deg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}
.price-label .yr { font-size: var(--step--1); color: var(--tag-muted); letter-spacing: 0.08em; font-weight: 600; }
.stamp {
  font-family: var(--font-stamp);
  color: var(--stamp);
  font-size: var(--step-2);
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}
.ask { margin: 0; font-size: var(--step-1); font-weight: 600; }
.ask .past-year { font-family: var(--font-stamp); color: var(--stamp); font-size: 1.15em; }

/* Guess form */
.guess { display: flex; flex-direction: column; gap: 8px; }
.guess-row { display: flex; gap: 8px; }
.money {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  background: var(--field);
  border: 2px solid var(--tag-ink);
  border-radius: 6px;
  padding: 0 12px;
}
.money span { font-family: var(--font-stamp); font-size: var(--step-1); color: var(--tag-muted); }
.money input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--tag-ink);
  font-family: var(--font-stamp);
  font-size: var(--step-1);
  padding: 10px 6px;
  outline: none;
}
.money:focus-within { outline: 3px solid var(--stamp); outline-offset: 2px; }
.btn {
  border: 0;
  border-radius: 6px;
  background: var(--stamp);
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 10px 18px;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.12); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; }
.btn.ghost { background: transparent; color: var(--tag-ink); border: 2px solid var(--tag-ink); }
.hint { margin: 0; min-height: 1.4em; font-size: var(--step--1); color: var(--tag-muted); }
.hint.error { color: var(--bad); font-weight: 600; }

/* Reveal */
.reveal { display: flex; flex-direction: column; gap: 14px; }
.reveal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  border-top: 1px dashed var(--tag-edge);
  padding-top: 14px;
}
.cell { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.cell .k { font-size: var(--step--1); font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tag-muted); }
.cell .v { font-family: var(--font-stamp); font-size: var(--step-1); font-variant-numeric: tabular-nums; word-break: break-word; }
.cell .v.actual { color: var(--stamp); font-size: var(--step-2); }
.points {
  align-self: flex-start;
  font-family: var(--font-display);
  font-size: var(--step-3);
  line-height: 1;
  color: var(--stamp);
  border: 3px solid currentColor;
  border-radius: 8px;
  padding: 6px 12px 4px;
  transform: rotate(-4deg);
  animation: thunk 260ms cubic-bezier(.2,.9,.3,1.3);
}
.points small { font-family: var(--font-body); font-size: var(--step--1); font-weight: 700; letter-spacing: 0.08em; margin-left: 4px; }
.points.t-good { color: var(--good); }
.points.t-ok { color: var(--ok); }
.points.t-bad { color: var(--bad); }
@keyframes thunk { from { transform: rotate(-4deg) scale(1.6); opacity: 0; } to { transform: rotate(-4deg) scale(1); opacity: 1; } }
.verdict-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.verdict { margin: 0; font-weight: 600; }
.then-now {
  margin: 0;
  background: var(--stamp-soft);
  border-left: 3px solid var(--stamp);
  padding: 10px 12px;
  font-size: var(--step-0);
}
.then-now b { font-family: var(--font-stamp); font-weight: 400; color: var(--stamp); }
.source { margin: 0; font-size: var(--step--1); color: var(--tag-muted); }

/* Results */
.results h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: var(--step-1); }
.total { display: flex; align-items: baseline; gap: 8px; }
.total .stamp { font-size: var(--step-3); }
.total .of { color: var(--tag-muted); font-weight: 600; }
.ledger { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.ledger td { padding: 7px 0; border-bottom: 1px dashed var(--tag-edge); vertical-align: top; }
.ledger td:last-child { text-align: right; font-family: var(--font-stamp); font-size: var(--step-0); font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 10px; }
.ledger .q { font-weight: 600; }
.ledger .sub { color: var(--tag-muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.stats div { display: flex; flex-direction: column; }
.stats b { font-family: var(--font-stamp); font-weight: 400; font-size: var(--step-2); color: var(--stamp); font-variant-numeric: tabular-nums; }
.stats span { font-size: 0.7rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tag-muted); font-weight: 600; }
.next { margin: 0; font-size: var(--step--1); color: var(--tag-muted); }
.next b { font-family: var(--font-stamp); font-weight: 400; font-size: var(--step-0); color: var(--tag-ink); font-variant-numeric: tabular-nums; }

/* How to play / messages on the counter */
.note { margin: 0; color: var(--muted); font-size: var(--step--1); text-align: center; }
.panel {
  background: var(--tag);
  color: var(--tag-ink);
  border: 1px solid var(--tag-edge);
  border-radius: 6px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
}
.panel h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: var(--step-1); }
.panel p, .panel ul { margin: 0; }
.panel ul { padding-left: 1.2em; display: flex; flex-direction: column; gap: 4px; }
.date-links { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 420px) {
  .tag { padding: 42px 18px 20px; }
  .guess-row { flex-direction: column; }
  .stats b { font-size: var(--step-1); }
}
@media (prefers-reduced-motion: reduce) {
  .points { animation: none; }
}

#app { display: flex; flex-direction: column; gap: 20px; }
.strip-btn {
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
#share-text:not(.visually-hidden) {
  width: 100%;
  font-family: var(--font-stamp);
  background: var(--field);
  color: var(--tag-ink);
  border: 1px solid var(--tag-edge);
  padding: 8px;
}

.credits {
  margin-top: 12px;
  padding-top: 16px;
  border-top: 1px dashed var(--muted);
  text-align: center;
  font-size: var(--step--1);
  letter-spacing: 0.04em;
  color: var(--muted);
}
