:root {
  color-scheme: dark;
  --bg: #15120F;
  --surface: #211C17;
  --surface-2: #2a241e;
  --edge: #352d25;
  --text: #EFE8DC;
  --muted: #9a8f81;
  --paper: #F6F0E2;
  --ink: #1A1714;
  --heat: #FF5A1F;
  --marker: #D7261E;
  --head: "Anton", "Archivo Narrow", Impact, sans-serif;
  --ui: "IBM Plex Sans Condensed", "Arial Narrow", system-ui, sans-serif;
  --mono: "Courier Prime", "Courier New", monospace;
  --hand: "Caveat", "Comic Sans MS", cursive;
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.45;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); overflow-x: hidden;
  background-image: radial-gradient(1200px 600px at 75% -10%, rgba(255,255,255,.035), transparent 70%); background-attachment: fixed; }
button, input, textarea { font: inherit; color: inherit; appearance: none; }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; }
[hidden] { display: none !important; }
::selection { background: var(--paper); color: var(--ink); }
:focus-visible { outline: 2px solid var(--paper); outline-offset: 3px; }
.muted { color: var(--muted); }

.scroll-progress { position: fixed; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, #ffb03a, var(--heat)); transform-origin: 0 50%; transform: scaleX(0); z-index: 50; }
.fx-layer { position: fixed; inset: 0; pointer-events: none; z-index: 80; overflow: hidden; }
.site-shell { max-width: 1240px; margin: 0 auto; padding: 28px 24px 24px; }

/* hero */
.hero { padding: 36px 0 34px; }
.hero-title { margin: 0; font-family: var(--head); font-weight: 400; text-transform: lowercase; font-size: clamp(56px, 11vw, 168px); line-height: .9; letter-spacing: -0.01em; }
.hero-title .line { display: block; overflow: hidden; padding: 0.03em 0 0.05em; }
.hero-title .word { display: inline-block; white-space: nowrap; }
.hero-title .char { display: inline-block; will-change: transform; }
.hero-row { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; margin-top: 26px; }
.hero-sub { margin: 0; font-size: 18px; color: var(--muted); }
.ghost-button { min-height: 44px; padding: 0 18px; border: 1px solid var(--edge); background: var(--surface); border-radius: 999px; font-weight: 600; }
.ghost-button:hover { border-color: #5a4d40; }

/* kitchen */
.kitchen { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 40px; align-items: start; }
.rail-wrap { margin-bottom: 30px; }
.rail-label { display: flex; justify-content: space-between; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 8px; }
.rail { position: relative; display: flex; flex-wrap: wrap; align-content: flex-start; gap: 0 10px; min-height: 92px; padding: 0 12px;
  background-image: linear-gradient(180deg, #8d877e 0, #d9d4cb 3px, #6f6a62 7px, #3b3731 9px, transparent 9px);
  background-size: 100% 92px; background-repeat: repeat-y; }
.rail-empty { margin: 22px 0 0; color: var(--muted); font-size: 14px; }
.rail-ticket { position: relative; height: 78px; margin-top: 4px; width: 112px; padding: 16px 10px 8px; background: var(--paper); color: var(--ink); transform-origin: 50% 0;
  box-shadow: 0 8px 14px -8px rgba(0,0,0,.7);
  -webkit-mask: linear-gradient(#000 0 0) top / 100% calc(100% - 5px) no-repeat, conic-gradient(from -45deg at bottom, #000 90deg, transparent 0) bottom / 8px 5px repeat-x;
  mask: linear-gradient(#000 0 0) top / 100% calc(100% - 5px) no-repeat, conic-gradient(from -45deg at bottom, #000 90deg, transparent 0) bottom / 8px 5px repeat-x; }
.rail-ticket::before { content: ""; position: absolute; top: -2px; left: 50%; width: 26px; height: 12px; transform: translateX(-50%); background: linear-gradient(#cfc9bf, #7d776e); border-radius: 0 0 3px 3px; }
.rail-ticket b { display: block; font-weight: 700; font-size: 13px; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-ticket span { display: block; font-family: var(--mono); font-size: 12px; margin-top: 6px; color: #5d554b; }

.category { border: 0; margin: 0 0 22px; padding: 0; min-width: 0; }
.cat-label { padding: 0; margin-bottom: 10px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .14em; color: var(--muted); }
.chip-group { display: flex; flex-wrap: wrap; gap: 10px; }
.chip { position: relative; display: inline-flex; align-items: baseline; gap: 12px; min-height: 46px; padding: 11px 14px 10px 20px; border: 1px solid var(--edge); border-radius: 3px; background: var(--surface); font-weight: 600; font-size: 16px; text-align: left;
  background-image: radial-gradient(circle at 7px 50%, var(--bg) 2.5px, transparent 3px); background-size: 14px 9px; background-repeat: repeat-y; background-position: 0 2px;
  transition: background-color 140ms, color 140ms, border-color 140ms; }
.chip:hover { border-color: #5a4d40; }
.item-pts { font-family: var(--mono); font-weight: 400; font-size: 13px; color: var(--muted); }
.chip[aria-pressed="true"] { background-color: var(--paper); border-color: var(--paper); color: var(--ink); }
.chip[aria-pressed="true"] .item-pts { color: #6b6257; }
.ghost { opacity: .38; }
.fx .category .chip, .fx .category .cat-label, .fx .extra-field { opacity: 0; }
.fx .hero-title .char { transform: translateY(110%); }
.fx .hero-row > *, .fx .rail-wrap, .fx .printer { opacity: 0; }

.extra-field { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--edge); position: relative; }
.field-heading { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.field-heading label { flex: 1; font-weight: 600; font-size: 16px; }
.field-heading .muted { font-size: 13px; }
input, textarea { width: 100%; border: 1px solid var(--edge); border-radius: 3px; background: var(--surface); padding: 12px 14px; font-size: 16px; }
input:focus { outline: none; border-color: #6d5e4e; }
input::placeholder { color: #6e6458; }
.extra-field p { margin: 8px 0 0; color: var(--muted); font-size: 13px; }

/* printer */
.printer { position: sticky; top: 20px; }
.printer-head { position: relative; height: 34px; background: linear-gradient(#2e2721, #221d18); border: 1px solid var(--edge); border-radius: 10px 10px 4px 4px; }
.slot { position: absolute; left: 18px; right: 18px; bottom: 7px; height: 6px; border-radius: 4px; background: #0b0908; box-shadow: inset 0 2px 3px #000; }
.live-receipt { position: relative; margin: -4px 30px 0; padding: 14px 16px 22px; background: var(--paper); color: var(--ink); font-family: var(--mono); font-size: 13px; line-height: 1.5;
  max-height: 46vh; overflow: hidden auto; scrollbar-width: none;
  -webkit-mask: linear-gradient(#000 0 0) top / 100% calc(100% - 6px) no-repeat, conic-gradient(from -45deg at bottom, #000 90deg, transparent 0) bottom / 10px 6px repeat-x;
  mask: linear-gradient(#000 0 0) top / 100% calc(100% - 6px) no-repeat, conic-gradient(from -45deg at bottom, #000 90deg, transparent 0) bottom / 10px 6px repeat-x; }
.live-receipt p { margin: 0; }
.lr-title { text-align: center; font-weight: 700; letter-spacing: 2px; }
.lr-sub { text-align: center; color: #6b6257; font-size: 12px; padding-bottom: 8px; border-bottom: 1px dashed #b9b0a0; }
.lr-lines { list-style: none; margin: 0; padding: 8px 0; min-height: 60px; }
.lr-lines li { display: flex; gap: 6px; white-space: nowrap; }
.lr-lines li .n { overflow: hidden; text-overflow: ellipsis; }
.lr-lines li .d { flex: 1; overflow: hidden; color: #9a907f; }
.lr-lines li .d::before { content: "................................................................"; }
.lr-empty { color: #8b8274; }
.lr-total { display: flex; justify-content: space-between; border-top: 1px dashed #b9b0a0; padding-top: 8px; font-weight: 700; }
.heat { padding: 16px 0 14px; }
.heat-label { display: flex; justify-content: space-between; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); margin-bottom: 7px; }
.heat-tier { color: var(--heat); font-weight: 700; display: inline-block; }
.heat-track { position: relative; height: 14px; border-radius: 8px; background: #0f0d0b; box-shadow: inset 0 1px 3px #000; overflow: visible; }
.heat-fill { position: relative; height: 100%; border-radius: 8px; transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, #ff3d12, var(--heat) 40%, #ffb03a 70%, var(--heat)); background-size: 220% 100%; animation: flame 1.6s linear infinite;
  box-shadow: 0 0 calc(var(--heat-glow, 0) * 22px) rgba(255,90,31,.65); }
.heat-fill::after { content: ""; position: absolute; left: 0; right: 0; bottom: 100%; height: 9px;
  background: radial-gradient(4px 8px at 50% 100%, rgba(255,140,40,.9), transparent 70%) 0 0 / 11px 9px repeat-x; animation: tongues .9s steps(3) infinite; opacity: calc(var(--heat-glow, 0)); }
@keyframes flame { to { background-position: -220% 0; } }
@keyframes tongues { 50% { transform: scaleY(.6) translateX(3px); } }
.audit-button { display: flex; justify-content: space-between; width: 100%; min-height: 54px; padding: 15px 16px; border: 0; border-radius: 6px; background: var(--paper); color: var(--ink); font-weight: 700; font-size: 16px; }
.audit-button .arrow { display: inline-block; }
.audit-button:disabled { background: var(--surface); color: #6e6458; border: 1px solid var(--edge); }
.picker-actions { display: flex; justify-content: center; margin-top: 6px; }
.action { display: inline-flex; align-items: center; min-height: 44px; border: 0; padding: 0 2px; background: transparent; text-decoration: underline; text-decoration-color: #5a4d40; text-underline-offset: 4px; }
.action:hover { text-decoration-color: var(--text); }
.action:disabled { color: #6e6458; text-decoration: none; }

.site-footer { display: flex; justify-content: center; margin-top: 56px; color: var(--muted); font-size: 13px; }
.skip-link { position: absolute; top: -100px; left: 20px; background: var(--surface); padding: 12px; z-index: 90; }
.skip-link:focus { top: 8px; }
.notice { background: var(--surface); border-left: 4px solid var(--marker); padding: 14px 16px; overflow-wrap: anywhere; }

/* fx pieces */
.fx-tag { position: absolute; padding: 3px 9px; font-weight: 700; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; background: var(--marker); color: #fff; border-radius: 3px; white-space: nowrap; }
.fx-bubble { position: absolute; padding: 5px 10px; background: var(--paper); color: var(--ink); border-radius: 12px; font-weight: 700; font-size: 13px; white-space: nowrap; }
.fx-bubble::after { content: ""; position: absolute; left: 14px; bottom: -6px; border: 6px solid transparent; border-top-color: var(--paper); border-bottom: 0; }
.fx-key { position: absolute; padding: 4px 10px 6px; background: #3a322a; border: 1px solid #5a4d40; border-bottom-width: 4px; border-radius: 5px; font-size: 12px; font-weight: 700; }
.fx-file { position: absolute; width: 10px; height: 13px; background: var(--paper); clip-path: polygon(0 0, 62% 0, 100% 32%, 100% 100%, 0 100%); }
.fx-bug { position: absolute; width: 3px; height: 3px; background: #7bd389; box-shadow: 3px 0 #7bd389, 6px 0 #7bd389, -3px -3px #7bd389, 9px -3px #7bd389, -3px 3px #7bd389, 9px 3px #7bd389, 3px 3px #7bd389, 6px 3px #7bd389; }
.fx-line { position: absolute; height: 2px; background: linear-gradient(90deg, transparent, var(--text)); border-radius: 2px; }
.fx-q { position: absolute; font-family: var(--head); font-size: 28px; color: var(--text); }
.fx-hook { position: absolute; width: 14px; height: 60px; }
.fx-mini { position: absolute; padding: 2px 8px; border-radius: 4px; background: #61dafb; color: var(--ink); font-size: 11px; font-weight: 700; }
.fx-steam { position: absolute; width: 6px; height: 22px; border-radius: 6px; background: rgba(239,232,220,.45); filter: blur(3px); }
.fx-word { position: absolute; font-family: var(--mono); font-weight: 700; font-size: 14px; color: var(--text); }
.fx-tab { position: absolute; width: 34px; height: 14px; border-radius: 5px 5px 0 0; background: #4a4037; border: 1px solid #6a5c4e; border-bottom: 0; }
.fx-sprout { position: absolute; width: 30px; height: 30px; }

/* result */
.result-screen { position: relative; max-width: 420px; margin: 10px auto 0; outline: none; }
.receipt-stage { position: relative; width: 100%; }
.receipt-stage-content { width: 100%; transform: scale(var(--receipt-scale, 1)); transform-origin: top center; }
.duel-receipts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; align-items: start; filter: drop-shadow(0 22px 24px rgba(0,0,0,.55)); }
body[data-view="duel"] .site-shell { max-width: 980px; }
body[data-view="duel"] .result-screen { max-width: none; }
body[data-view="duel"] .duel-receipts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.duel-verdict { text-align: center; font-family: var(--head); font-size: 34px; text-transform: lowercase; margin: 0 0 14px; }
.receipt { position: relative; font-family: var(--mono); font-size: 14px; color: var(--ink); background: var(--paper); padding: 28px 22px 34px; rotate: -2deg; transform-origin: top center;
  --tt: conic-gradient(from 135deg at top, #000 90deg, transparent 0) top / 12px 7px repeat-x;
  --tb: conic-gradient(from -45deg at bottom, #000 90deg, transparent 0) bottom / 12px 7px repeat-x;
  -webkit-mask: linear-gradient(#000 0 0) center / 100% calc(100% - 14px) no-repeat, var(--tt), var(--tb);
  mask: linear-gradient(#000 0 0) center / 100% calc(100% - 14px) no-repeat, var(--tt), var(--tb); }
#friend-receipt { rotate: 1.6deg; }
.duel-receipts .receipt { min-width: 0; width: 100%; max-width: 420px; justify-self: center; }
.receipt p { margin: 0; }
.receipt-owner { text-align: center; margin-bottom: 8px !important; text-transform: uppercase; }
.receipt-header { text-align: center; padding-bottom: 14px; }
.receipt-header h2 { margin: 0 0 4px; font-size: 18px; font-weight: 700; letter-spacing: 2px; }
.receipt-header p { font-size: 13px; color: #6b6257; }
.receipt-meta { border-top: 1px dashed #b9b0a0; padding: 12px 0; font-size: 13px; }
.receipt-meta p + p { margin-top: 2px; }
.receipt-columns { display: flex; justify-content: space-between; border-top: 1px dashed #b9b0a0; padding-top: 12px; margin-bottom: 8px; font-size: 13px; color: #6b6257; }
.receipt-items { list-style: none; padding: 0; margin: 0; }
.receipt-items li { padding-bottom: 10px; }
.line-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.line-name { overflow-wrap: anywhere; }
.line-points { flex-shrink: 0; }
.line-roast { margin-top: 2px !important; color: #6b6257; font-size: 13px; line-height: 1.35; overflow-wrap: anywhere; }
.receipt-combos { border-top: 1px dashed #b9b0a0; padding-top: 12px; }
.receipt-extra { border-top: 1px dashed #b9b0a0; padding: 12px 0; overflow-wrap: anywhere; font-size: 13px; }
.receipt-total { position: relative; border-top: 1px dashed #b9b0a0; padding: 16px 0 4px; }
.score-display { position: relative; z-index: 1; display: inline-block; font-family: var(--ui); font-size: clamp(66px, 20vw, 96px); line-height: 1.05; font-weight: 700; letter-spacing: -2px; margin: 4px 0 12px 10px; font-variant-numeric: tabular-nums; color: var(--heat); transform-origin: left bottom; }
.marker { position: absolute; left: -8px; top: 26px; width: 230px; height: 128px; overflow: visible; pointer-events: none; z-index: 2; }
.marker path { fill: none; stroke: var(--marker); stroke-width: 4.5; stroke-linecap: round; opacity: .85; }
#tier-name, .tier-name { position: absolute; right: 0; top: 46px; z-index: 3; display: block; width: max-content; border: 3px solid var(--marker); padding: 4px 10px; color: var(--marker); font-weight: 700; font-size: 18px; text-transform: uppercase; letter-spacing: 2px; transform: rotate(-9deg); opacity: .9; mix-blend-mode: multiply; }
.cashier-note { font-family: var(--hand); font-size: 28px; font-weight: 700; color: #2448a8; transform: rotate(-3deg); line-height: 1.1; min-height: 6px; }
.cashier-note:empty { display: none; }
.receipt-total #result-heading, .receipt-total .result-heading { font-size: 12px; margin-top: 12px; }
.receipt-footer { border-top: 1px dashed #b9b0a0; padding-top: 18px; text-align: center; font-size: 13px; }
.barcode { display: flex; justify-content: center; align-items: stretch; height: 44px; gap: 2px; overflow: hidden; }
.barcode span { display: block; background: var(--ink); flex-shrink: 0; transform-origin: 50% 100%; }
.receipt-footer p { margin-top: 8px; }
.share-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 18px; margin-top: 26px; }
.share-status { min-height: 21px; font-size: 13px; color: var(--muted); margin: 10px 0 0; overflow-wrap: anywhere; text-align: center; }
textarea { margin-top: 12px; min-height: 140px; font-size: 14px; resize: vertical; }

@media (max-width: 960px) {
  .kitchen { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .printer { position: sticky; top: auto; bottom: 0; z-index: 20; margin: 22px -24px 0; padding: 8px 24px 4px; background: var(--bg); box-shadow: 0 -14px 24px -10px rgba(0,0,0,.8); }
  .printer-head { height: 22px; }
  .slot { bottom: 5px; height: 5px; }
  .live-receipt { margin: -4px 22px 0; padding: 6px 12px 12px; max-height: 58px; font-size: 12px; }
  .lr-title, .lr-sub, .lr-total { display: none; }
  .lr-lines { min-height: 0; padding: 0; }
  .live-receipt { max-height: 46px; }
  .heat { padding: 8px 0 8px; }
  .audit-button { min-height: 48px; padding: 12px 14px; }
  .picker-actions { margin-top: 0; }
  .picker-actions .action { min-height: 34px; font-size: 14px; }
}
@media (max-width: 639px) {
  .site-shell { padding: 18px 16px 16px; }
  .hero { padding: 22px 0 24px; }
  .hero-sub { font-size: 16px; }
  .printer { margin-inline: -16px; padding-inline: 16px; }
  .rail-ticket { width: 96px; }
  .chip { font-size: 15px; padding: 10px 12px 9px 18px; }
  body:has(.result-screen:not([hidden])) .site-shell { padding: 14px 18px 8px; }
  body:has(.result-screen:not([hidden])) .site-footer { margin-top: 10px; }
  .result-screen { margin-top: 0; }
  .receipt { padding: 16px 14px 22px; font-size: 13px; }
  .receipt-header { padding-bottom: 8px; }
  .receipt-meta { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; padding: 8px 0; line-height: 1.35; }
  .receipt-meta p + p { margin: 0; }
  .receipt-meta p:nth-child(2) { grid-column: 1 / -1; grid-row: 2; }
  .receipt-meta p:nth-child(3) { grid-column: 2; grid-row: 1; }
  .receipt-columns { padding-top: 7px; margin-bottom: 6px; }
  .receipt-items li { padding-bottom: 6px; line-height: 1.35; }
  .line-heading { gap: 8px; }
  .receipt.is-dense .receipt-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 3px 12px; }
  .receipt.is-dense .receipt-items li { min-width: 0; padding-bottom: 3px; font-size: 12px; line-height: 1.35; }
  body[data-view="result"] .receipt.is-packed .receipt-items { display: block; columns: 2; column-gap: 12px; }
  body[data-view="result"] .receipt.is-packed .receipt-items li { break-inside: avoid; padding-bottom: 2px; line-height: 1.15; }
  .receipt-combos { padding-top: 7px; }
  .receipt-extra { padding: 8px 0; }
  .receipt-total { padding: 10px 0 4px; }
  .score-display { font-size: 66px; line-height: 1; margin: 6px 0 10px 10px; }
  .marker { top: 8px; left: -8px; width: 180px; height: 100px; }
  #tier-name, .tier-name { top: 30px; font-size: 15px; }
  .cashier-note { font-size: 24px; }
  .receipt-footer { padding-top: 10px; }
  .barcode { height: 28px; }
  .receipt-footer p { margin-top: 6px; }
  .share-actions { gap: 0 14px; margin-top: 12px; }
  body[data-view="duel"] .duel-receipts { gap: 10px; }
  body[data-view="duel"] .receipt { padding: 10px 8px 16px; font-size: 11px; }
  body[data-view="duel"] .receipt-header h2 { font-size: 12px; letter-spacing: 0; }
  body[data-view="duel"] .receipt-meta { display: block; }
  body[data-view="duel"] .receipt-items, body[data-view="duel"] .receipt.is-dense .receipt-items { display: block; }
  body[data-view="duel"] .receipt-items li { padding-bottom: 4px; font-size: 11px; line-height: 1.35; }
  body[data-view="duel"] .score-display { font-size: 42px; letter-spacing: -1px; }
  body[data-view="duel"] .marker { width: 120px; height: 70px; }
  body[data-view="duel"] .tier-name { position: static; margin-top: 4px; font-size: 11px; }
  body[data-view="duel"] .cashier-note { font-size: 17px; }
  body[data-view="duel"] .barcode { gap: 1px; }
  body[data-view="duel"] .barcode span { flex-shrink: 1; min-width: 1px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
