/* ————————————————————————————————————————————————
   ROOSTR · county-fair letterpress
   ———————————————————————————————————————————————— */
:root {
  --paper: #f3ead8;
  --paper-deep: #e7dcc2;
  --card: #fbf6ea;
  --ink: #2a2118;
  --ink-soft: #5b4f3f;
  --red: #b5402a;
  --red-deep: #93311f;
  --teal: #20655a;
  --gold: #c89a3f;
  --gold-pale: #ecd9a8;
  --shadow: 42, 33, 24;
  --card-h: 64px;
  --card-gap: 10px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Karla", "Segoe UI", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  min-height: 100dvh;
  overflow-x: hidden;
}

/* paper grain */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 50;
  opacity: .5;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0.16 0 0 0 0 0.13 0 0 0 0 0.09 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* faint big watermark */
body::after {
  content: "";
  position: fixed;
  top: 48%; left: 50%;
  width: 520px; height: 520px;
  transform: translate(-50%, -50%) rotate(-8deg);
  pointer-events: none;
  z-index: 0;
  opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M62 18c-7 0-12 5-13 11-9 1-16 8-17 17-6 1-12 6-12 14 0 9 7 15 16 15h34c10 0 18-8 18-18 0-8-5-14-12-17 0-1 .2-2 .2-3 0-11-6-19-14-19z' fill='%232a2118'/%3E%3Ccircle cx='63' cy='29' r='2.6' fill='%23f3ead8'/%3E%3Cpath d='M74 26l10-3-8 7z' fill='%232a2118'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

/* ————— masthead ————— */
.masthead {
  position: relative;
  z-index: 2;
  border-bottom: 3px double var(--ink);
  background:
    linear-gradient(to bottom, rgba(var(--shadow), .03), transparent 60%),
    var(--paper);
}
.masthead-inner {
  max-width: 560px;
  margin: 0 auto;
  padding: 14px 16px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.brand {
  font-family: var(--font-display);
  font-weight: 900;
  font-style: italic;
  font-size: clamp(26px, 7vw, 34px);
  letter-spacing: -.5px;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.brand .accent { color: var(--red); }
.rosette { width: 38px; height: 38px; flex: none; filter: drop-shadow(1px 2px 0 rgba(var(--shadow), .25)); }
.rosette-num { font: 700 30px var(--font-display); fill: var(--ink); }
.rosette-spin { transform-origin: 50px 42px; animation: spin 24s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.masthead-nav { display: flex; gap: 8px; }
.icon-btn {
  width: 36px; height: 36px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  font: 700 17px var(--font-display);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 2px 0 rgba(var(--shadow), .9);
  transition: transform .08s, box-shadow .08s;
  flex: none;
}
.icon-btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 rgba(var(--shadow), .9); }
.icon-btn--gold { background: var(--gold); color: var(--card); text-shadow: 0 1px 0 rgba(var(--shadow), .4); }

.dateline {
  text-align: center;
  font-size: 11.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  padding: 2px 16px 9px;
}

/* ————— bill (main column) ————— */
.bill {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px calc(28px + env(safe-area-inset-bottom));
}

/* ————— prompt ————— */
.prompt { text-align: center; animation: rise .5s ease both; }
.prompt-kicker {
  font-size: 12px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--red);
  font-weight: 700;
}
.prompt-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-style: italic;
  font-size: clamp(30px, 8.5vw, 44px);
  line-height: 1.05;
  margin: 6px 0 8px;
  text-wrap: balance;
}
.prompt-metric {
  font-size: 13.5px;
  color: var(--ink-soft);
  letter-spacing: .04em;
}
.prompt-metric strong { color: var(--teal); font-size: 15px; }
.prompt-rule {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 14px 0 4px;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--ink-soft);
}
.rule-end b { font-size: 13px; letter-spacing: .12em; }
.rule-end--lo b { color: var(--teal); }
.rule-end--hi b { color: var(--red); }
.rule-arrows { font-size: 18px; color: var(--gold); animation: bob 1.6s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(3px); } }

/* ————— the pen (card list) ————— */
.pen {
  margin-top: 14px;
  padding: 14px 10px;
  border: 2px solid var(--ink);
  background: var(--paper-deep);
  border-radius: 4px;
  box-shadow: inset 0 2px 8px rgba(var(--shadow), .14), 3px 4px 0 rgba(var(--shadow), .85);
  position: relative;
  animation: rise .5s .08s ease both;
}
.roost { position: relative; }

.card {
  position: absolute;
  left: 0; right: 0;
  height: var(--card-h);
  display: flex;
  align-items: stretch;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 3px;
  box-shadow: 2px 3px 0 rgba(var(--shadow), .28);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  transition: transform .22s cubic-bezier(.3, 1.2, .4, 1), box-shadow .15s;
  will-change: transform;
  transform: var(--ty, none);
}
.card.dragging {
  z-index: 10;
  cursor: grabbing;
  transition: box-shadow .15s;
  box-shadow: 5px 9px 14px rgba(var(--shadow), .35);
  rotate: 1.1deg;
}
.card.settled { cursor: default; touch-action: auto; }

/* entry-tag stub */
.card-stub {
  flex: none;
  width: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-right: 2px dashed var(--ink);
  position: relative;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 24px;
  background: var(--gold-pale);
  border-radius: 2px 0 0 2px;
  transition: background .25s, color .25s;
}
.card-stub::before { /* punched hole */
  content: "";
  position: absolute;
  top: 6px; left: 6px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--paper-deep);
  box-shadow: inset 0 1px 1px rgba(var(--shadow), .5);
}
.card-name {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 12px;
  min-width: 0;
}
.card-name b {
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: .01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-value {
  font-size: 12.5px;
  color: var(--teal);
  font-weight: 700;
  margin-top: 1px;
  display: none;
}
.card.show-value .card-value { display: block; }

.card-nudge {
  flex: none;
  display: flex;
  flex-direction: column;
  border-left: 1px solid rgba(var(--shadow), .18);
}
.card-nudge button {
  flex: 1;
  width: 34px;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 11px;
  cursor: pointer;
}
.card-nudge button:hover { color: var(--red); }
.card-nudge button:first-child { border-bottom: 1px solid rgba(var(--shadow), .14); }

/* feedback ribbons on stub */
.card.fb-hit .card-stub   { background: var(--teal); color: var(--card); border-right-style: solid; }
.card.fb-close .card-stub { background: var(--gold); color: var(--card); }
.card.fb-miss .card-stub  { background: #cfc4ab; color: var(--ink-soft); }
.card.fb-hit, .card.fb-close, .card.fb-miss { animation: stampin .3s ease; }
@keyframes stampin { 0% { transform: var(--ty) scale(1.03); } 100% { transform: var(--ty) scale(1); } }

/* ————— bench (controls) ————— */
.bench { margin-top: 16px; text-align: center; animation: rise .5s .14s ease both; }
.attempts {
  display: flex;
  justify-content: center;
  gap: 7px;
  margin-bottom: 12px;
}
.peck {
  width: 11px; height: 11px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--card);
  transition: background .3s;
}
.peck.used { background: var(--red); border-color: var(--red-deep); }

.btn {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: .02em;
  padding: 13px 30px;
  border: 2px solid var(--ink);
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .08s, box-shadow .08s, opacity .2s;
}
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn--judge { background: var(--red); color: var(--card); text-shadow: 0 1px 0 rgba(var(--shadow), .35); }
.btn--judge:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: 3px 3px 0 var(--ink); }
.btn--share { background: var(--teal); color: var(--card); }
.btn--ghost { background: var(--card); color: var(--ink); font-size: 16px; padding: 12px 22px; }

.history { margin-top: 14px; display: flex; flex-direction: column; gap: 5px; align-items: center; }
.history-row { display: flex; gap: 5px; }
.history-row i {
  width: 22px; height: 22px;
  border-radius: 3px;
  border: 1.5px solid var(--ink);
}
.history-row i.h { background: var(--teal); }
.history-row i.c { background: var(--gold); }
.history-row i.m { background: #cfc4ab; }

/* ————— verdict ————— */
.verdict { margin-top: 22px; }
.verdict-card {
  border: 2px solid var(--ink);
  background: var(--card);
  border-radius: 4px;
  padding: 22px 18px 18px;
  text-align: center;
  box-shadow: 3px 4px 0 rgba(var(--shadow), .85);
  position: relative;
  animation: rise .45s ease both;
}
.verdict-card::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(var(--shadow), .3);
  border-radius: 2px;
  pointer-events: none;
}
.verdict-stamp {
  font-family: var(--font-display);
  font-weight: 900;
  font-style: italic;
  font-size: clamp(26px, 7.5vw, 36px);
  color: var(--red);
  letter-spacing: .01em;
  transform: rotate(-2deg);
  animation: stamp .4s cubic-bezier(.2, 2.2, .4, 1) both;
}
.verdict-stamp.lost { color: var(--ink-soft); }
@keyframes stamp { 0% { transform: rotate(-2deg) scale(2.2); opacity: 0; } 100% { transform: rotate(-2deg) scale(1); opacity: 1; } }
.verdict-sub { font-size: 14px; color: var(--ink-soft); margin: 4px 0 16px; }

.reveal {
  list-style: none;
  text-align: left;
  margin: 0 auto 16px;
  max-width: 380px;
  counter-reset: rev;
}
.reveal li {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 7px 2px;
  border-bottom: 1px dashed rgba(var(--shadow), .35);
  font-size: 15px;
  counter-increment: rev;
  animation: rise .4s ease both;
}
.reveal li::before {
  content: counter(rev);
  font-family: var(--font-display);
  font-weight: 900;
  color: var(--gold);
  font-size: 17px;
  width: 18px;
  flex: none;
  text-align: center;
}
.reveal li b { flex: 1; }
.reveal li span { color: var(--teal); font-weight: 700; font-size: 13.5px; white-space: nowrap; }

.factbox {
  background: var(--paper-deep);
  border: 1px solid rgba(var(--shadow), .35);
  border-left: 4px solid var(--gold);
  border-radius: 3px;
  padding: 10px 14px;
  text-align: left;
  font-size: 14px;
  margin-bottom: 18px;
}
.factbox-label {
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--red);
  font-weight: 700;
  margin-bottom: 3px;
}
.verdict-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.countdown { margin-top: 16px; font-size: 13px; color: var(--ink-soft); }
.countdown b { font-family: var(--font-display); font-size: 16px; color: var(--ink); letter-spacing: .05em; }

/* ————— ads ————— */
.ad-slot {
  margin: 26px auto 0;
  max-width: 336px;
  min-height: 110px;
  border: 2px dashed rgba(var(--shadow), .35);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-slot span {
  font-size: 10px;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: rgba(var(--shadow), .45);
}
body.plus .ad-slot { display: none; }

/* ————— colophon ————— */
.colophon {
  margin-top: 26px;
  padding-top: 14px;
  border-top: 3px double var(--ink);
  text-align: center;
  font-size: 12px;
  color: var(--ink-soft);
  line-height: 2;
}
.linklike {
  border: 0;
  background: none;
  font: inherit;
  color: var(--teal);
  text-decoration: underline;
  cursor: pointer;
}

/* ————— modals ————— */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(var(--shadow), .55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 86dvh;
  overflow-y: auto;
  background: var(--card);
  border: 2px solid var(--ink);
  border-radius: 5px;
  box-shadow: 5px 7px 0 rgba(var(--shadow), .8);
  padding: 26px 22px 24px;
  animation: rise .3s ease both;
}
.modal-close {
  position: absolute;
  top: 10px; right: 10px;
  width: 32px; height: 32px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--paper);
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  line-height: 1;
}
.modal-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-style: italic;
  font-size: 26px;
  text-align: center;
  margin-bottom: 16px;
}
.modal-title em { color: var(--gold); }

.howto { padding-left: 20px; display: grid; gap: 10px; font-size: 14.5px; line-height: 1.5; }
.howto-foot {
  margin-top: 14px;
  text-align: center;
  font-size: 12.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--red);
  font-weight: 700;
}
.chip {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 3px;
  border: 1.5px solid var(--ink);
  margin: 0 2px;
  color: var(--card);
}
.chip--hit { background: var(--teal); }
.chip--close { background: var(--gold); }
.chip--miss { background: #cfc4ab; color: var(--ink-soft); }

.statgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; }
.stat b { display: block; font-family: var(--font-display); font-size: 28px; font-weight: 900; }
.stat span { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.dist-title {
  margin: 18px 0 8px;
  font-size: 11px;
  letter-spacing: .22em;
  text-transform: uppercase;
  text-align: center;
  color: var(--ink-soft);
}
.dist { display: grid; gap: 6px; }
.dist-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.dist-row b { width: 14px; font-family: var(--font-display); }
.dist-bar {
  height: 20px;
  background: var(--teal);
  color: var(--card);
  border-radius: 2px;
  min-width: 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 7px;
  font-size: 12px;
  font-weight: 700;
}

.modal--plus { text-align: center; }
.plus-rosette { font-size: 40px; color: var(--gold); text-shadow: 1px 2px 0 rgba(var(--shadow), .3); }
.plus-list {
  list-style: none;
  margin: 14px 0 16px;
  display: grid;
  gap: 8px;
  font-size: 14.5px;
}
.plus-list li::before { content: "✓ "; color: var(--teal); font-weight: 700; }
.plus-price { margin-bottom: 14px; font-size: 14px; color: var(--ink-soft); }
.plus-price b { font-family: var(--font-display); font-size: 26px; color: var(--ink); }
.plus-note { margin-top: 12px; font-size: 12px; color: var(--ink-soft); }

.about-text { font-size: 14px; line-height: 1.6; margin-bottom: 10px; }

/* ————— coffee tip jar ————— */
.colophon-legal { font-size: 11px; opacity: .8; }
.colophon-legal a { color: var(--teal); }

/* the coffee call-to-action, sitting under the red Judge button */
.coffee-prompt {
  margin: 14px auto 0;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  background: var(--gold-pale);
  border: 2px solid var(--gold);
  border-radius: 999px;
  padding: 11px 22px;
  font-size: 16.5px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: transform .1s, background .2s;
}
.coffee-prompt b { color: var(--red); font-size: 17px; }
.coffee-prompt:hover { background: #f3e4bd; transform: translateY(-1px); }
.coffee-prompt-cup { font-size: 20px; }

/* drawn mug */
.cup { width: 30px; height: 30px; flex: none; }
.cup--big { width: 58px; height: 58px; }
.cup--sm { width: 19px; height: 19px; }
.cup-steam { fill: none; stroke: var(--ink-soft); stroke-width: 2.5; stroke-linecap: round; opacity: .45; }
.cup--big .cup-steam { animation: steam 2.4s ease-in-out infinite; }
@keyframes steam { 0%, 100% { opacity: .2; } 50% { opacity: .6; transform: translateY(-1px); } }

.modal--coffee { text-align: center; }
.coffee-hero { line-height: 0; margin-bottom: 4px; }
.coffee-blurb { font-size: 14px; line-height: 1.55; color: var(--ink-soft); margin-bottom: 16px; }
.coffee-buy { margin-bottom: 6px; }
.coffee-stepper {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
}
.step-btn {
  width: 42px; height: 42px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: var(--card);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(var(--shadow), .8);
  transition: transform .08s, box-shadow .08s;
}
.step-btn:active { transform: translate(2px, 2px); box-shadow: 0 0 0 rgba(var(--shadow), .8); }
.coffee-cup-count { min-width: 74px; font-size: 18px; }
.coffee-cup-count b { font-family: var(--font-display); font-size: 26px; }
.coffee-custom {
  display: block;
  font-size: 13.5px;
  color: var(--ink-soft);
  margin-bottom: 14px;
}
.coffee-amt { white-space: nowrap; }
#cup-custom {
  width: 76px;
  font: inherit;
  font-size: 15px;
  padding: 6px 8px;
  margin-left: 2px;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  background: var(--paper);
  text-align: center;
}
.btn--coffee {
  background: var(--gold);
  color: var(--ink);
  font-size: 19px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .25);
}
.coffee-fineprint { font-size: 11.5px; color: var(--ink-soft); margin: 10px 0 4px; line-height: 1.5; }
.coffee-tally {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 15px;
  color: var(--teal);
  margin: 16px 0 10px;
  border-top: 1px dashed rgba(var(--shadow), .35);
  padding-top: 14px;
}
.coffee-tally:empty { border-top: 0; padding-top: 0; margin: 8px 0; }
.coffee-wall { list-style: none; display: grid; gap: 8px; text-align: left; }
.coffee-empty {
  text-align: center;
  font-size: 13px;
  color: var(--ink-soft);
  font-style: italic;
  padding: 6px 0 2px;
}
.coffee-name {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 10px;
  background: var(--paper-deep);
  border: 1px solid rgba(var(--shadow), .25);
  border-radius: 4px;
  padding: 8px 12px;
}
.coffee-cups { display: inline-flex; }
.coffee-name b { font-size: 15px; }
.coffee-note {
  grid-column: 2;
  font-size: 12.5px;
  font-style: italic;
  color: var(--ink-soft);
}

/* ————— standalone legal pages ————— */
.legal {
  max-width: 620px;
  margin: 0 auto;
  padding: 40px 20px 60px;
}
.legal h1 { font-family: var(--font-display); font-style: italic; font-weight: 900; font-size: 32px; margin-bottom: 6px; }
.legal h2 { font-family: var(--font-display); font-size: 20px; margin: 24px 0 6px; }
.legal p, .legal li { font-size: 14.5px; line-height: 1.6; color: var(--ink-soft); }
.legal ul { padding-left: 20px; margin: 6px 0; }
.legal a { color: var(--teal); }
.legal .back { display: inline-block; margin-bottom: 20px; font-weight: 700; color: var(--teal); text-decoration: none; }
.legal .updated { font-size: 12px; opacity: .7; }

/* ————— toast ————— */
.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 20px);
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 700;
  padding: 10px 20px;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s, transform .25s;
  z-index: 200;
  max-width: 88vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes rise { 0% { opacity: 0; transform: translateY(14px); } 100% { opacity: 1; transform: none; } }

@media (max-width: 420px) {
  :root { --card-h: 58px; }
  .card-name b { font-size: 15px; }
  .brand { font-size: 22px; gap: 6px; }
  .rosette { width: 30px; height: 30px; }
  .icon-btn { width: 32px; height: 32px; }
  .masthead-inner { padding: 12px 12px 4px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
