* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; background: #f6c99a; }
body { font: 15px/1.35 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif, "Noto Color Emoji"; color: #2b2118; -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
button { font: inherit; color: inherit; cursor: pointer; }
.hidden { display: none !important; }
body.touch .desk-only, body:not(.touch) .touch-only { display: none !important; }

#top { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center;
  padding: calc(env(safe-area-inset-top) + 8px) 12px 0; pointer-events: none; }
#top > * { pointer-events: auto; }
.brand { font-size: 19px; background: rgba(255, 248, 236, .82); padding: 8px 14px; border-radius: 22px; box-shadow: 0 2px 8px rgba(80, 40, 10, .12); }
.brand span { opacity: .65; font-size: 15px; margin-left: 4px; }
.right { display: flex; gap: 8px; align-items: center; }
.icon { width: 44px; height: 44px; border-radius: 22px; border: 0; background: rgba(255, 248, 236, .82); font-size: 19px; box-shadow: 0 2px 8px rgba(80, 40, 10, .12); }
.icon[aria-pressed="true"] { background: #2b2118; color: #fff; }
#shots { display: flex; gap: 5px; padding: 13px 12px; }
#shots i { width: 11px; height: 11px; border-radius: 50%; background: #e4572e; }
#shots i.used { background: rgba(43, 33, 24, .2); }
.chip { background: rgba(255, 248, 236, .82); padding: 10px 12px; border-radius: 22px; font-weight: 600; }

#job { position: fixed; top: calc(env(safe-area-inset-top) + 58px); left: 12px; right: 12px; max-width: 460px; margin: 0 auto; background: rgba(255, 248, 236, .88);
  border-radius: 14px; padding: 7px 12px; box-shadow: 0 2px 8px rgba(80, 40, 10, .12); pointer-events: none; font-size: 13px; }
#job p { margin: 0; }
#jobAmmo { font-weight: 700; }
#jobBrief { opacity: .85; }
#jobBrief b { font-weight: 700; }
body.flying #job, body.done #job { display: none; }
#loading { position: fixed; top: calc(env(safe-area-inset-top) + 60px); left: 50%; transform: translateX(-50%); width: 180px; text-align: center; font-size: 12px; opacity: .8; pointer-events: none; transition: opacity .4s; }
#loading i { display: block; height: 4px; border-radius: 2px; background: rgba(43, 33, 24, .15); overflow: hidden; position: relative; margin-bottom: 4px; }
#loading i::after { content: ""; position: absolute; inset: 0; width: 40%; background: #2b2118; border-radius: 2px; animation: load 1.1s ease-in-out infinite; }
@keyframes load { from { transform: translateX(-100%); } to { transform: translateX(250%); } }
#loading.done { opacity: 0; }

#banner { position: fixed; top: calc(env(safe-area-inset-top) + 118px); left: 50%; transform: translateX(-50%); background: #2b2118; color: #fff8ec;
  padding: 7px 14px; border-radius: 16px; font-size: 13px; white-space: nowrap; pointer-events: none; }

#count { position: fixed; top: calc(env(safe-area-inset-top) + 104px); left: 16px; text-align: left; pointer-events: none; color: #fff;
  text-shadow: 0 2px 10px rgba(60, 20, 0, .5); }
#count b { display: block; font-size: 48px; line-height: 1; font-weight: 800; transform-origin: left center; }
#count b.pop { animation: pop .18s ease-out; }
#count span { font-size: 16px; font-weight: 600; }
@keyframes pop { from { transform: scale(1.35); } to { transform: scale(1); } }

#ring { position: fixed; width: 120px; height: 120px; margin: -60px 0 0 -60px; pointer-events: none; }
#ring circle { fill: none; stroke-width: 7; }
#ring .track { stroke: rgba(255, 255, 255, .35); }
#ring .fill { stroke: #fff; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 60px 60px; stroke-dasharray: 314; stroke-dashoffset: 314; }
#ring text { fill: #fff; font: 700 20px system-ui, sans-serif; text-anchor: middle; text-shadow: 0 1px 4px rgba(0, 0, 0, .4); }

#bottom { position: fixed; left: 0; right: 0; bottom: 0; padding: 0 12px calc(env(safe-area-inset-bottom) + 10px); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
#bottom > * { pointer-events: auto; }
#picker { display: flex; gap: 6px; background: rgba(255, 248, 236, .82); padding: 5px; border-radius: 26px; box-shadow: 0 2px 8px rgba(80, 40, 10, .12); }
#picker button { border: 0; background: transparent; border-radius: 21px; min-height: 44px; padding: 0 12px; display: flex; align-items: center; gap: 5px; }
#picker button i { font-style: normal; font-size: 18px; }
#picker button span { font-size: 14px; }
#picker button[aria-checked="true"] { background: #2b2118; color: #fff8ec; }
#picker.locked { opacity: .5; pointer-events: none; }
.row { display: flex; align-items: center; gap: 10px; max-width: 100%; }
#hint { margin: 0; font-size: 13px; background: rgba(255, 248, 236, .82); padding: 8px 12px; border-radius: 16px; pointer-events: none; }
.pill { min-height: 44px; padding: 0 16px; border-radius: 22px; border: 0; background: rgba(255, 248, 236, .92); font-weight: 600; box-shadow: 0 2px 8px rgba(80, 40, 10, .12); white-space: nowrap; }
.pill.primary { background: #e4572e; color: #fff; }

#sheet { position: fixed; left: 0; right: 0; bottom: 0; background: #fff8ec; border-radius: 22px 22px 0 0; padding: 18px 18px calc(env(safe-area-inset-bottom) + 14px);
  text-align: center; box-shadow: 0 -6px 24px rgba(80, 40, 10, .18); animation: rise .35s ease-out; max-height: 100%; overflow-y: auto; overscroll-behavior: contain; }
@keyframes rise { from { transform: translateY(100%); } to { transform: none; } }
#sheet .kicker { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; opacity: .6; }
#sheet h2 { margin: 2px 0 0; font-size: 40px; line-height: 1.1; }
#sheet h2 small { font-size: 18px; font-weight: 600; opacity: .6; }
#sheetLine { margin: 4px 0 2px; font-size: 16px; font-weight: 700; }
#sheetBrief { margin: 0 0 4px; font-size: 14px; }
#sheetRating { margin: 2px 0 6px; font-size: 18px; font-weight: 700; color: #c8442a; }
#sheetBar { margin: 0 0 10px; font-size: 18px; letter-spacing: 1px; }
#sheetShots { margin: -4px 0 10px; font-size: 15px; font-weight: 600; opacity: .8; }
#sheet .buttons { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
#sheetNote { margin: 10px 0 0; font-size: 13px; opacity: .7; }
#sheet .more { margin: 6px 0 0; font-size: 13px; }
#sheetMore { margin: 12px -8px 0; }
#jobMark { display: block; margin-top: 3px; font-size: 11px; opacity: .6; }
#sheet a { color: #8a3a1e; }
#sheet.min { padding-top: 10px; }
#sheet.min #sheetRating, #sheet.min #sheetBrief, #sheet.min #sheetBar, #sheet.min #sheetShots, #sheet.min #sheetNote, #sheet.min #sheetMore { display: none; }

#toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 62px); transform: translateX(-50%); background: #2b2118; color: #fff8ec; padding: 9px 16px; border-radius: 18px; font-size: 14px; pointer-events: none; }

body.flying #bottom, body.flying #sheet { display: none; }

@media (min-width: 900px) and (pointer: fine) {
  #sheet { left: auto; right: 24px; bottom: 24px; width: 400px; max-height: calc(100% - 48px); border-radius: 22px; } /* wide enough for the studio row's cards */
  #bottom { flex-direction: row; justify-content: center; }
}

/* the bill while it falls: chips × mult, and the bonuses popping */
#count .bill { display: flex; align-items: baseline; gap: 8px; }
#count .bill b { display: inline-block; font-size: 46px; line-height: 1; font-weight: 800; transform-origin: center; font-variant-numeric: tabular-nums; }
#count .bill i { font-style: normal; font-size: 26px; font-weight: 700; opacity: .85; }
#count #mult { background: #fff8ec; color: #c8442a; text-shadow: none; border-radius: 10px; padding: 2px 9px 4px; font-size: 38px; }
#count #mult.pop { animation: popBig .3s ease-out; }
#count #chips.pop { animation: pop .18s ease-out; }
#countTotal { margin: 2px 0 0; font-size: 30px; font-weight: 800; min-height: 0; }
#count.closed #countTotal { animation: stamp .35s ease-out; }
#downs { display: block; font-size: 15px; font-weight: 600; opacity: .9; }
#pops { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
#pops p { margin: 0; background: #2b2118; color: #fff8ec; text-shadow: none; padding: 3px 10px; border-radius: 12px; font-size: 14px; font-weight: 700; animation: popIn .25s ease-out, fade 1.4s ease-in forwards; }
#pops p.big { background: #e4572e; font-size: 16px; }
@keyframes popBig { from { transform: scale(1.6) rotate(-6deg); } to { transform: none; } }
@keyframes stamp { from { transform: scale(1.8); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes popIn { from { transform: translateX(-12px) scale(1.2); } to { transform: none; } }
@keyframes fade { 0%, 70% { opacity: 1; } 100% { opacity: 0; } }
body.closing #bottom, body.closing #sheet { display: none; }
body.closing #job { display: none; }

/* the work order pick: three big cards above the slingshot */
#orders { position: fixed; left: 8px; right: 8px; max-width: 640px; margin: 0 auto; text-align: center; animation: rise .25s ease-out; }
#ordersLead { display: inline-block; margin: 0 0 6px; font-size: 13px; font-weight: 700; background: #2b2118; color: #fff8ec; padding: 5px 12px; border-radius: 14px; }
#ordersCards { display: flex; gap: 6px; }
#ordersCards button { flex: 1 1 0; min-height: 132px; border: 0; border-radius: 14px; background: #fff8ec; padding: 8px 6px 10px; display: flex; flex-direction: column; align-items: center; gap: 3px;
  box-shadow: 0 3px 0 #d7b48f, 0 6px 14px rgba(80, 40, 10, .2); position: relative; }
#ordersCards button i { font-style: normal; font-size: 30px; line-height: 1.1; }
#ordersCards button b { font-size: 14px; line-height: 1.15; }
#ordersCards button span { font-size: 12px; line-height: 1.25; opacity: .85; }
#ordersCards button kbd { position: absolute; top: 6px; right: 8px; font: 700 11px system-ui, sans-serif; opacity: .45; }
body.touch #ordersCards button kbd { display: none; }
#ordersCards button:active, #ordersCards button.sel { background: #2b2118; color: #fff8ec; box-shadow: 0 3px 0 #000; }
#jobOrders { margin-top: 2px !important; font-weight: 600; color: #8a3a1e; }

/* the invoice */
#sheetInvoice { margin: 6px auto 8px; max-width: 360px; text-align: left; background: #fffdf8; border: 1px dashed #c9a988; border-radius: 8px; padding: 6px 10px; font-size: 13px; }
#sheetInvoice .to { margin: 0 0 4px; font-size: 12px; opacity: .75; }
#sheetInvoice table { width: 100%; border-collapse: collapse; }
#sheetInvoice td { padding: 3px 2px; vertical-align: top; border-top: 1px solid rgba(43, 33, 24, .08); }
#sheetInvoice td small { display: block; font-size: 11px; opacity: .65; }
#sheetInvoice td.m { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
#sheetInvoice tr.tot td { font-weight: 800; font-size: 15px; border-top: 2px solid #2b2118; }
@media (min-width: 900px) and (pointer: fine) {
  #ordersCards button { min-height: 150px; padding: 12px 10px; }
  #ordersCards button b { font-size: 16px; }
  #ordersCards button span { font-size: 13px; }
}

/* v3: the site line, the friend's invoice to beat, par */
#jobSite { margin-top: 2px !important; font-weight: 600; }
#jobRun { margin-top: 2px !important; font-weight: 600; color: #2b5d8a; }
#rival { position: fixed; top: calc(env(safe-area-inset-top) + 58px); right: 12px; margin: 0; background: #2b2118; color: #fff8ec; padding: 6px 12px; border-radius: 14px; font-size: 13px; pointer-events: none; max-width: 70%; text-align: right; }
#rival b.up { color: #8fe08a; }
body:not(.flying):not(.closing) #rival { top: auto; bottom: calc(env(safe-area-inset-bottom) + 112px); left: 50%; right: auto; transform: translateX(-50%); white-space: nowrap; }
#sheetPar { margin: 0 0 4px; font-size: 14px; }

/* the yard: a ledger of things to buy, not cards */
#yard { position: fixed; left: 0; right: 0; bottom: 0; max-height: 100%; overflow-y: auto; background: #f1e6d2; border-radius: 22px 22px 0 0; padding: 16px 16px calc(env(safe-area-inset-bottom) + 14px);
  box-shadow: 0 -6px 24px rgba(80, 40, 10, .18); animation: rise .35s ease-out; text-align: center; border-top: 6px solid #e8b923; }
#yard .kicker { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; opacity: .6; }
#yard h2 { margin: 2px 0; font-size: 21px; }
#yardNext { margin: 0 0 8px; font-weight: 600; }
#yardItems { display: flex; flex-direction: column; gap: 6px; max-width: 460px; margin: 0 auto; }
#yardItems button { display: grid; grid-template-columns: 34px 1fr auto; grid-template-rows: auto auto; column-gap: 8px; text-align: left; align-items: center; border: 0; border-radius: 10px;
  background: #fffaf0; padding: 7px 10px; min-height: 52px; box-shadow: 0 2px 0 #d7b48f; }
#yardItems button i { grid-row: 1 / 3; font-style: normal; font-size: 24px; text-align: center; }
#yardItems button b { font-size: 14px; }
#yardItems button span { grid-column: 2; font-size: 12px; opacity: .8; }
#yardItems button em { grid-row: 1 / 3; grid-column: 3; font-style: normal; font-weight: 800; background: #2b2118; color: #fff8ec; border-radius: 8px; padding: 4px 8px; }
#yardItems button:disabled { opacity: .45; }
#yardItems button.got { opacity: 1; background: #e3f2d9; }
#yardItems button.got em { background: #3f8f5a; }
#yardOwned { margin: 8px 0; font-size: 13px; }
@media (min-width: 900px) and (pointer: fine) {
  #yard { left: auto; right: 24px; bottom: 24px; width: 420px; max-height: calc(100% - 48px); border-radius: 22px; }
}
/* the hint gets its own line above the buttons, so Practice and Contract fit beside each other on a phone */
#bottom .row { flex-wrap: wrap; justify-content: center; }
#bottom #hint { flex: 1 1 100%; text-align: center; order: -1; }
@media (min-width: 900px) and (pointer: fine) { #bottom #hint { flex: 0 1 auto; order: 0; } }

/* round 12: the client's speech bubble and their stamp on the invoice */
#say { position: fixed; z-index: 4; margin: 0; max-width: 170px; background: #fff8ec; color: #2b2118; font-weight: 700; font-size: 14px; padding: 6px 11px; border-radius: 14px 14px 3px 14px; box-shadow: 0 2px 8px rgba(0,0,0,.25); pointer-events: none; animation: sayIn .18s ease-out; }
@keyframes sayIn { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }
#sheetStamp { position: absolute; top: 14px; right: 14px; font: 900 22px/1 system-ui, sans-serif; letter-spacing: 1px; padding: 6px 10px; border: 4px solid currentColor; border-radius: 8px; transform: rotate(-12deg); opacity: .85; pointer-events: none; }
#sheetStamp.paid { color: #2f8f4a; }
#sheetStamp.no { color: #c8322b; }
#sheetStamp.thump { animation: thump .5s cubic-bezier(.3, 1.6, .5, 1) .3s both; }
@keyframes thump { from { transform: rotate(-12deg) scale(3); opacity: 0; } 60% { opacity: .95; } to { transform: rotate(-12deg) scale(1); opacity: .85; } }
