/* Audit, Please. A drab civil-service booth: slate walls, a worn desk, cream papers in a typewriter face. */
:root {
  --wall: #1B2B30; --wall-2: #24383E; --desk: #5B4632; --desk-2: #4A3827; --ink: #EDE8DA; --muted: #A9B6B2; --faint: rgba(237, 232, 218, 0.14);
  --paper: #F3ECD8; --paper-2: #E8DDC2; --paper-ink: #25241F; --paper-muted: #6D6655;
  --duck: #FFD23F; --good: #3F9A63; --bad: #B8412E; --hint: #2F6F86; --warn: #C98A1C;
  --serif: "Fraunces", Georgia, serif; --sans: "Chakra Petch", ui-sans-serif, system-ui, sans-serif; --mono: "Courier Prime", "Courier New", monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--wall); color: var(--ink); }
body {
  font-family: var(--sans); font-size: 16px; line-height: 1.35; overflow-x: hidden; -webkit-tap-highlight-color: transparent;
  background: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.015) 0 2px, transparent 2px 64px), radial-gradient(ellipse at 50% 0%, #2C4248, var(--wall) 70%);
  background-attachment: fixed;
}
button { font: inherit; color: inherit; }
#app { min-height: 100dvh; display: flex; flex-direction: column; }
kbd { font-family: var(--mono); font-size: 11px; padding: 0 5px; margin-left: 8px; border-radius: 4px; border: 1px solid currentColor; opacity: 0.55; }

/* ---------- buttons ---------- */
.btn {
  padding: 10px 18px; border-radius: 8px; border: 1px solid var(--faint); background: rgba(255, 255, 255, 0.06);
  cursor: pointer; font-weight: 700; letter-spacing: 0.03em; transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover:not(:disabled), .btn:focus-visible { border-color: var(--duck); outline: none; background: rgba(255, 210, 63, 0.1); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.primary { background: var(--duck); color: #1B2B30; border-color: #FFE070; box-shadow: 0 3px 0 #A8830C; }
.btn.primary:hover:not(:disabled) { background: #FFDF6B; }
.btn.small { padding: 4px 10px; font-size: 14px; }
.btn.big { padding: 14px 20px; font-size: 17px; }
.paper .btn:not(.primary) { color: var(--paper-ink); border-color: rgba(0, 0, 0, 0.25); background: rgba(0, 0, 0, 0.04); }
.paper .btn:not(.primary):hover:not(:disabled) { border-color: var(--paper-ink); background: rgba(0, 0, 0, 0.08); }

/* ---------- top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px;
  padding: 8px 18px; padding-top: calc(8px + env(safe-area-inset-top, 0px));
  background: rgba(14, 24, 27, 0.92); backdrop-filter: blur(8px); border-bottom: 1px solid var(--faint);
}
.bar .brand { font-family: var(--serif); font-weight: 800; font-size: 19px; color: var(--duck); }
.bar .when { margin-right: auto; font-weight: 700; white-space: nowrap; }
.bar .when small { margin-left: 8px; color: var(--muted); font-weight: 600; font-size: 13px; }
.bar .clock { font-family: var(--mono); font-weight: 700; font-size: 20px; padding: 2px 10px; border-radius: 6px; background: #0B1316; color: #FF9F5A; letter-spacing: 0.05em; cursor: help; box-shadow: inset 0 0 8px rgba(255, 120, 40, 0.25); }
.stat { color: var(--muted); font-weight: 600; }
.stat b { color: var(--ink); }
.stat { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; font-weight: 700; font-variant-numeric: tabular-nums; cursor: help; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; border: 1.5px solid var(--muted); }
.dots i.on { background: var(--bad); border-color: var(--bad); }

/* ---------- title and paper screens ---------- */
.title { flex: 1; display: grid; place-items: center; padding: 24px 16px; }
.title-card { display: grid; grid-template-columns: auto 1fr; gap: 36px; align-items: center; max-width: 820px; }
.booth-art {
  position: relative; width: 220px; height: 260px; border-radius: 10px 10px 0 0; border: 10px solid #3A4E53; border-bottom-width: 26px;
  background: linear-gradient(180deg, #87A9AE, #5D7F84); display: grid; place-items: end center; overflow: hidden; box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}
.booth-art span { font-size: 130px; line-height: 1; margin-bottom: -12px; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.35)); }
.booth-art .sign { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); padding: 3px 12px; background: #0B1316; color: #FF9F5A; font-family: var(--mono); font-weight: 700; font-size: 14px; border-radius: 4px; }
.title .tag { margin: 0; color: var(--muted); text-transform: uppercase; letter-spacing: 0.18em; font-size: 13px; font-weight: 700; }
.title h1 { margin: 6px 0 12px; font-family: var(--serif); font-weight: 800; font-size: clamp(48px, 9vw, 84px); line-height: 0.95; color: var(--duck); }
.title .lede { margin: 0 0 20px; color: var(--muted); max-width: 44ch; }
.title .note { color: #F2C77A; }
.actions, .row, .options { display: flex; flex-wrap: wrap; gap: 10px; }
.home-p { margin: 22px 0 0; }
.home { color: var(--muted); text-decoration: none; font-weight: 700; }
.home:hover { color: var(--duck); }

.screen { flex: 1; display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 22px; padding: 32px 16px 48px; }
.paper {
  background: linear-gradient(180deg, var(--paper), var(--paper-2)); color: var(--paper-ink); border-radius: 3px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 16px 34px rgba(0, 0, 0, 0.4); padding: 28px 32px;
}
.memo { width: min(620px, 100%); font-family: var(--mono); font-size: 16px; line-height: 1.5; }
.memo h2, .memo h3 { font-family: var(--serif); }
.memo h2 { margin: 0 0 12px; font-size: 26px; }
.memo p { margin: 0 0 14px; }
.memo .btn { font-family: var(--sans); margin-top: 8px; }
.letterhead { display: flex; flex-direction: column; margin: -4px 0 18px; padding-bottom: 10px; border-bottom: 3px double var(--paper-ink); font-family: var(--serif); font-weight: 800; letter-spacing: 0.12em; font-size: 18px; }
.letterhead small { font-family: var(--mono); font-weight: 400; letter-spacing: 0; font-size: 13px; color: var(--paper-muted); }
.sig { font-style: italic; }
.newrules { margin: 18px 0; padding: 12px 16px; border: 2px dashed var(--bad); border-radius: 4px; }
.newrules h3 { margin: 0 0 6px; color: var(--bad); font-size: 16px; text-transform: uppercase; letter-spacing: 0.08em; }
.newrules ul { margin: 0; padding-left: 20px; }
.memo.note { transform: rotate(-0.6deg); background: linear-gradient(180deg, #FAF3C8, #EFE5A8); }

/* ---------- the desk ---------- */
.desk-screen { flex: 1; display: grid; grid-template-columns: minmax(230px, 280px) 1fr minmax(250px, 320px); gap: 14px; padding: 14px; align-items: start; }
.booth { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 70px; }
.window {
  position: relative; height: 200px; border-radius: 8px 8px 0 0; border: 8px solid #3A4E53; border-bottom-width: 18px;
  background: linear-gradient(180deg, #7C9DA2, #557478); display: grid; place-items: end center; overflow: hidden;
}
.window .empty { place-self: center; color: rgba(255, 255, 255, 0.75); font-weight: 700; }
.applicant { display: flex; flex-direction: column; align-items: center; animation: walk-in 0.45s ease-out; }
.applicant .face { font-size: 96px; line-height: 1; filter: drop-shadow(0 6px 6px rgba(0, 0, 0, 0.3)); }
.applicant .who { display: flex; flex-direction: column; align-items: center; padding: 4px 10px; margin-bottom: 4px; background: rgba(11, 19, 22, 0.8); border-radius: 6px; font-size: 13px; text-align: center; }
.applicant .who span { color: var(--muted); }
@keyframes walk-in { from { transform: translateX(-120%); } to { transform: none; } }
.speech { position: relative; background: #FDFBF3; color: var(--paper-ink); padding: 10px 14px; border-radius: 12px; font-style: italic; }
.speech::before { content: ""; position: absolute; top: -9px; left: 40px; border: 9px solid transparent; border-top: 0; border-bottom-color: #FDFBF3; }
.controls { display: flex; flex-direction: column; gap: 10px; }
.controls.envelope { padding: 12px; border-radius: 8px; background: #EEE2C0; color: var(--paper-ink); }
.controls.envelope p { margin: 0; font-family: var(--mono); font-size: 14px; }
.controls.envelope .btn:not(.primary) { color: var(--paper-ink); border-color: rgba(0, 0, 0, 0.3); }
.btn.inspect.on { background: var(--hint); border-color: #7FC6DE; box-shadow: 0 0 0 3px rgba(127, 198, 222, 0.3); }
.stamps { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stamp {
  padding: 14px 6px; border-radius: 8px; cursor: pointer; font-family: var(--serif); font-weight: 800; letter-spacing: 0.08em;
  border: 3px solid currentColor; background: rgba(0, 0, 0, 0.2); transition: transform 0.1s, background 0.15s;
}
.stamp.approve { color: #6CD08F; }
.stamp.reject { color: #F07A62; }
.stamp:hover, .stamp:focus-visible { background: rgba(255, 255, 255, 0.08); outline: none; transform: translateY(-2px); }
.stamp:active { transform: translateY(2px); }
.messages { display: flex; flex-direction: column; gap: 6px; }
.msg { margin: 0; padding: 8px 12px; border-radius: 6px; font-size: 14px; border-left: 4px solid; background: rgba(0, 0, 0, 0.25); }
.msg.found, .msg.ok { border-color: var(--good); }
.msg.citation { border-color: var(--bad); background: rgba(184, 65, 46, 0.25); animation: shake 0.35s; }
.msg.warn { border-color: var(--warn); }
.msg.none, .msg.noted { border-color: var(--muted); }
.msg.hint { border-color: #7FC6DE; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.desk {
  min-height: calc(100dvh - 100px); padding: 18px; border-radius: 10px; display: flex; flex-wrap: wrap; gap: 16px; align-content: flex-start; justify-content: center;
  background: repeating-linear-gradient(8deg, rgba(0, 0, 0, 0.05) 0 3px, transparent 3px 11px), linear-gradient(180deg, var(--desk), var(--desk-2));
  box-shadow: inset 0 4px 20px rgba(0, 0, 0, 0.4);
}
.desk-empty { align-self: center; margin: auto; color: rgba(255, 255, 255, 0.55); font-weight: 700; }
.desk.handing-back .doc { transition: transform 0.3s ease-in, opacity 0.3s; transform: translateY(-40px) rotate(-4deg); opacity: 0; }
.doc {
  position: relative; width: 222px; padding: 12px 14px 14px; border-radius: 2px; color: var(--paper-ink);
  background: linear-gradient(180deg, var(--paper), var(--paper-2)); transform: rotate(var(--tilt, 0deg));
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35); animation: slide-in 0.35s ease-out backwards;
}
.doc:nth-child(2) { animation-delay: 0.05s; } .doc:nth-child(3) { animation-delay: 0.1s; } .doc:nth-child(4) { animation-delay: 0.15s; } .doc:nth-child(5) { animation-delay: 0.2s; }
@keyframes slide-in { from { transform: translateY(60px) rotate(var(--tilt, 0deg)); opacity: 0; } }
.doc header { display: flex; gap: 8px; align-items: center; margin: -2px 0 8px; padding-bottom: 6px; border-bottom: 1.5px solid rgba(0, 0, 0, 0.25); font-family: var(--serif); font-weight: 800; font-size: 15px; text-transform: uppercase; letter-spacing: 0.06em; }
.doc.form { background: linear-gradient(180deg, #F6F1E4, #ECE3CD); }
.doc.form header { color: #1E4E5E; }
.doc.statement { background: repeating-linear-gradient(180deg, transparent 0 25px, rgba(47, 111, 134, 0.12) 25px 26px), linear-gradient(180deg, #F3F2EA, #E4E3D8); }
.doc.cert { background: linear-gradient(180deg, #E9F1DE, #D8E6C8); border: 3px double #5F7F4B; }
.doc.cert header { color: #3F5F2E; }
.doc.letter { background: #FBF8F0; }
.doc.letter header { color: #6A3B54; }
.doc.bill { background: linear-gradient(180deg, #FAEBD8, #F0DCC0); }
.doc dl { margin: 0; display: flex; flex-direction: column; gap: 2px; }
.pickable { display: block; width: 100%; text-align: left; border: 1.5px solid transparent; border-radius: 3px; padding: 3px 5px; margin: 0; background: none; color: inherit; font: inherit; }
.doc .pickable { display: grid; grid-template-columns: 1fr; }
.doc dt { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--paper-muted); }
.doc dd { margin: 0; font-family: var(--mono); font-size: 15px; font-weight: 700; word-break: break-word; }
.doc dd .blank { color: #9A8F75; font-weight: 400; }
.inspecting .pickable { cursor: crosshair; border-color: rgba(47, 111, 134, 0.25); border-style: dashed; }
.inspecting .pickable:hover, .inspecting .pickable:focus-visible { background: rgba(47, 111, 134, 0.14); border-color: var(--hint); outline: none; }
.pickable.picked { background: rgba(255, 210, 63, 0.4) !important; border-color: #B08A00 !important; border-style: solid !important; }
.pickable.flagged.found { background: rgba(184, 65, 46, 0.18); border-color: var(--bad); border-style: solid; }
.pickable.flagged.none, .pickable.flagged.hint { background: rgba(0, 0, 0, 0.06); border-color: rgba(0, 0, 0, 0.3); border-style: solid; }
.inked {
  position: absolute; left: 50%; top: 50%; padding: 6px 14px; border: 5px solid; border-radius: 8px; font-family: var(--serif); font-weight: 800; font-size: 30px; letter-spacing: 0.1em;
  transform: translate(-50%, -50%) rotate(-12deg); animation: thump 0.22s cubic-bezier(0.3, 1.6, 0.6, 1) both; mix-blend-mode: multiply; pointer-events: none;
}
.inked.approve { color: #2F8750; }
.inked.reject { color: #B8412E; }
@keyframes thump { from { transform: translate(-50%, -50%) rotate(-12deg) scale(2.4); opacity: 0; } to { transform: translate(-50%, -50%) rotate(-12deg) scale(1); opacity: 0.85; } }

.rulebook { position: sticky; top: 70px; max-height: calc(100dvh - 84px); display: flex; flex-direction: column; border-radius: 6px; overflow: hidden; background: #6B2D2B; padding: 8px; box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35); }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.tabs button { padding: 4px 9px; font-size: 13px; border-radius: 4px; border: 0; cursor: pointer; background: rgba(255, 255, 255, 0.12); font-weight: 700; }
.tabs button[aria-selected="true"] { background: var(--paper); color: var(--paper-ink); }
.page { flex: 1; overflow-y: auto; background: var(--paper); color: var(--paper-ink); border-radius: 3px; padding: 10px 12px; font-size: 14px; }
.page .rules { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 6px; }
.page .rules li.new::marker { color: var(--bad); font-weight: 800; }
.page .rules li.new b::after { content: " NEW"; color: var(--bad); font-size: 10px; letter-spacing: 0.1em; }
.page ul { margin: 6px 0 0; padding-left: 18px; }
.page .mono { font-family: var(--mono); font-weight: 700; }
.page .small { margin: 0; font-size: 12px; color: var(--paper-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }

/* ---------- evenings ---------- */
.evening { align-items: flex-start; }
.evening .paper { width: min(360px, 100%); }
.evening h2 { margin: 0 0 14px; font-family: var(--serif); }
.ledger table { width: 100%; border-collapse: collapse; font-family: var(--mono); }
.ledger td { padding: 5px 0; border-bottom: 1px dotted rgba(0, 0, 0, 0.3); }
.ledger td:last-child, .score td:last-child { text-align: right; font-weight: 700; }
.savings { margin: 14px 0; font-size: 18px; }
.savings.short b { color: var(--bad); }
.ducklings { display: flex; justify-content: space-around; margin-bottom: 16px; }
.duckling { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.duckling .emoji { font-size: 44px; line-height: 1; }
.duckling small { font-weight: 700; text-transform: uppercase; font-size: 11px; letter-spacing: 0.06em; }
.duckling.well small { color: var(--good); }
.duckling.hungry small, .duckling.cold small { color: var(--warn); }
.duckling.sick small { color: var(--bad); }
.duckling.sick .emoji { filter: hue-rotate(60deg) saturate(0.6); animation: shiver 0.3s infinite; }
.duckling.cold .emoji { filter: saturate(0.5) brightness(1.1) hue-rotate(160deg); }
.duckling.flown-south { opacity: 0.45; }
@keyframes shiver { 50% { transform: translateX(1px); } }
.line { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px dotted rgba(0, 0, 0, 0.3); cursor: pointer; font-family: var(--mono); }
.line.disabled { cursor: default; color: var(--paper-muted); }
.line input { width: 18px; height: 18px; accent-color: #1E4E5E; }
.news { font-family: var(--serif); text-align: center; background: linear-gradient(180deg, #EDE9DE, #DAD4C4); }
.news .masthead { margin: 0 0 8px; padding-bottom: 8px; border-bottom: 3px double var(--paper-ink); font-weight: 800; letter-spacing: 0.18em; font-size: 20px; }
.news h3 { margin: 0; font-size: 28px; line-height: 1.1; }
.news .columns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.news .columns i { height: 150px; background: repeating-linear-gradient(180deg, rgba(37, 36, 31, 0.28) 0 5px, transparent 5px 12px); }
.news .columns i:last-child { height: 110px; }

.score { width: 100%; border-collapse: collapse; margin: 10px 0 18px; }
.score td { padding: 5px 0; border-bottom: 1px dotted rgba(0, 0, 0, 0.3); }
.score .total td { font-weight: 800; font-size: 20px; border-bottom: 0; }
.board-row { display: flex; gap: 8px; margin-bottom: 14px; }
.board-row input { flex: 1; min-width: 0; padding: 9px 12px; border-radius: 8px; border: 1px solid rgba(0, 0, 0, 0.3); background: #FFFDF6; font: inherit; }
.posted { font-weight: 700; }

/* ---------- tooltip ---------- */
#tip { position: fixed; z-index: 100; max-width: 280px; padding: 8px 11px; border-radius: 8px; background: #0B1316; border: 1px solid var(--faint); font-size: 13px; pointer-events: none; box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4); }

/* ---------- narrow screens ---------- */
@media (max-width: 1000px) {
  .desk-screen { grid-template-columns: 1fr 1fr; }
  .desk { grid-column: 1 / -1; order: 3; min-height: 0; }
  .booth, .rulebook { position: static; }
  .rulebook { max-height: 380px; }
}
@media (max-width: 640px) {
  .desk-screen { grid-template-columns: 1fr; padding: 10px 16px; }
  .booth { order: 1; } .desk { order: 2; } .rulebook { order: 3; }
  .window { height: 150px; }
  .applicant .face { font-size: 70px; }
  .doc { width: 100%; }
  .title-card { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 20px; }
  .title-card .actions { justify-content: center; }
  .booth-art { width: 170px; height: 200px; }
  .booth-art span { font-size: 96px; }
  .bar { padding-left: 16px; padding-right: 16px; gap: 6px 12px; }
  .bar .when small { display: none; }
  .paper { padding: 22px 18px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01s !important; transition-duration: 0.01s !important; } }
