/* Sizes are in rem. The code sets the root font size every frame so that the whole shop
   fits the window at any shape (see fit() in src/main.js): 1rem is a tenth of a "design
   pixel block", about 10px on a 360x620 portrait screen. */
* { box-sizing: border-box; }
html { font-size: 10px; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #0f1622;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-weight: 800; letter-spacing: .02em; color: #eef3fa; font-size: 1.3rem;
  user-select: none; -webkit-user-select: none; touch-action: none; -webkit-tap-highlight-color: transparent;
}
/* The shop wall: a pegboard of soft dots under a warm lamp. */
body {
  background:
    radial-gradient(ellipse at 50% -10%, rgba(255,170,90,.20), transparent 60%),
    radial-gradient(circle, rgba(255,255,255,.055) 1px, transparent 1.6px) 0 0 / 2.2rem 2.2rem,
    linear-gradient(180deg, #162133, #0c121c);
}
.hidden { display: none !important; }
/* While the host has the game paused, every animation holds still. */
body.paused *, body.paused *::before, body.paused *::after { animation-play-state: paused !important; }
/* On YouTube the player uses YouTube's own mute button, so the game's are hidden. */
body.playables #btnSound, body.playables #btnMenuSound { display: none !important; }
button { font: inherit; letter-spacing: inherit; color: inherit; cursor: pointer; touch-action: manipulation; border: 0; background: none; padding: 0; }
svg { display: block; width: 100%; height: 100%; }
small { font-size: 1rem; color: #8fa0b8; letter-spacing: .08em; }

.card { background: rgba(26,36,52,.92); border: .15rem solid #2a3850; border-radius: 1.4rem; }

/* ---------- The shop ---------- */
#app {
  position: fixed; inset: 0; display: flex; flex-direction: column; gap: .7rem; justify-content: center;
  padding: max(.8rem, env(safe-area-inset-top)) max(.8rem, env(safe-area-inset-right)) max(.8rem, env(safe-area-inset-bottom)) max(.8rem, env(safe-area-inset-left));
  max-width: 54rem; margin: 0 auto;
}
#topbar { display: flex; gap: .6rem; align-items: center; flex: none; height: 3.4rem; }
.pill {
  display: flex; align-items: center; gap: .6rem; height: 3.4rem; padding: 0 1.2rem; white-space: nowrap;
  background: rgba(26,36,52,.92); border: .15rem solid #2a3850; border-radius: 1.7rem; font-size: 1.3rem;
}
i.coin { width: 1.8rem; height: 1.8rem; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff3b0, #ffd24a 45%, #c98a12); box-shadow: inset 0 0 0 .15rem #b7841a; flex: none; }
#coinPill b { color: #ffd24a; font-size: 1.5rem; letter-spacing: 0; }
#coinPill.bump { animation: bump .35s; }
@keyframes bump { 50% { transform: scale(1.15); } }
#queueDots { display: flex; gap: .35rem; }
#queueDots i { width: .9rem; height: .9rem; border-radius: 50%; background: #33435c; }
#queueDots i.done { background: #5fe0a0; }
#queueDots i.now { background: #ff9d4d; box-shadow: 0 0 0 .2rem rgba(255,157,77,.3); }
#btnSound { margin-left: auto; font-size: 1.1rem; }

/* The customer and what they want. */
#order { flex: none; display: grid; grid-template-columns: 5.6rem 1fr auto; gap: .2rem 1rem; align-items: center; padding: .9rem 1.1rem .8rem; position: relative; overflow: hidden; }
#order.in { animation: walkIn .35s ease-out; }
@keyframes walkIn { from { transform: translateX(3rem); opacity: 0; } }
#face { width: 5.6rem; height: 5.6rem; border-radius: 50%; background: #24324a; overflow: hidden; }
#orderTitle { font-size: 1.45rem; color: #ffd24a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#orderText { min-width: 0; }
#orderSay { font-size: 1.2rem; font-weight: 600; letter-spacing: 0; color: #c8d3e3; line-height: 1.25; margin-top: .2rem; }
#orderWish { font-size: 1.15rem; color: #ffd24a; margin-top: .3rem; font-weight: 700; letter-spacing: 0; }
#orderWish:empty { display: none; }
#orderWish.met { color: #5fe0a0; }
#orderPay { text-align: right; }
#orderPay small { display: block; }
#orderPay b { font-size: 2.1rem; color: #5fe0a0; letter-spacing: 0; }
#patience { grid-column: 1 / -1; height: .6rem; border-radius: .3rem; background: #24324a; overflow: hidden; margin-top: .5rem; }
#patience.off { visibility: hidden; }
#patienceFill { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff9d4d, #ffd24a); transform-origin: left; border-radius: .3rem; }
#patience.out #patienceFill { background: #55647c; }

/* What the build can do, with the customer's targets marked on each meter. */
#stats { flex: none; padding: .7rem 1.1rem; display: flex; flex-direction: column; gap: .35rem; justify-content: center; }
.stat { display: grid; grid-template-columns: 7.2rem 1fr 4.6rem; gap: .8rem; align-items: center; height: 2rem; font-size: 1.2rem; }
.stat > span { color: #c8d3e3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.asked > span { color: #fff; }
.track { position: relative; height: 1rem; border-radius: .5rem; background: #24324a; }
.track > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: .5rem; background: #5a7396; transition: width .25s ease-out; min-width: .3rem; }
.stat.asked .track > i { background: #ff9d4d; }
.stat.met .track > i { background: #5fe0a0; }
/* The target: a flag standing on the meter. */
.track > u { position: absolute; top: -.45rem; bottom: -.45rem; width: .3rem; margin-left: -.15rem; border-radius: .15rem; background: #fff; }
.track > u::after { content: ''; position: absolute; left: .3rem; top: 0; border: .4rem solid transparent; border-left-color: #fff; border-right: 0; }
.stat.met .track > u { background: #5fe0a0; }
.stat.met .track > u::after { border-left-color: #5fe0a0; }
/* The wish: a gold marker. */
.track > s { position: absolute; top: -.3rem; width: 1.6rem; height: 1.6rem; margin-left: -.8rem; text-decoration: none; }
.stat > b { text-align: right; letter-spacing: 0; white-space: nowrap; color: #8fa0b8; }
.stat.asked > b { color: #ff9d4d; }
.stat.met > b { color: #5fe0a0; }
.stat.pop > b { animation: bump .35s; }

/* The bench: seven places for seven parts. */
#bench { flex: 1 1 auto; min-height: 0; max-height: 44rem; display: flex; flex-direction: column; padding: .7rem .9rem .9rem; }
#benchHead { flex: none; display: flex; align-items: baseline; gap: 1rem; font-size: 1.05rem; color: #8fa0b8; letter-spacing: .1em; padding: 0 .3rem .5rem; }
#hint { font-style: normal; letter-spacing: 0; color: #ffd24a; font-size: 1.15rem; font-weight: 700; margin-left: auto; text-align: right; }
#slots {
  flex: 1; min-height: 0; display: grid; gap: .6rem;
  grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr);
  grid-template-areas: 'mb cpu cool' 'mem gpu sto' 'psu case case';
}
.slot {
  min-width: 0; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem;
  padding: .3rem .5rem; background: #212d42; border: .15rem solid #33435c; border-radius: 1.1rem; position: relative; overflow: hidden;
}
.slot:active { transform: scale(.97); }
.slot .pic { flex: 0 1 4.4rem; min-height: 2rem; aspect-ratio: 1; max-height: 4.4rem; }
.slot small { font-size: .95rem; }
.slot b { font-size: 1.25rem; letter-spacing: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.slot em { font-style: normal; font-size: 1.1rem; color: #ffd24a; letter-spacing: 0; }
.slot.wide { flex-direction: row; gap: 1rem; }
.slot.wide .txt { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.slot.empty { border-style: dashed; }
.slot.empty b { color: #8fa0b8; }
.slot.bad { border-color: #ff6b6b; background: #3a2230; }
.slot.bad::after { content: '!'; position: absolute; right: .5rem; top: .4rem; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: #ff6b6b; color: #2a0d12; font-size: 1.3rem; line-height: 1.8rem; text-align: center; }
.slot.snap { animation: snap .3s; }
@keyframes snap { 0% { transform: scale(.9); } 60% { transform: scale(1.04); } }
.slot.nudge { animation: nudge 1.2s ease-in-out infinite; border-color: #ffd24a; }
@keyframes nudge { 50% { box-shadow: 0 0 0 .4rem rgba(255,210,74,.25); } }

/* Power and cooling: what the parts use against what the build supplies. */
#meters { flex: none; display: grid; grid-template-columns: 1fr 1fr; gap: .4rem 1.4rem; padding: .7rem 1.1rem; }
.meter { display: grid; grid-template-columns: auto 1fr; gap: .2rem .8rem; align-items: center; font-size: 1.1rem; }
.meter > span { color: #c8d3e3; }
.meter > b { grid-column: 1 / -1; grid-row: 1; justify-self: end; letter-spacing: 0; color: #8fa0b8; font-size: 1.1rem; }
.meter > span { grid-row: 1; grid-column: 1; }
.meter .track { grid-column: 1 / -1; height: .8rem; }
.meter .track > i { background: #58b8ff; }
.meter.over .track > i { background: #ff6b6b; }
.meter.over > b { color: #ff6b6b; }

/* The till. */
#deal { flex: none; display: flex; gap: 1rem; align-items: center; }
#sums { display: flex; gap: 1.4rem; flex: none; padding-left: .4rem; }
#sums small { display: block; }
#sums b { font-size: 1.8rem; letter-spacing: 0; }
#keepText { color: #5fe0a0; }
#keepText.loss { color: #ff6b6b; }

button.big {
  flex: 1; min-width: 0; padding: 1rem 1.6rem; border-radius: 1.6rem; font-size: 1.7rem; color: #2b1703;
  background: linear-gradient(180deg, #ffc27a, #ff9d4d); box-shadow: 0 .4rem 0 #b9601a, 0 .8rem 1.6rem rgba(0,0,0,.35);
}
button.big:active { transform: translateY(.2rem); box-shadow: 0 .2rem 0 #b9601a; }
button.big span { display: block; }
button.big small { display: block; font-weight: 700; font-size: 1.05rem; letter-spacing: 0; color: #5a3410; margin-top: .1rem; }
button.big small:empty { display: none; }
button.big.blocked { background: linear-gradient(180deg, #56657e, #44526a); color: #cfd8e6; box-shadow: 0 .4rem 0 #2a3547; }
button.big.blocked small { color: #ffb3b3; }
button.small { background: rgba(26,36,52,.92); border: .15rem solid #2a3850; border-radius: 1.2rem; padding: .9rem 1.4rem; font-size: 1.2rem; }

/* ---------- A wide window: the customer on the left, the bench on the right ---------- */
body.wide #app {
  display: grid; max-width: 110rem; gap: .7rem;
  grid-template-columns: minmax(30rem, 2fr) minmax(32rem, 3fr); grid-template-rows: auto auto 1fr auto;
  grid-template-areas: 'top top' 'order bench' 'stats bench' 'meters deal';
}
body.wide #topbar { grid-area: top; }
body.wide #order { grid-area: order; }
body.wide #stats { grid-area: stats; }
body.wide #bench { grid-area: bench; max-height: none; }
body.wide #meters { grid-area: meters; }
body.wide #deal { grid-area: deal; }

/* ---------- The sheet ---------- */
#shade { position: fixed; inset: 0; z-index: 7; background: rgba(5,8,14,.55); }
#panel {
  position: fixed; left: 0; right: 0; bottom: 0; max-height: 82%; z-index: 8; display: flex; flex-direction: column;
  max-width: 54rem; margin: 0 auto;
  background: #172131; border: .2rem solid #33435c; border-bottom: 0; border-radius: 2rem 2rem 0 0;
  box-shadow: 0 -.6rem 2.4rem rgba(0,0,0,.45); animation: sheet .22s ease-out;
  padding-bottom: env(safe-area-inset-bottom);
}
#panel.pickPanel { max-height: 56%; }
@keyframes sheet { from { transform: translateY(3rem); opacity: 0; } }
body.wide #panel { left: auto; top: 0; max-height: none; width: min(48rem, 58vw); margin: 0; border: 0; border-left: .2rem solid #33435c; border-radius: 2rem 0 0 2rem; }
body.wide #panel.pickPanel { max-height: none; }
#panelHead { display: flex; align-items: center; gap: .8rem; padding: 1.1rem 1.1rem .5rem 1.6rem; flex: none; }
#panelHead h2 { flex: 1; margin: 0; font-size: 1.9rem; color: #ffd24a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#btnPanelClose { width: 3.4rem; height: 3.4rem; border-radius: 50%; background: #24324a; font-size: 1.5rem; flex: none; }
#panel.locked #btnPanelClose { visibility: hidden; }
#panelBody { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y; padding: .4rem 1.2rem 1.4rem; display: flex; flex-direction: column; gap: .7rem; }

/* A part on the shelf. */
.pick { display: grid; grid-template-columns: 4rem 1fr auto; gap: .2rem 1rem; align-items: center; text-align: left; padding: .7rem 1rem; background: #212d42; border: .15rem solid #33435c; border-radius: 1.2rem; flex: none; }
.pick .pic { width: 4rem; height: 4rem; grid-row: span 2; }
.pick b { font-size: 1.4rem; letter-spacing: 0; }
.pick em { font-style: normal; font-size: 1.5rem; color: #ffd24a; letter-spacing: 0; grid-row: span 2; text-align: right; }
.pick em small { display: block; letter-spacing: 0; }
.pick .facts { grid-column: 2; display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { font-size: 1.05rem; font-weight: 700; letter-spacing: 0; padding: .15rem .7rem; border-radius: .8rem; background: #2c3b55; color: #c8d3e3; white-space: nowrap; }
.chip.up { background: #1f4a3a; color: #7ff0b6; }
.chip.warn { background: #4a2430; color: #ffb3b3; }
.pick.on { border-color: #ff9d4d; background: #2b3246; }
.pick.locked { opacity: .55; }
.pick.locked em { font-size: 1.1rem; color: #8fa0b8; }

/* A customer's verdict, and the end of the day. */
.verdict { display: flex; gap: 1.2rem; align-items: center; }
.verdict .who { width: 6.4rem; height: 6.4rem; border-radius: 50%; background: #24324a; overflow: hidden; flex: none; }
.verdict p { margin: 0; font-size: 1.35rem; font-weight: 700; letter-spacing: 0; line-height: 1.3; }
.stars { display: flex; gap: .6rem; justify-content: center; padding: .4rem 0; }
.stars i { width: 4rem; height: 4rem; transform: scale(.6); opacity: .5; transition: transform .25s cubic-bezier(.3,1.8,.5,1), opacity .2s; }
.stars i.lit { transform: scale(1); opacity: 1; }
.lines { background: #212d42; border-radius: 1.2rem; padding: .6rem 1.2rem; }
.lines div { display: flex; justify-content: space-between; gap: 1rem; padding: .35rem 0; font-size: 1.3rem; font-weight: 700; letter-spacing: 0; color: #c8d3e3; }
.lines div b { color: #fff; }
.lines div.total { border-top: .15rem solid #33435c; margin-top: .3rem; padding-top: .6rem; font-size: 1.6rem; font-weight: 800; color: #fff; }
.lines div.total b { color: #5fe0a0; }
.lines div.total.loss b { color: #ff6b6b; }
.note { font-size: 1.2rem; font-weight: 700; letter-spacing: 0; color: #c8d3e3; text-align: center; margin: 0; line-height: 1.3; }
.note.gold { color: #ffd24a; }
.note.good { color: #5fe0a0; }
.xp { display: grid; grid-template-columns: auto 1fr auto; gap: .8rem; align-items: center; font-size: 1.15rem; }
.xp .bar, #rankBar { height: .9rem; border-radius: .5rem; background: #24324a; overflow: hidden; }
.xp .bar i, #rankFill { display: block; height: 100%; background: linear-gradient(90deg, #58b8ff, #b58cff); transform-origin: left; transform: scaleX(0); transition: transform .6s ease-out; }
.xp span { color: #8fa0b8; letter-spacing: 0; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; }
.tiles div { background: #212d42; border-radius: 1.2rem; padding: .8rem .4rem; text-align: center; }
.tiles b { display: block; font-size: 1.9rem; letter-spacing: 0; }
.tiles small { display: block; margin-top: .2rem; }
.newParts { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; }
.newParts .chip { display: flex; align-items: center; gap: .5rem; padding: .3rem .9rem .3rem .4rem; font-size: 1.15rem; }
.newParts .chip i { width: 2.2rem; height: 2.2rem; }
h3 { margin: .6rem 0 0; font-size: 1.1rem; color: #8fa0b8; letter-spacing: .1em; }
.upg { display: grid; grid-template-columns: 1fr auto; gap: .1rem 1rem; align-items: center; padding: .8rem 1.1rem; background: #212d42; border-radius: 1.2rem; flex: none; }
.upg b { font-size: 1.35rem; letter-spacing: 0; }
.upg span { grid-column: 1; font-size: 1.1rem; font-weight: 600; letter-spacing: 0; color: #c8d3e3; }
.upg .pips { grid-column: 1; display: flex; gap: .3rem; margin-top: .3rem; }
.upg .pips i { width: 1.6rem; height: .5rem; border-radius: .25rem; background: #33435c; }
.upg .pips i.on { background: #5fe0a0; }
.btn { grid-column: 2; grid-row: 1 / span 3; padding: .9rem 1.3rem; border-radius: 1.2rem; background: #ff9d4d; color: #2b1703; font-size: 1.3rem; letter-spacing: 0; white-space: nowrap; box-shadow: 0 .3rem 0 #b9601a; }
.btn:active { transform: translateY(.2rem); box-shadow: 0 .1rem 0 #b9601a; }
.btn.cant { background: #33435c; color: #8fa0b8; box-shadow: 0 .3rem 0 #1f2a3b; }
.btn.done { background: none; color: #5fe0a0; box-shadow: none; }
.btn.ad { background: #58b8ff; color: #06243a; box-shadow: 0 .3rem 0 #1f6fa8; }
#panelBody > button.big { flex: none; margin-top: .6rem; }

#toast {
  position: fixed; left: 50%; top: 5.2rem; z-index: 30; transform: translate(-50%, -1rem); opacity: 0; pointer-events: none;
  background: rgba(255,244,214,.96); color: #3a2405; border-radius: 1.4rem; padding: .8rem 1.6rem; font-size: 1.3rem; letter-spacing: 0;
  max-width: calc(100vw - 2rem); text-align: center; transition: opacity .2s, transform .2s; box-shadow: 0 .3rem 1.4rem rgba(0,0,0,.3);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Full-screen overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.4rem;
  padding: 1.6rem 2rem; text-align: center;
  background: radial-gradient(ellipse at 50% 0%, rgba(255,170,90,.22), transparent 65%), linear-gradient(180deg, #162133, #0c121c);
}
.logo { margin: 0; font-size: 6rem; line-height: .95; letter-spacing: .04em; color: #eef3fa; text-shadow: 0 .4rem 0 rgba(0,0,0,.35); }
.logo span { color: #ff9d4d; }
.sub { margin: 0; font-size: 1.5rem; font-weight: 600; letter-spacing: 0; color: #c8d3e3; max-width: 34rem; }
.overlay button.big { flex: none; min-width: 22rem; padding: 1.3rem 2.6rem; font-size: 2rem; }
#rankLine { display: grid; grid-template-columns: auto 12rem auto; gap: 1rem; align-items: center; font-size: 1.25rem; }
#rankLine b { color: #ffd24a; }
#rankNext { color: #8fa0b8; letter-spacing: 0; }
#loadBar { width: 24rem; height: 1rem; background: rgba(255,255,255,.14); border-radius: .6rem; overflow: hidden; }
#loadFill { display: block; height: 100%; background: #ff9d4d; transform: scaleX(0); transform-origin: left; transition: transform .2s; }
#loadText { margin: 0; font-size: 1.2rem; color: #8fa0b8; font-weight: 600; letter-spacing: 0; }
#adStandIn { background: #05060c; z-index: 40; }
#adStandIn h2 { color: #9aa3b8; margin: 0; }
#adStandInBar { width: 28rem; height: 1.2rem; background: #1b2036; border-radius: .7rem; overflow: hidden; }
#adStandInFill { display: block; height: 100%; background: #6f7aa0; transform: scaleX(0); transform-origin: left; }

/* Small tiles show the picture, the part and its price; the two long ones also name the slot. */
.slot .txt { display: flex; flex-direction: column; align-items: center; min-width: 0; max-width: 100%; }
.slot:not(.wide) small { display: none; }
.slot .pic { flex: 0 1 3.2rem; max-height: 3.2rem; }
.slot.wide .pic { flex: 0 0 auto; height: 70%; max-height: 4.6rem; }
.slot .pic { flex: none; height: 44%; max-height: 5.6rem; min-height: 1.8rem; width: auto; aspect-ratio: 1; }
.slot.wide .pic { height: 64%; max-height: 5.6rem; }
/* While choosing a part the meters above stay bright, so nothing is dimmed. */
#shade.clear { background: transparent; }
/* A wide window is short, so the left-hand column is packed a little tighter. */
body.wide #app { grid-template-columns: minmax(31rem, 9fr) minmax(32rem, 11fr); }
body.wide #order { grid-template-columns: 4.6rem 1fr auto; padding: .7rem 1rem .6rem; }
body.wide #face { width: 4.6rem; height: 4.6rem; }
body.wide #patience { margin-top: .3rem; }
body.wide #stats { padding: .5rem 1.1rem; gap: .2rem; }
body.wide .stat { height: 1.85rem; }
#orderSay { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
body.wide #orderSay { -webkit-line-clamp: 2; }

/* Painted pictures: one square of a sheet. */
i.art { display: block; background-repeat: no-repeat; }
#face i, .verdict .who i { display: block; width: 100%; height: 100%; }
#face i.art, .verdict .who i.art { transform: scale(1.12) translateY(4%); }
i.coin.art { background-color: transparent; box-shadow: none; border-radius: 0; width: 2.2rem; height: 2.2rem; }
.pick.locked .pic { filter: brightness(0) invert(.35); }

/* The title: a small word, the name, and what kind of game it is. */
.logo small { display: block; font-size: 2.2rem; letter-spacing: .5em; margin-right: -.5em; color: #ffd24a; margin-bottom: .6rem; text-shadow: none; }
.logo span { display: block; font-size: 3.5rem; letter-spacing: .14em; margin-top: .5rem; }
/* Painted parts are shown larger than the drawn stand-ins were. */
.slot .pic { height: 54%; max-height: 7.2rem; }
.slot.wide .pic { height: 78%; max-height: 7.2rem; }
.pick { grid-template-columns: 4.8rem 1fr auto; }
.pick .pic { width: 4.8rem; height: 4.8rem; }

/* =====================================================================================
   The dressed-up look: a painted shop behind, chunky glossy panels, icons on the meters.
   Everything below restyles what is laid out above; sizes and positions stay the same.
   ===================================================================================== */
body {
  background:
    linear-gradient(180deg, rgba(10,16,28,.72), rgba(10,16,28,.86)),
    url(img/shop-tall.jpg) center / cover no-repeat, #0f1622;
}
body.wide {
  background:
    linear-gradient(180deg, rgba(10,16,28,.72), rgba(10,16,28,.86)),
    url(img/shop-wide.jpg) center / cover no-repeat, #0f1622;
}
.overlay {
  background:
    radial-gradient(ellipse at 50% 42%, rgba(10,16,28,.82), rgba(10,16,28,.5) 70%),
    url(img/shop-tall.jpg) center / cover no-repeat, #0f1622;
}
body.wide .overlay {
  background:
    radial-gradient(ellipse at 50% 42%, rgba(10,16,28,.82), rgba(10,16,28,.5) 70%),
    url(img/shop-wide.jpg) center / cover no-repeat, #0f1622;
}
#adStandIn, body.wide #adStandIn { background: #05060c; }

/* Panels: a lit top edge, a solid lower lip. */
.card {
  background: linear-gradient(180deg, rgba(42,58,86,.96), rgba(24,34,54,.97));
  border: .2rem solid #47608a; border-radius: 1.6rem;
  box-shadow: 0 .4rem 0 rgba(6,10,18,.85), inset 0 .15rem 0 rgba(255,255,255,.13);
}
.pill {
  background: linear-gradient(180deg, rgba(48,66,98,.97), rgba(26,37,58,.97)); border: .2rem solid #47608a;
  box-shadow: 0 .3rem 0 rgba(6,10,18,.8), inset 0 .12rem 0 rgba(255,255,255,.14);
}
#coinPill { border-color: #b98a22; }
#queueDots i { width: 1rem; height: 1rem; background: #1a2538; box-shadow: inset 0 0 0 .15rem #47608a; }
#queueDots i.done { background: #5fe0a0; box-shadow: none; }
#queueDots i.now { background: #ff9d4d; box-shadow: 0 0 0 .2rem rgba(255,157,77,.35); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.25); } }

/* The customer: a framed portrait, a speech bubble, a price tag. */
#order { border-color: #c98a3a; background: linear-gradient(180deg, rgba(74,54,40,.97), rgba(40,32,36,.97)); }
#face { background: radial-gradient(circle at 50% 35%, #7fd8ff, #2f6fb0); box-shadow: 0 0 0 .25rem #ffd24a, 0 .4rem 0 .25rem rgba(6,10,18,.6); }
#orderTitle { color: #fff; text-shadow: 0 .15rem 0 rgba(0,0,0,.4); }
#orderSay {
  position: relative; background: #fff6df; color: #3a2a14; border-radius: 1rem; padding: .45rem .8rem; margin-top: .35rem;
  font-weight: 700; box-shadow: 0 .2rem 0 rgba(0,0,0,.25); overflow: visible; display: block; -webkit-line-clamp: unset;
}
#orderSay::before { content: ""; position: absolute; left: -.7rem; top: .7rem; border: .5rem solid transparent; border-right-color: #fff6df; border-left: 0; }
#orderWish { display: inline-block; background: rgba(255,210,74,.16); border: .15rem solid rgba(255,210,74,.55); border-radius: .9rem; padding: .1rem .7rem; margin-top: .45rem; }
#orderWish:empty { display: none; }
#orderWish.met { background: rgba(95,224,160,.16); border-color: rgba(95,224,160,.6); }
#orderPay { background: linear-gradient(180deg, #2d7a57, #1d5a40); border: .2rem solid #5fe0a0; border-radius: 1.1rem; padding: .3rem .9rem .4rem; text-align: center; box-shadow: 0 .3rem 0 rgba(6,10,18,.6); transform: rotate(3deg); }
#orderPay small { color: #b8f5d6; }
#orderPay b { color: #fff; text-shadow: 0 .15rem 0 rgba(0,0,0,.3); }
#patience { height: .9rem; border-radius: .5rem; background: #1a1418; box-shadow: inset 0 .15rem .2rem rgba(0,0,0,.5); margin-top: .7rem; }
#patienceFill { border-radius: .5rem; background: linear-gradient(180deg, #ffe08a, #ff9d4d); box-shadow: inset 0 .15rem 0 rgba(255,255,255,.45); }

/* Meters: an icon, a glossy bar marked off in steps, the number in a little plate. */
.stat { grid-template-columns: 2rem 6rem 1fr 4.8rem; gap: .6rem; }
.stat > i { width: 2rem; height: 2rem; }
.track { height: 1.2rem; border-radius: .6rem; background: #131b2b; box-shadow: inset 0 .15rem .25rem rgba(0,0,0,.6); }
.track > i { border-radius: .6rem; background: linear-gradient(180deg, #8aa4c8, #56709a); box-shadow: inset 0 .15rem 0 rgba(255,255,255,.35); }
.stat.asked .track > i { background: linear-gradient(180deg, #ffc27a, #ff8a3c); }
.stat.met .track > i { background: linear-gradient(180deg, #8ff5c2, #3ecb8a); }
.track > u { top: -.5rem; bottom: -.5rem; z-index: 1; box-shadow: 0 0 0 .1rem rgba(10,16,28,.6); }
.track > s { z-index: 1; top: -.2rem; }
.stat > b { background: #131b2b; border-radius: .7rem; padding: .1rem .5rem; text-align: center; font-size: 1.15rem; }
.stat.met > b { background: #1f4a3a; }
.stat.asked:not(.met) > b { background: #4a3320; }
.meter > span { display: flex; align-items: center; gap: .4rem; }
.meter > span i { width: 1.7rem; height: 1.7rem; }
.meter .track { height: 1rem; }
.meter .track > i { background: linear-gradient(180deg, #8fd4ff, #3e9be0); }
.meter.over .track > i { background: linear-gradient(180deg, #ff9a9a, #e04e4e); }

/* The bench: a workshop tabletop with a labelled tray for each part. */
#bench { border-color: #47608a; background: linear-gradient(180deg, rgba(38,52,78,.96), rgba(20,28,46,.97)); }
#benchHead { align-items: center; color: #cfe0f7; font-size: 1.15rem; }
#benchHead > span { display: flex; align-items: center; gap: .5rem; background: #ff9d4d; color: #2b1703; border-radius: .9rem; padding: .15rem .9rem .15rem .4rem; letter-spacing: .06em; box-shadow: 0 .2rem 0 #b9601a; }
#benchHead > span i { width: 1.8rem; height: 1.8rem; }
.slot {
  --tier: #9fb0c3;
  background: radial-gradient(circle at 50% 38%, rgba(255,255,255,.10), transparent 60%), linear-gradient(180deg, #2c3d5c, #1c2740);
  border: .2rem solid #4a6390; border-radius: 1.3rem; padding-top: 1.2rem;
  box-shadow: 0 .35rem 0 rgba(6,10,18,.8), inset 0 .15rem 0 rgba(255,255,255,.12), inset 0 -.45rem 0 var(--tier);
}
.slot:active { transform: translateY(.2rem) scale(.98); box-shadow: 0 .15rem 0 rgba(6,10,18,.8), inset 0 -.45rem 0 var(--tier); }
.slot:not(.wide) small, .slot small {
  display: block; position: absolute; left: .7rem; top: .35rem; font-size: .9rem; letter-spacing: .06em; color: #9fb6d6; text-transform: uppercase;
  max-width: calc(100% - 1.4rem); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.slot .pic { height: 50%; filter: drop-shadow(0 .3rem .2rem rgba(0,0,0,.45)); }
.slot.wide { padding-top: .4rem; }
.slot.wide .pic { height: 74%; }
.slot.wide small { position: static; max-width: 100%; }
.slot b { text-shadow: 0 .12rem 0 rgba(0,0,0,.45); }
.slot em { background: rgba(10,16,28,.55); border-radius: .7rem; padding: 0 .6rem; margin-bottom: .35rem; }
.slot.empty { border-style: dashed; box-shadow: none; background: rgba(20,28,46,.6); }
.slot.bad { border-color: #ff6b6b; background: linear-gradient(180deg, #5a2a3a, #3a1c28); animation: alarm 1s ease-in-out infinite; }
@keyframes alarm { 50% { box-shadow: 0 .35rem 0 rgba(6,10,18,.8), 0 0 0 .3rem rgba(255,107,107,.3), inset 0 -.45rem 0 var(--tier); } }
.slot.bad::after { box-shadow: 0 .2rem 0 rgba(0,0,0,.4); font-weight: 900; }

/* The till. */
#sums { background: linear-gradient(180deg, rgba(42,58,86,.96), rgba(24,34,54,.97)); border: .2rem solid #47608a; border-radius: 1.3rem; padding: .5rem 1.1rem; box-shadow: 0 .35rem 0 rgba(6,10,18,.8); }
button.big { position: relative; overflow: hidden; border: .2rem solid #ffe0b0; background: linear-gradient(180deg, #ffd08f, #ff8f38); text-shadow: 0 .1rem 0 rgba(255,255,255,.45); }
button.big::before { content: ""; position: absolute; top: 0; bottom: 0; left: -40%; width: 30%; transform: skewX(-20deg); background: rgba(255,255,255,.35); animation: shine 3.2s ease-in-out infinite; }
@keyframes shine { 0%, 60% { left: -40%; } 100% { left: 130%; } }
button.big.blocked { border-color: #7d8ca6; text-shadow: none; }
button.big.blocked::before { display: none; }
button.small { background: linear-gradient(180deg, rgba(48,66,98,.97), rgba(26,37,58,.97)); border: .2rem solid #47608a; box-shadow: 0 .3rem 0 rgba(6,10,18,.8); }

/* The sheet and what is on it. */
#panel { background: linear-gradient(180deg, #24334f, #141d30); border-color: #5a78aa; }
#panelHead h2 { text-shadow: 0 .2rem 0 rgba(0,0,0,.4); }
#btnPanelClose { background: #ff6b6b; color: #3a0d12; box-shadow: 0 .3rem 0 #a03a3a; font-weight: 900; }
.pick {
  --tier: #9fb0c3; position: relative; overflow: hidden; padding-left: 1.5rem;
  background: linear-gradient(180deg, #2c3d5c, #1e2a44); border: .2rem solid #4a6390; border-radius: 1.3rem;
  box-shadow: 0 .3rem 0 rgba(6,10,18,.7), inset 0 .15rem 0 rgba(255,255,255,.1);
}
.pick::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: .7rem; background: var(--tier); }
.pick:active { transform: translateY(.15rem); }
.pick .pic { filter: drop-shadow(0 .25rem .15rem rgba(0,0,0,.45)); }
.pick em { background: rgba(10,16,28,.55); border-radius: .9rem; padding: .2rem .8rem; text-align: center; }
.pick.locked .pic { filter: brightness(0) invert(.35); }
.pick.on { border-color: #ffb066; background: linear-gradient(180deg, #4a4050, #2e2a3c); box-shadow: 0 .3rem 0 rgba(6,10,18,.7), 0 0 0 .2rem rgba(255,157,77,.35); }
.chip { border: .12rem solid rgba(255,255,255,.08); }
.lines, .tiles div, .upg { background: linear-gradient(180deg, #2c3d5c, #1e2a44); border: .2rem solid #4a6390; box-shadow: 0 .3rem 0 rgba(6,10,18,.7); }
.tiles b { color: #ffd24a; }
.verdict .who { background: radial-gradient(circle at 50% 35%, #7fd8ff, #2f6fb0); box-shadow: 0 0 0 .25rem #ffd24a; }
.verdict p { background: #fff6df; color: #3a2a14; border-radius: 1.1rem; padding: .7rem 1rem; position: relative; box-shadow: 0 .2rem 0 rgba(0,0,0,.25); }
.verdict p::before { content: ""; position: absolute; left: -.7rem; top: 50%; margin-top: -.5rem; border: .5rem solid transparent; border-right-color: #fff6df; border-left: 0; }
.stars i { width: 4.6rem; height: 4.6rem; filter: drop-shadow(0 .3rem 0 rgba(0,0,0,.35)); }
.stars i.lit { animation: starPop .45s cubic-bezier(.3,1.8,.5,1); }
@keyframes starPop { 0% { transform: scale(.3) rotate(-30deg); } 100% { transform: scale(1) rotate(0); } }
.xp .bar, #rankBar { height: 1.1rem; background: #131b2b; box-shadow: inset 0 .15rem .25rem rgba(0,0,0,.6); }
.xp .bar i, #rankFill { box-shadow: inset 0 .15rem 0 rgba(255,255,255,.35); }
h3 { display: flex; align-items: center; gap: .6rem; color: #cfe0f7; }
h3 i { width: 2rem; height: 2rem; }

/* A little shower of confetti for a perfect build. */
.confetti { position: absolute; left: 0; right: 0; top: 0; height: 0; pointer-events: none; z-index: 3; }
.confetti i { position: absolute; top: 9rem; width: .9rem; height: 1.3rem; border-radius: .2rem; animation: fall 1.4s ease-out forwards; }
@keyframes fall { 0% { transform: translate(0, 0) rotate(0); opacity: 1; } 100% { transform: translate(var(--dx), 22rem) rotate(var(--rot)); opacity: 0; } }

/* The title screen. */
.logo { text-shadow: 0 .15rem 0 #b9c6da, 0 .3rem 0 #7f8da6, 0 .6rem 0 rgba(0,0,0,.45); }
.logo small { text-shadow: 0 .15rem 0 rgba(0,0,0,.5); }
.logo span { color: #ff9d4d; text-shadow: 0 .15rem 0 #c96a22, 0 .3rem 0 #8a4512, 0 .6rem 0 rgba(0,0,0,.45); }
#hero { display: flex; align-items: flex-end; justify-content: center; gap: .6rem; height: 9rem; flex: none; }
#hero i { width: 7rem; height: 7rem; filter: drop-shadow(0 .5rem .3rem rgba(0,0,0,.5)); animation: bob 3s ease-in-out infinite; }
#hero i:nth-child(2) { width: 9rem; height: 9rem; animation-delay: -1s; }
#hero i:nth-child(3) { animation-delay: -2s; }
@keyframes bob { 50% { transform: translateY(-.6rem); } }
#hero:empty { display: none; }
.sub { background: rgba(10,16,28,.6); border-radius: 1.2rem; padding: .4rem 1.4rem; }
#rankLine { background: rgba(10,16,28,.6); border-radius: 1.2rem; padding: .5rem 1.2rem; }
/* A wide window is short: the title screen sits in two columns. */
body.wide #menu { flex-flow: row wrap; align-content: center; gap: 1rem 3rem; }
body.wide #menu .logo { font-size: 4.6rem; }
body.wide #menu .logo, body.wide #menu #hero { flex: 0 0 auto; }
body.wide #menu .sub, body.wide #menu #rankLine { flex-basis: 100%; max-width: none; background: none; padding: 0; }
body.wide #menu #rankLine { justify-content: center; }

/* Names sit a touch smaller inside the framed trays, so the longest still fit. */
.slot b { font-size: 1.12rem; }
.slot.wide b { font-size: 1.25rem; }
.slot em { font-size: 1.05rem; }

/* The picture takes whatever height the tray has left after the name and the price. */
.slot .pic, .slot.wide .pic { flex: 1 1 0; min-height: 0; height: auto; max-height: 7.2rem; width: auto; aspect-ratio: 1; }
.slot.wide .pic { flex: 0 0 auto; height: 74%; }
.slot .txt { flex: none; }
.slot em { margin-bottom: .5rem; }
body.tight .slot { padding-top: .35rem; }
body.tight .slot:not(.wide) small { display: none; }
body.tight .slot em { margin-bottom: .45rem; }
/* A wide window is short: the speech bubble is trimmed to two lines and loses its tail. */
body.wide #orderSay { display: -webkit-box; -webkit-line-clamp: 2; overflow: hidden; padding: .25rem .7rem; margin-top: .2rem; }
body.wide #orderWish { margin-top: .25rem; padding: 0 .6rem; }
body.wide #patience { margin-top: .4rem; height: .7rem; }
body.wide #orderPay { padding: .1rem .8rem .2rem; }

/* Short trays: no slot label, and the price moves up into the corner as a small tag. */
body.tight .slot small { display: none; }
body.tight .slot:not(.wide) em { position: absolute; right: .35rem; top: .3rem; margin: 0; font-size: .95rem; padding: 0 .45rem; z-index: 1; }
body.tight .slot:not(.wide) b { margin-bottom: .55rem; }
body.tight .slot.bad::after { right: auto; left: .4rem; }

/* Confetti is invisible except while it is actually falling, so it can never sit still on screen. */
.confetti i { opacity: 0; }

/* ---------- The market, the news and the stockroom ---------- */
#btnNotes { font-size: 1.15rem; border-color: #b98a22; color: #ffd24a; }
#btnSound { margin-left: auto; font-size: 1.7rem; padding: 0 1.1rem; }
#btnSound.off { opacity: .45; text-decoration: line-through; }
#topbar { min-width: 0; }
#topbar .pill { padding: 0 1rem; min-width: 0; }
#orderPay.hot { background: linear-gradient(180deg, #c9622a, #8f3f16); border-color: #ffb066; }
#orderPay.hot small { color: #ffe0b0; }
.slot.stocked em { background: #1f4a3a; color: #7ff0b6; }
.news { display: flex; flex-direction: column; gap: .6rem; flex: none; }
.news div { display: flex; align-items: center; gap: .9rem; padding: .7rem 1rem; border-radius: 1.2rem; font-size: 1.25rem; font-weight: 700; letter-spacing: 0; line-height: 1.25; background: linear-gradient(180deg, #2c3d5c, #1e2a44); border: .2rem solid #4a6390; }
.news div i { width: 2.6rem; height: 2.6rem; flex: none; }
.news div.good { border-color: #3f9a70; }
.news div.bad { border-color: #b65555; }
.stack { display: flex; flex-direction: column; gap: .7rem; flex: none; }
.offer { grid-template-columns: 4.4rem 1fr auto; }
.offer .pic { width: 4.4rem; height: 4.4rem; grid-row: 1 / span 2; }
.offer b, .offer span { grid-column: 2; }
.offer .btn { grid-column: 3; grid-row: 1 / span 2; }
h3 .room { margin-left: auto; font-size: 1.1rem; letter-spacing: 0; color: #ffd24a; }

/* The patience bar warns when little is left, and the customer's card shows when it is gone. */
#patience.low #patienceFill { background: linear-gradient(180deg, #ff9a9a, #e04e4e); }
#patience.low { animation: hurry .6s ease-in-out infinite; }
@keyframes hurry { 50% { box-shadow: 0 0 0 .3rem rgba(255,107,107,.35), inset 0 .15rem .2rem rgba(0,0,0,.5); } }
#patience.out { background: #3a2026; }
#order.late { border-color: #b65555; }
#order.late #orderSay { background: #ffe3dc; }
#order.late #orderSay::before { border-right-color: #ffe3dc; }

/* A late customer's price tag turns red while the price falls. */
#order.late #orderPay { background: linear-gradient(180deg, #a83d3d, #6e2323); border-color: #ff9a9a; }
#order.late #orderPay small { color: #ffd0d0; }

/* An empty tray: a dashed outline, the name of what goes in it, and a quiet prompt. */
.slot.empty b { color: #cfe0f7; }
.slot.empty em { background: none; color: #8fa0b8; font-weight: 700; }
.slot.empty .pic { opacity: .7; }

/* An empty tray already names its slot in the middle, so the corner label is dropped. */
.slot.empty small, .slot.empty.wide small { display: none; }

/* The way out for a stuck player: the hint beside THE BUILD becomes a small button. */
#hint.pass { color: #ffb3b3; text-decoration: underline; cursor: pointer; pointer-events: auto; padding: .2rem 0 .2rem 1rem; }

/* ---------- The line: who else is in the shop ---------- */
#waitRow { grid-column: 1 / -1; display: flex; align-items: center; gap: .9rem; margin-top: .6rem; min-width: 0; }
#waitRow #patience { flex: 1; margin-top: 0; min-width: 4rem; }
body.wide #waitRow { margin-top: .35rem; }
#line { display: flex; gap: .6rem; flex: none; }
.seat { position: relative; width: 3.2rem; height: 3.2rem; border-radius: 50%; flex: none; background: radial-gradient(circle at 50% 35%, #7fd8ff, #2f6fb0); box-shadow: 0 0 0 .2rem #47608a; }
.seat > i:first-child { display: block; width: 100%; height: 100%; border-radius: 50%; overflow: hidden; }
.seat i.art { border-radius: 50%; }
.seat.on { box-shadow: 0 0 0 .25rem #ffd24a; }
.seat:not(.on) { opacity: .8; }
.seat u { position: absolute; left: .1rem; right: .1rem; bottom: -.55rem; height: .4rem; border-radius: .2rem; background: #1a1418; overflow: hidden; text-decoration: none; }
.seat u i { display: block; height: 100%; background: #5fe0a0; }
.seat.low u i { background: #ffb066; }
.seat.late u i { background: #e04e4e; width: 100% !important; }
.seat.late { box-shadow: 0 0 0 .25rem #e04e4e; }
.seat.late.on { box-shadow: 0 0 0 .25rem #ffd24a, 0 0 0 .45rem #e04e4e; }
.seat.free { background: none; box-shadow: inset 0 0 0 .2rem rgba(255,255,255,.18); border-radius: 50%; }
#order { padding-bottom: 1.1rem; }

/* A wide window is short: the line is drawn smaller, and the card around it is trimmed. */
body.wide .seat { width: 2.3rem; height: 2.3rem; }
body.wide .seat u { bottom: -.4rem; height: .3rem; }
body.wide #order { padding: .5rem 1rem .7rem; }
body.wide #waitRow { margin-top: .25rem; gap: .7rem; }
body.wide #line { gap: .5rem; }
body.wide #orderSay { padding: .15rem .7rem; margin-top: .15rem; }
body.wide #orderWish { margin-top: .2rem; font-size: 1.05rem; }
body.wide #stats { padding: .35rem 1.1rem; gap: .1rem; }
body.wide .stat { height: 1.75rem; }

/* =====================================================================================
   The display font, the shop front, and the tags on a customer's card.
   ===================================================================================== */
/* Luckiest Guy by Astigmatic, Apache License 2.0 (see fonts/LuckiestGuy-LICENSE.txt). */
@font-face {
  font-family: "Luckiest Guy";
  src: url(fonts/LuckiestGuy.woff2) format("woff2");
  font-display: swap;
}
/* Headings, buttons and money are set in the display font; everything to be read stays plain. */
.logo, #panelHead h2, #frontHead h2, h3, button.big span, .btn, #orderPay b, #sums b, #coins, #frontCoins, .tiles b,
#benchHead > span, #dayText, #btnNotes, #orderTitle, .lines div.total, .xp b, #rankName, button.small, .pick em, .slot em {
  font-family: "Luckiest Guy", "Arial Black", Impact, system-ui, sans-serif; font-weight: 400; letter-spacing: .04em;
}
/* The font sits high in its line, so text set in it is nudged down a touch. */
button.big span, .btn, #benchHead > span, button.small, #btnNotes, #dayText { padding-top: .15em; }
#orderPay b, #sums b, .tiles b { display: inline-block; padding-top: .1em; }
#orderTitle { font-size: 1.5rem; letter-spacing: .03em; }
.logo { font-size: 7rem; line-height: .9; letter-spacing: .03em; }
.logo span { display: block; font-size: 7rem; letter-spacing: .06em; margin-top: .2rem; }
.logo small { display: none; }
.overlay .row { display: flex; gap: 1rem; align-items: center; justify-content: center; }

/* ---------- The shop front ---------- */
.scene {
  position: relative; display: block; aspect-ratio: 3 / 2; padding: 0; overflow: hidden; flex: none;
  background: url(img/front.jpg) center / cover no-repeat, #1c2a44; border: .25rem solid #ffd24a; border-radius: 1.6rem;
  box-shadow: 0 .5rem 0 rgba(6,10,18,.8), 0 1rem 2rem rgba(0,0,0,.4);
}
.scene i { position: absolute; aspect-ratio: 1; transform: translateY(-50%); pointer-events: none; }
#menuScene { width: 27rem; }
#front { justify-content: flex-start; gap: 1rem; padding: max(1.2rem, env(safe-area-inset-top)) 1.2rem max(1.2rem, env(safe-area-inset-bottom)); z-index: 21; }
#frontHead { display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: 100%; max-width: 46rem; flex: none; }
#frontHead h2 { margin: 0; font-size: 2.2rem; color: #ffd24a; text-shadow: 0 .2rem 0 rgba(0,0,0,.4); padding-top: .15em; }
#frontScene { width: 100%; max-width: 46rem; }
#frontList {
  flex: 1; min-height: 0; width: 100%; max-width: 46rem; overflow-y: auto; overscroll-behavior: contain; touch-action: pan-y;
  display: flex; flex-direction: column; gap: .7rem; padding: .2rem .2rem .6rem; text-align: left;
}
#btnFrontBack { flex: none; width: 100%; max-width: 46rem; min-width: 0; padding: 1rem 2rem; font-size: 1.8rem; }
/* A wide window: the shop on the left, the list on the right. */
body.wide #front {
  display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); grid-template-rows: auto minmax(0, 1fr) auto; gap: .8rem 1.6rem;
  grid-template-areas: 'head list' 'scene list' 'back list'; align-items: start; justify-items: center;
}
body.wide #frontHead { grid-area: head; }
body.wide #frontScene { grid-area: scene; max-height: 100%; width: auto; height: 100%; max-width: 100%; }
body.wide #frontList { grid-area: list; height: 100%; max-width: none; }
body.wide #btnFrontBack { grid-area: back; padding: .7rem 2rem; }
body.wide #menuScene { width: 22rem; }
body.wide #menu .logo span { display: inline; margin-left: .3em; }
body.wide #menu .logo { font-size: 5rem; }
body.wide #menu .logo span { font-size: 5rem; }

/* ---------- What else a customer said: small tags under the speech bubble ---------- */
#orderWish, #orderWish.met { display: flex; flex-wrap: wrap; gap: .3rem .4rem; background: none; border: 0; padding: 0; margin-top: .45rem; }
#orderWish:empty { display: none; }
.trait {
  font-size: 1.1rem; font-weight: 700; letter-spacing: 0; line-height: 1.25; padding: .05rem .65rem; border-radius: .9rem;
  background: rgba(255,255,255,.08); border: .14rem solid rgba(255,255,255,.22); color: #e6edf7;
}
.trait.met { background: rgba(95,224,160,.16); border-color: rgba(95,224,160,.6); color: #8ff5c2; }
.trait.wish { background: rgba(255,210,74,.16); border-color: rgba(255,210,74,.55); color: #ffd24a; }
.trait.bad { background: rgba(255,107,107,.18); border-color: rgba(255,107,107,.65); color: #ffb3b3; }
.trait.info { background: rgba(88,184,255,.16); border-color: rgba(88,184,255,.55); color: #a8dcff; }
body.wide #orderWish { margin-top: .2rem; gap: .2rem .3rem; }
body.wide .trait { font-size: 1rem; padding: 0 .5rem; }
#costText.loss { color: #ff6b6b; }

/* The display font has its own small letters; names set in it read better all in capitals. */
#rankName, #orderTitle, .xp b, #panelHead h2 { text-transform: uppercase; }

/* Money is set in the plain font: its figures and dollar sign are clearer at small sizes. */
.btn, #orderPay b, #sums b, #coins, #frontCoins, .tiles b, .pick em, .slot em, .lines div.total {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; font-weight: 800; letter-spacing: 0; padding-top: 0;
}

/* A wide window is short: the tags under the speech bubble are kept to two rows. */
body.wide #orderWish { max-height: 3.2rem; overflow: hidden; }
body.wide #orderTitle { font-size: 1.35rem; }

/* An upright but not very tall window (9:16 and the like): everything above the bench is
   packed tighter, so the trays keep enough height for their pictures. */
body.squat #order { padding: .6rem 1rem .9rem; }
body.squat #face { width: 4.8rem; height: 4.8rem; }
body.squat #order { grid-template-columns: 4.8rem 1fr auto; }
body.squat #orderSay { padding: .3rem .7rem; margin-top: .2rem; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
body.squat #orderWish { margin-top: .3rem; gap: .2rem .3rem; max-height: 3.1rem; overflow: hidden; }
body.squat .trait { font-size: 1rem; padding: 0 .5rem; }
body.squat #waitRow { margin-top: .4rem; }
body.squat .seat { width: 2.7rem; height: 2.7rem; }
body.squat #stats { padding: .4rem 1.1rem; gap: .15rem; }
body.squat .stat { height: 1.75rem; }
body.squat #benchHead { padding-bottom: .3rem; }
body.squat #bench { padding-top: .5rem; }
body.squat #meters { padding: .45rem 1.1rem; }
body.squat #app { gap: .55rem; }

/* A first-time introduction: a picture and a few plain lines. */
.tipCard { display: flex; align-items: center; gap: 1.2rem; padding: 1rem 1.2rem; border-radius: 1.3rem; flex: none;
  background: linear-gradient(180deg, #2c3d5c, #1e2a44); border: .2rem solid #ffd24a; }
.tipCard i { width: 5rem; height: 5rem; flex: none; }
.tipCard p { margin: 0; font-size: 1.35rem; font-weight: 700; letter-spacing: 0; line-height: 1.35; color: #eef3fa; }

/* A little more room for the stat names, for languages where they run longer. */
.stat { grid-template-columns: 2rem 6.7rem 1fr 4.8rem; }

/* A wide window: the tags under the speech bubble stay on one row, each shortened if it must be,
   so the card keeps the same height in every language. */
body.wide #orderWish { flex-wrap: nowrap; max-height: none; overflow: hidden; }
body.wide .trait { flex: 0 1 auto; min-width: 2.5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.wide #orderSay { line-height: 1.2; }

/* ...unless there is room for two rows, which the slightly smaller landscape scale now gives:
   tags wrap in full, and nothing is shortened. */
body.wide #orderWish { flex-wrap: wrap; max-height: 3.5rem; }
body.wide .trait { white-space: normal; overflow: visible; text-overflow: clip; flex: none; min-width: 0; line-height: 1.2; }
