/* Thunderbloom — everything on screen that is not the sky. The look is a firework packet label, about 1910:
   cream paper, black keylines, vermilion, chrome yellow, Prussian blue, a little gold. */

@font-face { font-family: 'Rye'; src: url(../fonts/rye.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Alfa Slab One'; src: url(../fonts/alfa.woff2) format('woff2'); font-display: swap; }
@font-face { font-family: 'Bitter'; src: url(../fonts/bitter.woff2) format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Bitter'; src: url(../fonts/bitter-italic.woff2) format('woff2'); font-weight: 100 900; font-style: italic; font-display: swap; }

:root {
  --paper: #f3e5c0; --paper-2: #fbf2d8; --paper-3: #e4d19f; --ink: #17130e; --ink-soft: #4a4034;
  --red: #dd3a1e; --red-deep: #a8260f; --yellow: #f6c21c; --blue: #14365a; --blue-deep: #0a1c30; --blue-mid: #23577f;
  --green: #1f8a52; --gold: #c2932f;
  --display: 'Rye', 'Alfa Slab One', Georgia, serif; --head: 'Alfa Slab One', 'Rockwell', Georgia, serif; --body: 'Bitter', Georgia, 'Times New Roman', serif;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .25 0 0 0 0 .1 0 0 0 .1 0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)'/%3E%3C/svg%3E");
  --u: 1px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #05070f; color: var(--ink); font: 15px/1.38 var(--body); -webkit-user-select: none; user-select: none; touch-action: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
#sky, #over { position: fixed; inset: 0; width: 100vw; height: 100vh; display: block; }
#over { pointer-events: none; }
#ui { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
#ui > * { pointer-events: auto; }
.hidden { display: none !important; }

/* ---- paper */
.label { position: relative; background: var(--paper) var(--grain); color: var(--ink); border: 2px solid var(--ink); border-radius: 5px;
  box-shadow: 3px 3px 0 var(--red-deep), 0 10px 30px rgba(0, 0, 0, .5); }
.label::after { content: ''; position: absolute; inset: 4px; border: 1px solid rgba(23, 19, 14, .55); border-radius: 2px; pointer-events: none; }
.label.blue { background: var(--blue) var(--grain); color: var(--paper-2); box-shadow: 3px 3px 0 var(--ink), 0 10px 30px rgba(0, 0, 0, .5); }
.label.blue::after { border-color: rgba(246, 194, 28, .55); }
h1, h2, h3 { font-family: var(--head); font-weight: 400; margin: 0; letter-spacing: .02em; line-height: 1.1; }
.display { font-family: var(--display); letter-spacing: .03em; }
.caps { font-family: var(--head); text-transform: uppercase; letter-spacing: .09em; font-size: 11px; }
.dim { color: var(--ink-soft); }
.blue .dim { color: #b9c6d6; }
i, em, .quote { font-style: italic; }

/* ---- buttons: little printed tags */
.btn { position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 38px; padding: 6px 15px 7px; font-family: var(--head); font-size: 15px; letter-spacing: .04em;
  color: var(--ink); background: var(--yellow); border: 2px solid var(--ink); border-radius: 4px; box-shadow: 2px 3px 0 var(--ink); transition: transform .06s, box-shadow .06s, filter .12s; white-space: nowrap; }
.btn:hover { filter: brightness(1.07); }
.btn:active, .btn.down { transform: translate(2px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn.red { background: var(--red); color: #fff6dc; }
.btn.blue { background: var(--blue-mid); color: #fff6dc; }
.btn.plain { background: var(--paper-2); }
.btn.ghost { background: rgba(10, 28, 48, .72); color: var(--paper-2); border-color: var(--paper-3); box-shadow: 2px 3px 0 rgba(0, 0, 0, .6); }
.btn.big { min-height: 50px; font-size: 20px; padding: 8px 24px 10px; }
.btn.small { min-height: 30px; font-size: 12.5px; padding: 3px 10px 4px; box-shadow: 1px 2px 0 var(--ink); }
.btn[disabled] { filter: grayscale(.8) brightness(.8); opacity: .6; cursor: default; pointer-events: none; }
.btn .key { font-family: var(--body); font-size: 10.5px; font-weight: 700; padding: 0 5px; border: 1px solid currentColor; border-radius: 3px; opacity: .7; }

/* ---- chips: one choice among several */
.chips { display: flex; flex-wrap: wrap; gap: 5px; }
.chip { display: inline-flex; align-items: center; gap: 5px; min-height: 30px; padding: 3px 9px 4px; font-size: 13px; font-weight: 600; background: var(--paper-2); border: 1.5px solid var(--ink); border-radius: 15px; color: var(--ink); }
.chip:hover { background: #fff8e4; }
.chip.on { background: var(--ink); color: var(--paper-2); }
.chip.new::after, .tin.new::after { content: 'NEW'; font-family: var(--head); font-size: 8.5px; letter-spacing: .08em; color: #fff; background: var(--red); padding: 1px 4px; border-radius: 3px; margin-left: 3px; }
.seg { display: inline-flex; border: 1.5px solid var(--ink); border-radius: 5px; overflow: hidden; background: var(--paper-2); }
.seg button { border: 0; border-right: 1.5px solid var(--ink); background: none; padding: 4px 10px 5px; min-height: 30px; font-size: 13px; font-weight: 600; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--ink); color: var(--paper-2); }
.row { display: flex; align-items: center; gap: 8px; margin: 6px 0; flex-wrap: wrap; }
.row > .caps { flex: 0 0 62px; }

/* ---- the top bar and corners */
.topbar { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 8px; padding: 10px 12px; pointer-events: none; }
.topbar > * { pointer-events: auto; }
.topbar .spacer { flex: 1; }
.sign { font-family: var(--display); font-size: 22px; color: var(--paper-2); text-shadow: 2px 2px 0 var(--ink), 0 0 18px rgba(0, 0, 0, .8); }
.tally { display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px 5px; font-family: var(--head); font-size: 15px; color: var(--yellow); background: rgba(10, 28, 48, .78); border: 1.5px solid var(--paper-3); border-radius: 16px; }

/* ---- stars */
.stars { display: inline-flex; gap: 1px; font-size: 17px; line-height: 1; letter-spacing: 1px; }
.stars b { color: var(--red); font-weight: 400; -webkit-text-stroke: 1px var(--ink); }
.stars s { color: transparent; text-decoration: none; -webkit-text-stroke: 1px var(--ink-soft); }

/* ---- toasts */
#toasts { position: absolute; left: 50%; top: 62px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; z-index: 60; width: min(92vw, 520px); }
.toast { padding: 9px 16px 10px; max-width: 100%; text-align: center; animation: toast-in .35s cubic-bezier(.2, 1.3, .4, 1) both; }
.toast.out { animation: toast-out .4s ease-in both; }
.toast h3 { font-size: 16px; }
.toast p { margin: 2px 0 0; font-size: 13px; }
@keyframes toast-in { from { transform: translateY(-24px) scale(.9); opacity: 0; } }
@keyframes toast-out { to { transform: translateY(-16px); opacity: 0; } }

/* ---- title */
.title { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center; padding: 20px; }
.title .logo { font-family: var(--display); font-size: clamp(44px, 10.5vw, 128px); line-height: .95; color: var(--yellow); text-shadow: 3px 3px 0 var(--red), 6px 6px 0 var(--ink), 0 0 60px rgba(0, 0, 0, .8); letter-spacing: .02em; }
.title img.logo { width: min(86vw, 640px); height: auto; filter: drop-shadow(0 10px 30px rgba(0, 0, 0, .7)); }
.title .strap { font-family: var(--head); font-size: clamp(12px, 2vw, 17px); letter-spacing: .28em; text-transform: uppercase; color: var(--paper-2); text-shadow: 2px 2px 0 var(--ink); }
.title .menu { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; align-items: center; }
.title .menu .rowb { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.title .foot { position: absolute; bottom: 12px; left: 0; right: 0; font-size: 12px; color: #b9c6d6; text-shadow: 1px 1px 0 #000; }

/* ---- town: a street of posters */
.town { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; }
.town .blurb { align-self: center; max-width: min(92vw, 640px); margin: 0 12px 10px; padding: 8px 16px 9px; text-align: center; font-size: 14px; color: var(--paper-2); background: rgba(8, 20, 36, .7); border: 1px solid rgba(246, 194, 28, .4); border-radius: 4px; }
.posters { display: flex; gap: 12px; padding: 8px 16px 18px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; touch-action: pan-x; align-items: flex-end; }
.posters::-webkit-scrollbar { display: none; }
.posters::before, .posters::after { content: ''; flex: 1 0 0; }
.poster { flex: 0 0 150px; padding: 9px 9px 10px; text-align: center; cursor: pointer; transition: transform .12s; }
.poster:hover { transform: translateY(-5px) rotate(-.6deg); }
.poster img, .poster .face { width: 96px; height: 96px; margin: 2px auto 5px; display: block; border-radius: 50%; border: 2px solid var(--ink); background: var(--paper-3); object-fit: cover; }
.poster .face { display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 44px; color: var(--ink-soft); }
.poster h3 { font-size: 13.5px; min-height: 30px; display: flex; align-items: center; justify-content: center; }
.poster .who { font-size: 11.5px; color: var(--ink-soft); margin: 1px 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.poster.shut { filter: grayscale(1) brightness(.72); cursor: default; }
.poster.shut:hover { transform: none; }
.poster.festival { flex-basis: 178px; }
.poster.festival h3 { font-family: var(--display); font-size: 17px; color: var(--yellow); min-height: 40px; }
.poster.next { outline: 3px solid var(--yellow); outline-offset: 3px; animation: nudge 1.6s ease-in-out infinite; }
@keyframes nudge { 50% { transform: translateY(-6px); } }
.travel { position: absolute; top: 50%; transform: translateY(-50%); }
.travel.left { left: 10px; } .travel.right { right: 10px; }

/* ---- a commission: the ticket on the left, the bench on the right */
.ticket { position: absolute; left: 12px; top: 58px; width: 318px; max-height: calc(100% - 140px); padding: 12px 13px 12px; overflow-y: auto; scrollbar-width: thin; }
.ticket .head { display: flex; gap: 10px; align-items: center; }
.ticket .head img, .ticket .head .face { width: 74px; height: 74px; flex: 0 0 74px; border-radius: 50%; border: 2px solid var(--ink); background: var(--paper-3); object-fit: cover; }
.ticket .head .face { display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 34px; color: var(--ink-soft); }
.ticket h2 { font-size: 19px; }
.ticket .who { font-size: 12.5px; font-weight: 700; }
.ticket .quote { margin: 9px 0 8px; font-size: 13.5px; line-height: 1.4; }
.ticket .quote::before { content: '\201C'; } .ticket .quote::after { content: '\201D'; }
.wants { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--ink); }
.wants li { display: flex; gap: 8px; align-items: baseline; padding: 5px 2px; border-bottom: 1px dashed rgba(23, 19, 14, .35); font-size: 13.5px; font-weight: 600; }
.wants li .mark { flex: 0 0 18px; font-family: var(--head); font-size: 15px; text-align: center; }
.wants li.ok .mark { color: var(--green); } .wants li.no .mark { color: var(--red); } .wants li.unknown .mark { color: var(--ink-soft); }
.wants li small { display: block; font-weight: 400; font-size: 11.5px; color: var(--ink-soft); }
.wants li.star { font-weight: 500; font-style: italic; }
.wants li.star .mark { color: var(--gold); font-style: normal; }
.ticket .foot { display: flex; gap: 8px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.hintbox { margin-top: 8px; padding: 7px 9px; font-size: 12.5px; background: var(--paper-2); border: 1px dashed var(--ink); border-radius: 4px; }

.bench { position: absolute; right: 12px; top: 58px; width: 372px; max-height: calc(100% - 70px); display: flex; flex-direction: column; padding: 0; }
.bench .scroll { overflow-y: auto; padding: 10px 13px 12px; scrollbar-width: thin; }
.bench header { display: flex; align-items: center; gap: 8px; padding: 9px 13px 8px; border-bottom: 2px solid var(--ink); background: var(--red) var(--grain); color: #fff6dc; border-radius: 3px 3px 0 0; }
.bench header h2 { flex: 1; font-size: 14px; line-height: 1.15; }
.bench header .cost { font-family: var(--head); font-size: 17px; background: var(--yellow); color: var(--ink); border: 2px solid var(--ink); border-radius: 50%; width: 46px; height: 46px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; flex: 0 0 46px; }
.bench header .cost small { font-family: var(--body); font-size: 8.5px; font-weight: 700; letter-spacing: .04em; }
.bench .slots { display: flex; gap: 4px; padding: 7px 13px 0; }
.bench .slots .chip { border-radius: 4px; }
.bench .topgrid { display: grid; grid-template-columns: 132px 1fr; gap: 10px; align-items: start; }
.bench canvas.cut { width: 132px; height: 132px; display: block; cursor: pointer; }
.bench h4 { font-family: var(--head); font-weight: 400; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; margin: 11px 0 5px; padding-bottom: 2px; border-bottom: 1.5px solid var(--ink); display: flex; align-items: center; gap: 6px; }
.bench h4 .spacer { flex: 1; }
.tabs { display: flex; gap: 4px; margin-top: 10px; border-bottom: 2px solid var(--ink); }
.tabs button { font-family: var(--head); font-size: 12.5px; letter-spacing: .05em; padding: 5px 11px 5px; background: var(--paper-3); border: 2px solid var(--ink); border-bottom: 0; border-radius: 5px 5px 0 0; margin-bottom: -2px; opacity: .75; }
.tabs button.on { background: var(--paper); opacity: 1; padding-bottom: 7px; }
.tabs button.add { background: none; border-style: dashed; }
.coats { display: flex; flex-direction: column; gap: 4px; }
.coat { display: flex; align-items: center; gap: 7px; padding: 4px 7px; border: 1.5px solid var(--ink); border-radius: 5px; background: var(--paper-2); font-size: 13px; font-weight: 600; cursor: pointer; }
.coat.on { outline: 2.5px solid var(--red); outline-offset: 1px; }
.coat .sw { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--ink); flex: 0 0 22px; }
.coat .len { margin-left: auto; display: inline-flex; gap: 2px; }
.coat .len i { width: 7px; height: 12px; border: 1.5px solid var(--ink); border-radius: 2px; }
.coat .len i.f { background: var(--ink); }
.coat .x { border: 0; background: none; font-weight: 700; padding: 0 3px; opacity: .6; }
.tins { display: flex; gap: 6px; flex-wrap: wrap; }
.tin { position: relative; width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--ink); display: flex; align-items: center; justify-content: center; font-family: var(--head); font-size: 10px; color: rgba(0, 0, 0, .75); box-shadow: inset 0 -5px 0 rgba(0, 0, 0, .18), inset 0 4px 0 rgba(255, 255, 255, .25); text-align: center; line-height: 1; padding: 0; }
.tin.on { outline: 3px solid var(--ink); outline-offset: 2px; }
.tin.new::after { position: absolute; top: -6px; right: -10px; }
.flame-name { font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 6px; }
.flame-name .sw { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--ink); }
.note { font-size: 12px; color: var(--ink-soft); margin: 3px 0 0; min-height: 16px; }
.gauges { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin-top: 4px; font-size: 12.5px; }
.gauge { display: flex; justify-content: space-between; gap: 6px; border-bottom: 1px dashed rgba(23, 19, 14, .35); padding: 2px 0; }
.gauge b { font-weight: 700; text-align: right; }
.lightbar { grid-column: 1 / -1; height: 14px; display: flex; border: 1.5px solid var(--ink); border-radius: 7px; overflow: hidden; margin-top: 3px; }
.lightbar i { display: block; height: 100%; }
.lightkey { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 2px 9px; font-size: 11.5px; }
.lightkey span::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; border: 1px solid var(--ink); background: var(--c); margin-right: 3px; }
input[type=range] { -webkit-appearance: none; appearance: none; flex: 1; height: 6px; background: var(--ink); border-radius: 3px; min-width: 80px; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--yellow); border: 2px solid var(--ink); }
input[type=range]::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--yellow); border: 2px solid var(--ink); }
.actions { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; }

/* the pattern card */
.card-ed { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; }
.card-ed canvas { width: 204px; height: 204px; display: block; cursor: crosshair; touch-action: none; border-radius: 50%; }
.stencils { display: flex; flex-wrap: wrap; gap: 4px; }
.stencils .chip { min-height: 26px; padding: 2px 8px; font-size: 12px; }
.reads { font-weight: 700; font-size: 13px; margin: 4px 0; }

/* ---- the verdict */
.veil { position: absolute; inset: 0; background: rgba(4, 8, 16, .55); display: flex; align-items: center; justify-content: center; padding: 14px; z-index: 40; animation: fade .25s both; }
@keyframes fade { from { opacity: 0; } }
.verdict { width: min(94vw, 520px); max-height: 94%; overflow-y: auto; padding: 16px 18px 16px; animation: pop .4s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes pop { from { transform: scale(.8) rotate(-2deg); opacity: 0; } }
.verdict .head { display: flex; gap: 12px; align-items: center; }
.verdict .head img, .verdict .head .face { width: 92px; height: 92px; flex: 0 0 92px; border-radius: 50%; border: 2px solid var(--ink); object-fit: cover; background: var(--paper-3); }
.verdict .head .face { display: flex; align-items: center; justify-content: center; font-family: var(--display); font-size: 40px; color: var(--ink-soft); }
.verdict .line { font-size: 15.5px; font-style: italic; margin: 0; }
.verdict .bigstars { font-size: 44px; text-align: center; margin: 8px 0 4px; letter-spacing: 8px; }
.verdict .bigstars b { color: var(--red); -webkit-text-stroke: 2px var(--ink); display: inline-block; animation: star-in .5s cubic-bezier(.2, 1.6, .4, 1) both; }
.verdict .bigstars b:nth-child(2) { animation-delay: .25s; } .verdict .bigstars b:nth-child(3) { animation-delay: .5s; }
.verdict .bigstars s { color: transparent; -webkit-text-stroke: 2px var(--ink-soft); text-decoration: none; }
@keyframes star-in { from { transform: scale(0) rotate(-90deg); } }
.verdict .foot { display: flex; gap: 10px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.gift { display: flex; gap: 10px; align-items: center; margin-top: 8px; padding: 7px 10px; background: var(--paper-2); border: 1.5px dashed var(--ink); border-radius: 5px; }
.gift b { font-family: var(--head); font-weight: 400; font-size: 14px; }
.gift .tag { font-family: var(--head); font-size: 9px; letter-spacing: .08em; color: #fff; background: var(--red); padding: 2px 5px; border-radius: 3px; flex: 0 0 auto; }
.gift small { display: block; font-size: 12px; color: var(--ink-soft); }

/* ---- the firing line */
.rack { position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%); display: flex; gap: 8px; align-items: flex-end; max-width: 96vw; }
.tube { position: relative; width: 74px; padding: 5px 4px 6px; text-align: center; background: var(--paper) var(--grain); border: 2px solid var(--ink); border-radius: 6px; box-shadow: 2px 3px 0 var(--ink); cursor: pointer; transition: transform .08s; }
.tube.on { transform: translateY(-9px); background-color: var(--yellow); }
.tube.out { filter: grayscale(1) brightness(.6); }
.tube canvas { width: 46px; height: 46px; display: block; margin: 0 auto; }
.tube .n { font-family: var(--head); font-size: 13px; }
.tube .k { position: absolute; top: -9px; left: -7px; width: 20px; height: 20px; border-radius: 50%; background: var(--ink); color: var(--paper-2); font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.tube .nm { font-size: 9.5px; line-height: 1.05; height: 20px; overflow: hidden; font-weight: 600; }
.hud-tip { position: absolute; left: 50%; top: 62px; transform: translateX(-50%); padding: 7px 16px 8px; font-size: 14px; color: var(--paper-2); background: rgba(8, 20, 36, .78); border: 1px solid rgba(246, 194, 28, .5); border-radius: 4px; text-align: center; max-width: 92vw; pointer-events: none; }

/* ---- a plain dialog (almanac, catalogue, settings, how to play) */
.sheet { width: min(96vw, 860px); max-height: 92%; display: flex; flex-direction: column; animation: pop .35s cubic-bezier(.2, 1.3, .4, 1) both; }
.sheet header { display: flex; align-items: center; gap: 10px; padding: 11px 16px 10px; border-bottom: 2px solid var(--ink); }
.sheet header h2 { flex: 1; font-family: var(--display); font-size: 24px; }
.sheet .scroll { overflow-y: auto; padding: 12px 16px 16px; touch-action: pan-y; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 10px; }
.entry { padding: 9px 10px; border: 1.5px solid var(--ink); border-radius: 5px; background: var(--paper-2); font-size: 12.5px; }
.entry h3 { font-size: 15px; margin-bottom: 3px; }
.entry.blank { background: none; border-style: dashed; color: var(--ink-soft); }
.entry.blank h3 { color: var(--ink-soft); letter-spacing: .12em; }
.entry .stamp { float: right; font-family: var(--display); font-size: 10px; color: var(--red); border: 2px solid var(--red); border-radius: 50%; width: 38px; height: 38px; display: flex; align-items: center; justify-content: center; transform: rotate(-14deg); margin: -2px -2px 2px 6px; }
.cat { display: flex; gap: 8px; align-items: center; padding: 6px 8px; border: 1.5px solid var(--ink); border-radius: 5px; background: var(--paper-2); }
.cat canvas { width: 46px; height: 46px; flex: 0 0 46px; }
.cat .t { flex: 1; min-width: 0; font-size: 12.5px; }
.cat .t b { display: block; font-size: 13.5px; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
input[type=text] { font: inherit; padding: 6px 9px; border: 2px solid var(--ink); border-radius: 4px; background: var(--paper-2); color: var(--ink); min-width: 0; -webkit-user-select: text; user-select: text; }

/* ---- small screens. A phone held upright: the ticket becomes a strip and the bench a drawer along the bottom. */
@media (max-width: 699px) {
  body { font-size: 14px; }
  .ticket { left: 6px; right: 6px; top: 48px; width: auto; max-height: 30%; padding: 8px 10px; }
  .ticket .head img, .ticket .head .face { width: 44px; height: 44px; flex-basis: 44px; }
  .ticket h2 { font-size: 16px; }
  .ticket.folded .quote, .ticket.folded .foot, .ticket.folded .hintbox, .ticket.folded .wants li small { display: none; }
  .ticket.folded .wants li { padding: 2px; font-size: 12.5px; }
  .bench { left: 6px; right: 6px; top: auto; bottom: 60px; width: auto; max-height: 44%; }
  .bench .topgrid { grid-template-columns: 104px 1fr; }
  .bench canvas.cut { width: 104px; height: 104px; }
  .card-ed { grid-template-columns: 1fr; }
  .actions { bottom: 8px; }
  .btn.big { min-height: 44px; font-size: 17px; padding: 6px 16px 8px; }
  .posters { padding: 6px 10px 12px; gap: 9px; }
  .poster { flex-basis: 124px; }
  .poster img, .poster .face { width: 72px; height: 72px; }
  .sign { font-size: 16px; }
  .town .blurb { font-size: 12.5px; }
  .tube { width: 56px; } .tube canvas { width: 34px; height: 34px; } .tube .nm { display: none; }
  .rack { gap: 5px; }
  .topbar { padding: 7px 8px; gap: 5px; flex-wrap: wrap; }
  .hud-tip { top: 96px; font-size: 12.5px; }
}
/* A phone held sideways, or any short wide window: ticket and bench stay side by side, but smaller. */
@media (min-width: 700px) and (max-height: 520px) {
  body { font-size: 13px; }
  .ticket { top: 44px; width: 250px; padding: 8px 10px; max-height: calc(100% - 52px); }
  .ticket .head img, .ticket .head .face { width: 48px; height: 48px; flex-basis: 48px; }
  .ticket h2 { font-size: 15px; }
  .ticket .quote { font-size: 12px; margin: 5px 0; }
  .wants li { font-size: 12px; padding: 3px 2px; }
  .bench { top: 44px; width: 318px; max-height: calc(100% - 52px); }
  .bench .topgrid { grid-template-columns: 96px 1fr; }
  .bench canvas.cut { width: 96px; height: 96px; }
  .bench header h2 { font-size: 12.5px; }
  .bench header .cost { width: 38px; height: 38px; flex-basis: 38px; font-size: 14px; }
  .tin { width: 36px; height: 36px; font-size: 8.5px; }
  .actions { bottom: 8px; }
  .btn.big { min-height: 40px; font-size: 16px; padding: 5px 14px 7px; }
  .btn { min-height: 34px; font-size: 13.5px; }
  .poster { flex-basis: 118px; padding: 6px 6px 7px; }
  .poster img, .poster .face { width: 60px; height: 60px; }
  .poster h3 { font-size: 12px; min-height: 26px; }
  .town .blurb { display: none; }
  .tube { width: 60px; padding: 3px; } .tube canvas { width: 34px; height: 34px; } .tube .nm { display: none; }
  .title .logo, .title img.logo { width: min(60vw, 420px); }
  .title .menu { margin-top: 4px; gap: 6px; }
  .prep-cols { padding-top: 46px; }
}

/* ---- a festival: who is coming on the left, the racks on the right */
.prep { position: absolute; inset: 0; display: flex; flex-direction: column; }
.prep-cols { flex: 1; min-height: 0; display: flex; gap: 14px; justify-content: center; align-items: flex-start; padding: 56px 14px 14px; }
.prep-info { flex: 0 1 340px; max-height: 100%; overflow-y: auto; padding: 13px 15px; scrollbar-width: thin; }
.prep-info .wants { border-top-color: rgba(246, 194, 28, .5); }
.prep-info .wants li { border-bottom-color: rgba(251, 242, 216, .25); font-weight: 600; }
.prep-info .wants li small { color: #b9c6d6; }
.prep-info .wants li .mark { color: var(--yellow) !important; }
.prep-info .gauge { border-bottom-color: rgba(251, 242, 216, .25); }
.prep-tubes { flex: 0 1 520px; max-height: 100%; display: flex; flex-direction: column; }
.prep-tubes header { display: flex; align-items: baseline; gap: 10px; padding: 11px 14px 9px; border-bottom: 2px solid var(--ink); }
.prep-tubes header h2 { flex: 1; font-family: var(--display); font-size: 22px; }
.tubelist { overflow-y: auto; padding: 10px 13px 6px; display: flex; flex-direction: column; gap: 7px; scrollbar-width: thin; }
.tuberow { display: flex; gap: 9px; align-items: center; padding: 6px 8px; border: 1.5px solid var(--ink); border-radius: 5px; background: var(--paper-2); }
.tuberow canvas { width: 46px; height: 46px; flex: 0 0 46px; }
.tuberow .t { flex: 1; min-width: 0; font-size: 12.5px; }
.tuberow .t b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tuberow .b { display: flex; gap: 5px; }
.tuberow.add { border-style: dashed; background: none; flex-wrap: wrap; }
.says { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.says span { font-size: 10.5px; font-weight: 700; padding: 0 5px 1px; border-radius: 8px; border: 1px solid var(--ink); background: #fff; }
.says .love { background: var(--green); color: #fff; } .says .like { background: #cfe7c2; } .says .meh { background: var(--paper-3); color: var(--ink-soft); } .says .hate { background: var(--red); color: #fff; }

.showhud { position: absolute; top: 8px; right: 12px; display: flex; gap: 8px; pointer-events: none; }
.showhud > div { min-width: 86px; padding: 3px 12px 5px; text-align: right; background: rgba(8, 20, 36, .78); border: 1.5px solid var(--paper-3); border-radius: 5px; color: var(--paper-2); line-height: 1.05; }
.showhud small { display: block; font-family: var(--head); font-size: 9.5px; letter-spacing: .12em; color: #b9c6d6; }
.showhud b { font-family: var(--head); font-weight: 400; font-size: 23px; color: var(--yellow); }
.showhud .next { display: block; font-style: normal; font-size: 10.5px; color: #b9c6d6; margin-top: 1px; }

/* ---- the morning paper */
.gazette { width: min(96vw, 820px); max-height: 94%; overflow-y: auto; padding: 14px 20px 14px; background: #ece3cc var(--grain); color: #1b1712; border: 1px solid #1b1712; box-shadow: 0 16px 50px rgba(0, 0, 0, .7); transform: rotate(-.4deg); animation: paper-in .6s cubic-bezier(.2, 1.1, .3, 1) both; touch-action: pan-y; }
@keyframes paper-in { from { transform: translateY(40px) rotate(4deg) scale(.86); opacity: 0; } }
.gazette .mast { display: flex; align-items: flex-end; gap: 10px; border-bottom: 4px double #1b1712; padding-bottom: 5px; font-size: 11px; text-transform: uppercase; letter-spacing: .1em; }
.gazette .mast h1 { flex: 1; text-align: center; font-size: clamp(22px, 4.6vw, 40px); letter-spacing: .01em; text-transform: none; }
.gazette .head { font-family: var(--head); font-size: clamp(20px, 4.2vw, 36px); text-align: center; line-height: 1.05; margin: 10px 0 4px; }
.gazette .deck { text-align: center; font-style: italic; font-size: 14px; border-bottom: 1px solid #1b1712; padding-bottom: 7px; }
.gazette .cols { display: grid; grid-template-columns: 1.15fr 1fr; gap: 16px; margin-top: 10px; }
.gazette .col p { margin: 0 0 8px; font-size: 13.5px; line-height: 1.4; text-align: justify; hyphens: auto; }
.gazette .col > p:first-of-type::first-letter { font-family: var(--head); font-size: 32px; float: left; line-height: .85; padding: 3px 5px 0 0; }
.gazette figure { margin: 0 0 9px; }
.gazette figure img { width: 100%; display: block; border: 1px solid #1b1712; filter: grayscale(.92) contrast(1.25) sepia(.28) brightness(1.08); }
.gazette figcaption { font-size: 10.5px; font-style: italic; text-align: center; margin-top: 3px; }
.gazette .box { border: 2px solid #1b1712; padding: 8px 10px 9px; margin-bottom: 9px; text-align: center; }
.gazette .box .joy { font-family: var(--head); font-size: 40px; line-height: 1; }
.gazette .box .joy small { font-family: var(--body); font-size: 13px; }
.gazette .box .bigstars { font-size: 34px; letter-spacing: 6px; margin: 2px 0 4px; }
.gazette .box .bigstars b { color: var(--red); -webkit-text-stroke: 1.5px #1b1712; display: inline-block; animation: star-in .5s cubic-bezier(.2, 1.6, .4, 1) both .6s; }
.gazette .box .bigstars b:nth-child(2) { animation-delay: .9s; } .gazette .box .bigstars b:nth-child(3) { animation-delay: 1.2s; }
.gazette .box .bigstars s { color: transparent; -webkit-text-stroke: 1.5px #7a6f5e; text-decoration: none; }
.gazette .box .gauges { text-align: left; }
.register { border-top: 1px solid #1b1712; padding-top: 6px; font-size: 12.5px; }
.register ol { margin: 4px 0 0; padding-left: 22px; }
.register li { display: list-item; }
.register li span { display: inline-block; min-width: 55%; }
.register li b { float: right; }
.register li.me { font-weight: 800; color: var(--red-deep); }
.gazette .foot { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; border-top: 4px double #1b1712; margin-top: 8px; padding-top: 11px; }
@media (max-width: 699px) {
  .prep-cols { flex-direction: column; align-items: stretch; overflow-y: auto; padding-top: 50px; touch-action: pan-y; }
  .prep-info, .prep-tubes { flex: 0 0 auto; max-height: none; }
  .gazette .cols { grid-template-columns: 1fr; }
  .showhud b { font-size: 18px; } .showhud > div { min-width: 64px; }
}

.pulse { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(246, 194, 28, .95), 2px 3px 0 var(--ink); } 50% { box-shadow: 0 0 0 9px rgba(246, 194, 28, 0), 2px 3px 0 var(--ink); } }
.tin.pulse { animation: tinpulse 1.1s ease-in-out infinite; }
@keyframes tinpulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(221, 58, 30, .95), inset 0 -5px 0 rgba(0, 0, 0, .18); transform: scale(1); } 50% { box-shadow: 0 0 0 9px rgba(221, 58, 30, 0), inset 0 -5px 0 rgba(0, 0, 0, .18); transform: scale(1.08); } }

.poster.daily { background-color: var(--yellow); }
.poster.daily h3 { font-family: var(--display); font-size: 15px; }
.verdict .register li { list-style: decimal; }
/* a toast must not sit on top of a verdict or a newspaper: while a dialog is up, toasts drop to the bottom */
#ui:has(.veil) #toasts { top: auto; bottom: 14px; flex-direction: column-reverse; }
/* at the bench, notes come up from the bottom, above the buttons, and leave the sky where shells open clear */
body.at-bench #toasts { top: auto; bottom: 136px; flex-direction: column-reverse; }
@media (min-width: 900px) {
  #ui:has(.veil) #toasts { left: auto; right: 14px; top: 14px; bottom: auto; transform: none; width: 228px; flex-direction: column; }
  #ui:has(.veil) .toast h3 { font-size: 14px; } #ui:has(.veil) .toast p { font-size: 12px; }
}
.title .world { max-width: min(92vw, 560px); font-size: 13px; font-style: italic; color: #d7e0ea; text-shadow: 1px 1px 0 #000, 0 0 10px rgba(0, 0, 0, .9); min-height: 18px; }
/* the bench's footer (Lucky dip, Keep, From catalogue) is a strip of its own under the scrolling part */
.bench > .row:last-child { border-top: 1.5px solid var(--ink); padding-top: 7px !important; background: var(--paper-3) var(--grain); border-radius: 0 0 3px 3px; flex-wrap: nowrap; }
/* six casings must fit beside the cutaway */
.bench .topgrid .seg { flex-wrap: wrap; }
.bench .topgrid .seg button { padding: 4px 7px 5px; font-size: 12.5px; min-height: 28px; }
.seg button.new { position: relative; }
.seg button.new::after { content: ''; position: absolute; top: 2px; right: 2px; width: 7px; height: 7px; border-radius: 50%; background: var(--red); border: 1px solid var(--ink); }

/* ---- scrolling panels: a scrollbar that is always there, and a cue when there is more below */
.bench .scroll, .ticket, .tubelist, .sheet .scroll, .verdict, .gazette, .prep-info { scrollbar-width: auto; scrollbar-color: var(--ink-soft) rgba(23, 19, 14, .12); }
.bench .scroll::-webkit-scrollbar, .ticket::-webkit-scrollbar, .tubelist::-webkit-scrollbar, .sheet .scroll::-webkit-scrollbar, .verdict::-webkit-scrollbar, .gazette::-webkit-scrollbar { width: 11px; }
.bench .scroll::-webkit-scrollbar-thumb, .ticket::-webkit-scrollbar-thumb, .tubelist::-webkit-scrollbar-thumb, .sheet .scroll::-webkit-scrollbar-thumb, .verdict::-webkit-scrollbar-thumb, .gazette::-webkit-scrollbar-thumb { background: var(--ink-soft); border-radius: 6px; border: 2px solid var(--paper); }
.bench .scroll::-webkit-scrollbar-track, .ticket::-webkit-scrollbar-track, .tubelist::-webkit-scrollbar-track, .sheet .scroll::-webkit-scrollbar-track, .verdict::-webkit-scrollbar-track, .gazette::-webkit-scrollbar-track { background: rgba(23, 19, 14, .1); }
.bench .scroll, .tubelist, .sheet .scroll { min-height: 0; flex: 1 1 auto; }
.more { position: sticky; bottom: -12px; margin: 6px -13px -12px; padding: 14px 0 6px; text-align: center; cursor: pointer; pointer-events: auto;
  background: linear-gradient(rgba(243, 229, 192, 0), var(--paper) 55%); font-family: var(--head); font-size: 11.5px; letter-spacing: .1em; color: var(--red-deep); }
.more.gone { visibility: hidden; }

/* ---- notes keep to one line, so the controls under them never jump; the whole note is on hover */
.bench .note { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-height: 16px; }
.bench .flame-name { min-height: 20px; }

/* ---- a verdict and a front page keep their buttons in reach, however long they get */
.verdict .foot, .gazette .foot { position: sticky; bottom: -16px; z-index: 2; margin-bottom: -16px; padding-bottom: 14px; }
.verdict .foot { background: var(--paper) var(--grain); border-top: 1.5px dashed rgba(23, 19, 14, .35); padding-top: 10px; }
.gazette .foot { background: #ece3cc var(--grain); }
.verdict { padding-bottom: 16px; }

/* ---- the street of posters fits the window; if it cannot, it scrolls sideways with the wheel and shows a bar */
.posters { scrollbar-width: thin; scrollbar-color: var(--paper-3) transparent; }
.posters::-webkit-scrollbar { display: block; height: 8px; }
.posters::-webkit-scrollbar-thumb { background: rgba(243, 229, 192, .6); border-radius: 4px; }
.poster { flex: 0 1 150px; min-width: 112px; }
.poster.festival { flex: 0 1 178px; min-width: 132px; }

/* ---- the coaching line sits above the buttons, clear of the bench's title and of toasts */
.hud-tip.coach { top: auto; bottom: 84px; max-width: min(92vw, 470px); }

/* ---- what is lent for today's order */
.chip.lent::after, .tin.lent::after { content: 'LENT'; font-family: var(--head); font-size: 8.5px; letter-spacing: .08em; color: #fff; background: var(--blue-mid); padding: 1px 4px; border-radius: 3px; margin-left: 3px; }
.tin.lent::after { position: absolute; top: -6px; right: -12px; }
.seg button.lent { position: relative; }
.seg button.lent::after { content: ''; position: absolute; top: 2px; right: 2px; width: 7px; height: 7px; border-radius: 50%; background: var(--blue-mid); border: 1px solid var(--ink); }

/* ---- the crowd's opinion on a rack row: words, not dots */
.says span { font-size: 11px; padding: 1px 6px 2px; }
.says span::before { margin-right: 3px; }
.says .love::before { content: '♥'; } .says .like::before { content: '✓'; } .says .meh::before { content: '·'; } .says .hate::before { content: '✗'; }
.prep-legend { font-size: 12.5px; margin: 0 0 4px; }
.prep-legend li { margin: 0 0 4px; }
.prep-legend b { font-family: var(--head); font-weight: 400; color: var(--yellow); letter-spacing: .03em; }
.prep-info details summary { cursor: pointer; font-family: var(--head); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--yellow); margin: 12px 0 6px; }
.coat-caption { font-size: 12px; font-style: italic; color: var(--ink-soft); margin: 6px 0 2px; }

/* a one-line note must not make its row wider than the bench */
.bench .row > div { min-width: 0; flex: 1 1 auto; }
.bench .row > .seg, .bench .row > input[type=range] { flex: 0 1 auto; }
/* badges sit on the corner of a pill, so pills never move when a badge goes */
.chip { position: relative; }
.chip.new::after, .chip.lent::after { position: absolute; top: -7px; right: -5px; margin: 0; line-height: 1.2; z-index: 1; }
/* the coat being worked on says so */
.coat .editing { font-family: var(--head); font-size: 9px; letter-spacing: .08em; color: #fff; background: var(--red); padding: 1px 5px; border-radius: 3px; margin-left: 4px; }
/* the cost of a shell, item by item */
.costline { grid-column: 1 / -1; font-size: 11.5px; color: var(--ink-soft); margin-top: 2px; }
.costline b { color: var(--ink); font-weight: 700; }
.tubelist .more, .prep-info .more { margin: 4px 0 -6px; }
