:root {
  --backdrop: #cdd5dd;
  --bg: #eef3f7;
  /* The panels are warm paper with a dark warm outline and a hard drop edge, like the icons (icons.js): chunky, never grey. */
  --panel: #fffdf7;
  --cream: #fff5e3;
  --ink: #2f2230;
  --muted: #6d5c66;
  --edge: #3b2a2e;
  --line: #d9cdbd;
  --soft: #efe4d2;
  --teal: #0d9488;
  --teal-d: #0a766c;
  --teal-l: #cdeee9;
  --gold: #f6b73c;
  --gold-d: #c98512;
  --gold-ink: #4a3000;
  --amber: #e8892b;
  --off: #c3ccd6;
  --radius: 16px;
  font-family: 'DM Sans', system-ui, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; }
body { background: var(--backdrop); overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; touch-action: manipulation; }
h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
[hidden] { display: none !important; }
.icon { width: 1.6em; height: 1.6em; flex: none; vertical-align: middle; }

#game {
  --sheet-h: 0px;
  position: relative;
  width: min(100vw, 480px);
  height: 100vh;
  height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
  box-shadow: 0 0 0 1px var(--line);
}

/* HUD: three chunky tokens over the tower ------------------------------------------------------------------------ */
.hud {
  position: absolute; z-index: 5; inset: 0 0 auto 0;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top) + 10px) 14px 10px;
  pointer-events: none;
}
.brand, .wallet, .chip { background: var(--panel); border: 2.5px solid var(--edge); box-shadow: 0 3px 0 var(--edge); }
.brand { pointer-events: auto; min-height: 44px; font: inherit; color: inherit; text-align: left; cursor: pointer; display: flex; flex-direction: column; line-height: 1.15; min-width: 0; padding: 5px 14px; border-radius: 16px; }
.brand b { font-size: 17px; letter-spacing: -0.01em; }
.stage-name { font-size: 13px; color: var(--muted); font-weight: 600; }
.stage-name::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--sec, var(--teal)); box-shadow: 0 0 0 1.5px var(--edge); margin-right: 6px; }
.wallet {
  display: flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px 0 8px; border-radius: 999px;
  font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.wallet .icon { width: 30px; height: 30px; }
.chip {
  position: absolute; z-index: 5; left: 14px; top: calc(env(safe-area-inset-top) + 66px);
  min-height: 44px; padding: 0 16px; border-radius: 999px; color: var(--ink); font-weight: 700; font-size: 15px;
}
.chip.ready { background: linear-gradient(#ffdc7a, var(--gold)); color: var(--gold-ink); animation: nudge 1.6s ease-in-out infinite; }
.brand:active, .chip:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
@keyframes nudge { 0%, 70%, 100% { transform: none; } 78% { transform: translateY(-3px) rotate(-2deg); } 88% { transform: translateY(0) rotate(2deg); } }

/* Coach and toast ----------------------------------------------------------------------------------------------- */
.coach {
  position: absolute; z-index: 6; left: 14px; right: 14px; bottom: calc(env(safe-area-inset-bottom) + 16px);
  padding: 13px 16px; border-radius: 18px; background: #2f2a44; color: #fff; border: 2.5px solid var(--edge); box-shadow: 0 4px 0 var(--edge);
  font-size: 15.5px; font-weight: 600; line-height: 1.3; text-align: center; pointer-events: none;
}
.toast {
  position: absolute; z-index: 9; left: 50%; bottom: calc(var(--sheet-h) + env(safe-area-inset-bottom) + 20px);
  transform: translate(-50%, 8px) scale(0.96); opacity: 0; pointer-events: none;
  max-width: calc(100% - 28px); padding: 10px 16px; border-radius: 18px; border: 2.5px solid var(--edge); box-shadow: 0 3px 0 var(--edge);
  background: #8a2f14; color: #fff; font-size: 14.5px; font-weight: 600; text-align: center;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); transition: opacity 0.15s, transform 0.2s cubic-bezier(0.2, 1.5, 0.4, 1); }
.toast.beat { background: #2f2a44; font-weight: 700; }

/* Pop-ups ------------------------------------------------------------------------------------------------------- */
.fx { position: absolute; inset: 0; z-index: 8; pointer-events: none; overflow: hidden; }
.pop {
  position: absolute; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 4px;
  font-weight: 700; font-size: 22px; color: var(--gold-ink); text-shadow: 0 0 3px #fff, 0 0 3px #fff, 0 0 6px #fff;
  animation: rise 1.1s ease-out forwards;
}
.pop .icon { width: 28px; height: 28px; }
@keyframes rise { 0% { opacity: 0; margin-top: 8px; } 15% { opacity: 1; } 100% { opacity: 0; margin-top: -56px; } }

/* Buttons: chunky, with a hard edge under them that the press pushes into ------------------------------------------ */
.btn {
  position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 50px; padding: 0 14px; margin-bottom: 4px;
  border-radius: 16px; border: 2.5px solid var(--edge); box-shadow: 0 4px 0 var(--edge);
  font-size: 16px; font-weight: 700; background: var(--panel); color: var(--ink);
  transition: transform 0.06s, box-shadow 0.06s;
}
/* A button's contents never take the tap themselves: a label or price that is redrawn mid-press cannot lose it. */
.btn > *, .seg > *, .x > *, .chip > *, .swap > * { pointer-events: none; }
.btn > * { position: relative; }
.btn > span { display: inline-flex; align-items: center; gap: 6px; }
.btn .icon { width: 26px; height: 26px; }
.btn .price, .btn .tail { display: inline-flex; align-items: center; gap: 3px; padding: 2px 9px 2px 4px; border-radius: 999px; background: #0000001f; font-variant-numeric: tabular-nums; }
.btn .price .icon, .btn .tail .icon { width: 22px; height: 22px; }
.btn .tail b { font-weight: 700; }
.btn.main { min-height: 56px; font-size: 18px; }
.btn.main .ico .icon { width: 32px; height: 32px; }
.btn.primary, .btn.main { background: linear-gradient(#1bb09f, #0b8377); color: #fff; text-shadow: 0 1px 0 #0000004d; }
.btn.gold { background: linear-gradient(#ffdc7a, var(--gold)); color: var(--gold-ink); text-shadow: none; }
.btn.ghost { background: var(--panel); color: var(--teal-d); text-shadow: none; }
.btn.ghost .price { background: var(--teal-l); color: var(--ink); }
.btn.off { background: var(--soft); color: #7d6c63; text-shadow: none; border-color: #9c8b82; box-shadow: 0 4px 0 #9c8b82; }
.btn.off .price, .btn.off .tail { background: #00000012; }
/* Busy: the face fills from the left as the batch or the launch goes; the label is the time left. */
.btn .fill { position: absolute; inset: 0 auto 0 0; width: 0; background: repeating-linear-gradient(-45deg, #8fe0d3 0 12px, #a6ead9 12px 24px); box-shadow: 2px 0 0 #3b2a2e40; transition: width 0.25s linear; }
.btn.busy { background: var(--panel); color: var(--ink); border-color: var(--edge); box-shadow: 0 4px 0 var(--edge); font-variant-numeric: tabular-nums; }
.btn.busy .tail { background: #ffffffb3; }
.btn:not(.busy) .fill { display: none; }
.btn:active:not(.off) { transform: translateY(3px); box-shadow: 0 1px 0 var(--edge); }
.btn.hire, .btn.buy { justify-content: space-between; }

/* Sheet: warm paper under a band in the colour of its business -------------------------------------------------- */
.sheet {
  --sec: #7fd6c8;
  position: absolute; z-index: 7; left: 0; right: 0; bottom: 0; max-height: 52%; overflow-y: auto; overscroll-behavior: contain;
  background: var(--cream); border-radius: 24px 24px 0 0; border: 3px solid var(--edge); border-bottom: 0;
  box-shadow: 0 -5px 0 #3b2a2e26; padding: 0 14px calc(env(safe-area-inset-bottom) + 12px);
  animation: up 0.26s cubic-bezier(0.2, 1.3, 0.4, 1);
}
@keyframes up { from { transform: translateY(40px); opacity: 0.4; } }
.sh { display: flex; flex-direction: column; gap: 10px; }
.sh-head {
  position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 8px; margin: 0 -14px; padding: 8px 10px 8px 12px;
  background: color-mix(in srgb, var(--sec) 58%, #fff); border-bottom: 3px solid var(--edge);
}
.sh-id { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left; overflow: hidden; }
.sh-ico { flex: none; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--panel); border: 2.5px solid var(--edge); box-shadow: 0 2px 0 var(--edge); }
.sh-ico .icon { width: 34px; height: 34px; }
.sh-title { flex: 1; min-width: 0; }
.sh-title h2 { font-size: 19px; line-height: 1.15; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.sh-title p { font-size: 13.5px; font-weight: 600; color: var(--ink); opacity: 0.78; }
/* Nothing ends in an ellipsis: names and lines wrap. */
.sh-id .sh-title h2, .sh-id .sh-title p { overflow-wrap: anywhere; }
.chev { flex: none; width: 10px; height: 10px; margin: 6px 6px 0 2px; border-left: 3px solid var(--edge); border-top: 3px solid var(--edge); transform: rotate(45deg); }
.sh.rp:not(.strip) .chev { display: none; }
.x { flex: none; width: 40px; height: 40px; border-radius: 50%; font-size: 26px; font-weight: 700; line-height: 1; color: var(--ink); background: var(--panel); border: 2.5px solid var(--edge); box-shadow: 0 2px 0 var(--edge); }
.x:active { transform: translateY(2px); box-shadow: none; }
.lbl { font-size: 13px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }

/* Counts as things: a row of icons, lit one by one ----------------------------------------------------------------- */
.slots { display: inline-flex; align-items: center; gap: 3px; }
.slot { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; background: #3b2a2e1c; transition: transform 0.2s cubic-bezier(0.2, 1.6, 0.4, 1); }
.slot .icon { width: 22px; height: 22px; filter: grayscale(1); opacity: 0.32; transition: opacity 0.2s, filter 0.2s; }
.slot.on { background: #fff; box-shadow: inset 0 0 0 2px var(--edge); }
.slot.on .icon { filter: none; opacity: 1; }
.inputs { display: flex; align-items: center; gap: 6px; flex: none; }
.need { padding: 3px; border-radius: 12px; background: #ffffff8c; }
.need:not(.ok) { box-shadow: 0 0 0 2px var(--amber); }
.need.stock { display: inline-flex; align-items: center; gap: 3px; padding: 3px 10px 3px 5px; border-radius: 999px; font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.need.stock .icon { width: 26px; height: 26px; }
.need.stock:not(.ok) .icon { filter: grayscale(1); opacity: 0.5; }

/* Somebody speaking: a face and a bubble --------------------------------------------------------------------------- */
.say { display: flex; align-items: flex-end; gap: 8px; }
/* Three kinds of speaker, told apart by disc as well as face: an executive on the business's colour with a gold ring, a
   client on paper in a rounded square, the helper robot on teal. */
.face { flex: none; display: grid; place-items: center; overflow: hidden; width: 42px; height: 42px; border-radius: 50%; background: var(--panel); border: 2.5px solid var(--edge); }
.face .icon { width: 36px; height: 36px; margin-top: 4px; }
.say.exec .face { background: color-mix(in srgb, var(--sec) 55%, #fff); box-shadow: 0 0 0 3px var(--gold); margin: 3px; }
.say.helper .face { background: var(--teal-l); }
.say.helper .face .icon { width: 30px; height: 30px; margin: 0; }
.say .bubble-text { flex: 1; padding: 8px 12px; border-radius: 16px 16px 16px 4px; background: var(--panel); border: 2.5px solid var(--edge); font-size: 14.5px; font-weight: 600; line-height: 1.3; }

.bar { display: block; height: 10px; border-radius: 6px; background: #3b2a2e1c; overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--gold); border-radius: 6px; transition: width 0.25s linear; }

/* The level track: Stars as stars, ten pips to the next one ------------------------------------------------------ */
.block { display: flex; flex-direction: column; gap: 8px; }
.lv-top { display: flex; align-items: center; gap: 8px; }
.lv-top b { font-size: 17px; }
.stars { display: inline-flex; align-items: center; gap: 1px; font-size: 14px; font-weight: 700; color: #8a520a; }
.stars .icon { width: 22px; height: 22px; }
.switch { margin-left: auto; display: inline-flex; gap: 0; background: var(--panel); border: 2.5px solid var(--edge); border-radius: 14px; overflow: hidden; }
.seg { min-width: 46px; min-height: 40px; font-weight: 700; font-size: 14px; color: var(--muted); }
.seg + .seg { border-left: 2px solid #3b2a2e33; }
.seg[aria-pressed='true'] { background: linear-gradient(#ffdc7a, var(--gold)); color: var(--gold-ink); }
.pips { display: grid; grid-template-columns: repeat(10, 1fr) 26px; align-items: center; gap: 3px; }
.pips i { height: 14px; border-radius: 5px; background: var(--panel); border: 2px solid var(--edge); transition: background 0.15s; }
.pips i.on { background: linear-gradient(#ffdc7a, var(--gold)); }
.pip-star { display: grid; place-items: center; }
.pip-star .icon { width: 26px; height: 26px; }
.lv-note { margin: 0; font-size: 13.5px; font-weight: 500; line-height: 1.35; color: var(--muted); }
.helper.on { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; margin-bottom: 4px; border-radius: 16px; background: var(--teal-l); border: 2.5px dashed var(--teal-d); color: var(--teal-d); }
.helper.on .icon { width: 28px; height: 28px; }
.helper.on b { font-size: 14.5px; }
.helper-block { gap: 8px; }

/* Room panel ---------------------------------------------------------------------------------------------------- */
/* The strip: the band with the room's name and what it holds, and its three buttons under it. */
.sheet.slim { padding-bottom: calc(env(safe-area-inset-bottom) + 8px); border-radius: 22px 22px 0 0; }
.sh.rp.strip { flex-direction: row; flex-wrap: wrap; align-items: stretch; gap: 8px; }
.sh.rp.strip > :not(.sh-head):not(.main):not(.block):not(.order) { display: none; }
.sh.rp.strip .block { display: contents; }
.sh.rp.strip .block > :not(.btn) { display: none; }
.sh.rp.strip .sh-head { flex-basis: calc(100% + 28px); padding: 5px 8px 5px 10px; }
.sh.rp.strip .sh-id { gap: 8px; min-height: 40px; }
.sh.rp.strip .sh-ico { width: 36px; height: 36px; }
.sh.rp.strip .sh-ico .icon { width: 26px; height: 26px; }
.sh.rp.strip .sh-title { flex: 0 1 auto; }
.sh.rp.strip .sh-title h2 { font-size: 16px; }
.sh.rp.strip .sh-title p { display: none; }
.sh.rp.strip .x { width: 36px; height: 36px; font-size: 24px; }
.sh.rp.strip .btn { width: auto; flex: none; min-height: 50px; padding: 0 10px; font-size: 15px; gap: 5px; }
.sh.rp.strip .main { flex: 1; font-size: 16px; line-height: 1.1; }
.sh.rp.strip .main .ico { display: none; }
.sh.rp.strip .main.busy .tail { display: none; }
.btn.busy .lab { white-space: nowrap; }
.sh.rp.strip .btn .t { display: none; }
.sh.rp.strip .buy::before { content: '\2191'; font-size: 22px; font-weight: 700; line-height: 1; }
/* Expanded: the compact sheet. The big button, then Level up and the helper side by side, then the level track. */
.sh.rp:not(.strip) { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sh.rp:not(.strip) > * { grid-column: 1 / -1; order: 1; }
.sh.rp:not(.strip) > .sh-head { order: 0; }
.sh.rp:not(.strip) > .main { order: 3; }
.sh.rp:not(.strip) > .block { display: contents; }
.sh.rp:not(.strip) .block > * { grid-column: 1 / -1; order: 7; }
.sh.rp:not(.strip) .block > .buy { grid-column: 1; order: 4; }
.sh.rp:not(.strip) .block > .hire, .sh.rp:not(.strip) .block > .helper.on { grid-column: 2; order: 4; }
.sh.rp:not(.strip) .block > .say { order: 5; }
.sh.rp:not(.strip) .block > .lv-top { order: 6; }
.sh.rp:not(.strip) .block > .pips { order: 6; }
.sh.rp:not(.strip) .btn.buy, .sh.rp:not(.strip) .btn.hire { padding: 0 10px; font-size: 14.5px; white-space: nowrap; gap: 4px; }
.sh.rp:not(.strip) .btn.hire > span:first-child { display: none; }

/* The open order: a ticket pinned to the Sales desk. Who, the sales as boxes to fill, the bonus, the time left. */
.order {
  position: relative; flex-basis: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 2px 8px;
  margin-top: 6px; padding: 9px 10px 7px; border-radius: 14px; background: #fff0c2; border: 2.5px dashed #a8700e; font-variant-numeric: tabular-nums;
}
.order .tag { position: absolute; left: 12px; top: -10px; padding: 1px 9px; border-radius: 999px; background: var(--gold); border: 2px solid var(--edge); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gold-ink); }
.order .face { grid-column: 1; grid-row: 1 / 3; border-radius: 12px; background: #fff; }
.order .who { grid-column: 2; font-size: 15px; font-weight: 700; line-height: 1.15; overflow-wrap: anywhere; }
.order .bonus { grid-column: 3; display: inline-flex; align-items: center; gap: 2px; font-size: 16px; font-weight: 700; color: var(--gold-ink); white-space: nowrap; }
.order .bonus .icon { width: 22px; height: 22px; }
.order .sales { grid-column: 2; grid-row: 2; }
.order .sales .slot { width: 26px; height: 26px; border-radius: 8px; background: #a8700e2e; }
.order .sales .slot .icon { width: 20px; height: 20px; }
.order .left { grid-column: 3; grid-row: 2; justify-self: end; font-size: 13px; font-weight: 700; color: #7a5208; white-space: nowrap; }
.order .left::before { content: '\23F3\FE0E'; margin-right: 3px; font-size: 11px; }
.order .swap { grid-column: 4; grid-row: 1 / 3; align-self: stretch; min-height: 44px; max-width: 76px; padding: 0 9px; border-radius: 12px; background: linear-gradient(#ffdc7a, var(--gold)); border: 2.5px solid var(--edge); box-shadow: 0 3px 0 var(--edge); margin-bottom: 3px; color: var(--gold-ink); font-size: 13px; font-weight: 700; line-height: 1.1; }
.order .swap:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--edge); }
.order.big { background: #ffe08a; border-style: solid; }
.order.big .tag { background: #ff9d3c; }

/* Going public: a Star slot for every ten levels, a robot for every helper, a crate for every sale ------------------- */
.goals { display: flex; flex-direction: column; gap: 6px; }
.goal { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 0 8px; padding: 3px 10px 4px 6px; border-radius: 14px; background: var(--panel); border: 2px solid #3b2a2e33; }
.goal .g-ico { grid-row: 1 / 3; display: grid; place-items: center; }
.goal .g-ico .icon { width: 28px; height: 28px; }
.goal .nm { font-size: 15px; font-weight: 700; line-height: 1.15; }
.goal .bar { grid-column: 2 / 4; height: 7px; }
.goals { gap: 5px; }
/* The two tall sheets (the checklist, the company) may take more of the screen than a room's. */
.sheet:has(.goals-sheet), .sheet:has(.company) { max-height: 68%; }
.goal .star-slots .slot, .goal-line .slot { width: 24px; height: 24px; background: none; box-shadow: none; }
.goal .star-slots .slot .icon { width: 24px; height: 24px; }
.goal.done, .goal-line.done { background: #fff0c2; border-color: var(--gold-d); }
.goal-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 3px 10px; border-radius: 14px; background: var(--panel); border: 2px solid #3b2a2e33; }
.goal-line .nm { flex: none; font-size: 15px; font-weight: 700; white-space: nowrap; }
.goal-line .slots { justify-content: flex-end; gap: 0; min-height: 32px; }
.goal-line .crew .slot { width: 30px; height: 30px; }
.goal-line .crew .slot .icon { width: 28px; height: 28px; }
.goal-line .launches .slot { width: 18px; height: 22px; }
.goal-line .launches .slot .icon { width: 19px; height: 19px; }

/* Invest, on a sealed business's sheet: the boost, ten dots, one gold button --------------------------------------- */
.invest { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.boost { display: flex; align-items: baseline; justify-content: center; gap: 10px; font-variant-numeric: tabular-nums; }
.boost .was { font-size: 20px; font-weight: 700; color: var(--muted); }
.boost .arrow { font-size: 22px; font-weight: 700; color: var(--gold-d); }
.boost b { font-size: 34px; line-height: 1; letter-spacing: -0.02em; }
.dots { display: flex; align-items: center; gap: 6px; }
.dots i { width: 18px; height: 18px; border-radius: 50%; background: var(--panel); border: 2.5px solid var(--edge); }
.dots i.on { background: radial-gradient(circle at 35% 30%, #fff3c4, var(--gold) 60%); }
.dots .more { font-size: 14px; }
.invest .btn { justify-content: space-between; }

/* Company sheet: a trophy cabinet ------------------------------------------------------------------------------- */
.hero { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: 20px; background: var(--panel); border: 2.5px solid var(--edge); box-shadow: 0 4px 0 var(--edge); margin-bottom: 4px; }
.hero .big { font-size: 38px; font-weight: 700; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.medal { flex: none; display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; border: 2.5px solid var(--edge); box-shadow: inset 0 0 0 4px #ffffff73; background: #cfd6dd; font-size: 21px; font-weight: 700; }
.medal[data-place='1'] { background: radial-gradient(circle at 35% 30%, #fff3c4, var(--gold) 65%); color: var(--gold-ink); }
.medal[data-place='2'] { background: radial-gradient(circle at 35% 30%, #fff, #c5ccd6 65%); }
.medal[data-place='3'] { background: radial-gradient(circle at 35% 30%, #ffe1c2, #d98b4a 65%); }
.ladder { display: flex; flex-direction: column; gap: 5px; width: 100%; }
.ladder li { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 4px 12px 4px 6px; border-radius: 14px; background: var(--panel); border: 2px solid #3b2a2e33; font-size: 15px; font-weight: 600; text-align: left; }
.ladder .pos { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--dot); border: 2px solid var(--edge); color: #fff; font-size: 14px; font-weight: 700; text-shadow: 0 1px 0 #00000066; }
.ladder .nm { overflow-wrap: anywhere; line-height: 1.15; }
.ladder li.me { background: var(--teal-l); border: 2.5px solid var(--edge); box-shadow: 0 3px 0 var(--edge); font-weight: 700; margin-bottom: 3px; }
.ladder b { font-variant-numeric: tabular-nums; font-size: 16px; }
.biz { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.biz li { display: grid; grid-template-columns: 36px minmax(0, 1fr); align-items: center; column-gap: 8px; padding: 6px 10px 6px 6px; border-radius: 16px; background: color-mix(in srgb, var(--sec) 40%, #fff); border: 2.5px solid var(--edge); line-height: 1.15; }
.biz .b-ico { grid-row: 1 / 3; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--panel); border: 2px solid var(--edge); }
.biz .b-ico .icon { width: 26px; height: 26px; }
.biz b { font-size: 15px; }
.biz li > span:last-child { font-size: 12.5px; font-weight: 600; opacity: 0.8; }
.biz li.live { border-style: dashed; }
.sell { display: flex; flex-direction: column; gap: 10px; padding: 10px; border-radius: 18px; background: #fff0c2; border: 2.5px dashed #a8700e; }
.company { padding-bottom: 4px; }

/* Cards: a moment, not a dialog --------------------------------------------------------------------------------- */
.cards { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
.scrim { position: absolute; inset: 0; display: grid; place-items: center; padding: 20px; background: #2f2230a6; pointer-events: auto; animation: fade 0.18s ease-out; }
@keyframes fade { from { opacity: 0; } }
.card {
  --top: #8fe0d3;
  position: relative; overflow: hidden; width: 100%; max-width: 340px; padding: 0 18px 16px; border-radius: 28px; background: var(--cream); border: 3px solid var(--edge);
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; box-shadow: 0 8px 0 #1c141ea6;
  animation: card-in 0.34s cubic-bezier(0.2, 1.4, 0.4, 1);
}
.card.gold { --top: #ffd166; }
@keyframes card-in { from { transform: scale(0.8) translateY(20px); opacity: 0; } }
.card-top { position: relative; overflow: hidden; align-self: stretch; margin: 0 -18px 2px; height: 108px; display: grid; place-items: center; background: color-mix(in srgb, var(--top) 70%, #fff); border-bottom: 3px solid var(--edge); }
.rays { position: absolute; left: 50%; top: 50%; width: 520px; height: 520px; margin: -260px 0 0 -260px; background: repeating-conic-gradient(#ffffff80 0 10deg, #ffffff00 10deg 20deg); animation: spin 28s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.card-ico { position: relative; animation: bounce-in 0.5s 0.1s cubic-bezier(0.2, 1.8, 0.4, 1) backwards; }
.card-ico .icon { width: 80px; height: 80px; }
@keyframes bounce-in { from { transform: scale(0.2) rotate(-18deg); opacity: 0; } }
.card h2 { font-size: 23px; line-height: 1.15; letter-spacing: -0.01em; }
.card > .btn { margin-bottom: 4px; }
.card-body { align-self: stretch; display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 15.5px; font-weight: 500; }
.card-body .big { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-size: 24px; font-weight: 700; }
.card-body .big .icon { width: 34px; height: 34px; }
.card-body .haul { font-size: 40px; letter-spacing: -0.02em; animation: bounce-in 0.5s 0.25s cubic-bezier(0.2, 1.8, 0.4, 1) backwards; }
.card-body .haul .icon { width: 44px; height: 44px; }
.card-body .worth { font-weight: 700; }
.fact { align-self: stretch; display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 8px; border-radius: 14px; background: var(--panel); border: 2px solid #3b2a2e33; text-align: left; font-size: 15px; font-weight: 600; line-height: 1.25; }
.fact .f-ico { flex: none; display: grid; place-items: center; }
.fact .f-ico .icon { width: 30px; height: 30px; }
.sh .fact.runs { background: #fff0c2; border-color: var(--gold-d); }
.star-burst { display: flex; justify-content: center; gap: 2px; }
.star-burst i { animation: bounce-in 0.45s cubic-bezier(0.2, 1.8, 0.4, 1) backwards; }
.star-burst i:nth-child(1) { animation-delay: 0.25s; } .star-burst i:nth-child(2) { animation-delay: 0.35s; } .star-burst i:nth-child(3) { animation-delay: 0.45s; }
.star-burst i:nth-child(4) { animation-delay: 0.55s; } .star-burst i:nth-child(5) { animation-delay: 0.65s; }
.star-burst .icon { width: 40px; height: 40px; }
.star-burst i:nth-child(3) .icon { width: 50px; height: 50px; }
/* Confetti: sixteen bits that fall once across the card and are gone. */
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -14px; left: calc(var(--i) * 6.4% + 1%); width: 9px; height: 13px; border-radius: 3px; background: var(--c, var(--gold)); opacity: 0; animation: fall 1.7s calc(var(--i) * 0.045s + 0.15s) cubic-bezier(0.3, 0.2, 0.7, 1) 1 forwards; }
.confetti i:nth-child(4n + 1) { --c: #ee6f6f; } .confetti i:nth-child(4n + 2) { --c: #5b9cf0; } .confetti i:nth-child(4n + 3) { --c: #3fc1b0; } .confetti i:nth-child(3n) { width: 8px; height: 8px; border-radius: 50%; }
.confetti i:nth-child(1) { --i: 0; } .confetti i:nth-child(2) { --i: 7; } .confetti i:nth-child(3) { --i: 13; } .confetti i:nth-child(4) { --i: 3; }
.confetti i:nth-child(5) { --i: 10; } .confetti i:nth-child(6) { --i: 1; } .confetti i:nth-child(7) { --i: 15; } .confetti i:nth-child(8) { --i: 5; }
.confetti i:nth-child(9) { --i: 12; } .confetti i:nth-child(10) { --i: 8; } .confetti i:nth-child(11) { --i: 2; } .confetti i:nth-child(12) { --i: 14; }
.confetti i:nth-child(13) { --i: 6; } .confetti i:nth-child(14) { --i: 11; } .confetti i:nth-child(15) { --i: 4; } .confetti i:nth-child(16) { --i: 9; }
@keyframes fall { 0% { opacity: 1; transform: translateY(0) rotate(0); } 85% { opacity: 1; } 100% { opacity: 0; transform: translateY(520px) rotate(540deg); } }
.name-input { width: 100%; min-height: 52px; padding: 0 14px; border-radius: 16px; border: 2.5px solid var(--edge); background: var(--panel); color: var(--ink); font: inherit; font-size: 19px; font-weight: 700; text-align: center; box-shadow: inset 0 3px 0 #3b2a2e1a; }
.name-input:focus { outline: 3px solid var(--teal); outline-offset: 1px; }
.name-hint { min-height: 1.2em; color: #a3410a; font-size: 13.5px; font-weight: 600; }

/* Stand-in tower (dist/tower-stub.js) --------------------------------------------------------------------------- */
.stage { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; padding: calc(env(safe-area-inset-top) + 118px) 16px calc(var(--sheet-h) + 96px); }
.tw { display: flex; flex-direction: column; gap: 10px; }
.tw-sec.live { display: flex; flex-direction: column; gap: 3px; padding: 8px; border-radius: 10px; background: var(--soft); border-left: 6px solid var(--sec); }
.room {
  position: relative; display: grid; grid-template-columns: 40px 1fr auto; align-items: center; column-gap: 10px; min-height: 58px; padding: 6px 10px;
  background: var(--panel); border-radius: 8px; border: 1px solid var(--line); cursor: pointer; overflow: visible;
}
.room .ico .icon { width: 36px; height: 36px; }
.room .meta { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.room .meta b { font-size: 15px; }
.room .meta em { font-style: normal; font-size: 12.5px; color: var(--muted); }
.room .lv { font-size: 13px; font-weight: 700; color: var(--muted); padding-right: 52px; }
.room .bar { position: absolute; left: 10px; right: 10px; bottom: 4px; height: 4px; }
.room[data-status='unbuilt'] { background: #f1eee4; border-style: dashed; color: #7a7260; }
.room[data-status='unbuilt'] .ico { opacity: 0.45; }
.room[data-status='running'] { background: #e9f7f5; border-color: var(--teal); }
.room[data-status='ready'] { background: #fff7e0; border-color: var(--gold); }
.room[data-status='needs'] { background: #f7efe6; }
.room.helped .meta b::after { content: ' · helper'; font-weight: 500; font-size: 12px; color: var(--teal-d); }
.room.trainee .meta b::after { content: ' · trainee'; font-weight: 500; font-size: 12px; color: var(--muted); }
.bubble {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; border: 2px solid; background: var(--panel); box-shadow: 0 2px 8px #1e293b33; z-index: 2;
}
.bubble .icon { width: 28px; height: 28px; }
.bubble.ready { background: var(--gold); border-color: var(--gold-d); }
.bubble.needs { background: #ffe9cc; border-color: var(--amber); }
.bubble.build { background: var(--teal-l); border-color: var(--teal); }
.tw-sec.sealed { min-height: 44px; padding: 0 14px; display: flex; align-items: center; border-radius: 8px; background: #d4dde6; border-left: 6px solid var(--sec); color: #3d4b5c; font-weight: 600; font-size: 14px; text-align: left; }
.tw-street { display: flex; justify-content: center; padding-top: 6px; }

button:focus-visible { outline: 3px solid #0d9488cc; outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .stage { scroll-behavior: auto; }
  .confetti { display: none; }
}
