:root {
  --ink: #3a2216; --ink2: #6b4a36; --paper: #fff6e3; --paper2: #fbe7c4; --sand: #e9cf9f; --terra: #d8734a;
  --coin: #f2b52b; --coin-d: #9a6a10; --rep: #1fa59a; --rep-d: #12756d; --warn: #e5533d; --leaf: #5b9e4a; --sky: #cfe8f2;
  --col: min(100vw, 440px); --st: env(safe-area-inset-top, 0px); --sb: env(safe-area-inset-bottom, 0px);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #f6e2bb; color: var(--ink); font-family: var(--font); font-size: 15px; overscroll-behavior: none; touch-action: none; user-select: none; -webkit-user-select: none; }
canvas#scene { position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh; display: block; touch-action: none; }
#app { position: fixed; top: 0; bottom: 0; left: 50%; width: var(--col); transform: translateX(-50%); pointer-events: none; }
#app > * { pointer-events: auto; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
.hidden { display: none !important; }

/* HUD */
#hud { position: absolute; top: 0; left: 0; right: 0; padding: calc(var(--st) + 8px) 10px 0; pointer-events: none; z-index: 5; }
#hud > * { pointer-events: auto; }
#hud::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: calc(100% + 14px); background: linear-gradient(rgba(255,246,227,.92) 62%, rgba(255,246,227,0)); z-index: -1; pointer-events: none; }
#hud .row { display: flex; gap: 8px; align-items: center; }
.pill { height: 44px; display: flex; align-items: center; gap: 6px; padding: 0 12px 0 6px; border-radius: 22px; background: var(--paper); border: 2.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink); font-weight: 900; font-size: 18px; }
.pill b { font-weight: 900; }
.coinic { width: 28px; height: 28px; flex: none; }
#coins b { color: var(--coin-d); min-width: 44px; }
#coins.bump { animation: bump .35s ease; }
#level { flex: 1; min-width: 0; padding-left: 8px; }
#level .lv { background: var(--rep); color: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 1px 8px; font-size: 16px; white-space: nowrap; }
#level .bar { flex: 1; height: 12px; border-radius: 6px; background: #e6f2ef; border: 2px solid var(--ink); overflow: hidden; }
#level .bar i { display: block; height: 100%; background: var(--rep); width: 0; transition: width .5s ease; }
#mute { width: 44px; height: 44px; border-radius: 22px; background: var(--paper); border: 2.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink); display: grid; place-items: center; flex: none; }
#mute svg { width: 22px; height: 22px; }
.goal { margin-top: 8px; width: 100%; min-height: 44px; display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 14px; background: #fff9ec; border: 2.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink); text-align: left; }
.goal small { font-size: 12px; font-weight: 900; color: #fff; background: var(--terra); border-radius: 8px; padding: 2px 6px; white-space: nowrap; }
.goal span { flex: 1; font-weight: 800; font-size: 14px; line-height: 1.15; }
.goal em { font-style: normal; font-weight: 900; color: var(--coin-d); font-size: 15px; white-space: nowrap; }
.goal.done { animation: goalpop .7s ease; background: #e7f7e3; }
#collectAll { position: absolute; left: 0; right: 0; margin: 0 auto; width: fit-content; bottom: calc(var(--sb) + 80px); z-index: 6; height: 44px; padding: 0 16px; border-radius: 22px; background: var(--coin); border: 2.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink); font-weight: 900; font-size: 15px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

/* bottom tabs */
#tabs { position: absolute; left: 0; right: 0; bottom: 0; display: flex; padding: 6px 6px calc(var(--sb) + 6px); gap: 4px; background: var(--paper); border-top: 2.5px solid var(--ink); z-index: 6; }
#tabs button { flex: 1; height: 54px; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 12px; font-weight: 800; position: relative; color: var(--ink2); }
#tabs button svg { width: 26px; height: 26px; }
#tabs button.on { background: var(--paper2); color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
#tabs .badge { position: absolute; top: 2px; right: calc(50% - 24px); min-width: 20px; height: 20px; border-radius: 10px; background: var(--coin); border: 2px solid var(--ink); font-size: 12px; font-weight: 900; line-height: 16px; color: var(--ink); }

/* panels */
#panel { position: absolute; left: 0; right: 0; top: 0; bottom: 0; background: var(--paper); overflow-y: auto; overflow-x: hidden; padding: calc(var(--st) + 112px) 12px calc(var(--sb) + 84px); touch-action: pan-y; z-index: 3; -webkit-overflow-scrolling: touch; }
#panel.full { padding-top: calc(var(--st) + 10px); z-index: 7; padding-bottom: calc(var(--sb) + 12px); }
h2 { font-size: 22px; font-weight: 900; margin: 6px 2px 10px; display: flex; align-items: center; gap: 8px; }
h2 .sub { font-size: 14px; font-weight: 800; color: var(--ink2); margin-left: auto; }
h3 { font-size: 16px; font-weight: 900; margin: 16px 2px 8px; }
.card { background: #fffaf0; border: 2.5px solid var(--ink); border-radius: 16px; box-shadow: 0 3px 0 var(--ink); padding: 10px; margin-bottom: 10px; }
.card.dim { opacity: .55; }
.btn { min-height: 44px; padding: 0 14px; border-radius: 12px; background: var(--paper2); border: 2.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink); font-weight: 900; font-size: 15px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: transform .06s; white-space: nowrap; }
.btn:active, .btn.press { transform: translateY(3px); box-shadow: 0 0 0 var(--ink); }
.btn.go { background: #7cc96a; }
.btn.gold { background: var(--coin); }
.btn.teal { background: #8fd8cf; }
.btn.red { background: #f4a090; }
.btn[disabled] { opacity: .45; box-shadow: none; transform: none; }
.btn.small { min-height: 44px; font-size: 14px; padding: 0 10px; }
.btn.wide { width: 100%; }
.row2 { display: flex; gap: 8px; align-items: center; }
.grow { flex: 1; min-width: 0; }
.coins { color: var(--coin-d); font-weight: 900; white-space: nowrap; }
.rep { color: var(--rep-d); font-weight: 900; white-space: nowrap; }
.warn { color: var(--warn); font-weight: 800; }
.muted { color: var(--ink2); font-size: 13px; font-weight: 700; }
.name { font-weight: 900; font-size: 16px; }
.stars { color: var(--coin); font-size: 14px; letter-spacing: 1px; -webkit-text-stroke: .6px var(--ink); }

/* gigs */
.gig { display: flex; gap: 10px; align-items: center; }
.gicon { width: 48px; height: 48px; border-radius: 12px; border: 2.5px solid var(--ink); display: grid; place-items: center; flex: none; background: #ffe2a8; }
.gicon svg { width: 30px; height: 30px; }
.gig .meta { font-size: 13px; font-weight: 800; color: var(--ink2); margin-top: 2px; }
.gig .pay { font-size: 16px; margin-top: 2px; }
.gig .acts { display: flex; flex-direction: column; gap: 6px; }
.run { display: flex; gap: 8px; align-items: center; background: #fffaf0; border: 2px solid var(--ink); border-radius: 14px; padding: 6px 8px; margin-bottom: 8px; position: relative; }
.run canvas { flex: none; }
.prog { height: 10px; border-radius: 5px; background: #eadbbd; border: 2px solid var(--ink); overflow: hidden; margin-top: 4px; }
.prog i { display: block; height: 100%; background: var(--terra); }
.cut { position: absolute; right: 70px; top: -8px; background: #7cc96a; border: 2px solid var(--ink); border-radius: 10px; padding: 0 6px; font-weight: 900; font-size: 13px; animation: cut 1.6s ease forwards; }
.pending { text-align: center; color: var(--ink2); font-weight: 800; padding: 14px; border: 2.5px dashed #c8ab80; border-radius: 16px; margin-bottom: 10px; }

/* car bits */
.stat { display: grid; grid-template-columns: 52px 1fr 30px; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; margin: 3px 0; }
.stat .b { height: 10px; border-radius: 5px; background: #eadbbd; border: 2px solid var(--ink); overflow: hidden; }
.stat .b i { display: block; height: 100%; }
.thumb { display: block; }
.carbig { display: block; margin: 0 auto; }

/* sheet */
#sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 72%; background: var(--paper); border: 2.5px solid var(--ink); border-bottom: 0; border-radius: 22px 22px 0 0; padding: 10px 12px calc(var(--sb) + 14px); overflow-y: auto; z-index: 8; transform: translateY(calc(100% + 24px)); visibility: hidden; transition: transform .28s cubic-bezier(.2,.9,.3,1.1), visibility 0s .28s; box-shadow: 0 -6px 0 rgba(58,34,22,.12); touch-action: pan-y; }
#sheet.open { transform: translateY(0); visibility: visible; transition: transform .28s cubic-bezier(.2,.9,.3,1.1); }
#sheet .grab { width: 44px; height: 5px; border-radius: 3px; background: #d6bf98; margin: 0 auto 8px; }
#sheet .x { position: absolute; right: 10px; top: 10px; width: 44px; height: 44px; border-radius: 50%; background: var(--paper2); border: 2.5px solid var(--ink); box-shadow: 0 2px 0 var(--ink); font-size: 22px; font-weight: 900; line-height: 1; display: flex; align-items: center; justify-content: center; color: var(--ink); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.grid3 canvas { max-width: 100%; height: auto !important; }
.pick { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 6px 8px; border-radius: 14px; border: 2.5px solid var(--ink); background: #fffaf0; box-shadow: 0 3px 0 var(--ink); margin-bottom: 8px; min-height: 56px; }
.pick.no { opacity: .5; box-shadow: none; }
.pick.sel { background: #e7f7e3; }

/* overlay */
#overlay { position: absolute; inset: 0; background: rgba(58,34,22,.45); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
#overlay.street { background: rgba(58,34,22,.14); align-items: flex-start; padding-top: calc(var(--st) + 56px); }
#overlay .modal { width: 100%; max-width: 400px; max-height: 92%; overflow-y: auto; background: var(--paper); border: 3px solid var(--ink); border-radius: 22px; box-shadow: 0 6px 0 var(--ink); padding: 16px; text-align: center; animation: pop .35s cubic-bezier(.2,1.4,.4,1); }
.big { font-size: 34px; font-weight: 900; line-height: 1.05; margin: 4px 0; }
.big.win { color: #3f9a4a; } .big.lose { color: var(--warn); }
.mid { font-size: 18px; font-weight: 800; }
.starter { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }
.starter button { display: flex; align-items: center; gap: 8px; text-align: left; border: 2.5px solid var(--ink); border-radius: 16px; background: #fffaf0; box-shadow: 0 3px 0 var(--ink); padding: 6px 10px; }
.tag { display: inline-block; font-size: 15px; font-weight: 900; background: var(--coin); border: 2px solid var(--ink); border-radius: 10px; padding: 1px 8px; }
ul.new { text-align: left; font-weight: 800; font-size: 16px; padding-left: 22px; }
ul.new li { margin: 6px 0; }
.reason { text-align: left; font-weight: 800; background: #fde4dd; border: 2px solid var(--warn); border-radius: 12px; padding: 8px 10px; margin: 8px 0; font-size: 15px; }

/* paint shop */
.studio { display: block; margin: 0 auto; border-radius: 16px; border: 2.5px solid var(--ink); }
.ptabs { display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 6px; touch-action: pan-x; scrollbar-width: none; }
.ptabs button { min-height: 44px; padding: 0 12px; border-radius: 22px; border: 2.5px solid var(--ink); background: #fffaf0; font-weight: 900; font-size: 14px; white-space: nowrap; }
.ptabs button.on { background: var(--ink); color: var(--paper); }
.ptabs button.lock { opacity: .5; }
.sw { display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; }
.sw button { aspect-ratio: 1; min-height: 44px; border-radius: 12px; border: 2.5px solid var(--ink); }
.sw button.on { box-shadow: 0 0 0 3px var(--paper), 0 0 0 6px var(--ink); }
.opt { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.opt button { min-height: 52px; border-radius: 12px; border: 2.5px solid var(--ink); background: #fffaf0; font-weight: 900; font-size: 14px; padding: 4px; }
.opt button.on { background: #e7f7e3; box-shadow: inset 0 0 0 2px var(--ink); }
.opt button small { display: block; font-size: 12px; color: var(--coin-d); }
input[type=range] { width: 100%; height: 44px; }
/* sliders in our own ink and paper, with a thumb a finger can hold */
input[type=range] { -webkit-appearance: none; appearance: none; background: transparent; accent-color: var(--terra); }
input[type=range]::-webkit-slider-runnable-track { height: 12px; border-radius: 6px; background: #eadbbd; border: 2px solid var(--ink); }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 28px; height: 28px; margin-top: -10px; border-radius: 50%; background: var(--terra); border: 2.5px solid var(--ink); box-shadow: 0 2px 0 var(--ink); }
input[type=range]::-moz-range-track { height: 8px; border-radius: 6px; background: #eadbbd; border: 2px solid var(--ink); }
input[type=range]::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: var(--terra); border: 2.5px solid var(--ink); }
input[type=text] { font: inherit; font-size: 20px; font-weight: 900; letter-spacing: 2px; text-transform: uppercase; width: 100%; height: 48px; border: 2.5px solid var(--ink); border-radius: 12px; padding: 0 12px; background: #fff; color: var(--ink); user-select: text; -webkit-user-select: text; }
input.name { text-transform: none; letter-spacing: 0; }
.pad { display: grid; grid-template-columns: repeat(16, 1fr); width: min(100%, 236px, 30vh); aspect-ratio: 1; margin: 0 auto; border: 2.5px solid var(--ink); border-radius: 8px; overflow: hidden; background: repeating-conic-gradient(#f3e7cf 0 25%, #fffaf0 0 50%) 0 0/ 12.5% 12.5%; touch-action: none; }
.pad.small { width: min(100%, 236px, 16vh); } /* paint shop: room for the place chips and the book row */
.pad i { display: block; border-right: 1px solid rgba(58,34,22,.08); border-bottom: 1px solid rgba(58,34,22,.08); }
.pal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 4px; }
.pal button { min-height: 44px; border-radius: 10px; border: 2.5px solid var(--ink); font-weight: 900; }
.pal button.word { background: #fffaf0; font-size: 12px; padding: 0 2px; color: var(--ink2); }
.pal button.on { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ink); }
.paybar { position: sticky; bottom: 0; background: var(--paper); padding: 8px 0 4px; display: flex; gap: 8px; border-top: 2px solid #ead3ab; margin-top: 10px; }

/* toasts, fly, pulse */
#toast { position: absolute; left: 50%; bottom: calc(var(--sb) + 80px); flex-direction: column-reverse !important; transform: translateX(-50%); z-index: 12; pointer-events: none; display: flex; flex-direction: column; gap: 6px; align-items: center; width: 90%; }
#toast div { background: var(--ink); color: var(--paper); font-weight: 900; padding: 8px 14px; border-radius: 14px; font-size: 15px; animation: toast 2.2s ease forwards; text-align: center; }
#app.ca-on #toast { bottom: calc(var(--sb) + 132px); }
#fly { position: fixed; inset: 0; pointer-events: none; z-index: 20; }
#fly .c { position: fixed; width: 22px; height: 22px; margin: -11px; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #ffe27a, #f2b52b 60%, #c98a12); border: 2px solid var(--ink); }
#fly .lbl { position: fixed; font-weight: 900; font-size: 22px; color: var(--coin-d); -webkit-text-stroke: 1px var(--paper); text-shadow: 0 2px 0 var(--paper); transform: translate(-50%, -50%); animation: floatup 1s ease forwards; white-space: nowrap; }
#fly .lbl.r { color: var(--rep-d); }
.pulse:not(#collectAll) { position: relative; }
.pulse { animation: pulse 1.1s ease-in-out infinite; z-index: 2; }
.pulse::after { content: ''; position: absolute; inset: -6px; border-radius: inherit; border: 4px solid #fff; box-shadow: 0 0 0 2px var(--ink), inset 0 0 0 2px var(--ink); animation: ring 1.1s ease-out infinite; pointer-events: none; }
#pausebtn { position: absolute; right: 10px; top: calc(var(--st) + 8px); width: 44px; height: 44px; border-radius: 12px; background: var(--paper); border: 2.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink); font-weight: 900; font-size: 18px; z-index: 6; }
#backbtn { position: absolute; left: 10px; top: calc(var(--st) + 8px); z-index: 6; }

@keyframes bump { 40% { transform: scale(1.15); } }
@keyframes goalpop { 30% { transform: scale(1.06); } }
@keyframes pop { from { transform: scale(.7); opacity: 0; } }
@keyframes toast { 0% { opacity: 0; transform: translateY(-8px); } 10%, 80% { opacity: 1; transform: none; } 100% { opacity: 0; } }
@keyframes floatup { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); } 20% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -160%) scale(1); } }
@keyframes cut { 0% { opacity: 0; transform: translateY(6px); } 15%, 75% { opacity: 1; transform: none; } 100% { opacity: 0; transform: translateY(-10px); } }
@keyframes pulse { 50% { transform: scale(1.05); } }
@keyframes ring { 0% { opacity: 1; transform: scale(.96); } 100% { opacity: 0; transform: scale(1.18); } }
@media (min-width: 700px) { #panel { border-left: 2.5px solid var(--ink); border-right: 2.5px solid var(--ink); } #tabs { border: 2.5px solid var(--ink); border-bottom: 0; border-radius: 18px 18px 0 0; } }
/* Round A: parts chips, sticker book, segments, shows, trophies, walk-in sheet */
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 4px; touch-action: pan-x; scrollbar-width: none; }
.chips button { min-height: 44px; padding: 0 12px; border-radius: 22px; border: 2.5px solid var(--ink); background: #fffaf0; font-weight: 900; font-size: 14px; white-space: nowrap; flex: none; }
.chips button.on { background: var(--terra); color: #fff; }
.chips button[disabled] { opacity: .45; }
.opt button[disabled] { opacity: .4; }
.opt button[disabled] small { color: var(--ink2); }
.book { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0; touch-action: pan-x; scrollbar-width: none; }
.book button { flex: none; width: 48px; height: 48px; border-radius: 10px; border: 2.5px solid var(--ink); background: #fff6e2; padding: 2px; display: grid; place-items: center; }
.seg { display: flex; gap: 0; margin: 0 2px 10px; border: 2.5px solid var(--ink); border-radius: 14px; overflow: hidden; box-shadow: 0 3px 0 var(--ink); }
.seg button { flex: 1; min-height: 44px; font-weight: 900; font-size: 15px; background: #fffaf0; color: var(--ink2); }
.seg button + button { border-left: 2.5px solid var(--ink); }
.seg button.on { background: var(--ink); color: var(--paper); }
.seg button.lock { opacity: .55; }
.show .theme { font-size: 18px; font-weight: 900; }
.ribbon { display: inline-block; min-width: 22px; padding: 1px 7px; border-radius: 9px; border: 2px solid var(--ink); font-size: 12px; font-weight: 900; }
.ribbon.r1 { background: #d9a26a; } .ribbon.r2 { background: #dfe3e6; } .ribbon.r3 { background: #f4d34d; } .ribbon.r0 { background: #fffaf0; color: var(--ink2); }
.wall { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.wall div { border: 2.5px solid var(--ink); border-radius: 12px; background: #fffaf0; padding: 6px 2px; text-align: center; font-size: 12px; font-weight: 800; line-height: 1.15; min-height: 62px; }
.wall div.r0 { opacity: .5; border-style: dashed; }
.wall div.r1 { background: #f1d2b0; } .wall div.r2 { background: #eceff1; } .wall div.r3 { background: #fbe9a6; }
.wall b { display: block; font-size: 20px; }
.stickers { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.stickers > div { border: 2.5px solid var(--ink); border-radius: 12px; background: #fffaf0; padding: 4px; text-align: center; font-size: 12px; font-weight: 800; min-height: 64px; display: grid; place-items: center; gap: 2px; }
.stickers > div.empty { border-style: dashed; opacity: .55; }
.stickers button.x2 { min-height: 32px; font-size: 12px; padding: 0 6px; border-radius: 8px; border: 2px solid var(--ink); background: #f4a090; font-weight: 900; }
.meter { display: inline-flex; gap: 3px; vertical-align: middle; }
.meter i { width: 14px; height: 14px; border-radius: 7px; border: 2px solid var(--ink); background: #fffaf0; }
.meter i.on { background: var(--coin); }
.grades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 8px 0; text-align: center; }
.grades div { border: 2.5px solid var(--ink); border-radius: 12px; padding: 4px; font-weight: 900; }
.grades div:nth-child(1) { background: #fbe9a6; } .grades div:nth-child(2) { background: #eceff1; } .grades div:nth-child(3) { background: #f1d2b0; }
.swatch { display: inline-block; width: 28px; height: 28px; border-radius: 8px; border: 2.5px solid var(--ink); vertical-align: middle; }

/* Round B */
#toast.top { bottom: auto; top: calc(var(--st) + 70px); flex-direction: column !important; }
#fly .lbl.h { color: #c4566a; }
.tag.small { font-size: 12px; padding: 0 6px; vertical-align: middle; }
.hearts { color: #e8584a; font-size: 15px; letter-spacing: 1px; -webkit-text-stroke: .5px var(--ink); white-space: nowrap; }
.hearts i { font-style: normal; color: #f3e3cf; }
.heart { color: #e8584a; }
.map { display: block; margin: 0 auto 10px; border-radius: 14px; touch-action: pan-y; }
.trip .souv { flex-wrap: wrap; }
.slot { border-radius: 8px; border: 2px solid var(--ink); flex: none; }
.slot.q { display: inline-grid; place-items: center; background: #f3e7cf; color: var(--ink2); font-weight: 900; font-size: 14px; border-style: dashed; }
.pc { display: block; border-radius: 8px; flex: none; max-width: 100%; }
.cards { gap: 10px; }
.pcard { border: 2.5px solid var(--ink); border-radius: 14px; background: #fffaf0; box-shadow: 0 3px 0 var(--ink); padding: 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; }
.pcard canvas.pc { width: 100% !important; height: auto !important; }
.pcard .souv { gap: 4px; justify-content: center; }
.pcard.full { background: #fbe9a6; }
.cupic { width: 40px; height: 44px; flex: none; position: relative; }
.cupic::before { content: ''; position: absolute; left: 5px; top: 2px; width: 30px; height: 24px; background: var(--c); border: 2.5px solid var(--ink); border-radius: 4px 4px 16px 16px; }
.cupic::after { content: ''; position: absolute; left: 12px; top: 30px; width: 16px; height: 8px; background: #9c6a3c; border: 2.5px solid var(--ink); border-radius: 2px; box-shadow: 0 -5px 0 -1px var(--c); }
.cupic:not(.won) { opacity: .45; filter: grayscale(.6); }
.cupic.big { width: 80px; height: 88px; margin: 8px auto; transform: scale(1.6); transform-origin: top center; margin-bottom: 50px; }
.bracket { display: block; margin: 8px auto 0; border-radius: 10px; border: 2px solid var(--ink); }
.shelf { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.shelf div { border: 2.5px solid var(--ink); border-radius: 12px; background: #fbe9a6; padding: 6px 2px; text-align: center; font-size: 12px; font-weight: 800; line-height: 1.15; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.shelf div.empty { background: #fffaf0; border-style: dashed; opacity: .7; }
.shelf canvas { max-width: 100%; height: auto !important; }
.shelf b { font-size: 15px; }
.achs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ach { border: 2px dashed #c8ab80; border-radius: 12px; padding: 6px 8px; font-size: 12px; line-height: 1.2; background: #fffaf0; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ach b { font-size: 13px; }
.ach span { color: var(--ink2); font-weight: 700; }
.ach em { font-style: normal; font-size: 12px; }
.ach.got { border: 2.5px solid var(--ink); background: #e7f7e3; }
.stats div { display: flex; justify-content: space-between; gap: 8px; padding: 7px 2px; border-bottom: 1.5px solid #ead3ab; font-weight: 800; font-size: 14px; }
.stats div:last-child { border-bottom: 0; }
.stats b { font-size: 16px; }
.props { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.prop { border: 2.5px solid var(--ink); border-radius: 14px; background: #fffaf0; padding: 6px 4px; display: flex; flex-direction: column; align-items: center; gap: 3px; text-align: center; min-width: 0; }
.prop .pn { font-weight: 900; font-size: 13px; line-height: 1.1; }
.prop .pl { font-size: 12px; line-height: 1.1; }
.prop .btn { width: 100%; }
.prop .x2 { min-height: 44px; font-size: 13px; padding: 0 6px; border-radius: 8px; border: 2px solid var(--ink); background: #fffaf0; font-weight: 900; width: 100%; }
.souvbig { display: block; margin: 8px auto 4px; border-radius: 14px; border: 2.5px solid var(--ink); }
#placebar { position: absolute; left: 8px; right: 8px; top: calc(var(--st) + 104px); z-index: 6; display: flex; gap: 8px; align-items: center; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 16px; box-shadow: 0 3px 0 var(--ink); padding: 6px 8px; max-width: 424px; margin: 0 auto; }
#placebar canvas { border-radius: 8px; flex: none; }
#visitbar { position: absolute; left: 0; right: 0; top: 0; z-index: 6; display: flex; gap: 8px; align-items: flex-start; padding: calc(var(--st) + 8px) 10px 58px; background: var(--paper); border-bottom: 2.5px solid var(--ink); } /* solid: the bubble sits on it, nothing of the tower shows through */
#visitbar .vname { font-weight: 900; font-size: 17px; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#vsay { position: absolute; left: 12px; right: 12px; top: calc(var(--st) + 60px); z-index: 6; max-width: 416px; margin: 0 auto; background: #fff; border: 2.5px solid var(--ink); border-radius: 16px; padding: 6px 12px; font-weight: 800; font-size: 15px; box-shadow: 0 3px 0 var(--ink); pointer-events: none; }
#vsay.pop { animation: pop .3s cubic-bezier(.2,1.4,.4,1); }
#visitact { position: absolute; left: 0; right: 0; bottom: 0; z-index: 6; display: flex; gap: 6px; padding: 8px 8px calc(var(--sb) + 8px); background: var(--paper); border-top: 2.5px solid var(--ink); justify-content: center; }
#visitact .btn { flex: 1; flex-direction: column; gap: 0; min-height: 52px; padding: 2px 6px; white-space: normal; line-height: 1.1; max-width: 220px; }
#visitact .btn span { font-size: 14px; }
#visitact .btn small { font-size: 12px; font-weight: 800; opacity: .85; }

/* Round B fix pass */
#app.pan #hud::before { background: var(--paper); height: calc(100% + 6px); box-shadow: 0 2px 0 rgba(58,34,22,.08); }
#app.ca-on #panel:not(.full) { padding-bottom: calc(var(--sb) + 140px); }
#tabs .pulse { animation: none; }
#tabs .pulse::after { inset: 2px; animation: tabglow 1.4s ease-in-out infinite; }
@keyframes tabglow { 50% { opacity: .3; } }
.cupic::before { left: 9px; width: 22px; height: 20px; border-radius: 3px 3px 12px 12px; }
.cupic::after { left: 13px; top: 26px; width: 14px; height: 6px; box-shadow: 0 -4px 0 -1px var(--c); }
.cupic i { position: absolute; top: 5px; width: 9px; height: 11px; border: 2.5px solid var(--ink); border-radius: 50%; }
.cupic::before { z-index: 1; } /* the bowl sits over the handles' inner ends */
.cupic i:first-of-type { left: 3px; border-right-color: transparent; }
.cupic i:nth-of-type(2) { right: 3px; border-left-color: transparent; }
.cupic b.base { position: absolute; left: 8px; top: 36px; width: 24px; height: 6px; background: #9c6a3c; border: 2.5px solid var(--ink); border-radius: 2px; }

/* Round C: gifts in tower links, monthly shows, highway tags */
.giftrow { display: flex; gap: 6px; flex-wrap: wrap; }
.giftrow button { flex: 1 1 auto; min-height: 40px; border: 2.5px solid var(--ink); border-radius: 10px; background: #fff6e2; font-weight: 800; font-size: 14px; padding: 4px 8px; color: var(--ink); }
.giftrow button.on, .book button.on { background: var(--coin); box-shadow: inset 0 0 0 2px var(--ink); }
.tag.hwy { background: #3f8a5a; color: #fff6dc; }
.card.month { background: linear-gradient(#fff6dc, #fde9c4); }
.card.month .mrow { margin-top: 8px; padding-top: 8px; border-top: 2px dashed rgba(58, 34, 22, .25); }
.card.month .mrow .ribbon { min-width: 56px; text-align: center; }
/* The real street: a marker for real players, the offline line, the boards */
.tag.real { background: #cfe3f6; }
.mpname { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.mpoff { background: #fff1d6; font-weight: 800; color: var(--ink2); font-size: 14px; }
.mpoff .dot { width: 10px; height: 10px; border-radius: 50%; background: #c8ab80; border: 2px solid var(--ink); flex: none; }
.onl { color: #3f9a4a; }
.vrow + .vrow { margin-top: 8px; padding-top: 8px; border-top: 2px dashed rgba(58, 34, 22, .2); }
.board .bh { font-weight: 900; font-size: 15px; border-bottom: 2.5px solid var(--ink); }
.board .me { background: #fff1c4; border-radius: 8px; padding-left: 6px; padding-right: 6px; }
.code { font-family: ui-monospace, Menlo, monospace; font-weight: 900; font-size: 22px; letter-spacing: 2px; }
#sheet .mph { padding-right: 52px; } /* a sheet's title and first line stay clear of the close button */
.nw { white-space: nowrap; }
.btn.wrap { white-space: normal; line-height: 1.1; padding: 4px 8px; }
.reportbtn { min-height: 32px; padding: 2px 8px; border-radius: 9px; border: 2px solid var(--ink); background: #fffaf0; color: var(--ink2); font-weight: 900; font-size: 12px; vertical-align: middle; white-space: nowrap; }
.reportbtn:active { transform: translateY(1px); }

/* ---------- Round D: the week, parts, wrecks, moving cars ---------- */
#week { height: 44px; min-width: 58px; padding: 0 9px; border-radius: 22px; background: #d6f0ea; border: 2.5px solid var(--ink); box-shadow: 0 3px 0 var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; flex: none; }
#week b { font-size: 16px; font-weight: 900; }
#week span { font-size: 12px; font-weight: 900; color: var(--ink2); margin-top: 2px; }
#week.hot { background: var(--coin); animation: bump 1.2s ease infinite; }
#week .gift { font-size: 18px; }
.wobj { padding: 5px 0; border-top: 2px solid #eadbbd; font-weight: 800; font-size: 14px; }
.wobj:first-of-type { border-top: 0; }
.wobj.done { color: var(--rep-d, #1f6f66); }
.wobj .prog { height: 8px; }
.pdot { display: inline-block; width: 12px; height: 12px; border-radius: 4px; border: 2px solid var(--ink); margin-right: 5px; vertical-align: -1px; }
.pline { display: flex; flex-wrap: wrap; gap: 6px; }
.pchip { font-size: 13px; font-weight: 800; background: #fffaf0; border: 2px solid var(--ink); border-radius: 10px; padding: 3px 7px; white-space: nowrap; }
.edrow { display: flex; gap: 4px; justify-content: space-between; margin-top: 6px; }
.edrow canvas { max-width: 32%; height: auto !important; }
.card.dim { opacity: .62; }
.liftcab { position: relative; width: 256px; max-width: 100%; height: 118px; margin: 8px auto; background: #f5e3bd; border: 6px solid #c4623e; outline: 2.5px solid var(--ink); border-radius: 6px; overflow: hidden; display: grid; place-items: end center; }
.liftcab::before { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 22px, rgba(160,110,60,.16) 22px 32px); }
.liftcab canvas { position: relative; }
.liftcab .rise { animation: liftrise .9s cubic-bezier(.2,.8,.3,1) both; }
.liftcab.open .rise { animation: sheetoff .5s ease both; }
.liftcab .crate { position: relative; width: 84px; height: 70px; margin-bottom: 6px; background: #c9a477; border: 2.5px solid var(--ink); border-radius: 6px; display: grid; place-items: center; font-size: 34px; font-weight: 900; animation: liftrise .9s cubic-bezier(.2,.8,.3,1) both; }
@keyframes liftrise { from { transform: translateY(110px); } to { transform: translateY(0); } }
@keyframes sheetoff { from { transform: scale(.9); filter: brightness(1.6) saturate(.2); } to { transform: scale(1); filter: none; } }
.mvgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mvgrid.four { grid-template-columns: repeat(4, 1fr); }
.mv { min-height: 48px; border-radius: 12px; border: 2.5px solid var(--ink); background: #fffaf0; box-shadow: 0 2px 0 var(--ink); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 3px 4px; line-height: 1.1; }
.mv b { font-size: 13px; font-weight: 900; }
.mv span { font-size: 12px; font-weight: 700; color: var(--ink2); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mv.here { background: #e7f7e3; }
.mv:disabled { opacity: .5; box-shadow: none; }
.mstar { color: #c9862c; letter-spacing: 1px; white-space: nowrap; }
.card.comm { background: #eef7f5; }
.card.boxcard { background: #fff1c9; }
div.pick { cursor: default; }

.sliders { margin-top: 4px; display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.sliders label { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 800; color: var(--ink2); height: 36px; }
.sliders label:first-child { grid-column: 1 / 3; }
.sliders label input { height: 36px; }
.sliders label input { flex: 1; min-width: 0; }

/* with the week chip in the row, the level pill stacks its bar under the label so the bar never shrinks to nothing */
#hud.wk .row { gap: 6px; }
#hud.wk #level { flex-direction: column; justify-content: center; gap: 3px; padding: 0 8px; align-items: stretch; }
#hud.wk #level .lv { font-size: 14px; padding: 0 6px; text-align: center; align-self: center; }
#hud.wk #level .bar { flex: none; height: 9px; }
