/* Papurrs: a warm booth at the cat-flap, a wooden desk, cream papers. One palette:
   night blue-greys for the booth, honey wood for the desk, cream and ink for paper, gold, a stamp green and a stamp red. */
:root {
  --wall: #263640; --wall-dark: #18232b; --frame: #6b4426; --frame-dark: #3e2614; --frame-light: #9a6a3e;
  --wood-a: #9a6538; --wood-b: #7a4c28; --wood-line: rgba(40, 20, 6, .16);
  --paper: #fbf3df; --paper-edge: #d8c8a4; --ink: #2a2320; --ink-soft: #6b5c4c;
  --gold: #e8b54a; --gold-dark: #a8741c;
  --ok: #2f9a52; --ok-dark: #1d6a36; --no: #c23b32; --no-dark: #86231c;
  --sel: #ffcf3a; --flag: #e0453a;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ds: .52; /* the papers' size on the desk (game.js sets it) */
  color-scheme: light;
}
body[data-desk="walnut"] { --wood-a: #6e4a32; --wood-b: #4e3222; }
body[data-desk="cherry"] { --wood-a: #a4553a; --wood-b: #7a3a26; }
body[data-desk="birch"] { --wood-a: #d9bd8c; --wood-b: #b99a68; --wood-line: rgba(80, 50, 20, .14); }
body[data-desk="teal"] { --wood-a: #3f8a86; --wood-b: #2c6663; }
body[data-desk="marble"] { --wood-a: #e8e4dc; --wood-b: #c9c2b6; --wood-line: rgba(90, 90, 110, .12); }
body[data-desk="ebony"] { --wood-a: #3a302c; --wood-b: #231c19; }
body[data-ink="ocean"] { --ok: #1f7fa6; --ok-dark: #145a78; --no: #c2533a; --no-dark: #86321c; }
body[data-ink="plum"] { --ok: #6a8f2a; --ok-dark: #4a661a; --no: #8a3a8a; --no-dark: #5a1f5a; }
body[data-ink="sunset"] { --ok: #d9822e; --ok-dark: #9a5414; --no: #c2335a; --no-dark: #861c3a; }
body[data-ink="gold"] { --ok: #b8902a; --ok-dark: #7a5c12; --no: #9a2a2a; --no-dark: #641414; }

* { box-sizing: border-box; touch-action: manipulation; }
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; }
body {
  position: fixed; inset: 0;
  font-family: "Baloo 2", ui-rounded, system-ui, sans-serif;
  color: #f4ead2;
  background: var(--wall-dark);
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
button { font: inherit; color: inherit; }
button:disabled { cursor: default; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .02em; }

.app {
  height: 100%; max-width: 640px; margin: 0 auto;
  display: grid; grid-template-rows: auto clamp(190px, 31vh, 270px) 1fr auto;
  background: linear-gradient(var(--wall), var(--wall-dark));
}

/* ---------- the header ---------- */
.hud {
  display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 6px;
  min-height: 44px; padding: var(--sg-corner-top) 12px 6px calc(var(--sg-corner-left));
}
.hud-mid { line-height: 1.05; min-width: 0; text-align: center; }
.hud-mid b { display: block; font-size: 20px; font-weight: 800; white-space: nowrap; }
.hud-mid span { font-size: 14px; font-weight: 600; opacity: .8; white-space: nowrap; }
.hud-right { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.1; }
.hud-clock { font-size: 18px; font-weight: 800; font-variant-numeric: tabular-nums; }
.hud-clock.late { color: #ffb36b; }
.hud-coins { display: flex; align-items: center; gap: 4px; font-weight: 800; font-size: 16px; color: var(--gold); }
.hud-coins[hidden] { display: none; }
.hud-coins i { width: 14px; height: 14px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #fff2b0, var(--gold) 55%, var(--gold-dark)); box-shadow: 0 1px 0 #5a3a08; }

/* ---------- the booth: a window onto the line, the visitor, the scale and the calendar ---------- */
.booth { position: relative; overflow: hidden; margin: 0 8px; border-radius: 14px 14px 0 0; background: #1b2a33; }
.sky {
  --t: 0;
  position: absolute; inset: 0 0 34% 0;
  background:
    radial-gradient(circle at calc(15% + var(--t) * 70%) calc(70% - sin(var(--t) * 3.1416) * 50%), rgba(255, 236, 170, .95) 0 14px, rgba(255, 220, 140, .3) 15px 34px, transparent 36px),
    linear-gradient(color-mix(in srgb, #8ec5e8 calc((1 - var(--t)) * 100%), #e98a5a), color-mix(in srgb, #d8ecf4 calc((1 - var(--t)) * 100%), #f6c78a));
}
.sky::after { /* the town over the wall */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 40%;
  background:
    linear-gradient(90deg, transparent 0 6%, #5a6e7a 6% 15%, transparent 15% 22%, #4e626e 22% 30%, transparent 30% 60%, #56697a 60% 72%, transparent 72% 80%, #4a5e6c 80% 92%, transparent 92%) bottom / 100% 70% no-repeat,
    linear-gradient(#6f8592, #5f7480) bottom / 100% 30% no-repeat;
  opacity: .85;
}
.booth::after { /* the counter */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 34%;
  background: linear-gradient(var(--frame-light), var(--frame) 18%, var(--frame-dark));
  box-shadow: 0 -3px 0 rgba(0, 0, 0, .25);
}
.queue { position: absolute; left: 8px; bottom: 34%; height: 46px; display: flex; gap: 2px; z-index: 1; }
.queue i {
  width: 22px; height: calc(34px + var(--k) * -2px); align-self: flex-end; opacity: calc(.8 - var(--k) * .1);
  background: #2c3a44; border-radius: 11px 11px 4px 4px;
  clip-path: polygon(0 30%, 18% 0, 36% 22%, 64% 22%, 82% 0, 100% 30%, 100% 100%, 0 100%);
}
.visitor { position: absolute; left: 65%; bottom: 26%; width: min(40%, 190px); aspect-ratio: 1; transform: translateX(-50%); z-index: 2; }
.visitor .face { width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 6px 4px rgba(0, 0, 0, .3)); pointer-events: auto; }
.visitor.arrive { animation: arrive .52s cubic-bezier(.2, .9, .3, 1.2) both; }
.visitor.leave-in { animation: leave-in .55s ease-in both; }
.visitor.leave-out { animation: leave-out .55s ease-in both; }
@keyframes arrive { from { transform: translateX(-140%) translateY(6px) rotate(-6deg); opacity: 0; } 70% { transform: translateX(-46%) translateY(-6px) rotate(2deg); opacity: 1; } }
@keyframes leave-in { to { transform: translateX(160%) translateY(4px) rotate(8deg); opacity: 0; } }
@keyframes leave-out { to { transform: translateX(-200%) translateY(8px) rotate(-10deg); opacity: 0; } }
.frame { position: absolute; inset: 0 0 34% 0; z-index: 3; pointer-events: none;
  border: 10px solid var(--frame); border-bottom: 0; border-radius: 14px 14px 0 0;
  box-shadow: inset 0 0 0 2px var(--frame-dark), inset 0 8px 16px rgba(0, 0, 0, .25); }
.flap { position: absolute; right: 12px; bottom: 34%; width: 44px; height: 52px; z-index: 1; border-radius: 22px 22px 4px 4px; background: #1a252c; border: 4px solid var(--frame-dark); perspective: 120px; }
.flap i { position: absolute; inset: 4px; border-radius: 16px 16px 2px 2px; background: linear-gradient(#c9d6dc, #8fa4ae); transform-origin: top; }
.flap.swing i { animation: swing .8s ease-out; }
@keyframes swing { 20% { transform: rotateX(-70deg); } 45% { transform: rotateX(40deg); } 70% { transform: rotateX(-18deg); } }
.bubble {
  position: absolute; z-index: 4; left: 10px; top: 10px; width: calc(50% - 6px); padding: 6px 11px; border-radius: 14px 14px 4px 14px;
  background: #fffaf0; color: var(--ink); font-size: 14px; font-weight: 600; line-height: 1.25;
  box-shadow: 0 3px 0 rgba(0, 0, 0, .25); opacity: 0; transform: scale(.9); transform-origin: 100% 60%;
}
.bubble.on { opacity: 1; transform: scale(1); }
.bubble.pop { animation: pop .25s ease-out; }
@keyframes pop { from { transform: scale(.85); } 60% { transform: scale(1.04); } }
.calendar, .scale {
  position: absolute; z-index: 5; bottom: 6%; min-width: 64px; min-height: 52px; padding: 3px 8px; border: 0; border-radius: 8px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
}
.calendar { right: 10px; background: #fffaf0; color: var(--ink); box-shadow: 0 3px 0 rgba(0, 0, 0, .3); border-top: 7px solid #c23b32; }
.calendar small, .scale small { font-size: 11px; font-weight: 800; letter-spacing: .08em; opacity: .7; }
.calendar b { font-size: 22px; font-weight: 800; }
.calendar span { font-size: 12px; font-weight: 700; }
.scale { left: 10px; background: #1c2a1e; color: #9df0a8; font-family: ui-monospace, Menlo, monospace; border: 3px solid #6f7a72; }
.scale[hidden] { display: none; }
.scale b { font-size: 18px; text-shadow: 0 0 6px rgba(120, 255, 150, .6); }
.sill { position: absolute; z-index: 4; left: 84px; right: 84px; bottom: 9%; height: 26px; display: flex; justify-content: center; gap: 8px; pointer-events: none; }
.tk { width: 24px; height: 24px; border-radius: 6px; }
.tk-plant { background: radial-gradient(circle at 50% 30%, #6fbf5a 0 8px, transparent 9px), linear-gradient(transparent 55%, #b8643a 55%); }
.tk-mug { background: linear-gradient(90deg, transparent 15%, #e9e2d4 15% 75%, transparent 75%) bottom / 100% 70% no-repeat; border-radius: 4px; }
.tk-fish { background: radial-gradient(circle at 55% 55%, #ff9a3a 0 4px, transparent 5px), radial-gradient(circle, rgba(170, 220, 255, .85) 0 11px, transparent 12px); }
.tk-lamp { background: linear-gradient(#ffd56a, #c9962a) top / 100% 45% no-repeat, linear-gradient(90deg, transparent 44%, #a8741c 44% 56%, transparent 56%); }
.tk-bell { background: radial-gradient(ellipse at 50% 70%, #e8b54a 0 10px, transparent 11px); }
.tk-photo { background: #fffaf0; border: 3px solid #6b4426; box-shadow: inset 0 -8px 0 #8ec5e8; }
.float { position: absolute; z-index: 6; left: 50%; top: 40%; transform: translateX(-50%); font-weight: 800; font-size: 22px; pointer-events: none; animation: float 1.3s ease-out forwards; white-space: nowrap; text-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
.float.good { color: #ffe38a; }
.float.dot { color: #ff8a8a; top: 55%; font-size: 16px; }
@keyframes float { to { transform: translate(-50%, -46px); opacity: 0; } }

/* ---------- the desk ---------- */
.desk {
  position: relative; overflow: hidden; margin: 0 8px; min-height: 0;
  background:
    repeating-linear-gradient(178deg, var(--wood-line) 0 2px, transparent 2px 19px, rgba(255, 255, 255, .05) 19px 21px, transparent 21px 37px),
    linear-gradient(var(--wood-a), var(--wood-b));
  box-shadow: inset 0 10px 16px rgba(0, 0, 0, .3);
}
.desk-papers { position: absolute; inset: 0; z-index: 0; isolation: isolate; }
.paper {
  position: absolute; width: 300px; color: var(--ink); background: var(--paper); border-radius: 6px;
  box-shadow: 0 2px 0 var(--paper-edge), 0 8px 14px rgba(0, 0, 0, .35);
  transform: rotate(var(--rot, 0deg)) scale(var(--ds)); transform-origin: top left;
  touch-action: none; cursor: grab; overflow: hidden;
}
.paper.dealt { animation: deal .45s cubic-bezier(.2, .9, .3, 1.1) both; }
@keyframes deal { from { transform: translateY(-260px) rotate(calc(var(--rot) * 4)) scale(var(--ds)); opacity: 0; } }
.paper.held { transform: rotate(0deg) scale(calc(var(--ds) * 1.04)); box-shadow: 0 2px 0 var(--paper-edge), 0 18px 26px rgba(0, 0, 0, .4); }
.paper.back { transition: transform .45s ease-in, opacity .45s ease-in; transform: translateY(-420px) rotate(calc(var(--rot) * -3)) scale(var(--ds)); opacity: 0; }
.p-head { --land: #2b4c8c; display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 8px 12px; background: var(--land); color: #f6e7b8; }
.p-head b { font-size: 19px; font-weight: 800; letter-spacing: .06em; }
.p-head span { font-size: 12px; font-weight: 700; letter-spacing: .06em; opacity: .9; text-align: right; }
.pass-head { background: #3d7a4a; }
.card-head { background: #2b4c8c; }
.vet-head { background: #2a7f8f; }
.work-head { background: #b8761c; }
.book-head { background: #5a3a22; }
.p-body { padding: 8px 12px 10px; display: grid; gap: 4px; }
.p-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; padding: 6px 12px 12px; border-top: 2px dashed var(--paper-edge); }
.p-foot .f[data-ref="pp.no"] { grid-column: 1 / -1; }
.f { display: flex; flex-direction: column; padding: 3px 6px; border-radius: 6px; line-height: 1.15; }
.f .k { font-size: 12px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-soft); }
.f .val { font-size: 19px; font-weight: 700; font-family: Georgia, "Times New Roman", serif; }
.pp-grid { grid-template-columns: 104px 1fr; align-items: start; }
.photo { padding: 4px; background: #dde5eb; border: 2px solid #b8c4cc; border-radius: 6px; }
.photo img { width: 100%; display: block; filter: saturate(.85) contrast(1.05); }
.pp-fields { display: grid; gap: 2px; }
.seal { position: absolute; right: 10px; bottom: 8px; padding: 2px; border-radius: 50%; }
.paper-pass, .paper-work { min-height: 210px; }
.reddot { position: absolute; left: 14px; bottom: 12px; width: 9px; height: 9px; border-radius: 50%; background: #e0201a; box-shadow: 0 0 4px rgba(224, 32, 26, .6); }
.shots .shot { font-family: Georgia, serif; font-size: 17px; font-weight: 600; }
.shots .shot b { font-family: "Baloo 2", system-ui; font-weight: 800; }
.paper-book { width: 160px; background: #6b4426; border-radius: 4px 10px 10px 4px; box-shadow: inset 8px 0 0 #4a2c16, 0 8px 14px rgba(0, 0, 0, .35); }
.book-cover { height: 210px; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--gold); border: 3px double rgba(232, 181, 74, .6); margin: 10px 10px 10px 18px; border-radius: 6px; }
.book-cover b { font-size: 30px; font-weight: 800; letter-spacing: .12em; }
.book-cover span { font-size: 16px; font-weight: 700; color: #f4ead2; }
.paper.big.paper-book { width: 300px; background: var(--paper); box-shadow: inset 6px 0 0 #6b4426, 0 2px 0 var(--paper-edge), 0 8px 14px rgba(0, 0, 0, .35); }
.bk-tabs { display: flex; gap: 6px; padding: 8px 12px 0; }
.tab { flex: 1; min-height: 44px; border: 0; border-radius: 10px 10px 0 0; background: #e6d8b6; color: var(--ink-soft); font-weight: 800; font-size: 16px; }
.tab.on { background: #5a3a22; color: #f6e7b8; }
.bk-page { padding: 8px 12px 12px; border-top: 3px solid #5a3a22; }
.bk-date { margin: 0 0 4px; font-weight: 800; font-size: 15px; color: var(--ink-soft); }
.bk-rules { margin: 0; padding-left: 22px; display: grid; gap: 4px; }
.bk-rules li { display: list-item; font-size: 16px; font-weight: 600; line-height: 1.25; padding: 4px 6px; }
.bk-lands { width: 100%; border-collapse: collapse; font-size: 14px; display: table; }
.bk-lands th { text-align: left; font-size: 12px; color: var(--ink-soft); }
.bk-lands td { padding: 4px 3px; border-top: 1px solid var(--paper-edge); vertical-align: top; font-weight: 600; }
.bk-lands td i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 4px; }
.bk-seal-row { margin-bottom: 8px; }
.bk-seal-row b { display: block; font-size: 14px; color: var(--ink-soft); }
.bk-seal-row div { display: flex; gap: 12px; }
.bk-seal-row span { display: flex; flex-direction: column; align-items: center; font-size: 13px; font-weight: 700; }
.bk-note { margin: 0; font-size: 14px; font-weight: 700; color: var(--no); }
.ink {
  position: absolute; left: 50%; top: 52%; padding: 2px 12px; border: 5px solid currentColor; border-radius: 8px;
  font-size: 34px; font-weight: 900; letter-spacing: .06em; transform: translate(-50%, -50%) rotate(-12deg); opacity: .85; mix-blend-mode: multiply;
  animation: ink .2s ease-out both; pointer-events: none;
}
.ink.approve { color: var(--ok); }
.ink.deny { color: var(--no); }
@keyframes ink { from { transform: translate(-50%, -50%) rotate(var(--ir, -12deg)) scale(1.5); opacity: 0; } }
/* the ink: each stamp lands at its own slight angle, a little uneven, with a few spatters round it */
.ink { transform: translate(-50%, -50%) rotate(var(--ir, -12deg)); text-shadow: .5px .5px 0 currentColor; }
.ink::before, .ink::after { content: ''; position: absolute; border-radius: 50%; background: currentColor; opacity: .7; }
.ink::before { width: 7px; height: 7px; left: -12px; top: -8px; box-shadow: 9px -6px 0 -2px currentColor, -4px 14px 0 -2.5px currentColor; }
.ink::after { width: 6px; height: 6px; right: -11px; bottom: -9px; box-shadow: -10px 7px 0 -2px currentColor, 5px -15px 0 -2.5px currentColor; }

/* the magnifier */
.inspecting .paper [data-ref], .inspecting .zoom [data-ref], .inspecting .booth [data-ref] { outline: 2px dashed rgba(255, 207, 58, .9); outline-offset: -2px; cursor: pointer; }
.inspecting .booth .face { outline-offset: -6px; border-radius: 16px; }
.picked { background: rgba(255, 207, 58, .55) !important; outline: 3px solid var(--sel) !important; }
.flag { background: rgba(224, 69, 58, .22) !important; outline: 3px solid var(--flag) !important; }
.desk-hint {
  position: absolute; z-index: 30; left: 50%; top: 8px; transform: translateX(-50%); margin: 0; padding: 6px 14px; border-radius: 14px; width: max-content; text-align: center; line-height: 1.25;
  background: rgba(20, 28, 34, .88); color: #fff4cf; font-weight: 700; font-size: 15px; max-width: calc(100% - 24px); pointer-events: none;
}
.desk-hint[hidden], .found[hidden], .zoom[hidden], .cardlayer[hidden], .screen[hidden] { display: none; }
.desk:has(.zoom:not([hidden])) .found { bottom: 66px; }
.found {
  position: absolute; z-index: 31; left: 10px; right: 10px; bottom: 10px; padding: 8px 12px; border-radius: 12px;
  background: #fff1ef; color: var(--no-dark); border: 3px solid var(--flag); display: flex; flex-direction: column; line-height: 1.2; pointer-events: none;
}
.found b { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; }
.found span { font-size: 17px; font-weight: 700; }
.found.pop { animation: pop .3s ease-out; }

/* reading a paper up close */
.zoom { position: absolute; inset: 0; z-index: 25; background: rgba(16, 12, 8, .55); display: flex; flex-direction: column; }
.zoom.in { animation: fade .18s ease-out; }
@keyframes fade { from { opacity: 0; } }
.zoom-in { flex: 1; min-height: 0; overflow: auto; display: flex; justify-content: center; align-items: flex-start; padding: 12px 10px 6px; }
.paper.big { position: relative; transform: none; cursor: default; touch-action: manipulation; }
.zoom-strip { display: flex; gap: 6px; padding: 6px 8px 8px; overflow-x: auto; }
.zs { flex: 1 0 auto; min-height: 44px; padding: 0 10px; border: 0; border-radius: 10px; background: rgba(251, 243, 223, .85); color: var(--ink); font-weight: 800; font-size: 15px; }
.zs.on { background: var(--gold); }
.zoom-close { position: absolute; right: 8px; top: 8px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(20, 28, 34, .85); z-index: 2; display: grid; place-items: center; }
.zoom-close svg { width: 22px; height: 22px; fill: none; stroke: #fff4cf; stroke-width: 2.6; stroke-linecap: round; }

/* the citation slip */
.citation {
  position: absolute; z-index: 32; left: 50%; top: 0; width: min(78%, 280px); transform: translate(-50%, -110%);
  background: #fff6f2; color: var(--no-dark); border-radius: 0 0 8px 8px; padding: 8px 12px 10px; box-shadow: 0 6px 12px rgba(0, 0, 0, .35);
  display: flex; flex-direction: column; text-align: center; line-height: 1.2; animation: print .5s steps(6) forwards;
  border-bottom: 3px dashed #e0b8b0;
}
.citation b { letter-spacing: .14em; font-size: 15px; }
.citation span { font-size: 17px; font-weight: 700; color: var(--ink); }
.citation em { font-style: normal; font-weight: 800; font-size: 16px; }
.citation.gone { transition: transform .4s ease-in; transform: translate(-50%, -110%); }
@keyframes print { to { transform: translate(-50%, 0); } }

/* the stamps */
.tools { display: grid; grid-template-columns: 1fr 1.3fr 1.3fr; gap: 8px; padding: 8px 10px calc(var(--safe-bottom) + 10px); background: var(--frame-dark); }
.tool { min-height: 64px; border: 0; border-radius: 14px; font-weight: 800; font-size: 19px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; position: relative; box-shadow: 0 4px 0 rgba(0, 0, 0, .4); }
.tool:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .4); }
.tool:disabled { opacity: .45; }
.look { background: #e9dcc0; color: var(--ink); font-size: 15px; }
.look svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.look[aria-pressed="true"] { background: var(--sel); box-shadow: 0 0 0 3px #fff4cf, 0 4px 0 rgba(0, 0, 0, .4); }
.stamp span { letter-spacing: .08em; text-transform: uppercase; }
.approve { background: linear-gradient(var(--ok), var(--ok-dark)); color: #f2fff4; }
.deny { background: linear-gradient(var(--no), var(--no-dark)); color: #fff2f0; }
.deny em { font-style: normal; font-size: 12px; font-weight: 700; padding: 0 8px; border-radius: 999px; background: rgba(255, 255, 255, .25); }
.deny em[hidden] { display: none; }
.slam {
  position: fixed; z-index: 40; left: 0; top: 0; width: 120px; height: 120px; margin: -60px 0 0 -60px; pointer-events: none; opacity: 0;
  border-radius: 18px; background: radial-gradient(circle at 50% 35%, #8a5a34 0 30px, transparent 31px), linear-gradient(transparent 50%, #3a2a20 50% 62%, var(--ok) 62%);
}
.slam.deny { background: radial-gradient(circle at 50% 35%, #8a5a34 0 30px, transparent 31px), linear-gradient(transparent 50%, #3a2a20 50% 62%, var(--no) 62%); }
.slam.go { animation: slam .42s ease-in both; }
@keyframes slam { 0% { opacity: 0; transform: translateY(-120px) scale(1.4); } 40% { opacity: 1; transform: translateY(0) scale(1); } 60% { transform: translateY(0) scale(1.05, .9); } 100% { opacity: 0; transform: translateY(-90px) scale(1.1); } }

/* ---------- cards: the morning paper, notes, the night, results ---------- */
.cardlayer { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; padding: 16px 16px calc(var(--safe-bottom) + 16px); background: rgba(8, 12, 16, .7); overflow: auto; }
.cardlayer.in .card { animation: cardin .3s cubic-bezier(.2, .9, .3, 1.1); }
@keyframes cardin { from { transform: translateY(30px) scale(.96); opacity: 0; } }
.card { width: min(100%, 420px); max-height: 100%; overflow: auto; border-radius: 18px; background: #fffaf0; color: var(--ink); padding: 18px 18px 16px; box-shadow: 0 16px 40px rgba(0, 0, 0, .5); }
.card h2 { margin: 2px 0 8px; font-size: 26px; line-height: 1.1; font-weight: 800; }
.card p { margin: 0 0 10px; font-size: 17px; line-height: 1.35; }
.card-btns { display: flex; gap: 10px; margin-top: 12px; }
.card-btns.col { flex-direction: column; }
.card-btns button { flex: 1; min-height: 52px; border: 0; border-radius: 14px; font-weight: 800; font-size: 18px; }
.card-btns .primary { background: var(--gold); color: #3a2608; box-shadow: 0 4px 0 var(--gold-dark); }
.card-btns .secondary { background: #ece2cc; color: var(--ink); box-shadow: 0 4px 0 #c9b78f; }
.card-btns button:disabled { opacity: .5; }
.paper-card { background: #f6efdc; background-image: repeating-linear-gradient(transparent 0 27px, rgba(0, 0, 0, .04) 27px 28px); }
.news-mast { font-family: Georgia, serif; font-weight: 700; letter-spacing: .14em; font-size: 15px !important; border-bottom: 3px double var(--ink); padding-bottom: 4px; }
.news-mast small { letter-spacing: 0; font-weight: 600; color: var(--ink-soft); }
.news h2 { font-family: Georgia, serif; font-size: 27px; font-weight: 900; }
.news-body { font-family: Georgia, serif; }
.news-rules { background: #fff; border: 2px solid var(--paper-edge); border-radius: 10px; padding: 8px 12px; }
.news-rules b { font-size: 14px; letter-spacing: .06em; text-transform: uppercase; color: var(--ok-dark); }
.news-rules ul { margin: 4px 0 0; padding-left: 20px; font-size: 16px; font-weight: 600; }
.note { text-align: center; }
.note .who { width: 92px; height: 92px; display: block; margin: 0 auto 4px; }
.note-sub { font-weight: 700; color: var(--ink-soft); }
.sum { width: 100%; border-collapse: collapse; font-size: 17px; margin-bottom: 8px; }
.sum td { padding: 6px 2px; border-bottom: 1px solid #eadfc6; }
.sum td:nth-child(2) { color: var(--ink-soft); font-size: 15px; }
.sum td:last-child { text-align: right; font-weight: 800; }
.sum-total { font-size: 19px !important; }
.big { font-size: 34px !important; font-weight: 800; color: var(--gold-dark); margin: 0 0 6px !important; }
.said { margin: 0 0 8px; padding-left: 20px; font-size: 17px; line-height: 1.4; }
.got { font-weight: 800; color: var(--gold-dark); }
.fam { display: flex; justify-content: space-around; gap: 6px; margin-bottom: 8px; }
.fm { display: flex; flex-direction: column; align-items: center; line-height: 1.1; text-align: center; }
.fm img { width: 64px; height: 64px; }
.fm b { font-size: 16px; }
.fm small { font-size: 13px; font-weight: 700; color: var(--ok-dark); }
.fm.st1 small { color: #b8761c; } .fm.st2 small { color: var(--no); } .fm.st3 { opacity: .45; } .fm.st3 small { color: var(--ink-soft); }
.fm.st2 img { filter: saturate(.5) hue-rotate(40deg); }
.night-note { font-size: 15px !important; color: var(--ink-soft); }
.bills { display: grid; gap: 6px; }
.bill { display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 8px; min-height: 48px; padding: 0 12px; border: 2px solid #e2d4b4; border-radius: 12px; background: #fff; text-align: left; font-size: 17px; font-weight: 700; color: var(--ink); }
.bill .tick { width: 24px; height: 24px; border-radius: 7px; border: 3px solid #c9b78f; }
.bill[aria-pressed="true"] { border-color: var(--ok); background: #f1faf2; }
.bill[aria-pressed="true"] .tick { background: var(--ok); border-color: var(--ok); box-shadow: inset 0 0 0 3px #fff; }
.bill.must { opacity: .85; }
.bc { font-weight: 800; color: var(--gold-dark); }
.night-sum { margin: 10px 0 0 !important; font-size: 17px; text-align: center; }
.night-sum .neg { color: var(--no); }
.ending { text-align: center; }
.ending-kicker { font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); margin: 0 !important; }
.ending.good h2 { color: var(--gold-dark); }
.ending-art { display: flex; justify-content: center; align-items: flex-end; gap: 2px; margin: 4px 0 10px; position: relative; }
.ending-art img { width: 64px; height: 64px; }
.ending-art .dots { position: absolute; inset: 0; background: radial-gradient(circle at 20% 30%, #ff2a1a 0 4px, transparent 5px), radial-gradient(circle at 70% 20%, #ff2a1a 0 4px, transparent 5px), radial-gradient(circle at 55% 70%, #ff2a1a 0 4px, transparent 5px); animation: dots 1.4s infinite alternate; }
@keyframes dots { to { transform: translate(14px, -6px); } }
.ending-count { font-weight: 700; color: var(--ink-soft); }

/* ---------- screens from the title ---------- */
.screen { position: fixed; inset: 0; z-index: 30; background: linear-gradient(var(--wall), var(--wall-dark)); color: #f4ead2; overflow: auto; }
.screen-top { display: flex; align-items: center; gap: 12px; padding: var(--sg-corner-top) 16px 8px var(--sg-corner-left); position: sticky; top: 0; background: var(--wall); z-index: 1; }
.screen-top h2 { margin: 0; font-size: 24px; font-weight: 800; }
.screen-body { padding: 4px 16px calc(var(--safe-bottom) + 24px); max-width: 560px; margin: 0 auto; }
.screen-lead { font-size: 17px; font-weight: 600; }
.screen-body h3 { margin: 18px 0 8px; font-size: 19px; }
.end-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.end-list li { padding: 10px 12px; border-radius: 12px; background: rgba(255, 250, 240, .08); display: flex; flex-direction: column; line-height: 1.3; }
.end-list li b { font-size: 17px; }
.end-list li span { font-size: 15px; opacity: .85; }
.end-list li.got { background: rgba(232, 181, 74, .2); }
.end-list li.got b { color: var(--gold); }
.pick-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.pick { min-height: 84px; border: 2px solid rgba(255, 250, 240, .2); border-radius: 12px; background: rgba(255, 250, 240, .06); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-weight: 700; font-size: 14px; padding: 6px; }
.pick i { width: 54px; height: 30px; border-radius: 6px; }
.pick.on { border-color: var(--gold); background: rgba(232, 181, 74, .2); }
.pick:disabled { opacity: .5; }
.pick-desk-oak i { background: linear-gradient(#9a6538, #7a4c28); } .pick-desk-walnut i { background: linear-gradient(#6e4a32, #4e3222); }
.pick-desk-cherry i { background: linear-gradient(#a4553a, #7a3a26); } .pick-desk-birch i { background: linear-gradient(#d9bd8c, #b99a68); }
.pick-desk-teal i { background: linear-gradient(#3f8a86, #2c6663); } .pick-desk-marble i { background: linear-gradient(#e8e4dc, #c9c2b6); }
.pick-desk-ebony i { background: linear-gradient(#3a302c, #231c19); }
.pick-ink-classic i { background: linear-gradient(90deg, #2f9a52 50%, #c23b32 50%); } .pick-ink-ocean i { background: linear-gradient(90deg, #1f7fa6 50%, #c2533a 50%); }
.pick-ink-plum i { background: linear-gradient(90deg, #6a8f2a 50%, #8a3a8a 50%); } .pick-ink-sunset i { background: linear-gradient(90deg, #d9822e 50%, #c2335a 50%); }
.pick-ink-gold i { background: linear-gradient(90deg, #b8902a 50%, #9a2a2a 50%); }
.help p, .help li { font-size: 16px; line-height: 1.4; }
.toast {
  position: fixed; z-index: 70; left: 50%; top: calc(var(--sg-corner-top) + 52px); transform: translate(-50%, -10px); max-width: calc(100vw - 32px);
  padding: 8px 16px; border-radius: 999px; background: rgba(20, 28, 34, .92); color: #fff4cf; font-weight: 700; font-size: 16px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* Title screen: the shared layout (shared/mainmenu.js); only this game's colours. */
#mm {
  /* a sunny morning at the cat-flap (Bri, 2026-11-27): cream cards over the painted street */
  --sg-bg: linear-gradient(#8fc3ec, #ffe2b0 45%, #c9b089);
  --sg-ink: #fffaf0; --sg-ink-soft: #fff3dc;
  --sg-title: #ffd65a; --sg-title-shadow: 0 3px 0 #8a4a12;
  --sg-accent: #ffb938; --sg-accent-ink: #4a2a06;
  --sg-card: rgba(255, 249, 236, .92); --sg-card-ink: #4a3220; --sg-line: rgba(138, 90, 40, .22);
}
.sg-sheet { --sg-sheet-bg: #fffaf0; --sg-sheet-ink: #2a2320; --sg-accent: #d99b2b; --sg-accent-ink: #3a2608; --sg-ink-soft: #6b5c4c; }
.pp-art { height: 100%; display: flex; justify-content: center; }
.pp-title-art { height: 100%; width: auto; max-width: min(300px, 82vw); display: block; overflow: visible; }
.pp-title-art .pp-wave { transform-origin: 242px 192px; animation: pp-wave 1.6s ease-in-out infinite; }
@keyframes pp-wave { 0%, 100% { transform: rotate(0deg); } 50% { transform: rotate(-16deg); } }
@media (prefers-reduced-motion: reduce) { .pp-title-art .pp-wave { animation: none; } }

@media (max-height: 700px) {
  .app { grid-template-rows: auto clamp(160px, 28vh, 220px) 1fr auto; }
  .tool { min-height: 54px; }
  .bubble { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .visitor.arrive, .visitor.leave-in, .visitor.leave-out, .paper.dealt, .flap.swing i, .cardlayer.in .card, .ending-art .dots, .slam.go { animation-duration: .01s !important; }
  .paper.back { transition-duration: .1s; }
}

/* ---------- v2: the missing-paper slip, the news's Around town, the tip, the epilogue ---------- */
.missing {
  position: absolute; z-index: 5; left: 8px; bottom: 8px; min-width: 64px; min-height: 48px; padding: 4px 8px; border: 2px dashed #b9a57c;
  border-radius: 8px; background: rgba(251, 243, 223, .92); color: var(--ink-soft); align-items: center; justify-content: center; gap: 0;
  box-shadow: 0 3px 6px rgba(0, 0, 0, .3); transform: rotate(-4deg); font-family: inherit;
}
.missing[hidden] { display: none; }
.missing b { font-size: 12px; font-weight: 900; letter-spacing: .1em; color: var(--no); }
.missing span { font-size: 13px; font-weight: 800; }
.inspecting .missing { outline: 2px dashed rgba(255, 207, 58, .9); outline-offset: 2px; z-index: 26; }
.zs-missing { background: #fff1ef; color: var(--no-dark); border: 2px dashed var(--flag); }
.news-around { border-left: 4px solid var(--ink); padding: 2px 0 2px 10px; }
.news-around b { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.news-around ul { margin: 2px 0 0; padding-left: 18px; font-family: Georgia, serif; font-size: 15px; font-style: italic; }
.tip-demo { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 6px 0 10px; }
.tip-demo span { padding: 6px 10px; border-radius: 8px; font-weight: 800; font-size: 14px; }
.tip-demo .td-rule { background: rgba(255, 207, 58, .55); outline: 3px solid var(--sel); }
.tip-demo .td-miss { background: #fff1ef; color: var(--no-dark); border: 2px dashed var(--flag); }
.tip-demo i { font-style: normal; font-weight: 900; font-size: 20px; }
.bill .bl small { display: block; font-size: 12px; font-weight: 700; color: var(--no); }
.epilogue { text-align: left; background: rgba(255, 255, 255, .55); border-radius: 12px; padding: 8px 10px; margin: 6px 0; }
.epilogue > b { display: block; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 4px; }
.epilogue ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.epilogue li { display: flex; gap: 8px; align-items: center; font-size: 15px; line-height: 1.25; font-weight: 600; }
.epilogue li .who { width: 40px; height: 40px; flex: none; margin: 0; }

/* the small "i" that keeps scoring rules out of sight until asked */
.info-btn { width: 44px; height: 44px; margin: -12px -8px -12px 0; padding: 0; border: 0; background: none; vertical-align: middle; cursor: pointer; }
.info-btn i { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 2px solid currentColor; font: italic 800 14px/1 Georgia, serif; opacity: .75; }
.info-btn[aria-expanded="true"] i { opacity: 1; }
.info-pop[hidden] { display: none; }

/* Closing time (feel pass 2026-11-29): the shutter comes down over the window, the desk dims, then the day's card */
.shutter { position: absolute; inset: 0; z-index: 8; pointer-events: none; display: flex; align-items: center; justify-content: center;
  background: repeating-linear-gradient(#7c8790 0 9px, #5c666e 9px 11px, #8a949c 11px 18px); box-shadow: inset 0 -6px 0 #3e464c;
  transform: translateY(-102%); transition: transform .5s cubic-bezier(.5, 0, .75, 0); }
.shutter b { padding: 4px 16px; border: 3px solid #f3e6c8; border-radius: 8px; background: #8a2f26; color: #f3e6c8; font-size: 26px; font-weight: 900; letter-spacing: .16em;
  transform: rotate(-4deg) translateY(-24px); opacity: 0; transition: transform .35s .55s cubic-bezier(.2, 1.4, .4, 1), opacity .2s .55s; }
.shutter.down { transform: none; }
.shutter.down b { transform: rotate(-4deg); opacity: 1; }
.app.closing .desk, #app.closing .desk { filter: brightness(.55) saturate(.7); transition: filter .8s .3s; }
/* the morning paper lands on the desk, tossed and settling */
.cardlayer.in .card.paper-card { animation: paperIn .55s cubic-bezier(.2, .9, .3, 1.15); }
@keyframes paperIn { from { transform: translate(-30%, 70%) rotate(-14deg) scale(.8); opacity: 0; } 60% { opacity: 1; } }
/* an ending: a held dark beat, then its card rises */
.cardlayer.in .card.ending-card { animation: endingIn 1.1s cubic-bezier(.2, .8, .3, 1) both; }
@keyframes endingIn { 0%, 40% { transform: translateY(24px) scale(.94); opacity: 0; } 100% { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .shutter, .shutter b { transition-duration: .01s !important; transition-delay: 0s !important; }
  .cardlayer.in .card.paper-card, .cardlayer.in .card.ending-card { animation-duration: .01s !important; }
}
