/* Только не увольте! — ночной офис и бумажные документы.
   Раскладка: шапка с показателями → офис в разрезе (холст) → док из четырёх кнопок;
   все окна — «документы» поверх офиса. Тема одна, тёмная: работаем допоздна. */
:root {
  --night: #151726;      /* фон за окном */
  --panel: #22253a;      /* шапка, док, панели */
  --panel-2: #2c3049;
  --line: #3b4062;
  --paper: #f2ead6;      /* бумага документов */
  --paper-2: #e3d8bd;
  --paper-line: #d9cdb0;
  --ink: #24222b;        /* чернила */
  --ink-deep: #121220;
  --muted: #8c90ad;
  --muted-ink: #6d6658;
  --stamp: #cf3a2f;      /* красная печать */
  --stamp-blue: #2f63b6; /* синяя печать */
  --gold: #f2b84b;       /* папки, деньги */
  --xp: #f7cf4f;
  --hp: #e5533d;
  --accept: #3f86d9;
  --refuse: #e07b39;
  --good: #3f9a57;
  --bad: #c0463b;
  --font-px: 'Pixelify Sans', 'Trebuchet MS', system-ui, sans-serif; /* крупные заголовки, печати, деньги */
  --font-ui: 'Rubik', 'Segoe UI', system-ui, sans-serif;             /* весь остальной интерфейс */
  --font-doc: 'PT Mono', 'Courier New', ui-monospace, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--night);
  color: var(--paper);
  font-family: var(--font-ui);
  font-size: 15px;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
img.pix, .pix { image-rendering: pixelated; image-rendering: crisp-edges; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

#app {
  position: relative;
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--night);
  box-shadow: 0 0 0 2px var(--ink-deep), 0 0 60px rgba(0, 0, 0, 0.5);
}

/* ── Шапка ─────────────────────────────────────────────────────── */
#hud {
  flex: none;
  padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 6px;
  background: var(--panel);
  border-bottom: 2px solid var(--ink-deep);
  display: flex;
  flex-direction: column;
  gap: 6px;
  user-select: none;
}
.hud-row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.company {
  flex: 1; min-width: 0;
  font-size: 13px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.money {
  display: flex; align-items: center; gap: 6px;
  font-size: 19px; font-weight: 700; color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.money .coin { width: 18px; height: 18px; }
.hud-btns { display: flex; gap: 4px; }
.icon-btn {
  width: 36px; height: 36px; padding: 0;
  display: grid; place-items: center;
  background: var(--panel-2);
  border: 2px solid var(--ink-deep);
  box-shadow: inset -2px -2px 0 rgba(0, 0, 0, 0.25), inset 2px 2px 0 rgba(255, 255, 255, 0.08);
  cursor: pointer;
}
.icon-btn img { width: 20px; height: 20px; }
.icon-btn:active { transform: translateY(1px); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }

.pos-row { justify-content: space-between; }
.pos { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 18px; font-weight: 700; }
.pos > span:first-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tag {
  flex: none;
  font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 2px 6px; background: var(--stamp); color: #fff; border: 2px solid var(--ink-deep);
}
.hud-promo { flex: none; font-size: 13px; color: var(--muted); white-space: nowrap; }
.hud-promo b { color: var(--paper); font-size: 16px; font-variant-numeric: tabular-nums; }
.hud-promo s { text-decoration: none; color: var(--refuse); margin-left: 4px; }

.bars { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.bar {
  position: relative; height: 20px;
  background: #10111c; border: 2px solid var(--ink-deep);
  overflow: hidden;
}
.bar i { position: absolute; inset: 0 auto 0 0; width: 0; transition: width 0.15s linear; }
.bar.xp i { background: linear-gradient(var(--xp) 0 55%, #e0b43a 55%); }
.bar.hp i { background: linear-gradient(var(--hp) 0 55%, #c43f2c 55%); }
.bar.hp.low i { animation: pulse 0.6s steps(2) infinite; }
.bar em, .bar span {
  position: relative; z-index: 1;
  font-style: normal; font-size: 12px; line-height: 16px; padding: 0 6px;
  text-shadow: 1px 1px 0 var(--ink-deep), -1px 0 0 var(--ink-deep), 0 -1px 0 var(--ink-deep);
  font-variant-numeric: tabular-nums;
}
.bar em { float: left; }
.bar span { float: right; }
.sub-row { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 12px; color: var(--muted); min-height: 32px; }
#pileInfo { flex: none; font-variant-numeric: tabular-nums; }
.task-info { flex: 1; min-width: 0; color: var(--gold); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task-info.urgent { color: #ff8f7a; animation: pulse 0.6s steps(2) infinite; }
.perk-btn {
  margin-left: auto; flex: none; max-width: 58%;
  display: flex; flex-direction: column; align-items: flex-end; gap: 1px;
  padding: 3px 8px; line-height: 1.1;
  background: var(--accept); color: #fff;
  border: 2px solid var(--ink-deep);
  box-shadow: inset -2px -2px 0 rgba(0, 0, 0, 0.22), inset 2px 2px 0 rgba(255, 255, 255, 0.2);
  cursor: pointer;
}
.perk-btn b { max-width: 100%; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.perk-btn small { font-size: 11px; opacity: 0.9; font-variant-numeric: tabular-nums; }
.perk-btn.cool { background: var(--panel-2); color: var(--muted); }
.perk-btn.ready { animation: ready 1.4s steps(2) infinite; }
.perk-btn:active { transform: translateY(1px); }
@keyframes ready { 50% { box-shadow: inset -2px -2px 0 rgba(0, 0, 0, 0.22), inset 2px 2px 0 rgba(255, 255, 255, 0.2), 0 0 0 2px var(--gold); } }

/* ── Сцена ─────────────────────────────────────────────────────── */
#stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--night); }
#view { position: absolute; inset: 0; display: block; touch-action: manipulation; cursor: pointer; user-select: none; }
.hint {
  position: absolute; left: 12px; right: 12px; bottom: 10px;
  padding: 8px 10px;
  background: rgba(21, 23, 38, 0.92); border: 2px solid var(--gold); color: var(--paper);
  font-size: 13px; line-height: 1.3; text-align: center;
  pointer-events: none;
}
.hint:empty { display: none; }
#toasts {
  position: absolute; left: 12px; right: 12px; top: 10px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  pointer-events: none;
}
.toast {
  max-width: 100%;
  padding: 6px 10px;
  background: var(--paper); color: var(--ink);
  border: 2px solid var(--ink-deep); box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35);
  font-size: 13px; text-align: center;
  animation: toastIn 0.18s steps(3);
}
.toast-phew { background: #d9f0d4; }
.toast.out { opacity: 0; transition: opacity 0.35s; }
.banner {
  position: absolute; left: 0; right: 0; top: 34%;
  padding: 8px 0; overflow: hidden; white-space: nowrap;
  border-block: 3px solid var(--ink-deep);
  font-size: 22px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  pointer-events: none;
}
.banner span { display: inline-block; padding-left: 100%; animation: marquee 3.2s linear infinite; }
.banner-fever { background: repeating-linear-gradient(-45deg, var(--gold) 0 14px, #e7a23a 14px 28px); color: var(--ink-deep); }
.banner-bad { background: repeating-linear-gradient(-45deg, var(--stamp) 0 14px, #a92c23 14px 28px); color: #fff; }

/* ── Док ───────────────────────────────────────────────────────── */
#dock {
  flex: none;
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--panel);
  border-top: 2px solid var(--ink-deep);
  padding: 4px 4px calc(4px + env(safe-area-inset-bottom, 0px));
  gap: 4px;
}
#dock button {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 6px 2px 5px;
  background: var(--panel-2);
  border: 2px solid var(--ink-deep);
  box-shadow: inset -2px -2px 0 rgba(0, 0, 0, 0.25), inset 2px 2px 0 rgba(255, 255, 255, 0.07);
  font-size: 13px; cursor: pointer;
}
#dock button img { width: 26px; height: 26px; }
#dock button:active { transform: translateY(1px); }
#dock button:disabled { opacity: 0.4; cursor: default; }
.badge {
  position: absolute; top: 2px; right: 3px;
  font-size: 11px; font-weight: 700; line-height: 14px;
  padding: 0 4px; background: var(--ink-deep); color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.badge:empty { display: none; }
.badge.ready { background: var(--good); color: #fff; }

/* ── Окна ──────────────────────────────────────────────────────── */
#overlay {
  position: fixed; inset: 0; z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: rgba(8, 9, 18, 0.62);
}
#overlay[hidden] { display: none; }
.modal { width: 100%; max-width: 440px; max-height: 100%; display: flex; animation: popIn 0.16s steps(3); }
.modal.flash { animation: flash 0.32s steps(2) infinite; }
.sheet {
  position: relative;
  width: 100%; max-height: 100%; overflow: auto;
  padding: 18px;
  border: 3px solid var(--ink-deep);
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.45);
  display: flex; flex-direction: column; gap: 12px;
  min-width: 0;
}

/* бумага */
.doc {
  background: var(--paper);
  background-image: repeating-linear-gradient(transparent 0 25px, var(--paper-line) 25px 26px);
  color: var(--ink);
  font-family: var(--font-doc);
  font-size: 14.5px; line-height: 1.5;
}
.doc-head {
  display: flex; justify-content: space-between; gap: 12px;
  padding-bottom: 6px; border-bottom: 2px dashed var(--muted-ink);
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted-ink);
}
.title, .title-big { margin: 0; font-family: var(--font-ui); font-weight: 700; line-height: 1.1; text-wrap: balance; }
.title { font-size: 25px; }
.title-big { font-size: 34px; color: var(--stamp); }
.doc p, .panel p { margin: 0; }
.lead { font-size: 15.5px; }
.story { font-size: 15px; }
.fine { font-size: 12.5px; color: var(--muted-ink); }
.panel .fine { color: var(--muted); }
.muted { color: var(--muted-ink); }
.blink { animation: pulse 0.8s steps(2) infinite; }
.field-label { font-family: var(--font-ui); font-size: 14px; color: var(--muted-ink); }
.choice-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.link-row { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: center; }
.link {
  background: none; border: 0; padding: 4px 0; cursor: pointer;
  font-family: var(--font-ui); font-size: 14px; color: var(--stamp-blue);
  text-decoration: underline; text-underline-offset: 3px; align-self: flex-start;
}
.panel .link { color: #8fb6ff; }

.meter {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border: 2px solid var(--ink); background: rgba(255, 255, 255, 0.45);
}
.meter-label { font-family: var(--font-ui); font-size: 14px; }
.meter-val { font-family: var(--font-ui); font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.surv, .sev {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  font-size: 13px; padding: 6px 0; border-bottom: 1px dashed var(--muted-ink);
}
.surv b, .sev b { font-family: var(--font-ui); font-size: 17px; white-space: nowrap; }
.sev b { color: var(--good); }
.panel .surv { border-color: var(--line); }

.fired-top, .promo-top { display: flex; align-items: center; gap: 14px; }
.reason-icon { flex: none; width: 64px; height: 64px; }
.reason-icon.unknown, .card-icon.unknown, .mini.unknown {
  display: grid; place-items: center; background: var(--paper-2); color: var(--muted-ink);
  font-family: var(--font-ui); font-size: 26px; border: 2px dashed var(--muted-ink);
}
.reason-no { font-size: 12px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted-ink); }
.reason-no em { font-style: normal; color: var(--stamp); font-weight: 700; }
.panel .reason-no { color: var(--muted); }
.portrait { width: 72px; height: 78px; flex: none; background: var(--paper-2); border: 2px solid var(--ink); }
.portrait.big { width: 96px; height: 104px; }
.portrait.mini, .mini { width: 36px; height: 39px; flex: none; }
.mini.check { display: grid; place-items: center; border: 2px solid var(--line); color: var(--good); font-size: 20px; background: transparent; }

.stamp {
  position: absolute; right: 16px; top: 64px; z-index: 2;
  padding: 4px 12px;
  border: 4px double currentColor;
  font-family: var(--font-ui); font-size: 28px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em;
  transform: rotate(-12deg) scale(2.6); opacity: 0;
  pointer-events: none; mix-blend-mode: multiply;
}
.stamp-red { color: var(--stamp); }
.stamp-blue { color: var(--stamp-blue); }
.stamp.in { animation: slam 0.22s steps(4) forwards; }
.promo .stamp { top: 54px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-family: var(--font-ui); font-size: 13px; padding: 3px 8px;
  border: 2px solid var(--ink); background: var(--paper-2); color: var(--ink);
}
.chip-good { background: #cfe9cf; }
.chip-bad { background: #f3cbc4; }
.chip-none { background: transparent; border-style: dashed; }

/* кнопки */
.btn {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 46px; padding: 10px 14px;
  font-family: var(--font-ui); font-size: 17px; font-weight: 600; line-height: 1.15;
  color: #fff; text-align: center; text-decoration: none;
  border: 3px solid var(--ink-deep);
  box-shadow: inset -3px -3px 0 rgba(0, 0, 0, 0.22), inset 3px 3px 0 rgba(255, 255, 255, 0.22);
  cursor: pointer;
}
.btn small { font-size: 12.5px; font-weight: 500; opacity: 0.9; }
.btn:active:not(:disabled) { transform: translateY(2px); box-shadow: inset 3px 3px 0 rgba(0, 0, 0, 0.2); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-wide { width: 100%; }
.btn-accept { background: var(--accept); }
.btn-refuse { background: var(--refuse); }
.btn-plain { background: var(--paper-2); color: var(--ink); flex-direction: row; gap: 8px; }
.btn-buy { min-height: 38px; padding: 6px 10px; font-size: 14px; background: var(--good); white-space: nowrap; }
.ico { width: 20px; height: 20px; }

/* разговор */
.chat { background: #1d2033; color: var(--paper); }
.chat-head { display: flex; align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 2px solid var(--line); }
.chat-head .portrait { background: #2c3049; border-color: var(--ink-deep); }
.chat-who { font-size: 18px; font-weight: 700; }
.chat-role { font-size: 13px; color: var(--muted); }
.chat-title { font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--gold); }
.msg {
  max-width: 88%; padding: 10px 12px;
  font-family: var(--font-doc); font-size: 14.5px; line-height: 1.45;
  border: 2px solid var(--ink-deep);
}
.msg-in { align-self: flex-start; background: var(--paper); color: var(--ink); box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3); }
.msg-out { align-self: flex-end; background: var(--accept); color: #fff; box-shadow: -3px 3px 0 rgba(0, 0, 0, 0.3); }
.chat-actions { display: flex; flex-direction: column; gap: 8px; }
.chat .chip { background: var(--panel-2); color: var(--paper); border-color: var(--ink-deep); }
.chat .chip-good { background: #2f5a3b; }
.chat .chip-bad { background: #6b2c2a; }

/* панели */
.panel { background: var(--panel); color: var(--paper); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel-head h2 { margin: 0; font-size: 22px; line-height: 1.15; text-wrap: balance; }
.x {
  flex: none; width: 36px; height: 36px; padding: 0;
  background: var(--panel-2); border: 2px solid var(--ink-deep); font-size: 22px; line-height: 1; cursor: pointer;
}
.wallet { font-size: 14px; color: var(--muted); }
.wallet b { color: var(--gold); font-size: 17px; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; padding: 7px 10px; font-size: 14px; cursor: pointer;
  background: var(--panel-2); border: 2px solid var(--ink-deep); color: var(--muted);
}
.tab.on { background: var(--paper); color: var(--ink); }
.tab-note { font-family: var(--font-doc); font-size: 13px; line-height: 1.45; color: #c2c5dc; }
.tab-note b { color: var(--paper); }
.blocked { font-family: var(--font-doc); font-size: 13px; color: #ffb4a6; }
.doc .blocked { color: var(--bad); }
.sub { margin: 4px 0 0; font-size: 16px; color: var(--muted); font-weight: 600; }

.sk-list, .ch-list, .career { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sk, .ch, .career li {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: var(--panel-2); border: 2px solid var(--ink-deep);
}
.sk-main, .ch > div, .career li > div { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sk b, .ch b, .career b { font-size: 15px; }
.sk span, .ch span, .career span { font-family: var(--font-doc); font-size: 12px; color: var(--muted); line-height: 1.35; }
.sk-ok { font-style: normal; font-size: 12px; color: #8fd19c; }
.sk-price { font-style: normal; font-size: 13px; color: var(--muted); white-space: nowrap; }
.sk-done { opacity: 0.6; }
.sk-next { border-color: var(--gold); }
.sk-later { opacity: 0.5; }
.ch i, .career li > i { font-style: normal; font-size: 12px; color: var(--gold); white-space: nowrap; }
.ch-locked { opacity: 0.5; }
.career li { opacity: 0.55; }
.career li.got { opacity: 1; }
.career li.now { border-color: var(--gold); }
.career .portrait { background: #2c3049; border-color: var(--ink-deep); }

.tries { display: flex; align-items: center; gap: 12px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pips { display: flex; gap: 4px; }
.pips i { width: 16px; height: 16px; border: 2px solid var(--ink-deep); background: #10111c; }
.pips i.on { background: var(--refuse); }

/* трудовая книжка */
.book-body { display: flex; flex-direction: column; gap: 10px; }
.progress { display: flex; flex-direction: column; gap: 6px; }
.pbar { height: 12px; border: 2px solid var(--ink-deep); background: #10111c; }
.pbar i { display: block; height: 100%; background: var(--stamp); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; }
.card {
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 6px 8px; min-height: 104px;
  background: var(--panel-2); border: 2px solid var(--ink-deep); cursor: pointer;
  text-align: center;
}
.card.got { background: var(--paper); color: var(--ink); }
.card-icon { width: 40px; height: 40px; }
.card-icon.unknown { font-size: 18px; border-color: var(--line); background: transparent; color: var(--muted); }
.card-no { position: absolute; top: 3px; left: 5px; font-size: 11px; color: var(--muted); }
.card.got .card-no { color: var(--muted-ink); }
.card-title { font-size: 12.5px; line-height: 1.15; }
.card-n { position: absolute; top: 3px; right: 5px; font-size: 11px; font-weight: 700; color: var(--stamp); }
.detail { display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--paper); color: var(--ink); border: 2px solid var(--ink-deep); font-family: var(--font-doc); }
.detail .title { font-size: 21px; }
.detail .link { color: var(--stamp-blue); }
.rank { padding: 12px; background: var(--paper); color: var(--ink); border: 2px solid var(--ink-deep); }
.rank-name { font-size: 26px; font-weight: 700; color: var(--stamp); }
.rank .fine { color: var(--muted-ink); }
.stats { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; font-size: 14px; }
.stats dt { color: var(--muted); }
.stats dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.howto { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; font-family: var(--font-doc); font-size: 13px; line-height: 1.45; color: #c8cbe0; }
.photo { width: 100%; border: 2px solid var(--ink); background: #fff; }

/* аттестация */
.dice-line { display: flex; justify-content: center; gap: 10px; }
.dice-line i { width: 14px; height: 14px; background: var(--ink); animation: pulse 0.5s steps(2) infinite; }
.dice-line i:nth-child(2) { animation-delay: 0.16s; }
.dice-line i:nth-child(3) { animation-delay: 0.32s; }

/* шабашка */
.part-hud { display: flex; justify-content: space-between; font-size: 17px; font-variant-numeric: tabular-nums; }
.part-hud b { color: var(--gold); }
.doors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.door {
  position: relative; aspect-ratio: 3 / 4; max-width: 100%;
  background: linear-gradient(90deg, #8c5e3c 0 10%, #a3734c 10% 90%, #8c5e3c 90%);
  border: 3px solid var(--ink-deep); cursor: pointer; touch-action: manipulation;
}
.door span {
  position: absolute; top: 10%; left: 50%; transform: translateX(-50%);
  padding: 0 5px; font-size: 12px; background: var(--paper); color: var(--ink); border: 2px solid var(--ink-deep);
}
.door::before { content: ''; position: absolute; right: 16%; top: 52%; width: 8%; aspect-ratio: 1; background: var(--gold); }
.door.has::after {
  content: ''; position: absolute; left: 22%; right: 22%; bottom: 8%; height: 34%;
  background: linear-gradient(transparent 0 42%, #6b4423 42% 58%, transparent 58%), linear-gradient(90deg, transparent 0 44%, #6b4423 44% 56%, transparent 56%), #d9a35b;
  border: 3px solid var(--ink-deep);
  animation: hop 0.3s steps(2) infinite alternate;
}
.door.got { background: #4b8f5a; }

/* ── Анимации ──────────────────────────────────────────────────── */
@keyframes pulse { 50% { opacity: 0.35; } }
@keyframes popIn { from { transform: scale(0.94); opacity: 0; } }
@keyframes toastIn { from { transform: translateY(-6px); opacity: 0; } }
@keyframes marquee { to { transform: translateX(-100%); } }
@keyframes slam { 0% { transform: rotate(-12deg) scale(2.6); opacity: 0; } 70% { transform: rotate(-12deg) scale(0.92); opacity: 0.9; } 100% { transform: rotate(-12deg) scale(1); opacity: 0.85; } }
@keyframes flash { 50% { filter: brightness(1.8) contrast(0.7); } }
@keyframes hop { to { transform: translateY(-4px); } }

@media (prefers-reduced-motion: reduce) {
  .modal, .modal.flash, .toast, .blink, .dice-line i, .bar.hp.low i, .door.has::after { animation: none !important; }
  .banner span { animation: none; padding-left: 12px; }
  .stamp.in { animation: none; transform: rotate(-12deg); opacity: 0.85; }
}

@media (min-width: 520px) {
  body { background: radial-gradient(circle at 50% 30%, #1f2240, var(--night) 70%); }
}

#dock button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 360px) {
  #dock button { font-size: 12px; }
  .money { font-size: 17px; }
  .icon-btn { width: 32px; height: 32px; }
}
.sheet > * { flex-shrink: 0; max-width: 100%; }
.doc p, .panel p, .msg, .chip { overflow-wrap: break-word; }
.career .perk-line { color: #9fc4ff; }

/* ── Отдел кадров ──────────────────────────────────────────────── */
#dock button { font-size: 12px; padding-inline: 1px; }
#dock button img { width: 24px; height: 24px; }
#dock button.locked { opacity: 0.45; }
.emp-list, .cand-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.emp, .cand { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 2px solid var(--ink-deep); }
.emp { background: var(--panel-2); }
.cand { background: rgba(255, 255, 255, 0.5); border-color: var(--ink); }
.emp-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.emp-top .portrait { background: #2c3049; border-color: var(--ink-deep); }
.cand .portrait { background: var(--paper-2); border-color: var(--ink); }
.emp-who { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.emp-who b { font-family: var(--font-ui); font-size: 16px; }
.emp-who span { font-family: var(--font-doc); font-size: 12px; line-height: 1.35; color: var(--muted); }
.cand .emp-who span { color: var(--muted-ink); }
.btn-small { min-height: 38px; padding: 6px 10px; font-size: 14px; }
.traits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.tr {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px;
  padding: 4px 8px; border: 2px solid var(--ink-deep);
  font-size: 13px;
}
.tr b { font-family: var(--font-ui); font-weight: 600; }
.tr span { font-family: var(--font-doc); font-size: 12px; line-height: 1.35; }
.tr-good { background: #d6f0d2; color: #1f5a2a; }
.tr-bad { background: #f6d2cc; color: #7a231b; }
.tr.new { animation: flipIn 0.3s steps(3); }
.slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.slots .tr { flex-direction: column; justify-content: center; gap: 0; padding: 4px 6px; min-height: 46px; }
.slots .tr b { font-size: 12.5px; line-height: 1.15; }
.slot {
  min-height: 46px; padding: 2px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--paper-2); color: var(--ink);
  border: 2px dashed var(--muted-ink); cursor: pointer;
  font-family: var(--font-ui); font-size: 18px; line-height: 1;
}
.slot small { font-size: 11px; color: var(--muted-ink); }
.slot:hover:not(:disabled) { border-style: solid; background: #fff6d8; }
.slot:disabled { opacity: 0.5; cursor: not-allowed; }
.qa { font-family: var(--font-doc); font-size: 13px; line-height: 1.4; padding: 6px 8px; background: rgba(255, 255, 255, 0.6); border-left: 3px solid var(--ink); }
.qa i { color: var(--muted-ink); }
.aura { display: flex; flex-wrap: wrap; gap: 6px; }
.aura .chip { background: var(--panel-2); color: var(--paper); border-color: var(--ink-deep); }
.confirm-box { display: flex; flex-direction: column; gap: 8px; padding: 8px; background: #3a2a30; border: 2px solid var(--ink-deep); font-family: var(--font-doc); font-size: 13px; line-height: 1.4; }
.confirm-box .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.verdict { font-family: var(--font-ui); font-size: 18px; }
@keyframes flipIn { from { transform: scaleY(0.1); } }
@media (prefers-reduced-motion: reduce) { .tr.new { animation: none; } }
.pips.inline { display: inline-flex; vertical-align: middle; gap: 3px; }
.pips.inline i { width: 12px; height: 12px; }
.slots .tr b { font-size: 11.5px; overflow-wrap: anywhere; hyphens: auto; }
.pips.inline i { background: transparent; border-color: var(--muted-ink); }
.pips.inline i.on { background: var(--refuse); border-color: var(--ink-deep); }

/* Пиксельный шрифт — только для крупного: заголовки, печати, баннеры, деньги */
.title, .title-big, .stamp, .banner, .meter-val, .panel-head h2, .money, .rank-name, .part-hud b { font-family: var(--font-px); }
.pos { font-weight: 600; }
.btn { font-weight: 500; letter-spacing: 0.01em; }
.banner-info { background: repeating-linear-gradient(-45deg, #3f86d9 0 14px, #346fb4 14px 28px); color: #fff; }
.hearts { font-size: 20px; letter-spacing: 2px; color: var(--stamp); }
.hearts .off { color: var(--line); }
.sec-perks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.sec-perks li { display: flex; gap: 8px; align-items: baseline; padding: 6px 8px; background: var(--panel-2); border: 2px solid var(--ink-deep); font-size: 13px; line-height: 1.35; opacity: 0.55; }
.sec-perks li.on { opacity: 1; border-color: #e07b8a; }
.sec-perks li b { flex: none; color: #ff9aa8; font-size: 12px; min-width: 52px; }

/* ── Телефоны ──────────────────────────────────────────────────── */
html, body { touch-action: manipulation; }
#app, #overlay { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
img { -webkit-user-drag: none; }
.adm-input, .msg, .story, .tab-note { -webkit-user-select: text; user-select: text; }
@supports (height: 100dvh) { #app { height: 100dvh; } }
.sheet { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
button { -webkit-tap-highlight-color: transparent; }

/* окна выезжают снизу — их удобно нажимать большим пальцем */
@media (max-width: 560px) {
  #overlay { align-items: flex-end; padding: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px)); }
  .modal { max-width: none; animation-name: sheetUp; }
  .sheet { max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px)); padding: 16px; }
}
@keyframes sheetUp { from { transform: translateY(24px); opacity: 0; } }

/* низкие экраны: шапка и док компактнее, офису больше места */
@media (max-height: 720px) {
  #hud { gap: 4px; padding-top: calc(6px + env(safe-area-inset-top, 0px)); padding-bottom: 4px; }
  .pos { font-size: 16px; }
  .money { font-size: 17px; }
  .icon-btn { width: 32px; height: 32px; }
  .icon-btn img { width: 18px; height: 18px; }
  .bar { height: 18px; }
  .bar em, .bar span { line-height: 14px; font-size: 11.5px; }
  .sub-row { min-height: 28px; }
  #dock button { padding: 4px 1px 3px; font-size: 11.5px; }
  #dock button img { width: 22px; height: 22px; }
}
@media (max-height: 620px) {
  .company { display: none; }
  .hud-row:first-child { justify-content: flex-end; }
  .hud-row:first-child .money { margin-right: auto; }
}

/* горизонтальный телефон: офис не помещается — просим повернуть */
#rotate { display: none; }
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  #rotate {
    position: fixed; inset: 0; z-index: 100;
    display: grid; place-items: center; text-align: center;
    background: var(--night); color: var(--paper);
  }
  #rotate div { display: flex; flex-direction: column; gap: 6px; }
  #rotate b { font-family: var(--font-px); font-size: 26px; }
  #rotate span { color: var(--muted); }
}

/* ── Админка ───────────────────────────────────────────────────── */
.adm-form { display: flex; flex-direction: column; gap: 8px; }
.adm-label { font-size: 13px; color: var(--muted); }
.adm-input {
  width: 100%; min-width: 0; min-height: 42px; padding: 8px 10px;
  font: 500 16px var(--font-ui); /* 16px — иначе iOS увеличивает страницу при вводе */
  color: var(--ink); background: var(--paper);
  border: 2px solid var(--ink-deep); border-radius: 0;
}
.adm-input:disabled { opacity: 0.5; }
.adm-sec { display: flex; flex-direction: column; gap: 8px; padding: 10px; background: var(--panel-2); border: 2px solid var(--ink-deep); }
.adm-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.adm-row b { font-size: 15px; }
.adm-row span { font-size: 14px; color: var(--gold); font-variant-numeric: tabular-nums; text-align: right; }
.adm-set { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.adm-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.adm-hint { font-size: 12px; color: var(--muted); }
.adm-note { padding: 8px 10px; background: #2f5a3b; border: 2px solid var(--ink-deep); font-size: 13px; }
.admin .btn-small { min-height: 40px; }
