/* Refillit OS × denim / coral collage (design/art-direction/PLAN.md, step 5).
   The in-game UI drawn as Mac OS 8 "Iced Latte" windows: pinstriped title bars, hard 2-px bevels, a ringed default
   button, On/Off segments, pixel icons, the bottom menu as a Control Strip; a light collage layer round the edges.
   Denim carries everything ordinary; coral only says "something happened" (events, alerts, money in).
   Tokens live in style.css (:root, --os-*). Everything here is scoped to #ui: the start screen (#loading) keeps
   its own look. Loaded after style.css, so equal-specificity rules here win. */

/* ---------- the old tokens, re-pointed at the OS palette inside the game UI ---------- */
#ui {
  --font: var(--os-font); --font-display: var(--os-font);
  --ink: var(--os-ink); --ink-soft: #4A5677; --ink-faint: #7C87A3;
  --surface: var(--os-field); --sheet: var(--os-body); --fill: #EEF2F9; --fill-2: #DCE4F1; --line: #C9D4E8;
  --yellow: var(--os-denim); --accent: var(--os-denim); --accent-2: var(--os-denim-deep); --accent-ink: var(--os-ink);
  --red: var(--os-coral); --green: var(--os-denim); --gold: var(--os-denim);
  --shadow: var(--os-drop); --shadow-sm: 2px 3px 0 rgba(31, 42, 74, .24);
  --cell: var(--os-field); --cell-hover: #F3F6FB;
  font-family: var(--os-font); font-synthesis: none; color: var(--os-ink);
  /* the left column and the Control Strip, measured from the HUD windows and the strip */
  --hb: 40px; --hg: 8px; --ht: calc(64px + var(--sat)); --hl: calc(18px + var(--sal)); --hbot: calc(80px + var(--sab));
}
#ui * { font-weight: 400 !important; letter-spacing: 0; font-stretch: normal; }
#ui .pix { flex: none; display: block; }
#ui .pix .pk { fill: var(--pi-ink, var(--os-ink)); }
#ui .pix .po { fill: var(--pi-fill, var(--os-denim)); }

/* ---------- window kit ---------- */
#ui .oswin, #ui .card { background: var(--os-frame); border: var(--os-b) solid var(--os-ink); border-radius: 3px; box-shadow: var(--os-bevel), var(--os-drop); color: var(--os-ink); }
.os-bar { position: relative; height: 12px; padding: 2px; background: var(--os-field); border: var(--os-b) solid var(--os-ink); }
.os-bar > i { display: block; height: 100%; width: 0; background: linear-gradient(180deg, var(--os-denim-2) 0 40%, var(--os-denim) 40%); box-shadow: 2px 0 0 var(--os-ink); transition: width .4s steps(6, end); }
/* a title bar drawn on any card that has none of its own */
#ui #modal .card, #ui #celebrate .card, #ui #receipt .card, #ui #info, #ui .rating-tip, #ui #visitbar, #ui #coach { padding-top: 32px; }
#ui #modal .card::before, #ui #celebrate .card::before, #ui #receipt .card::before, #ui #info::before, #ui .rating-tip::before, #ui #visitbar::before, #ui #coach::before {
  content: ''; position: absolute; left: 4px; right: 4px; top: 4px; height: 18px; background: var(--os-stripes); border: var(--os-b) solid var(--os-ink); pointer-events: none; }

/* ---------- HUD: two windows rolled up to their pinstriped title bars (Mac OS "windowshade"): one thin row ----------
   The café: a knob, its name on a flag that sticks up, the level; a hairline along the foot fills to the next level.
   Status: the live numbers in sunken LCD fields. */
#hud { top: calc(12px + var(--sat)); left: calc(18px + var(--sal)); right: calc(10px + var(--sar)); justify-content: flex-start; align-items: center; gap: 8px; }
#ui #hudbrand, #ui #hudstats { position: relative; display: flex; align-items: center; gap: 5px; height: 30px; padding: 0 4px; overflow: visible; border-radius: 3px;
  background: var(--os-stripes); box-shadow: var(--os-bevel), 3px 3px 0 rgba(31, 42, 74, .22); }
#ui #hudbrand { flex: 0 1 auto; min-width: 0; max-width: 250px; padding: 0 4px 0 12px; transform: rotate(-1deg); }
#hudbrand .os-knob { position: absolute; left: -9px; top: -8px; z-index: 2; width: 18px; height: 18px; border-radius: 50%; border: var(--os-b) solid var(--os-ink);
  background: radial-gradient(circle at 35% 35%, #fff 0 14%, var(--os-peach) 36%, #B88E86 78%, var(--os-ink) 100%); }
#hudbrand .os-flag { position: relative; flex: 0 1 auto; min-width: 0; height: 24px; margin: -9px 0 0; display: flex; align-items: center; padding: 0 17px 0 8px;
  background: var(--os-denim); color: #fff; border: var(--os-b) solid var(--os-ink); transform: rotate(-3deg);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .4), inset -2px -2px 0 rgba(0, 0, 0, .28); clip-path: polygon(0 0, 100% 0, calc(100% - 9px) 50%, 100% 100%, 0 100%); }
#ui #hudbrand .bname { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; line-height: 1.3; }
#ui .hb-lv { flex: none; margin-left: auto; padding: 2px 5px 1px; border-radius: 0; background: var(--os-field); color: var(--os-ink); border: var(--os-b) solid var(--os-ink);
  box-shadow: var(--os-sunk); font: 12px/1.2 var(--os-font); text-transform: uppercase; }
#hudbrand .os-bar { position: absolute; left: 3px; right: 3px; bottom: 2px; height: 4px; padding: 0; border: 0; background: rgba(31, 42, 74, .14); }
#hudbrand .os-bar > i { background: var(--os-denim); box-shadow: none; }
#ui #hudstats { flex: 0 0 auto; gap: 4px; transform: rotate(1deg); }
#ui .hs { position: relative; display: flex; align-items: center; gap: 4px; min-width: 0; height: 22px; padding: 0 5px 0 4px; border: var(--os-b) solid var(--os-ink); border-radius: 0; background: var(--os-field);
  box-shadow: var(--os-sunk); color: var(--os-ink); font-family: var(--os-lcd); font-size: 20px; line-height: 1; white-space: nowrap; overflow: hidden; }
#ui .hs + .hs::before { display: none; }
#ui .hs .num { min-width: 0; overflow: hidden; text-overflow: clip; font-variant-numeric: tabular-nums; padding-top: 1px; }
#ui button.hs { cursor: pointer; border-radius: 0; }
#ui button.hs:hover { background: #F3F6FB; }
#ui button.hs:active { box-shadow: var(--os-sunk), inset 0 0 0 20px rgba(63, 93, 170, .12); }
#ui .hs.speed { font-size: 18px; color: var(--os-ink); }
.rating-tip { top: calc(var(--ht) - 6px); }
#ui .rating-tip { border-radius: 3px; }

/* ---------- the left column: bevelled OS buttons with pixel icons ---------- */
#ui #questbtn, #ui #friendsbtn, #ui #specialbtn, #ui #abtoggle { border-radius: 4px; border: var(--os-b) solid var(--os-ink); background: var(--os-frame); box-shadow: var(--os-bevel), 2px 3px 0 rgba(31, 42, 74, .24); color: var(--os-ink); }
#ui #questbtn:hover, #ui #friendsbtn:hover, #ui #abtoggle:hover { background: #F3F6FB; }
#ui #questbtn:active, #ui #friendsbtn:active, #ui #abtoggle:active { box-shadow: var(--os-sunk); }
#ui #questbtn.active, #ui #friendsbtn.active, #ui #abtoggle.open { background: var(--os-denim); box-shadow: var(--os-sunk); --pi-ink: #fff; --pi-fill: var(--os-peach); }
#ui #questbtn .pix, #ui #friendsbtn .pix, #ui #abtoggle .pix { width: 24px; height: 24px; }
/* Today: the goals claimed fill a thin bar along the button's foot */
#ui #questbtn { background: linear-gradient(90deg, var(--os-denim) var(--p, 0%), transparent 0) 3px calc(100% - 3px) / calc(100% - 6px) 3px no-repeat, var(--os-frame); }
#ui #questbtn.done { background: linear-gradient(90deg, var(--os-denim) 100%, transparent 0) 3px calc(100% - 3px) / calc(100% - 6px) 3px no-repeat, var(--os-frame); }
#ui #questbtn.active, #ui #questbtn.active.done { background: var(--os-denim); }
#ui .qb-badge { right: -8px; bottom: -6px; height: 16px; min-width: 20px; padding: 0 4px; border-radius: 0; background: var(--os-ink); border: 0; box-shadow: 0 0 0 2px var(--os-frame);
  font: 12px/16px var(--os-lcd); font-size: 16px; }
#ui #questbtn.done .qb-badge { background: var(--os-denim); }
#ui .qb-badge.alert, #ui #friendsbtn .badge, #ui .tool .badge { background: var(--os-coral); color: #fff; border-radius: 0; box-shadow: 0 0 0 2px var(--os-ink); font: 16px/16px var(--os-lcd); height: 16px; }
#ui #specialbtn .sp-dot { border-radius: 0; background: var(--os-coral); box-shadow: 0 0 0 2px var(--os-ink); }
#ui #abtoggle.ready:not(.open) { box-shadow: var(--os-bevel), 0 0 0 3px var(--os-denim); animation: os-ready 1.2s steps(1, end) infinite; }
@keyframes os-ready { 50% { box-shadow: var(--os-bevel), 0 0 0 3px var(--os-frame), 0 0 0 5px var(--os-denim); } }

/* staff skills dock: square bevel buttons, the cooldown still sweeps round */
#ui .ability { border-radius: 4px; border: var(--os-b) solid var(--os-ink); background: var(--os-frame); box-shadow: var(--os-bevel), 2px 3px 0 rgba(31, 42, 74, .24); }
#ui .ability .ab-face { border-radius: 2px; }
#ui .ability .ab-cd { border-radius: 2px; background: conic-gradient(transparent var(--p, 0%), rgba(31, 42, 74, .45) 0); }
#ui .ability .ab-glyph, #ui #cutin .ab-glyph { border-radius: 0; box-shadow: 0 0 0 2px var(--os-ink); }
#ui .ability.ready { box-shadow: var(--os-bevel), 0 0 0 3px var(--c); }
#ui .ability.active { box-shadow: var(--os-sunk), 0 0 0 3px var(--c); }
#ui .ability:hover { transform: none; }

/* ---------- the Control Strip: modules with pixel icons, the open one pressed in; a grip tab at the end ---------- */
#ui #toolbar { left: calc(10px + var(--sal)); right: auto; bottom: calc(10px + var(--sab)); transform: none; max-width: calc(100vw - 20px - var(--sal) - var(--sar)); justify-content: flex-start;
  display: flex; align-items: center; gap: 5px; padding: 6px 0 6px 8px; overflow: visible; border-radius: 0 28px 28px 0; background: var(--os-frame);
  border: var(--os-b) solid var(--os-ink); border-left: 0; box-shadow: var(--os-bevel), 4px 4px 0 var(--os-denim); }
#ui #toolbar::after { content: ''; flex: none; align-self: stretch; width: 18px; margin: -6px 0 -6px 4px; border-left: var(--os-b) solid var(--os-ink); border-radius: 0 26px 26px 0;
  background: repeating-linear-gradient(90deg, var(--os-lo) 0 2px, #fff 2px 4px); }
#ui .tool { width: 48px; height: 44px; border-radius: 0; border: var(--os-b) solid var(--os-ink); background: var(--os-field); box-shadow: var(--os-bevel); color: var(--os-ink); }
#ui .tool .pix { width: 24px; height: 24px; }
#ui .tool::after { content: ''; position: absolute; left: auto; right: 3px; bottom: 3px; width: 0; height: 0; margin: 0; border-radius: 0; transform: none; transition: none;
  border: 3px solid transparent; border-top-color: var(--os-ink); border-bottom: 0; background: none; }   /* the pop-up arrow */
@media (hover: hover) { #ui .tool:hover { background: #F3F6FB; } }
#ui .tool:active { box-shadow: var(--os-sunk); }
#ui .tool.active, #ui .tool.active:hover { background: var(--os-denim); box-shadow: var(--os-sunk); --pi-ink: #fff; --pi-fill: var(--os-peach); }
#ui .tool.active::after { transform: none; border-top-color: #fff; }
#ui .tool.active .pix { transform: translate(1px, 1px); }
#ui .tool .badge { top: -6px; right: -6px; min-width: 16px; padding: 0 3px; }

/* ---------- panels: OS windows ---------- */
#ui #panel { padding: 4px; border-radius: 3px; background: var(--os-frame); box-shadow: var(--os-bevel), var(--os-drop); transition: none; }
#ui #panel.open { transform: none; }
#ui #panel .grabber, #ui #info .grabber { display: none; }
#ui .panel-head { position: relative; height: 22px; margin: 0 0 4px; padding: 0 4px; gap: 4px; background: var(--os-stripes); border: var(--os-b) solid var(--os-ink); }
.panel-head::before, .panel-head::after { content: ''; order: 2; flex: none; width: 12px; height: 12px; border: var(--os-b) solid var(--os-ink); background: var(--os-frame); box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 var(--os-lo); }
#ui .panel-head h2 { flex: 0 1 auto; margin: 0 auto; padding: 0 10px; height: 100%; display: flex; align-items: center; background: var(--os-frame); font-size: 12px; line-height: 1; color: var(--os-ink); }
/* close box: Mac puts it on the left; a bigger invisible hit area round the small box */
#ui #panel .panel-head .btn.xbtn { order: -1; position: relative; width: 14px; min-width: 14px; height: 14px; min-height: 14px; padding: 0; border-radius: 0; border: var(--os-b) solid var(--os-ink);
  background: var(--os-frame); box-shadow: inset 1px 1px 0 #fff, inset -1px -1px 0 var(--os-lo); }
#ui #panel .panel-head .btn.xbtn::before { content: ''; position: absolute; inset: -14px; }
#ui .panel-head .xbtn .glyph { display: none; }
#ui #panel .panel-head .btn.xbtn:active { background: var(--os-ink); }
#ui .panel-body { margin: 0; padding: 8px 6px 8px 8px; background: var(--os-body); border: var(--os-b) solid var(--os-ink); box-shadow: var(--os-sunk);
  scrollbar-width: auto; scrollbar-color: auto; }
/* slim OS scrollbar (Chromium, Safari; Firefox keeps its own) */
#ui .panel-body::-webkit-scrollbar, #ui #info::-webkit-scrollbar, #ui #modal .card::-webkit-scrollbar { width: 12px; }
#ui .panel-body::-webkit-scrollbar-track, #ui #info::-webkit-scrollbar-track, #ui #modal .card::-webkit-scrollbar-track { background: repeating-linear-gradient(45deg, #fff 0 2px, var(--os-stripe-b) 2px 4px); border-left: var(--os-b) solid var(--os-ink); }
#ui .panel-body::-webkit-scrollbar-thumb, #ui #info::-webkit-scrollbar-thumb, #ui #modal .card::-webkit-scrollbar-thumb { background: linear-gradient(90deg, #fff 0 2px, var(--os-frame) 2px calc(100% - 2px), var(--os-lo) 0); border: var(--os-b) solid var(--os-ink); border-right: 0; }
#ui #scrim { background: rgba(31, 42, 74, .16); }
/* the torn denim sheet of the panel-open wipe (transition.js) and the slices of the close */
.tr-paper { position: absolute; z-index: 8; pointer-events: none; background: url('../../assets/ui/collage/paper_denim.webp') center / 100% 100% no-repeat;
  filter: drop-shadow(4px 0 0 var(--os-ink)); }
#ui .tr-slice { position: absolute; right: auto; bottom: auto; margin: 0; pointer-events: none; transition: none; z-index: 8; }

/* tabs: rounded OS tabs on a rule, the chosen one denim */
#ui .tabs { gap: 3px; margin: 0 0 10px; padding: 0 2px; border-bottom: var(--os-b) solid var(--os-ink); align-items: end; }
#ui .tab, #ui .tab:hover { min-height: 28px; padding: 0 8px; border: var(--os-b) solid var(--os-ink); border-bottom: 0; border-radius: 8px 8px 0 0; background: var(--os-frame); color: var(--os-ink);
  box-shadow: inset 2px 2px 0 #fff; font-size: var(--fs); transform: none; }
#ui .tab:hover { background: #F3F6FB; }
#ui .tab.on, #ui .tab.on:hover { background: var(--os-denim); color: #fff; box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .35); }
#ui #panel .tabs .tab { min-height: 30px; }
#ui .tabs.seg .tab { min-height: 36px; }
#ui .tabs.seg .tab small { font: 16px/1 var(--os-lcd); opacity: .85; }
#ui #panel .tab:not(.on) { background: var(--os-frame); }

/* push buttons: rounded rect, bevel; pressed = inverted; the default (primary) one denim with the thick ring */
#ui .btn, #ui #panel .btn:not(.primary):not(.danger):not(.ghost):not(.tab):not(.panel-head > .btn), #ui #info .btn:not(.primary):not(.danger):not(.ghost):not(.info-x), #ui #buildbar .btn:not(.primary):not(.danger):not(.ghost):not(.tab) {
  min-height: var(--tap, 30px); padding: 0 12px; gap: 5px; border-radius: 7px; border: var(--os-b) solid var(--os-ink); background: var(--os-frame); color: var(--os-ink); box-shadow: var(--os-bevel);
  font-family: var(--os-font); font-size: var(--fs); line-height: 1; transition: none; }
#ui .btn:hover, #ui #panel .btn:not(.primary):not(.danger):not(.ghost):not(.tab):not(.panel-head > .btn):hover { background: #F3F6FB; }
#ui .btn:active, #ui #panel .btn:not(.primary):not(.danger):not(.ghost):not(.tab):not(.panel-head > .btn):active { transform: none; background: var(--os-ink); color: #fff; box-shadow: none; --pi-ink: #fff; }
#ui .btn.primary, #ui .btn.primary:hover { background: var(--os-denim); color: #fff; box-shadow: inset 2px 2px 0 rgba(255, 255, 255, .35), inset -2px -2px 0 rgba(0, 0, 0, .25), 0 0 0 2px var(--os-frame), 0 0 0 4px var(--os-ink); }
#ui .btn.primary:active { background: var(--os-ink); box-shadow: 0 0 0 2px var(--os-frame), 0 0 0 4px var(--os-ink); }
#ui .btn.danger { background: var(--os-frame); color: #B5432C; box-shadow: var(--os-bevel); }
#ui .btn.ghost { border-color: transparent; background: transparent; box-shadow: none; }
#ui .btn.small { min-height: var(--tap, 26px); padding: 0 10px; font-size: var(--fs); }
#ui .btn.icon { width: 36px; min-width: 36px; height: 36px; border-radius: 7px; }
#ui .btn[disabled], #ui .btn.disabled { opacity: .45; }
#ui .btn .glyph { color: currentColor; }
#ui .pill { border-radius: 0; background: var(--os-body); box-shadow: inset 0 0 0 1px var(--os-lo); font-size: var(--fs-sm); }
#ui .btn .pill, #ui .btn.primary .pill { background: none; box-shadow: none; color: inherit; }
#ui .bmsg { border-radius: 0; font-size: var(--fs); background: var(--os-body); box-shadow: inset 0 0 0 1px var(--os-lo); }
#ui .bmsg.bad { background: #FCE7E1; color: #A63B25; box-shadow: inset 0 0 0 1px var(--os-coral); }
#ui .bmsg.good { background: #E7ECF7; color: var(--os-denim-deep); box-shadow: inset 0 0 0 1px var(--os-denim); }
#ui .bmsg.warn { background: #FCEFE8; color: #8A4A35; }

/* On / Off as two segments, the chosen one filled (denim On, ink Off) */
#ui .switch { display: grid; grid-template-columns: 1fr 1fr; width: var(--sw-w, 76px); min-width: var(--sw-w, 76px); height: var(--sw-h, 24px); min-height: 0; padding: 0; border-radius: 0; border: var(--os-b) solid var(--os-ink);
  background: var(--os-field); box-shadow: 2px 2px 0 var(--os-ink); transition: none; overflow: hidden; }
#ui .switch::before, #ui .switch::after { content: 'On'; position: static; display: grid; place-items: center; width: auto; height: auto; border-radius: 0; transform: none; transition: none;
  background: var(--os-field); color: var(--os-ink); box-shadow: none; font: var(--fs-sw, 12px)/1 var(--os-font); }
#ui .switch::after { content: 'Off'; border-left: var(--os-b) solid var(--os-ink); }
:lang(zh) #ui .switch::before { content: '開'; }
:lang(zh) #ui .switch::after { content: '關'; }
#ui .switch.on::before { background: var(--os-denim); color: #fff; }
#ui .switch:not(.on)::after { background: var(--os-ink); color: #fff; }
#ui .switch.on::after { transform: none; }
#ui .toggle .btn.switch { box-shadow: 2px 2px 0 var(--os-ink); }

/* list rows and cards: white sheets with an ink outline and a hard denim shadow */
#ui .row, #ui .scard, #ui .tile, #ui .toggle, #ui #panel .orow, #ui .today-head, #ui .study-bar, #ui .club, #ui .sp-theme, #ui .decor-score, #ui .bb-act, #ui .stat {
  border-radius: 0; background: var(--os-field); border: var(--os-b) solid var(--os-ink); box-shadow: 3px 3px 0 var(--os-denim); }
#ui .stat { box-shadow: none; }
#ui .decor-score { background: var(--os-denim); color: #fff; }
#ui .row.current { background: #EDF1FA; box-shadow: 3px 3px 0 var(--os-denim), inset 0 0 0 2px var(--os-denim); }
#ui .row.ready { background: #FFF5F1; box-shadow: 3px 3px 0 var(--os-coral); }
#ui #panel .scard::before, #ui #panel .scard::after { display: none; }
#ui .scard-head, #ui .sk, #ui .portrait, #ui .thumb-slot, #ui .row .g-ico, #ui .sp-card, #ui .sp-cicon { border-radius: 0; }
#ui .portrait { box-shadow: inset 0 0 0 2px var(--os-ink); background: radial-gradient(var(--os-stripe-b) 28%, transparent 31%) 0 0 / 6px 6px, var(--os-body); }
#ui .row h3, #ui .scard-title b, #ui .tile b, #ui .sk-name b, #ui .section-title, #ui .info-head h3 { font-size: var(--fs); line-height: 1.35; }
#ui .section-title { font-size: var(--fs); text-transform: uppercase; color: var(--os-denim); }
#ui .muted, #ui .note, #ui .sk-desc, #ui .meta, #ui .scard-status, #ui .skill, #ui .abil, #ui .stock { font-size: var(--fs); line-height: 1.5; }
#ui .note { border-radius: 0; background: var(--os-body); box-shadow: inset 0 0 0 1px var(--os-lo); }
#ui .sk-tag, #ui .ing, #ui .sdot, #ui .sk-dot, #ui .sk-ico { border-radius: 0; }
#ui .ing.done { background: #E7ECF7; color: var(--os-denim-deep); }
#ui .ing.short, #ui .pill.short { color: #B5432C; box-shadow: inset 0 0 0 1px var(--os-coral); }
#ui .pill.voucher, #ui .pill.cap.full { background: #EEF2F9; box-shadow: inset 0 0 0 1px var(--os-denim); }
#ui .pill.claimed { background: #E7ECF7; color: var(--os-denim-deep); }
#ui .sdot.big { background: var(--os-peach); }
#ui input[type=text], #ui input[type=email], #ui input[type=password] { border-radius: 0; border: var(--os-b) solid var(--os-ink); background: var(--os-field); box-shadow: var(--os-sunk); font: 12px/1.4 var(--os-font); }
#ui input[type=range] { accent-color: var(--os-denim); }
#ui .sw { border-radius: 0; border: var(--os-b) solid var(--os-ink); box-shadow: none; }
#ui .sw.on { box-shadow: 0 0 0 2px var(--os-frame), 0 0 0 4px var(--os-ink); }
#ui kbd { border-radius: 0; font: 12px var(--os-font); }

/* bars: an inset field with a denim fill; coral only for the warning ones */
#ui .pbar { height: 10px; border-radius: 0; background: var(--os-field); box-shadow: inset 0 0 0 2px var(--os-ink); padding: 0; }
#ui .pbar > i { top: 2px; bottom: 2px; left: 2px; border-radius: 0; max-width: calc(100% - 4px); background: linear-gradient(180deg, var(--os-denim-2) 0 40%, var(--os-denim) 40%); }
#ui .pbar.red > i, #ui .pbar.orange > i { background: var(--os-coral); }
#ui .scard-status .pbar { height: 8px; }

/* build tray */
#ui #buildbar .card { border-radius: 3px; background: var(--os-frame); }
#ui .bitem, #ui #buildbar .bitem:not(.charm) { border-radius: 0; background: var(--os-field); box-shadow: inset 0 0 0 2px var(--os-ink); }
#ui .bitem.sel, #ui #buildbar .bitem.sel { background: #EDF1FA; box-shadow: inset 0 0 0 2px var(--os-ink), inset 0 0 0 4px var(--os-denim); }
#ui .bitem.charm { background: var(--os-denim); }
#ui .bitem .bstat { border-radius: 0; background: var(--os-denim); color: #fff; }
#ui .bitem.locked .bstat { background: var(--os-body); color: var(--os-ink); }
#ui #buildbanner { border-radius: 0; background: var(--os-denim); color: #fff; font: 12px/1.3 var(--os-type); box-shadow: 3px 3px 0 var(--os-ink); }
#ui #ghostctl .gc-btn { border-radius: 7px; border: var(--os-b) solid var(--os-ink); background: var(--os-frame); box-shadow: var(--os-bevel), 2px 3px 0 rgba(31, 42, 74, .3); color: var(--os-ink); }
#ui #ghostctl .gc-btn.ok { background: var(--os-denim); color: #fff; }

/* the character card and cut-in */
#ui #info { border-radius: 3px; }
#ui #info .btn.small.info-x { position: absolute; top: 6px; left: 8px; right: auto; width: 14px; min-width: 14px; height: 14px; min-height: 14px; padding: 0; border-radius: 0; z-index: 1; }
#ui #info .info-x::before { content: ''; position: absolute; inset: -14px; }
#ui #info .info-x .glyph { display: none; }
#ui .info-head h3 { padding-right: 0; }
#ui #cutin { border-radius: 0; border: var(--os-b) solid var(--os-ink); border-left: 0; background: var(--os-frame); box-shadow: var(--os-bevel), 4px 4px 0 var(--os-denim), inset 6px 0 0 var(--c, var(--os-denim)); }
#ui #cutin .ci-portrait { border-radius: 0; }
#ui #cutin .ci-text b { font-size: 24px; line-height: 1.1; }

/* ---------- system dialogs: toasts, trouble alerts, modals ---------- */
#ui #toasts { top: calc(var(--ht) - 4px); gap: 8px; }
#ui:has(#alerts .alert) #toasts { top: calc(var(--ht) + 62px); }   /* below a trouble alert, never on it */
#ui .toast { position: relative; display: flex; align-items: center; gap: 8px; padding: 14px 12px 7px 9px; border-radius: 0; background: var(--os-field); color: var(--os-ink);
  border: var(--os-b) solid var(--os-ink); box-shadow: 3px 3px 0 var(--os-denim); font-size: 12px; text-align: left; animation: os-pop .18s steps(3, end); }
#ui .toast::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 7px; background: var(--os-stripes); border-bottom: var(--os-b) solid var(--os-ink); }
#ui .toast > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#ui .toast.bad, #ui .toast.money { background: var(--os-field); color: var(--os-ink); box-shadow: 3px 3px 0 var(--os-coral); --pi-fill: var(--os-coral); }
#ui .toast.bad::before, #ui .toast.money::before { background: repeating-linear-gradient(0deg, #fff 0 2px, var(--os-coral-2) 2px 4px); }
#ui .toast.out { opacity: 1; transform: none; transition: none; animation: os-drop .2s steps(3, end) forwards; }
@keyframes os-pop { from { clip-path: inset(50% 0 50% 0); } }
@keyframes os-drop { to { clip-path: inset(50% 0 50% 0); } }
/* trouble: a small coral-flagged dialog per troublemaker */
#ui #alerts { gap: 14px; padding-top: 10px; }
#ui #alerts .alert { position: relative; overflow: visible; padding: 6px 12px 6px 6px; border-radius: 0; background: var(--os-field); color: var(--os-ink); border: var(--os-b) solid var(--os-ink);
  box-shadow: 3px 3px 0 var(--os-coral); animation: os-shake 1.4s steps(1, end) infinite; }
#ui #alerts .alert::before { content: attr(data-flag); position: absolute; left: 8px; top: -13px; height: 18px; padding: 0 14px 0 7px; display: flex; align-items: center; background: var(--os-coral); color: #fff;
  border: var(--os-b) solid var(--os-ink); font: 12px/1 var(--os-font); text-transform: uppercase; clip-path: polygon(0 0, 100% 0, calc(100% - 7px) 50%, 100% 100%, 0 100%); transform: rotate(-3deg); }
#ui #alerts .al-ico { border-radius: 0; background: var(--os-coral); border: var(--os-b) solid var(--os-ink); }
#ui #alerts .al-ico .glyph { color: #fff; }
#ui #alerts .al-text b { font-size: var(--fs); color: #B5432C; }
#ui #alerts .al-text small { font-size: var(--fs-sm); opacity: 1; }
#ui #alerts .alert.sent { box-shadow: 3px 3px 0 var(--os-denim); animation: none; }
#ui #alerts .alert.sent::before { background: var(--os-denim); }
#ui #alerts .alert.sent .al-ico { background: var(--c); }
#ui #alerts .alert.sent .al-text b { color: var(--os-ink); }
@keyframes os-shake { 0%, 60%, 100% { translate: 0 0; } 64% { translate: -2px 0; } 70% { translate: 2px 0; } 76% { translate: -1px 0; } }
#ui #modal { background: rgba(31, 42, 74, .32); }
#ui #modal .card { border-radius: 3px; animation: os-pop .2s steps(4, end); }
#ui .big-title { font-size: 24px; line-height: 1.2; }
#ui .stat b { font-family: var(--os-lcd); font-size: 24px; }
#ui #coach { border-radius: 3px; background: var(--os-frame); border: var(--os-b) solid var(--os-ink); box-shadow: var(--os-bevel), var(--os-drop); }

/* the café in play is left clear: no collage round the edges (the start screen keeps its own) */
.hs-wrap { position: relative; flex: 0 0 auto; display: flex; }
#ui #hudstats { z-index: 4; }

/* ---------- phones ---------- */
@media (max-width: 760px) {
  #ui #panel, #ui #info { left: calc(14px + var(--sal)); right: calc(8px + var(--sar)); bottom: calc(82px + var(--sab)); border-radius: 3px; }
  #ui #panel { padding: 4px; }
  #ui #info { padding: 32px 12px 12px; }
  #ui .btn.small { min-height: var(--tap, 32px); }
  #ui .tab { min-height: var(--tap-tab, 32px); }
  #ui .tabs { overflow-y: hidden; }
}
@media (max-width: 600px) {
  #hud { top: calc(12px + var(--sat)); left: calc(17px + var(--sal)); right: calc(6px + var(--sar)); gap: 6px; }
  #ui .hs { padding: 0 3px; gap: 3px; }
  #ui #hudstats { gap: 3px; padding: 0 3px; }
  #hudbrand .os-flag { padding-right: 13px; }
  #ui .hb-lv { padding: 2px 3px 1px; }
  #ui .hs.clock .pix { display: none; }   /* an LCD time needs no clock icon; the room goes to the café's name */
  #ui #toolbar { left: calc(10px + var(--sal)); transform: none; justify-content: flex-start; overflow: visible; gap: 5px; }
  #ui #buildbanner, #ui #celebrate { top: calc(var(--ht) - 4px); }
  #ui .rating-tip { top: calc(var(--ht) - 6px); }
}
@media (max-width: 360px) {
  #ui .tool { width: 42px; height: 40px; }
  #ui #toolbar { gap: 3px; }
  #ui #hudbrand .bname { display: block; }
}
/* desktop: a little more room; the panel runs from the top on the right, clear of the HUD on the left */
@media (min-width: 761px) {
  #ui { --hb: 44px; --ht: calc(70px + var(--sat)); }
  #ui #hudbrand { max-width: 300px; }
  #ui .tool { width: 56px; height: 50px; }
  #ui .tool .pix { width: 36px; height: 36px; }
  #ui #panel { top: calc(16px + var(--sat)); bottom: calc(86px + var(--sab)); }
  #ui #info { top: var(--ht); left: calc(var(--hl) + var(--hb) + 12px); }   /* beside the left column, not over it */
}
@media (max-height: 560px) and (orientation: landscape) and (max-width: 960px) {
  #ui { --ht: calc(60px + var(--sat)); --hbot: calc(70px + var(--sab)); }
  #ui #toolbar { bottom: calc(6px + var(--sab)); }
  #ui #panel, #ui #info { bottom: calc(70px + var(--sab)); }
}
@media (prefers-reduced-motion: reduce) {
  #ui .toast, #ui #modal .card, #ui #alerts .alert, #ui #abtoggle.ready:not(.open) { animation: none; }
}

/* =====================================================================================================================
   Persona pass (2026-10-21, "too square"): nothing is a plain box. Every surface is a slanted, cut or staggered plate
   drawn by a layer behind straight text (pixel type is never skewed), type jumps in size, and plates carry a hard
   offset shadow like a misregistered print. The OS kit stays as texture: pinstripes, pixel icons, On/Off, LCD digits.
   ===================================================================================================================== */
#ui { --cut-win: polygon(0 12px, 100% 0, 100% calc(100% - 18px), calc(100% - 22px) 100%, 0 100%); }

/* ---- HUD: the café name as a big slanted label with an LCD level tag; Status as three staggered tags ---- */
#ui #hudbrand { height: auto; padding: 0 0 6px 10px; gap: 0; align-items: center; background: none; box-shadow: none; border: 0; transform: none; filter: drop-shadow(3px 3px 0 var(--os-ink)); }
#ui #hudbrand .os-knob { left: 0; top: -4px; }
#ui #hudbrand .os-flag { margin: 0; height: auto; padding: 5px 20px 5px 12px; border: 0; box-shadow: none; transform: rotate(-5deg);
  clip-path: polygon(0 3px, 100% 0, calc(100% - 10px) 100%, 5px 100%); }
#ui #hudbrand .bname { font-size: 18px; line-height: 1.15; }
#ui .hb-lv { margin: 6px 0 0 -8px; padding: 1px 7px 0; border: 0; box-shadow: none; background: var(--os-field); transform: rotate(7deg);
  font: 22px/1 var(--os-lcd); clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%); }
#ui #hudbrand .os-bar { left: 16px; right: 18px; bottom: 0; height: 5px; background: var(--os-field); transform: rotate(-3deg) skewX(-24deg); }
#ui #hudstats { height: auto; padding: 0; gap: 0; align-items: flex-start; background: none; box-shadow: none; border: 0; transform: none; filter: drop-shadow(3px 3px 0 var(--os-ink)); }
#ui .hs, #ui .hs.speed { height: 28px; padding: 0 10px; border: 0; box-shadow: none; clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); }
#ui .hs.coin { height: 34px; font-size: 30px; transform: rotate(-4deg); z-index: 1; }
#ui .hs.rating { margin: 9px 0 0 -6px; background: var(--os-frame); transform: rotate(5deg); }
#ui .hs.clock .hs-out { margin-left: 6px; padding: 0 5px; background: var(--os-denim); color: #fff; font: inherit; white-space: nowrap; }
#ui .hs.clock .hs-out:empty { display: none; }
#ui .hs.clock { margin: 1px 0 0 -6px; background: var(--os-ink); color: #fff; transform: rotate(-2deg); --pi-ink: #fff; --pi-fill: var(--os-peach); }
#ui .hs.speed { margin: 12px 0 0 -6px; background: var(--os-peach); }
#ui button.hs:active { box-shadow: none; translate: 1px 1px; }

/* ---- left column: slanted tags, a little out of line with each other ---- */
#ui #questbtn, #ui #friendsbtn, #ui #specialbtn, #ui #abtoggle { isolation: isolate; border: 0; background: none !important; box-shadow: none !important; }
#ui #questbtn::before, #ui #friendsbtn::before, #ui #specialbtn::before, #ui #abtoggle::before { content: ''; position: absolute; inset: 0; z-index: -1; transform: skewX(-10deg);
  background: var(--os-field); border: var(--os-b) solid var(--os-ink); box-shadow: 3px 3px 0 var(--os-ink); }
#ui #questbtn::before { background: linear-gradient(90deg, var(--os-denim) var(--p, 0%), transparent 0) 3px calc(100% - 4px) / calc(100% - 6px) 3px no-repeat, var(--os-field); }
#ui #questbtn.done::before { background: linear-gradient(90deg, var(--os-denim) 100%, transparent 0) 3px calc(100% - 4px) / calc(100% - 6px) 3px no-repeat, var(--os-field); }
#ui #friendsbtn { translate: 7px 0; }
#ui #specialbtn { translate: 2px 0; }
#ui #questbtn.active::before, #ui #friendsbtn.active::before, #ui #abtoggle.open::before { background: var(--os-denim); }
#ui #questbtn:active::before, #ui #friendsbtn:active::before, #ui #abtoggle:active::before { translate: 2px 2px; box-shadow: none; }

/* ---- Control Strip: a slanted paper band; modules are skewed keys at uneven heights; the open one jumps up and tilts ---- */
#ui #toolbar { isolation: isolate; align-items: flex-end; gap: 4px; padding: 12px 30px 8px 14px; border: 0; border-radius: 0; background: none; box-shadow: none; filter: drop-shadow(4px 4px 0 var(--os-denim)); }
#ui #toolbar::before { content: ''; position: absolute; inset: 8px 0 0 -12px; z-index: -1; clip-path: polygon(0 9px, 100% 0, calc(100% - 20px) 100%, 0 100%); background: var(--os-paper); }
#ui #toolbar::after { position: absolute; right: 2px; top: 6px; bottom: 0; width: 22px; margin: 0; border: 0; border-radius: 0; transform: skewX(-12deg);
  background: repeating-linear-gradient(90deg, var(--os-ink) 0 2px, var(--os-paper) 2px 5px); }
#ui .tool, #ui .tool:hover, #ui .tool:active { isolation: isolate; border: 0; background: none; box-shadow: none; transition: transform .12s steps(3, end); }
#ui .tool::before { content: ''; position: absolute; inset: 0; z-index: -1; transform: skewX(-9deg); background: var(--os-field); border: var(--os-b) solid var(--os-ink); }
#ui .tool:nth-child(odd) { translate: 0 -4px; }
#ui .tool:nth-child(3n) { translate: 0 2px; }
#ui .tool:active::before { background: var(--os-frame); }
#ui .tool.active, #ui .tool.active:hover { background: none; box-shadow: none; transform: translateY(-9px) rotate(-6deg) scale(1.1); z-index: 2; }
#ui .tool.active::before { background: var(--os-denim); box-shadow: 3px 3px 0 var(--os-ink); }
#ui .tool.active .pix { transform: none; }

/* ---- windows: a cut sheet of paper over a hard ink shadow; the title is a big slanted plate breaking out of the top ---- */
#ui #panel { isolation: isolate; padding: 34px 10px 14px 12px; border: 0; border-radius: 0; background: none; box-shadow: none; }
#ui #panel::before, #ui #panel::after { content: ''; position: absolute; inset: 0; z-index: -1; clip-path: var(--cut-win); }
#ui #panel::before { background: var(--os-ink); transform: translate(6px, 7px); }
#ui #panel::after { background: radial-gradient(rgba(63, 93, 170, .1) 28%, transparent 31%) 0 0 / 8px 8px, var(--os-paper); }
#ui .panel-head { position: absolute; left: -8px; right: 10px; top: -14px; height: auto; margin: 0; padding: 0; gap: 8px; align-items: flex-start; background: none; border: 0; z-index: 2; }
#ui .panel-head::before { content: ''; order: 0; position: absolute; left: 4px; top: 6px; width: 46%; height: 34px; border: 0; box-shadow: none; transform: rotate(-4deg) skewX(-14deg); background: var(--os-ink); z-index: -1; }
#ui .panel-head::after { content: ''; order: 2; flex: 1; align-self: center; height: 8px; margin-top: 14px; border: 0; box-shadow: none; transform: skewX(-30deg); background: var(--os-stripes); }
#ui .panel-head h2 { flex: 0 1 auto; margin: 0; padding: 6px 26px 7px 14px; height: auto; background: var(--os-denim); color: #fff; font-size: 24px; line-height: 1.05; transform: rotate(-4deg);
  clip-path: polygon(0 4px, 100% 0, calc(100% - 14px) 100%, 6px 100%); }
#ui #panel .panel-head .btn.xbtn { order: 3; align-self: flex-start; width: 34px; min-width: 34px; height: 30px; min-height: 30px; margin-top: 10px; border: 0; background: var(--os-ink); box-shadow: none;
  clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); color: #fff; transform: rotate(6deg); }
#ui #panel .panel-head .btn.xbtn .glyph { display: block; color: #fff; }
#ui #panel .panel-head .btn.xbtn::before { inset: -8px; }
#ui .panel-body { padding: 6px 8px 8px 4px; border: 0; box-shadow: none; background: none; }
#ui .panel-body::-webkit-scrollbar { width: 6px; }
#ui .panel-body::-webkit-scrollbar-track { background: linear-gradient(90deg, transparent 2px, var(--os-ink) 2px 4px, transparent 4px); border: 0; }
#ui .panel-body::-webkit-scrollbar-thumb { background: var(--os-denim); border: 0; }
/* other windows: the same cut sheet (clip-path on the element itself; their own shadow goes) */
#ui #info, #ui #modal .card, #ui #celebrate .card, #ui #receipt .card, #ui .rating-tip, #ui #coach, #ui #buildbar .card {
  border: 0; border-radius: 0; box-shadow: none; clip-path: var(--cut-win); background: radial-gradient(rgba(63, 93, 170, .1) 28%, transparent 31%) 0 0 / 8px 8px, var(--os-paper); }
#ui #celebrate, #ui #receipt, #ui #buildbar { filter: drop-shadow(6px 7px 0 var(--os-ink)); }
#ui #modal .card::before, #ui #celebrate .card::before, #ui #receipt .card::before, #ui #info::before, #ui .rating-tip::before, #ui #coach::before {
  left: 14px; right: 38%; top: 12px; height: 10px; border: 0; transform: rotate(-2deg) skewX(-30deg); }
#ui #info .btn.small.info-x { left: auto; right: 14px; top: 8px; background: var(--os-ink); border: 0; box-shadow: none; transform: rotate(6deg); }

/* ---- section heads: big type with a peach marker swipe; list plates staggered and tilted a hair ---- */
#ui .section-title { display: table; margin: 18px 0 8px -2px; padding: 0 10px 0 4px; font-size: 24px; line-height: 1.1; color: var(--os-ink); text-transform: uppercase; transform: rotate(-2deg);
  background: linear-gradient(transparent 55%, var(--os-peach) 55%); }
#ui .row, #ui .scard, #ui .tile, #ui .toggle, #ui #panel .orow, #ui .today-head, #ui .study-bar, #ui .club, #ui .sp-theme, #ui .bb-act {
  position: relative; isolation: isolate; border: 0 !important; background: none !important; box-shadow: none !important; }
#ui .row::before, #ui .scard::before, #ui #panel .scard::before, #ui .tile::before, #ui .toggle::before, #ui #panel .orow::before, #ui .today-head::before, #ui .study-bar::before,
#ui .club::before, #ui .sp-theme::before, #ui .bb-act::before {
  content: ''; display: block; position: absolute; inset: 0; width: auto; height: auto; border-radius: 0; z-index: -1;
  background: var(--os-field); border: var(--os-b) solid var(--os-ink); box-shadow: 4px 4px 0 var(--os-denim); transform: rotate(-.5deg) skewX(-3deg); }
#ui .panel-body > :nth-child(even)::before { transform: rotate(.4deg) skewX(2deg); }
#ui .panel-body > :is(.row, .scard, .toggle, .club):nth-child(3n+1) { margin-left: 6px; margin-right: -2px; }
#ui .panel-body > :is(.row, .scard, .toggle, .club):nth-child(3n+2) { margin-left: -2px; margin-right: 6px; }
#ui .row.current::before { background: #EDF1FA; box-shadow: 4px 4px 0 var(--os-denim), inset 0 0 0 2px var(--os-denim); }
#ui .row.ready::before { background: #FFF5F1; box-shadow: 4px 4px 0 var(--os-coral); }

/* ---- tabs: slanted keys, the chosen one denim, lifted and turned ---- */
#ui .tabs { gap: 2px; padding: 6px 6px 2px; border-bottom: 0; }
#ui .tab, #ui .tab:hover, #ui .tab.on, #ui .tab.on:hover, #ui #panel .tab:not(.on) { isolation: isolate; border: 0 !important; border-radius: 0; background: none !important; box-shadow: none !important; }
#ui .tab::before { content: ''; position: absolute; inset: 0 2px; z-index: -1; transform: skewX(-14deg); background: var(--os-field); border: var(--os-b) solid var(--os-ink); }
#ui .tab.on, #ui .tab.on:hover { color: #fff; transform: translateY(-3px) rotate(-3deg); z-index: 1; }
#ui .tab.on::before { background: var(--os-denim); box-shadow: 3px 3px 0 var(--os-ink); }

/* ---- buttons: parallelogram plates; the default one denim with a double shadow; pressed = the plate drops onto its shadow ---- */
#ui .btn:not(.tab):not(.tool):not(.switch):not(.panel-head > .btn):not(.info-x) { isolation: isolate; border-color: transparent !important; border-radius: 0 !important; background: none !important; box-shadow: none !important; }
#ui .btn:not(.tab):not(.tool):not(.switch):not(.panel-head > .btn):not(.info-x)::before { content: ''; position: absolute; inset: 0 3px; z-index: -1; transform: skewX(-12deg);
  background: var(--os-field); border: var(--os-b) solid var(--os-ink); box-shadow: 3px 3px 0 var(--os-ink); }
#ui .btn.primary:not(.tab):not(.tool):not(.switch):not(.panel-head > .btn):not(.info-x)::before { background: var(--os-denim); box-shadow: 3px 3px 0 var(--os-ink), 6px 6px 0 var(--os-peach); }
#ui .btn.danger:not(.tab):not(.tool):not(.switch):not(.panel-head > .btn):not(.info-x)::before { box-shadow: 3px 3px 0 var(--os-coral); }
#ui .btn.ghost:not(.tab):not(.tool):not(.switch):not(.panel-head > .btn):not(.info-x)::before { display: none; }
#ui .btn:not(.tab):not(.tool):not(.switch):not(.panel-head > .btn):not(.info-x):active::before { translate: 3px 3px; box-shadow: none; }
#ui .btn:not(.tab):not(.tool):not(.primary):active, #ui #panel .btn:not(.primary):not(.danger):not(.ghost):not(.tab):not(.panel-head > .btn):active { color: var(--os-ink); --pi-ink: var(--os-ink); }

/* ---- On / Off: two segments meeting on a diagonal ---- */
#ui .switch { gap: 0; border: 0; background: none; box-shadow: none; overflow: visible; filter: drop-shadow(2px 2px 0 var(--os-ink)); }
#ui .switch::before { clip-path: polygon(0 0, 100% 0, calc(100% - 7px) 100%, 0 100%); box-shadow: inset 0 0 0 2px var(--os-ink); }
#ui .switch::after { margin-left: -5px; border-left: 0; clip-path: polygon(7px 0, 100% 0, 100% 100%, 0 100%); box-shadow: inset 0 0 0 2px var(--os-ink); }
#ui .toggle .btn.switch { box-shadow: none; }

/* ---- bars lean too ---- */
#ui .pbar { transform: skewX(-22deg); }

/* ---- toasts: typed strips across the screen (coral when something happened); alerts: a coral-flagged plate ---- */
#ui .toast { padding: 6px 20px 6px 12px; border: 0; background: var(--os-denim); color: #fff; box-shadow: none; font: var(--fs)/1.3 var(--os-type);
  clip-path: polygon(0 2px, 100% 0, calc(100% - 8px) 100%, 5px calc(100% - 1px)); transform: rotate(-1.5deg); --pi-ink: #fff; --pi-fill: var(--os-peach); animation: os-strip .2s steps(3, end); }
#ui .toast:nth-child(even) { transform: rotate(1.2deg); translate: 14px 0; }
#ui .toast::before { display: none; }
#ui .toast.bad, #ui .toast.money { background: var(--os-coral); color: #fff; box-shadow: none; --pi-fill: #fff; }
#ui .toast.out { animation: os-strip-out .2s steps(3, end) forwards; }
@keyframes os-strip { from { scale: 0 1; } }
@keyframes os-strip-out { to { scale: 1 0; } }
#ui #alerts .alert { isolation: isolate; background: none; border: 0; box-shadow: none; }
#ui #alerts .alert::after { content: ''; position: absolute; inset: 0; z-index: -1; transform: skewX(-8deg); background: var(--os-field); border: var(--os-b) solid var(--os-ink); box-shadow: 4px 4px 0 var(--os-coral); }
#ui #alerts .alert.sent { box-shadow: none; }
#ui #alerts .alert.sent::after { box-shadow: 4px 4px 0 var(--os-denim); }

@media (min-width: 761px) {
  #ui #panel { top: calc(34px + var(--sat)); }   /* room for the title plate that breaks out of the top */
  #ui #hudbrand .bname { font-size: 24px; }
  #ui .hs.coin { font-size: 34px; height: 38px; }
}
@media (max-width: 600px) {
  #ui .hs, #ui .hs.speed { padding: 0 8px; }
  #ui #hudbrand .os-flag { padding-right: 18px; }
}

/* =====================================================================================================================
   Bolder pass: tab rows read like a Persona menu (words, no keys; sizes and angles change; the chosen word big on a
   denim brush stroke), the chosen row in a list gets the same brush, and events open with a coral ink iris.
   Text never spills: tab rows wrap instead of overflowing, nothing in them truncates, and sizes only grow on the
   chosen word. The brush is one inline SVG stroke stretched to its text.
   ===================================================================================================================== */
#ui { --brush: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 40' preserveAspectRatio='none'%3E%3Cpath fill='%233F5DAA' d='M7 11C38 5 84 9 132 5c22-2 44-1 63 3l-5 6c6 3 7 9 3 13l4 5c-36 6-78 3-118 6-24 2-49 2-74-1l6-6c-6-3-8-9-3-13l-4-4z'/%3E%3Cpath fill='%233F5DAA' d='M150 1l46 3-1 3-44-2zM4 36l52 1-1 3-50-1z' opacity='.75'/%3E%3C/svg%3E"); }

/* ---- tab rows: a cascade of words ---- */
#ui .tabs, #ui #panel .tabs:not(.seg), #ui .tabs.seg, #ui #buildbar .bb-top .tabs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 8px 4px 8px 6px; margin: 0 0 8px;
  overflow: visible; grid-template-columns: none; grid-auto-flow: row; }
#ui .tabs .tab, #ui #panel .tabs .tab, #ui .tabs.seg .tab, #ui #buildbar .bb-top .tab { flex: 0 0 auto; width: auto; min-width: 0; max-width: 100%; min-height: 0; height: auto; padding: 3px 7px;
  overflow: visible; white-space: nowrap; text-overflow: clip; color: var(--os-ink); font-size: var(--fs); line-height: 1.2; min-height: var(--tap-tab, 0); display: inline-flex; align-items: center; }
#ui .tabs .tab span, #ui .tabs .tab small { overflow: visible; text-overflow: clip; max-width: none; }
#ui .tabs .tab::before { display: none; }
#ui .tabs .tab:nth-child(odd):not(.on) { transform: rotate(-3deg) translateY(-2px); }
#ui .tabs .tab:nth-child(even):not(.on) { transform: rotate(2deg) translateY(3px); }
#ui .tabs .tab:nth-child(3n):not(.on) { color: var(--os-denim); }
#ui .tabs .tab:not(.on):hover { text-decoration: underline 2px; text-underline-offset: 3px; }
#ui .tabs .tab.on, #ui .tabs .tab.on:hover, #ui #panel .tabs .tab.on, #ui #buildbar .bb-top .tab.on { padding: 4px 16px 5px 12px; color: #fff; font-size: 24px; line-height: 1.05; transform: rotate(-4deg); z-index: 1; }
#ui .tabs .tab.on::before { content: ''; display: block; position: absolute; inset: -2px 0 -3px -8px; z-index: -1; border: 0; box-shadow: none; transform: none;
  background: var(--brush) center / 100% 100% no-repeat; animation: os-brush .45s steps(1, end) infinite; }
#ui .tabs .tab.on::after { content: ''; position: absolute; left: 6px; right: 2px; bottom: -6px; height: 3px; background: var(--os-ink); transform: rotate(2deg) skewX(-30deg); }
#ui .tabs.seg .tab.on small { font-size: 16px; }
@keyframes os-brush { 50% { translate: 1px -1px; scale: 1.02 1; } }

/* ---- the chosen row: its title on the brush ---- */
#ui .scard.open .scard-title b, #ui .row.current h3, #ui .bitem.sel > span:first-of-type, #ui .pick-tile.on b {
  position: relative; z-index: 0; padding: 1px 12px 2px 8px; margin-left: -6px; color: #fff; background: var(--brush) center / 100% 100% no-repeat; animation: os-brush .45s steps(1, end) infinite; }
#ui .pick-tile { border-radius: 0; background: none; }
#ui .pick-tile.on { box-shadow: none; background: none; }

/* ---- events: the coral ink iris (transition.js iris) ---- */
@property --hole { syntax: '<length>'; inherits: false; initial-value: 0px; }
.tr-iris { position: absolute; inset: 0; z-index: 9; pointer-events: none; overflow: hidden;
  -webkit-mask-image: radial-gradient(circle at var(--at), transparent var(--hole), #000 calc(var(--hole) + 1px)); mask-image: radial-gradient(circle at var(--at), transparent var(--hole), #000 calc(var(--hole) + 1px)); }
.tr-blot { position: absolute; background: url('../../assets/ui/collage/ink_coral.webp') center / contain no-repeat; transform: scale(0); }

@media (prefers-reduced-motion: reduce) {
  #ui .tabs .tab.on::before, #ui .scard.open .scard-title b, #ui .row.current h3, #ui .bitem.sel > span:first-of-type, #ui .pick-tile.on b { animation: none; }
}

/* ---- text is never cut: the HUD wraps to a second row (ui.js moves --ht to its foot), names wrap inside their
   label, toasts and alerts wrap to two lines, the typed strip too ---- */
#hud { flex-wrap: wrap; row-gap: 8px; }
#ui #hudbrand { flex: 0 1 auto; max-width: 100%; }
#ui #hudbrand .os-flag { min-width: 0; }
#ui #hudbrand .bname { white-space: normal; overflow: visible; text-overflow: clip; word-break: keep-all; overflow-wrap: anywhere; }
#ui .hs-wrap { margin-left: auto; }
#ui .toast > span, #ui #alerts .al-text b, #ui #alerts .al-text small { white-space: normal; overflow: visible; text-overflow: clip; word-break: keep-all; overflow-wrap: anywhere; }
#ui .toast { max-width: min(92vw, 420px); }
#ui #toasts { width: max-content; max-width: calc(100vw - 2 * (var(--hl) + var(--hb) + var(--hg))); }   /* between the side columns, never over a button */
#ui .toast { width: max-content; max-width: 100%; }
/* the chosen staff card's name: bigger on its brush, wrapping rather than cut */
#ui .scard.open .scard-title b { font-size: 18px; line-height: 1.25; white-space: normal; overflow: visible; text-overflow: clip; word-break: keep-all; overflow-wrap: anywhere; }
/* phones: the sheet starts under the HUD, lower still while a trouble alert hangs there, so no text lies on other text */
@media (max-width: 760px) {
  #ui #panel { height: min(68dvh, calc(100dvh - 100px - var(--sab) - var(--ht))); }
  #ui:has(#alerts .alert) #panel { height: min(68dvh, calc(100dvh - 160px - var(--sab) - var(--ht))); }
}
@media (min-width: 761px) { #ui .hs-wrap { margin-left: 0; } }   /* desktop: Status beside the name, clear of the panel on the right */

/* ---- the café's openings (transition.js): poured coffee and a loaf out of the oven; popups no longer fade in ---- */
#ui #modal .card, #ui #celebrate.show, #ui #receipt.show { animation: none; }
/* coffee: espresso black with a rolling peach crema line, filling the window's own cut shape */
.tr-pour { position: absolute; z-index: 8; pointer-events: none; overflow: hidden; clip-path: var(--cut-win); }
.tr-coffee { position: absolute; inset: -40px -12px 0; display: block;   /* a real glass of coffee, side on, its crema the rising edge */
  background: url('../../assets/ui/collage/coffee.webp') center top / cover no-repeat, linear-gradient(transparent 45%, #141414 45%); }
/* the grey kettle, its stream falling into the coffee */
.tr-kettle { position: absolute; z-index: 9; pointer-events: none; transform-origin: 80% 20%; background: url('../../assets/ui/collage/kettle.webp') no-repeat center / contain;
  filter: drop-shadow(3px 3px 0 var(--os-denim)); }
.tr-stream { position: absolute; z-index: 8; width: 3px; pointer-events: none; background: #1E1C1A; box-shadow: 1px 0 0 rgba(246, 205, 191, .7); }
/* the loaf on its peel */
.tr-bread { position: absolute; z-index: 9; pointer-events: none; background: url('../../assets/ui/collage/bread.webp') no-repeat center / contain; filter: drop-shadow(4px 4px 0 var(--os-denim)); }

/* latte art (transition.js 'latte'): a grey halftone photo of a real latte, spreading from its heart, then a heart-shaped
   hole in it opens onto the window and the view dives in */
.tr-latte { position: absolute; z-index: 8; pointer-events: none; clip-path: var(--cut-win); }
.tr-latte svg { display: block; }
.tr-latte .spread { transform-box: fill-box; transform-origin: center; transform: scale(0); }
.tr-latte .hole { transform-box: view-box; transform-origin: 0 0; transform: scale(0); }
.tr-latte .zoom, .tr-latte .swirl { transform-box: view-box; }
/* falling beans (transition.js 'beans') */
.tr-beans { position: absolute; z-index: 8; pointer-events: none; }
.tr-bean { position: absolute; top: 0; background: url('../../assets/ui/collage/bean.webp') no-repeat center / contain; }
/* steam puffs (transition.js 'steam'): flat white clouds with a faint denim dot screen */
.tr-steam { position: absolute; z-index: 8; pointer-events: none; clip-path: inset(-24px -16px -8px -16px); }   /* the window's own cloud, not the whole screen's */
.tr-puff { position: absolute; background: url('../../assets/ui/collage/steam.webp') center / contain no-repeat; }

/* ---- the Home Screen hint (ui/fullscreen.js, iPhone / iPad Safari only) ---- */
#ui .a2hs .hero-ico { margin: 4px 0 6px; }
#ui .a2hs-hero { display: inline-grid; place-items: center; width: 72px; height: 72px; background: var(--os-denim); --pi-ink: #fff; --pi-fill: var(--os-peach); clip-path: polygon(6px 0, 100% 0, calc(100% - 6px) 100%, 0 100%); }
#ui .a2hs-share { display: inline-grid; place-items: center; vertical-align: -6px; width: 28px; height: 28px; background: var(--os-denim); --pi-ink: #fff; --pi-fill: var(--os-peach); }
#ui .a2hs .muted { margin-top: 8px; }
#ui .a2hs .btnrow { margin-top: 14px; }

/* =====================================================================================================================
   Readable pass (2026-10-28 review): text and touch sizes. The pixel face is drawn on a 12-px grid, so 12 and 24 are
   crisp everywhere and 16 on 3x phones: body text is 16 (--fs), secondary text (counts, chips, small notes) 12 and
   never less (--fs-sm). On touch screens anything tappable is at least 44 px tall (--tap); wide screens get 18-px text
   and a wider panel.
   ===================================================================================================================== */
#ui { --fs: 16px; --fs-sm: 12px; }
#ui small, #ui .g-note, #ui .today-head small, #ui .reset small, #ui .g-n, #ui .chips .pill, #ui .ing { font-size: var(--fs-sm); }
#ui .goal .g-note { color: var(--ink-soft); }   /* was the faint grey: too pale at 12 px on the peach rows */
/* the market tiles' two buy buttons share a narrow tile: tight insides so "×5 65" fits */
#ui #panel .tile .btnrow .btn:not(.primary):not(.danger):not(.ghost):not(.tab):not(.panel-head > .btn) { padding: 0 6px; gap: 2px; font-size: var(--fs-sm); }
#ui #panel .tile .btnrow .pill { padding: 0 2px; }
/* the staff strip (seats, wages, feed all, ?) wraps rather than pushing the ? out of the panel */
#ui #panel .stat-strip { flex-wrap: wrap; row-gap: 8px; }#ui input[type=range] { min-height: var(--tap-range, 16px); }
#ui :is(input:not([type=range]), textarea, select) { font-size: var(--fs); min-height: var(--tap, 0); }
@media (pointer: coarse) {
  #ui { --tap: 44px; --tap-tab: 44px; --tap-range: 44px; --sw-w: 96px; --sw-h: 40px; --fs-sw: 16px; }
  #ui .coach-acts .btn { min-height: var(--tap); padding: 0 14px; }
}
@media (min-width: 1200px) {
  #ui { --fs: 18px; }
  #ui #panel { width: 500px; }
}
