:root {
  --night: #11142c; --night2: #1d2150; --ink: #14111f; --cream: #f3eee2; --cream-dim: #c9c2ad; --gold: #ffd43b;
  --red: #ff4d4f; --green: #51cf66; --paper: #f3eee2; --muted: #8a85a0;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--night); color: var(--cream); overflow: hidden; }
body { font-family: Chivo, system-ui, sans-serif; -webkit-tap-highlight-color: transparent; }
button { font-family: inherit; }
.app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; width: 100%; }

.top { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 2px 16px; min-height: 50px; background: var(--ink); }
.brand { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand .ep { white-space: nowrap; font-size: 12px; font-weight: 700; color: var(--cream-dim); letter-spacing: .08em; }
.brand .name { font-weight: 900; font-size: 18px; color: var(--gold); letter-spacing: .05em; white-space: nowrap; }
.btns { display: flex; gap: 8px; }
.btns button { width: 46px; height: 46px; border: 0; border-radius: 12px; background: #2b2f5e; color: var(--cream); display: grid; place-items: center; cursor: pointer; padding: 0; font-weight: 900; font-size: 16px; }
.btns button:active { transform: scale(.94); }
#mute svg { width: 24px; height: 24px; }
#mute .x { display: none; }
#mute.muted .x { display: inline; }
#mute.muted .w { display: none; }

.hud { flex: 0 0 auto; display: flex; gap: 8px; padding: 6px 16px; background: var(--night); min-height: 52px; align-items: stretch; }
.stat { display: flex; flex-direction: column; justify-content: center; padding: 4px 10px; border-radius: 10px; background: #1d2150; min-width: 0; }
.stat .lbl { font-size: 12px; font-weight: 700; letter-spacing: .08em; color: var(--cream-dim); white-space: nowrap; }
.stat b { font-size: 19px; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--cream); white-space: nowrap; }
.stat.sanity { flex: 1 1 auto; display: grid; grid-template-columns: 1fr auto; grid-template-rows: auto auto; column-gap: 8px; align-content: center; }
.stat.sanity .lbl { grid-column: 1 / 3; }
.stat.sanity .bar { align-self: center; height: 12px; border-radius: 6px; background: #0b0d22; overflow: hidden; }
.stat.sanity .bar i { display: block; height: 100%; width: 100%; background: var(--green); border-radius: 6px; transform-origin: left; }
.stat.sanity.warn .bar i { background: #fcc419; }
.stat.sanity.danger .bar i { background: var(--red); }
.stat.sanity.danger b { color: #ff8787; }
.stat.flash { box-shadow: 0 0 0 3px var(--red) inset; }
#hours.gain { box-shadow: 0 0 0 3px var(--green) inset; }
#hours b { color: var(--gold); }

.rulebar { flex: 0 0 auto; display: flex; justify-content: center; padding: 2px 16px 4px; background: var(--night); }
.rule { margin: 0; padding: 5px 16px; background: var(--gold); color: var(--ink); border-radius: 999px; font-weight: 900; font-size: 15px; letter-spacing: .06em; white-space: nowrap; }
body.intro .hud, body.intro .rulebar, body.intro #speed { visibility: hidden; }
body.intro .app { background: var(--paper); }

.board { position: relative; flex: 1 1 auto; min-height: 0; overflow: hidden; touch-action: none; background: var(--paper); }
body:not(.intro) .board { background: var(--night); }
.board canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; touch-action: none; cursor: pointer; }
.vignette { position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0; background: radial-gradient(ellipse at center, rgba(255,0,0,0) 45%, rgba(220,20,30,.55) 100%); }

.caption { position: absolute; left: 16px; right: 16px; bottom: 16px; z-index: 6; margin: 0 auto; max-width: 560px; padding: 14px 18px; text-align: center;
  background: var(--ink); color: var(--cream); border-radius: 16px; font-weight: 900; font-size: 26px; line-height: 1.2; pointer-events: none; box-shadow: 0 6px 0 rgba(0,0,0,.25); }
.banner { position: absolute; left: 50%; top: 12px; z-index: 6; transform: translateX(-50%); margin: 0; padding: 10px 18px; border-radius: 14px; background: var(--gold); color: var(--ink);
  font-weight: 900; font-size: 24px; letter-spacing: .04em; text-align: center; width: max-content; max-width: calc(100% - 32px); box-shadow: 0 5px 0 rgba(0,0,0,.35); pointer-events: none; }
.banner small { display: block; font-size: 14px; font-weight: 700; letter-spacing: .02em; }
.banner.red { background: var(--red); color: #fff; }
.toast { position: absolute; left: 50%; bottom: 14px; z-index: 6; transform: translateX(-50%); margin: 0; padding: 8px 14px; border-radius: 12px; background: rgba(20,17,31,.92); color: var(--cream);
  font-weight: 700; font-size: 16px; text-align: center; width: max-content; max-width: calc(100% - 32px); pointer-events: none; opacity: 0; }
.toast b { color: var(--gold); }

.next { position: absolute; z-index: 5; left: 12px; top: 10px; display: flex; flex-direction: column; gap: 5px; pointer-events: none; width: 230px; }
body.intro .next { visibility: hidden; }
.next .nt { font-size: 12px; font-weight: 900; letter-spacing: .1em; color: var(--cream-dim); }
.next .nl { display: flex; flex-direction: column; gap: 5px; }
.chip { display: flex; align-items: center; gap: 7px; padding: 5px 9px 5px 6px; border-radius: 10px; background: rgba(29,33,80,.92); border-left: 6px solid var(--c, #ff6b6b); font-size: 13px; font-weight: 700; color: var(--cream); white-space: nowrap; overflow: hidden; }
.k-close { --c: #6c8ebf; } .k-payroll { --c: #f08a24; } .k-vat { --c: #e0a70c; } .k-board { --c: #8f5bd6; } .k-review { --c: #3d9ad1; } .k-q3report { --c: #21a596; }
.k-audit { --c: #b3261e; } .k-budget { --c: #d6336c; } .k-annual { --c: #8a1f45; } .k-xmas { --c: #2f9e44; } .k-adhoc { --c: #ff6b6b; }
.chip b { font-weight: 900; color: var(--gold); font-variant-numeric: tabular-nums; }
.chip.crunch { background: #5c1020; border-left-color: #ff3b3b; }
.chip.crunch i { font-style: normal; font-weight: 900; color: #ffd43b; }
@media (max-aspect-ratio: 4/5) {
  .next { left: 12px; right: 12px; width: auto; top: 8px; }
  .next .nl { flex-direction: row; }
  .chip { flex: 1 1 0; min-width: 0; flex-direction: column; align-items: flex-start; gap: 0; padding: 4px 7px; font-size: 12px; }
  .chip span { overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .banner { top: 74px; }
}
.radial { position: absolute; z-index: 8; left: 0; top: 0; width: 2px; height: 2px; }
.radial[hidden] { display: none; }
.r-month { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); margin: 0; padding: 4px 10px; border-radius: 999px; background: var(--gold); color: var(--ink); font-weight: 900; font-size: 13px; letter-spacing: .06em; white-space: nowrap; pointer-events: none; }
.radial button { position: absolute; width: 92px; height: 66px; margin: -33px 0 0 -46px; border: 3px solid var(--ink); border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  color: #fff; cursor: pointer; padding: 2px; box-shadow: 0 4px 0 rgba(0,0,0,.4); transform: scale(var(--pop, 1)); }
.radial button svg { width: 22px; height: 22px; }
.radial button span { font-size: 12px; font-weight: 900; line-height: 1.1; white-space: nowrap; }
.radial button em { font-style: normal; font-size: 12px; font-weight: 700; color: var(--gold); }
.radial button.t-prep { background: #2f6db3; } .radial button.t-delegate { background: #2b8a3e; }
.radial button.t-automate { background: #6741d9; } .radial button.t-buffer { background: #7a6d5b; }
.radial button:disabled { filter: grayscale(.9) brightness(.6); cursor: not-allowed; }
.radial button:disabled em { color: #ff8787; }
.radial button.hl { outline: 4px solid var(--gold); outline-offset: 2px; }

.end { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(10, 8, 20, .7); padding: 16px; }
.end[hidden], .hand[hidden], .caption[hidden], .banner[hidden] { display: none; }
.end-card { width: min(100%, 440px); background: var(--night); border: 4px solid var(--gold); border-radius: 20px; padding: 22px 18px; text-align: center; box-shadow: 0 10px 0 rgba(0,0,0,.4); }
.end-card p { margin: 0; }
.end-title { font-weight: 900; font-size: 46px; color: var(--gold); letter-spacing: .03em; line-height: 1.05; }
.end.burn .end-card { border-color: var(--red); }
.end.burn .end-title { color: var(--red); }
.end-why { font-size: 17px; line-height: 1.4; color: var(--cream); margin-top: 10px !important; }
#again { margin-top: 18px; min-height: 54px; padding: 0 24px; border: 0; border-radius: 14px; background: var(--gold); color: var(--ink); font-weight: 900; font-size: 18px; letter-spacing: .05em; cursor: pointer; box-shadow: 0 4px 0 #b08a1c; }

.hand { position: fixed; left: 0; top: 0; z-index: 40; width: 48px; height: 56px; pointer-events: none; transform: translate(-30%, -8%); }
.hand svg { width: 48px; height: 56px; filter: drop-shadow(0 3px 0 rgba(0,0,0,.5)); }
.hand .tapring { position: absolute; left: 4px; top: -14px; width: 36px; height: 36px; border-radius: 50%; border: 4px solid var(--gold); opacity: 0; }

footer { flex: 0 0 auto; text-align: center; font-size: 12px; color: var(--cream-dim); padding: 5px 16px 7px; background: var(--ink); }
body.intro footer { background: #e6e0d0; color: #6b6580; }
body.intro .top { background: #e6e0d0; }
body.intro .brand .ep { color: #6b6580; } body.intro .brand .name { color: #2b2840; }
body.intro .btns button { background: #d6cfbd; color: #2b2840; }

@media (max-width: 520px) {
  .top { padding: 2px 12px; }
  .hud { padding: 6px 12px; gap: 6px; }
  .stat { padding: 4px 8px; }
  .stat b { font-size: 17px; }
  .caption { font-size: 22px; }
  .banner { font-size: 20px; }
  .toast { font-size: 15px; }
}
