* { box-sizing: border-box; margin: 0; padding: 0; }

/* ---------- цвета и общие величины ---------- */
:root {
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, Consolas, "Cascadia Mono", Menlo, monospace;
  /* «рукописный» шрифт для книги: что найдётся в системе */
  --hand: "Caveat", "Marck Script", "Neucha", "Segoe Print", "Bradley Hand", "Noteworthy", "Comic Sans MS", cursive;
  --text: #f4eee2;
  --text-dim: rgba(244, 238, 226, .7);
  --glass: rgba(17, 23, 15, .58);
  --glass-strong: rgba(15, 20, 13, .84);
  --glass-hover: rgba(255, 244, 220, .1);
  --line: rgba(255, 240, 210, .14);
  --line-strong: rgba(255, 240, 210, .26);
  --accent: #eaa53f;          /* янтарь */
  --accent-hi: #f6c167;
  --accent-ink: #231505;
  --cap: #c8553d;             /* шляпка мухомора */
  --good: #93d66f;
  --bad: #ff7f6e;
  --hp: linear-gradient(90deg, #c8453a, #e8704f);
  --st: linear-gradient(90deg, #d79a35, #f4d06a);
  --radius: 14px;
  --radius-s: 9px;
  --shadow: 0 10px 34px rgba(0, 0, 0, .38);
  --tshadow: 0 1px 2px rgba(0, 0, 0, .75), 0 0 8px rgba(0, 0, 0, .35);
  --blur: blur(10px) saturate(1.15);
  /* HUD: тёплое тёмное дерево, читается и на снегу, и ночью */
  --hud-bg: rgba(33, 23, 13, .66);
  --hud-bg-strong: rgba(28, 19, 10, .84);
  --hud-line: rgba(255, 222, 170, .22);
  --wood-hi: #7a5532;
  --wood: #4f3520;
  --wood-dk: #34220f;
  /* бумага книги */
  --paper: #f2e4c4;
  --paper-dk: #e4cf9f;
  --ink: #3a2a19;
  --ink-dim: #6c5640;
  --ink-red: #9a3a22;
  --ink-green: #3d7424;
  --rule: rgba(80, 118, 168, .2);
  --margin: rgba(200, 85, 61, .38);
}

html, body {
  height: 100%;
  overflow: hidden;
  background: #11180f;
  font-family: var(--font);
  color: var(--text);
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
}
button, input, select { font-family: inherit; }
button:focus-visible, select:focus-visible, input:focus-visible, [role="button"]:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }

#game { position: relative; width: 100vw; height: 100vh; height: 100dvh; overflow: hidden; }
#canvas { display: block; width: 100%; height: 100%; cursor: pointer; }
body.locked #canvas { cursor: none; }

.dim { opacity: .7; }
.small { font-size: 12px; }
.hidden { display: none !important; }
[hidden] { display: none !important; }
.record { color: var(--good); font-weight: bold; }
.hand { font-family: var(--hand); }

/* ---------- HUD: всё прозрачно для мыши, кроме кнопок ----------
   Видимость элементов с классом .hud задаём только «прятками» или через :where(),
   чтобы фото-режим (body.photo-mode .hud) всегда мог их спрятать. */
#hud { position: absolute; inset: 0; pointer-events: none; text-shadow: var(--tshadow); }
#hud > div, #hint, #log, .panel, #mobile, #joy, #lookTip { zoom: var(--ui, 1); }
.chip {
  display: inline-flex; align-items: center; gap: 5px; white-space: nowrap;
  background: var(--hud-bg); border: 1px solid var(--hud-line); border-radius: 999px;
  padding: 3px 10px; font-size: 13px; line-height: 1.3;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  font-variant-numeric: tabular-nums;
}
#hud kbd, #hint kbd, .book-btn kbd {
  min-width: 18px; padding: 0 4px; font-size: 10.5px; line-height: 15px; font-weight: 700; border-radius: 4px;
  background: rgba(255, 236, 200, .12); border: 1px solid rgba(255, 222, 170, .32); border-bottom-width: 2px; color: var(--text); text-shadow: none;
}

/* слева сверху: часы, сезон и погода, очки, друг */
.hud-tl {
  position: absolute; top: 12px; left: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 5px;
  max-width: max(180px, calc(50vw / var(--ui, 1) - 236px));
}
.clock { font-size: 17px; font-weight: 700; gap: 6px; padding: 3px 12px 3px 9px; transition: color .4s, border-color .4s; }
.clock #clockIc { font-size: 15px; }
.clock.late { color: #ffd27a; border-color: rgba(246, 193, 103, .55); }
.clock.night { color: #ffb3a6; border-color: rgba(255, 127, 110, .55); }
.info-strip {
  display: flex; flex-direction: column; background: var(--hud-bg); border: 1px solid var(--hud-line); border-radius: var(--radius-s); padding: 3px 10px;
  font-size: 12px; line-height: 1.45; color: var(--text-dim); max-width: 100%;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.info-strip span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info-strip span:first-child { color: var(--text); }
.info-strip:empty { display: none; }
.ledger { display: flex; flex-wrap: wrap; gap: 4px; }
.ledger .chip { font-size: 12.5px; padding: 2px 9px; }
.chip.partner { font-size: 12px; color: #cfe8b4; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip.partner.off { color: var(--text-dim); }

/* справа сверху: книга, круглая карта, задания */
.hud-tr { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.hud-btns { display: flex; gap: 6px; justify-content: flex-end; }
.hbtn {
  pointer-events: auto; height: 34px; min-width: 34px; padding: 0 8px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--hud-bg); border: 1px solid var(--hud-line); color: var(--text); font-size: 16px; line-height: 1; cursor: pointer;
  text-shadow: var(--tshadow); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur); transition: background .15s, transform .12s;
}
.hbtn:hover { background: rgba(80, 55, 30, .8); }
.hbtn:active { transform: translateY(1px); }
.touch-only { display: none; }
/* кнопка книги: маленький кожаный томик с корешком */
.book-btn {
  padding: 0 7px 0 12px; font-size: 13px; font-weight: 700; color: #f6e2b8; letter-spacing: .2px;
  background: linear-gradient(90deg, rgba(58, 22, 14, .95) 0 6px, rgba(255, 220, 160, .35) 6px 7px, rgba(124, 50, 32, .88) 7px);
  border-color: rgba(255, 210, 160, .32);
}
.book-btn:hover { background: linear-gradient(90deg, rgba(58, 22, 14, .95) 0 6px, rgba(255, 220, 160, .45) 6px 7px, rgba(146, 60, 38, .92) 7px); }
.book-btn .bb-ic { font-size: 15px; }

/* круглая карта: деревянное кольцо, весь лес вписан в круг */
.map-ring {
  position: relative; width: 152px; height: 152px; border-radius: 50%; border: 6px solid transparent;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle, rgba(46, 58, 34, .94), rgba(22, 29, 16, .96)) padding-box,
    conic-gradient(from 20deg, #8a6038, #5a3b20, #7a5532, #4a3019, #8a6038, #5a3b20, #7a5532, #8a6038) border-box;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .42), 0 0 0 1px rgba(255, 222, 170, .25), inset 0 0 14px rgba(0, 0, 0, .55);
}
#minimap { display: block; width: 80%; height: 60%; border-radius: 4px; opacity: .96; }
.mr-n {
  position: absolute; top: -1px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 10px; font-weight: 800;
  color: var(--accent-hi); text-shadow: 0 1px 2px #000; line-height: 1;
}

/* задания дня: строка со счётом, H разворачивает */
#tasksBox {
  pointer-events: auto; cursor: pointer; width: 250px; max-width: 280px;
  max-height: max(64px, calc(100vh / var(--ui, 1) - 340px)); overflow-y: auto; scrollbar-width: thin;
  background: var(--hud-bg); border: 1px solid var(--hud-line); border-radius: 12px; padding: 5px 10px;
  font-size: 12.5px; line-height: 1.45; backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.tk-head { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.tk-head .tk-t { flex: 1; }
.tk-head b { color: var(--accent-hi); font-variant-numeric: tabular-nums; }
.tk-arr { font-style: normal; opacity: .7; width: 10px; text-align: center; }
.tk-list { margin-top: 4px; padding-top: 4px; border-top: 1px dashed rgba(255, 222, 170, .25); }
.tk-list > div { padding: 1px 0; }
#tasksBox .tk-sub { color: var(--text-dim); font-size: 11.5px; }
#tasksBox .done { color: var(--good); }
#tasksBox .fail { color: var(--bad); text-decoration: line-through; }

/* снизу по центру: силы, пояс с инструментами, ягоды и чай слева, корзина справа */
.hud-bc { position: absolute; left: 0; right: 0; bottom: 12px; display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.vitals { width: 232px; display: flex; flex-direction: column; gap: 3px; }
.meter { display: flex; align-items: center; gap: 6px; font-size: 11px; font-variant-numeric: tabular-nums; }
.m-ic { width: 12px; text-align: center; font-size: 11px; opacity: .95; }
.meter.hp .m-ic { color: #ff8a7a; }
.meter.st .m-ic { color: #ffd772; }
.m-val { width: 22px; text-align: right; opacity: .85; }
.meter .bar {
  flex: 1; height: 5px; border-radius: 99px; overflow: hidden;
  background: rgba(20, 13, 6, .6); box-shadow: 0 0 0 1px rgba(255, 222, 170, .18), 0 1px 4px rgba(0, 0, 0, .4);
}
.meter .bar span { display: block; height: 100%; width: 100%; border-radius: 99px; }
#hpbar { background: var(--hp); transition: width .3s; }
#hpbar.low { animation: lowBar 1.2s ease-in-out infinite; }
#stbar { background: var(--st); transition: width .2s; }
#stbar.tired { background: #e04b4b; }
@keyframes lowBar { 50% { filter: brightness(1.5); } }

.belt { display: flex; align-items: flex-end; gap: 10px; }
.quick { display: flex; gap: 6px; align-items: flex-end; width: 150px; }
.q-left { justify-content: flex-end; }
.q-right { justify-content: flex-start; }
.qk, .basket-g {
  display: flex; align-items: center; height: 40px; border-radius: 11px;
  background: var(--hud-bg); border: 1px solid var(--hud-line); font-variant-numeric: tabular-nums;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.qk { gap: 5px; padding: 0 9px 0 6px; font-size: 15px; font-weight: 700; transition: opacity .2s; }
.qk .qi { font-size: 17px; }
.qk .qn { min-width: 2ch; text-align: right; }
.qk.off { opacity: .55; }
.basket-g { gap: 7px; padding: 0 10px 0 8px; }
.basket-g .qi { font-size: 19px; }
.bg-main { display: flex; flex-direction: column; gap: 3px; width: 54px; }
.bg-num { font-size: 14px; font-weight: 700; line-height: 1; }
.bg-bar { height: 5px; border-radius: 3px; overflow: hidden; background: rgba(20, 13, 6, .6); box-shadow: 0 0 0 1px rgba(255, 222, 170, .16); }
#basketFill { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #b9893f, var(--accent-hi)); transition: width .25s; }
.bg-val { font-size: 12px; color: var(--accent-hi); min-width: 4ch; }
.basket-g.full { border-color: rgba(255, 140, 110, .55); }
.basket-g.full .bg-num { color: #ffb19a; }
.basket-g.full #basketFill { background: linear-gradient(90deg, var(--cap), #e8704f); }
.basket-g.bad .qi { filter: drop-shadow(0 0 4px rgba(255, 80, 60, .95)); }

/* пояс: три ячейки на деревянной планке */
.hotbar {
  display: flex; gap: 5px; padding: 5px; border-radius: 14px;
  background:
    repeating-linear-gradient(178deg, rgba(0, 0, 0, .07) 0 1px, transparent 1px 7px),
    linear-gradient(180deg, rgba(104, 71, 42, .86), rgba(62, 41, 22, .9));
  border: 1px solid rgba(255, 214, 150, .26);
  box-shadow: 0 6px 18px rgba(0, 0, 0, .38), inset 0 1px 0 rgba(255, 230, 190, .2);
}
.slot {
  pointer-events: auto; position: relative; width: 64px; height: 58px; border-radius: 10px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, rgba(255, 240, 210, .1), rgba(0, 0, 0, .22)), rgba(30, 20, 11, .6);
  border: 1px solid rgba(0, 0, 0, .4); color: var(--text); text-shadow: var(--tshadow);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, .5);
  transition: transform .12s, border-color .12s, background-color .12s, box-shadow .12s;
}
.slot:hover { background-color: rgba(70, 47, 24, .7); }
.slot .si { font-size: 24px; line-height: 1; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .6)); }
.slot .sn { font-size: 10px; margin-top: 4px; max-width: 60px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-dim); letter-spacing: -.1px; }
#hud .slot .sk { position: absolute; top: 3px; left: 4px; min-width: 0; padding: 0 3px; font-size: 9.5px; line-height: 13px; background: rgba(0, 0, 0, .35); border: none; color: var(--text-dim); }
.slot .slock { display: none; position: absolute; top: 2px; right: 3px; font-size: 10px; }
.slot.on {
  border-color: var(--accent-hi); transform: translateY(-3px);
  background: radial-gradient(ellipse at 50% 35%, rgba(246, 193, 103, .34), rgba(234, 165, 63, .06) 70%), rgba(62, 41, 18, .78);
  box-shadow: 0 0 0 2px rgba(246, 193, 103, .3), 0 0 16px rgba(234, 165, 63, .35), inset 0 1px 0 rgba(255, 240, 200, .3);
}
.slot.on .sn { color: var(--accent-hi); font-weight: 700; }
#hud .slot.on .sk { color: var(--accent-ink); background: var(--accent-hi); }
/* под выбранной ячейкой: красная «шляпка» */
.slot.on::after { content: ""; position: absolute; bottom: -7px; left: 50%; width: 18px; height: 4px; margin-left: -9px; border-radius: 4px 4px 2px 2px; background: var(--cap); box-shadow: 0 1px 2px rgba(0, 0, 0, .5); }
.slot.locked { cursor: help; }
.slot.locked .si { filter: grayscale(1) brightness(.75); opacity: .42; }
.slot.locked .sn { opacity: .55; }
.slot.locked .slock { display: block; }
/* название инструмента над поясом после переключения */
.tool-name {
  position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translate(-50%, 6px);
  padding: 3px 12px; border-radius: 99px; background: var(--hud-bg-strong); border: 1px solid rgba(246, 193, 103, .45);
  font-size: 14px; font-weight: 700; color: var(--accent-hi); white-space: nowrap; opacity: 0; transition: opacity .2s, transform .2s;
}
.tool-name.show { opacity: 1; transform: translate(-50%, 0); }
.tool-name:empty { display: none; }

/* ---------- прицел и подсказка ---------- */
#crosshair {
  position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px;
  border-radius: 50%; background: rgba(255, 250, 240, .92); box-shadow: 0 0 0 1.5px rgba(0, 0, 0, .4);
  pointer-events: none; transition: width .15s, height .15s, margin .15s, background .15s, box-shadow .15s;
}
#crosshair.aim {
  width: 22px; height: 22px; margin: -11px 0 0 -11px; background: transparent;
  box-shadow: inset 0 0 0 2px rgba(255, 236, 196, .95), 0 0 0 1.5px rgba(0, 0, 0, .35), inset 0 0 0 3.5px rgba(0, 0, 0, .25);
}
/* с удочкой точка голубая; рамку фотоаппарата рисует photo.js (#camFinder) */
#crosshair.tool-rod:not(.aim) { background: #cfe9ff; }
body:not(.playing) #crosshair { display: none; }
#lookTip {
  position: absolute; left: 50%; top: calc(50% - 56px); transform: translateX(-50%);
  background: var(--hud-bg); border: 1px solid var(--hud-line); padding: 5px 14px; border-radius: 99px; font-size: 13px;
  pointer-events: none; white-space: nowrap; backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
body:not(.playing) #lookTip, body.locked #lookTip { display: none; }
@media not all and (hover: hover) and (pointer: fine) { #lookTip { display: none; } }
#hint {
  position: absolute; left: 50%; top: calc(50% + 34px); transform: translate(-50%, 4px);
  background: var(--hud-bg-strong); border: 1px solid var(--hud-line); padding: 4px 13px 4px 6px; border-radius: 99px;
  font-size: 14px; white-space: nowrap; max-width: 80vw; overflow: hidden; text-overflow: ellipsis;
  opacity: 0; transition: opacity .15s, transform .15s; pointer-events: none; text-shadow: var(--tshadow);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
#hint.show { opacity: 1; transform: translate(-50%, 0); }
#hint .hseg { display: inline-flex; align-items: center; }
#hint .hseg + .hseg { margin-left: 12px; padding-left: 12px; border-left: 1px solid var(--hud-line); }
#hint .hseg:first-child:not(:has(kbd)) { padding-left: 7px; }
#hint kbd { font-size: 12px; line-height: 18px; min-width: 22px; background: var(--accent-hi); color: var(--accent-ink); border-color: rgba(0, 0, 0, .35); }
#hint .hdot { font-style: normal; opacity: .55; margin: 0 6px; }
#hint.warn { background: rgba(92, 22, 14, .88); border-color: rgba(255, 127, 110, .55); }

/* ---------- компас ---------- */
#compass {
  --ppd: 2.333px;
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  width: max(200px, min(420px, calc(100vw - 440px * var(--ui, 1)))); height: 52px; overflow: hidden; pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 22%, #000 78%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 22%, #000 78%, transparent);
  text-shadow: var(--tshadow);
}
#compass::before {
  content: ""; position: absolute; left: 0; right: 0; top: 2px; height: 22px; border-radius: 99px;
  background: linear-gradient(180deg, rgba(33, 23, 13, .55), rgba(33, 23, 13, .3));
  border-top: 1px solid var(--hud-line); border-bottom: 1px solid var(--hud-line);
}
.cmp-tape { position: absolute; left: 0; top: 2px; height: 22px; width: 0; will-change: transform; }
.cmp-tape i {
  position: absolute; top: 0; width: 0; height: 22px; font-style: normal; line-height: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding-top: 4px;
  font-size: 10px; color: var(--text-dim); white-space: nowrap;
}
.cmp-tape i::after { content: ""; position: absolute; bottom: 0; width: 1px; height: 3px; background: rgba(255, 255, 255, .35); }
.cmp-tape i.c-mid::after { height: 4px; background: rgba(255, 255, 255, .5); }
.cmp-tape i.c-main { font-size: 13px; font-weight: 700; color: var(--text); padding-top: 3px; }
.cmp-tape i.c-main::after { height: 4px; width: 2px; background: rgba(255, 255, 255, .75); }
/* метки под лентой, чтобы не налезать на буквы */
.cmp-marks { position: absolute; left: 0; right: 0; top: 26px; bottom: 0; }
.cm {
  position: absolute; left: 0; top: 0; width: 0; display: flex; flex-direction: column; align-items: center;
  will-change: transform; line-height: 1;
}
.cm b { font-weight: normal; font-size: 14px; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .7)); }
.cm span { font-size: 10px; margin-top: 2px; color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.cm span:empty { display: none; }
.cm.home span { color: var(--accent-hi); }
.cm.alert b { animation: cmpPulse 1.2s ease-in-out infinite; }
.cm.friend span { color: #9fe3ff; }
.cm.glade b { font-size: 12px; opacity: .9; }
@keyframes cmpPulse { 50% { transform: scale(1.25); } }
.cmp-needle {
  position: absolute; left: 50%; top: 0; width: 0; height: 0; margin-left: -5px;
  border: 5px solid transparent; border-top: 6px solid var(--accent-hi); border-bottom: 0;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .6));
}

/* ---------- урон и слабость ---------- */
#hurt { position: absolute; inset: 0; pointer-events: none; }
#hurt::before, #hurt::after { content: ""; position: absolute; inset: 0; opacity: 0; }
#hurt::before { background: radial-gradient(ellipse at center, transparent 45%, rgba(20, 0, 0, .65) 100%); transition: opacity 1s; }
#hurt.low::before { opacity: 1; animation: lowBeat 1.6s ease-in-out infinite; }
#hurt::after { background: radial-gradient(ellipse at center, rgba(160, 10, 0, 0) 35%, rgba(190, 20, 10, .62) 100%); }
#hurt.hit::after { animation: hurtFlash .5s ease-out; }
@keyframes hurtFlash { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes lowBeat { 50% { opacity: .7; } }
#flashOverlay { position: absolute; inset: 0; background: #fff; opacity: 0; pointer-events: none; transition: opacity .08s; }

/* ---------- лог сообщений: слева над поясом ---------- */
#log {
  position: absolute; left: 14px; bottom: 112px; max-width: min(440px, 40vw);
  flex-direction: column; align-items: flex-start; gap: 4px; pointer-events: none;
}
:where(#log) { display: flex; }
#log div {
  background: var(--hud-bg-strong); padding: 5px 11px; border-radius: var(--radius-s); font-size: 14px; line-height: 1.35;
  border-left: 3px solid var(--accent); animation: fadeout 4.5s forwards; text-shadow: var(--tshadow);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
#log div.good { border-left-color: var(--good); }
#log div.bad { border-left-color: var(--bad); background: rgba(70, 16, 12, .84); }
@keyframes fadeout {
  0%   { opacity: 0; transform: translateY(8px); }
  8%   { opacity: 1; transform: none; }
  78%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ---------- чат ---------- */
#chatBox { position: absolute; left: 50%; bottom: 126px; transform: translateX(-50%); width: min(480px, 90vw); z-index: 25; }
#chatBox input {
  width: 100%; background: var(--hud-bg-strong); border: 1px solid var(--accent); color: #fff;
  padding: 9px 14px; border-radius: 99px; font-size: 14px; outline: none;
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}

/* ---------- в меню HUD не нужен ---------- */
body:not(.inday) #hud, body:not(.inday) #compass, body:not(.inday) #crosshair, body:not(.inday) #hint,
body:not(.inday) #mobile, body:not(.inday) #joy, body:not(.inday) #hurt, body:not(.inday) #lookTip { display: none !important; }

/* ---------- общие кнопки ---------- */
.btn {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent)); color: var(--accent-ink); border: none;
  padding: 11px 24px; font-size: 17px; font-weight: 700; border-radius: 12px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(234, 165, 63, .25), inset 0 1px 0 rgba(255, 255, 255, .35); transition: transform .12s, filter .12s;
}
.btn:hover { filter: brightness(1.07); }
.btn:active { transform: translateY(1px); }
.btn:disabled { filter: grayscale(.8) brightness(.7); cursor: default; }
.btn.big { font-size: 20px; padding: 14px 34px; min-width: 220px; }
.small-btn { font-size: 14px; padding: 8px 16px; }
.link { background: none; border: none; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font-size: 13px; }
.link:hover { color: var(--accent-hi); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
kbd {
  display: inline-block; min-width: 22px; text-align: center; background: rgba(255, 255, 255, .08);
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px;
  padding: 1px 6px; font-family: var(--mono); font-size: 12px; line-height: 1.5; color: var(--text);
}

/* ---------- оверлей: меню, пауза, итоги ---------- */
#overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
#overlay.hidden { display: none; }
#overlay.mode-card { background: rgba(6, 10, 5, .5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
#overlay.mode-menu {
  padding: 0; justify-content: flex-start; align-items: stretch;
  background:
    linear-gradient(90deg, rgba(9, 13, 7, .82) 0%, rgba(9, 13, 7, .55) 30%, rgba(9, 13, 7, .12) 55%, rgba(9, 13, 7, 0) 70%),
    linear-gradient(0deg, rgba(9, 13, 7, .55) 0%, rgba(9, 13, 7, 0) 38%);
}
.card.hidden { display: none; }

/* карточки паузы и итогов: тёмное стекло */
.card.glass {
  background: var(--glass-strong); border: 1px solid var(--line); border-radius: 20px;
  padding: 26px 30px; width: 100%; max-width: 620px; max-height: 92vh; overflow: auto;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .5); backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
  border-top: 3px solid var(--cap); animation: cardIn .25s ease-out;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.card h1 { font-size: 30px; font-weight: 800; letter-spacing: .3px; margin-bottom: 14px; color: var(--text); }
.card h2 { font-size: 24px; font-weight: 700; }
.card h4 { color: var(--accent-hi); margin: 14px 0 6px; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; }
.card p, .card li { line-height: 1.5; margin-bottom: 8px; }

/* пункты меню */
.mbtn {
  display: flex; align-items: baseline; gap: 10px; width: 100%; text-align: left;
  background: transparent; border: none; border-left: 3px solid transparent; color: var(--text);
  padding: 9px 16px; font-size: 21px; font-weight: 600; cursor: pointer; border-radius: 0 10px 10px 0;
  text-shadow: var(--tshadow); transition: background .15s, border-color .15s, padding .15s, color .15s;
}
.mbtn small { font-size: 13px; font-weight: 400; color: var(--text-dim); }
.mbtn:hover, .mbtn:focus-visible { background: linear-gradient(90deg, rgba(234, 165, 63, .18), rgba(234, 165, 63, 0)); border-left-color: var(--accent); padding-left: 22px; outline: none; }
.mbtn.primary { color: var(--accent-hi); }
.mbtn:disabled { opacity: .45; cursor: default; }

/* главное меню слева */
.card.menu { position: relative; width: min(560px, 100%); height: 100%; }
.screen {
  position: absolute; inset: 0; display: flex; flex-direction: column; padding: 7vh 48px 5vh; overflow-y: auto;
  opacity: 0; visibility: hidden; transform: translateX(-18px); pointer-events: none;
  transition: opacity .28s ease, transform .28s ease, visibility 0s linear .28s;
}
.screen.on { opacity: 1; visibility: visible; transform: none; pointer-events: auto; transition-delay: 0s; }
.brand { display: flex; align-items: center; gap: 16px; margin-bottom: 10px; }
.brand-mark { width: 74px; height: 74px; flex-shrink: 0; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .45)); }
.brand h1 { font-size: 64px; line-height: 1; margin: 0; font-weight: 800; letter-spacing: 1px; text-shadow: 0 3px 18px rgba(0, 0, 0, .55); }
.tagline { font-size: 15px; color: var(--text-dim); margin-top: 6px; letter-spacing: .5px; text-shadow: var(--tshadow); }
/* строка аккаунта под заголовком (заполняет модуль аккаунта) */
.acct-status { font-size: 13px; color: var(--text-dim); margin: 0 0 2px; text-shadow: var(--tshadow); min-height: 1.4em; }
.acct-status:empty { visibility: hidden; }
.info-line { font-size: 14px; color: var(--accent-hi); margin: 6px 0 4vh; text-shadow: var(--tshadow); }
.menu-list { display: flex; flex-direction: column; gap: 2px; max-width: 380px; margin-left: -16px; }
.menu-foot { margin-top: auto; font-size: 12px; color: var(--text-dim); text-shadow: var(--tshadow); max-width: 380px; }

/* подэкраны меню */
.screen.sub { padding: 5vh 32px 4vh; }
.screen.sub > * { position: relative; }
.screen.sub::before {
  content: ""; position: absolute; inset: 3vh 0 3vh 16px; border-radius: 20px;
  background: var(--glass-strong); border: 1px solid var(--line); box-shadow: var(--shadow);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.sub-head { display: flex; align-items: center; gap: 14px; padding: 10px 16px 10px 26px; }
.sub-head h2 { font-size: 24px; }
.back {
  background: rgba(255, 255, 255, .07); border: 1px solid var(--line); color: var(--text); border-radius: 99px;
  padding: 5px 13px 5px 10px; font-size: 14px; cursor: pointer; transition: background .15s;
}
.back:hover { background: rgba(255, 255, 255, .14); }
.sub-body { flex: 1; overflow: auto; padding: 4px 18px 10px 32px; min-height: 0; }
.sub-foot { padding: 12px 16px 6px 32px; }
.sub-foot.quiet { padding-top: 6px; }
.sub-foot:not(:has(:not(.hidden))) { display: none; }

/* выбор персонажа, сезона, испытаний */
.picks { display: flex; flex-wrap: wrap; gap: 6px; }
button.pick {
  background: rgba(255, 255, 255, .06); border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 7px 11px; cursor: pointer; font-size: 13px; line-height: 1.25; text-align: left;
  transition: background .15s, border-color .15s;
}
button.pick:hover { background: rgba(255, 255, 255, .11); }
button.pick.on { border-color: var(--accent); background: rgba(234, 165, 63, .16); color: var(--accent-hi); }
button.pick small { opacity: .7; font-size: 11px; }
.picks.locked { pointer-events: none; opacity: .45; }
#chalPick { display: flex; flex-direction: column; gap: 2px; }
.pick-row { display: flex; align-items: center; gap: 8px; font-size: 14px; padding: 5px 8px; cursor: pointer; border-radius: 8px; }
.pick-row:hover { background: rgba(255, 255, 255, .06); }
.pick-row input, .panel input[type=checkbox] { accent-color: var(--accent); width: 16px; height: 16px; }

/* игра вдвоём */
#coopBox .btn-row { margin-bottom: 8px; }
#roomCode {
  width: 76px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line-strong); color: var(--accent-hi);
  border-radius: 10px; padding: 7px 8px; font-size: 16px; letter-spacing: 4px; text-align: center; font-family: var(--mono);
}
#roomCode:focus { outline: none; border-color: var(--accent); }
#roomStatus { line-height: 1.5; font-size: 13px; }
.room-code { color: var(--accent-hi); font-size: 17px; letter-spacing: 3px; }

/* рекорды */
.top-details > summary { list-style: none; pointer-events: none; color: var(--text-dim); font-size: 13px; margin-bottom: 8px; }
.top-details > summary::-webkit-details-marker { display: none; }
#topList table { width: 100%; border-collapse: collapse; font-size: 14px; }
#topList td { padding: 6px 6px; border-bottom: 1px solid rgba(255, 255, 255, .07); }
#topList td:first-child { width: 30px; color: var(--text-dim); }
#topList td:nth-child(3) { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
#topList td:last-child { text-align: right; width: 80px; }
#topList tr.me td { color: var(--accent-hi); }

/* управление */
.keys { display: grid; gap: 4px; }
.keys > div { display: grid; grid-template-columns: 130px 1fr; gap: 10px; align-items: baseline; font-size: 14px; line-height: 1.45; }
.keys > div > span { display: flex; flex-wrap: wrap; gap: 3px; }

/* достижения */
.ach { display: flex; gap: 10px; align-items: center; padding: 6px 0; font-size: 13px; opacity: .45; border-bottom: 1px solid rgba(255, 255, 255, .05); }
.ach.on { opacity: 1; }
.ach .a-name { font-weight: 600; }
.ach .a-desc { font-size: 12px; opacity: .8; }
.ach-scroll { max-height: 46vh; overflow: auto; padding-right: 4px; }

/* пауза */
.pause-grid { display: grid; grid-template-columns: minmax(200px, 1fr) 1.2fr; gap: 22px; }
.pause-menu { display: flex; flex-direction: column; gap: 2px; margin-left: -16px; }
.pause-menu .mbtn { font-size: 19px; }
.pause-ach h4 { margin-top: 2px; }
#pauseRoom { margin: 10px 0 0 16px; color: #cfe8b4; line-height: 1.45; }
#pauseRoom:empty { display: none; }

/* итоги дня */
#summary table { width: 100%; border-collapse: collapse; margin: 10px 0 14px; font-size: 14px; }
#summary td { padding: 5px 6px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
#summary td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
#summary .rank { font-size: 20px; color: var(--accent-hi); margin: 4px 0 8px; font-weight: 700; }
#submitBox { margin: 10px 0 4px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .03); }
#submitBox label.row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 14px; flex-wrap: wrap; }
#submitBox input[type=text] {
  flex: 1; min-width: 140px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line-strong); color: #fff;
  padding: 7px 10px; border-radius: 8px; font-size: 14px; user-select: text; -webkit-user-select: text;
}
#submitBox input[type=text]:focus { outline: none; border-color: var(--accent); }
#againBtn { margin-top: 12px; }

/* ---------- панели: тёмная доска по центру ---------- */
.panel {
  position: absolute; inset: 0; margin: auto; z-index: 30; display: none;
  width: min(440px, calc(92vw / var(--ui, 1))); height: fit-content; max-height: calc(86vh / var(--ui, 1)); overflow: auto;
  color: var(--text); border-radius: 16px; padding: 14px 18px 16px;
  background:
    repeating-linear-gradient(177deg, rgba(0, 0, 0, .06) 0 1px, transparent 1px 8px, rgba(255, 220, 170, .025) 8px 9px, transparent 9px 15px),
    linear-gradient(180deg, rgba(64, 44, 26, .97), rgba(42, 28, 15, .97));
  border: 1px solid rgba(255, 214, 160, .24);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 230, 190, .14), inset 0 0 0 4px rgba(0, 0, 0, .12);
}
.panel.show { display: block; animation: cardIn .2s ease-out; }
.panel h3 {
  position: sticky; top: -14px; z-index: 2; margin: -14px -18px 8px; padding: 14px 18px 10px;
  background: linear-gradient(180deg, rgba(70, 48, 28, .99) 72%, rgba(70, 48, 28, 0));
  display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 18px; font-weight: 700; color: #f6dfb3;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .6);
}
.panel .close {
  background: radial-gradient(circle at 40% 35%, rgba(255, 230, 190, .22), rgba(0, 0, 0, .15)); border: 1px solid rgba(255, 214, 160, .32); color: #fff;
  width: 30px; height: 30px; border-radius: 50%; font-size: 14px; cursor: pointer; flex-shrink: 0; transition: background .15s;
}
.panel .close:hover { background: rgba(255, 230, 190, .22); }
.panel h4 { margin: 14px 0 6px; color: var(--accent-hi); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; }
.panel label.row { display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 14px; }
.panel label.row input[type=range] { flex: 1; accent-color: var(--accent); min-width: 0; }
.panel label.row > span { width: 40px; text-align: right; font-size: 12px; opacity: .8; font-variant-numeric: tabular-nums; }
.panel label.row.check { cursor: pointer; }
.panel select {
  flex: 1; background: rgba(0, 0, 0, .3); color: var(--text); border: 1px solid rgba(255, 214, 160, .28);
  border-radius: 8px; padding: 5px 8px; font-size: 14px; cursor: pointer;
}
.panel select option { background: #2e2014; color: var(--text); }
.panel .link { margin-top: 10px; }

/* клавиши в настройках */
.k-item { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; font-size: 13px; border-bottom: 1px dashed rgba(255, 214, 160, .1); }
.k-item button {
  background: rgba(0, 0, 0, .25); border: 1px solid rgba(255, 214, 160, .3); border-bottom-width: 2px; color: #fff; border-radius: 7px;
  padding: 3px 10px; cursor: pointer; font-family: var(--mono); min-width: 84px;
}
.k-item button:hover { background: rgba(255, 230, 190, .12); }
.k-item button.wait { border-color: var(--accent); color: var(--accent-hi); }

/* ---------- лавка: прилавок с ценниками ---------- */
#shop { width: min(560px, calc(94vw / var(--ui, 1))); }
.shop-purse { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-size: 14px; margin-bottom: 4px; }
.shop-purse b { color: var(--accent-hi); font-size: 18px; font-variant-numeric: tabular-nums; }
#shop h4.shelf-name {
  display: inline-block; margin: 14px 0 6px 2px; padding: 1px 12px 2px; border-radius: 4px; transform: rotate(-1.5deg);
  background: linear-gradient(180deg, #f2dfb5, #e2c993); color: #4a2e14; text-shadow: none;
  font-family: var(--hand); font-size: 18px; font-weight: 700; text-transform: none; letter-spacing: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .4);
}
.shelf {
  padding: 2px 4px 4px; border-radius: 6px 6px 3px 3px; background: rgba(0, 0, 0, .14);
  border-bottom: 7px solid #2c1c0e; box-shadow: 0 5px 6px -3px rgba(0, 0, 0, .55);
}
.s-item { display: flex; align-items: center; gap: 10px; padding: 8px 2px; }
.s-item + .s-item { border-top: 1px solid rgba(255, 214, 160, .1); }
.s-ic {
  width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px;
  background: radial-gradient(circle at 40% 35%, #8a6038, #4a3019); box-shadow: inset 0 2px 5px rgba(0, 0, 0, .5), 0 1px 0 rgba(255, 220, 170, .15);
}
.s-item .s-info { flex: 1; min-width: 0; }
.s-item .name { font-weight: 700; }
.s-item .desc { font-size: 12px; opacity: .82; line-height: 1.35; }
.s-item .lvl { font-size: 12px; color: var(--accent-hi); }
.s-item.owned .name { color: #c9e7a8; }
.tag {
  position: relative; flex-shrink: 0; min-width: 82px; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 6px 12px 6px 20px; border: none; border-radius: 4px 12px 12px 4px; cursor: pointer;
  background: linear-gradient(180deg, #f8ead0, #ead5a8); color: #3b2715; font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums;
  box-shadow: 1px 2px 4px rgba(0, 0, 0, .45); transform: rotate(2deg); transition: transform .12s, filter .12s;
}
.tag::before {
  content: ""; position: absolute; left: 7px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%;
  background: #4a3019; box-shadow: inset 0 1px 1px rgba(0, 0, 0, .7);
}
.tag:hover:not(:disabled) { transform: rotate(0) translateY(-1px); filter: brightness(1.05); }
.tag .t-c { font-size: 13px; }
.tag:disabled { cursor: default; opacity: .55; filter: grayscale(.55); }
.s-item.owned .tag { background: linear-gradient(180deg, #d9ecc0, #bfd9a0); color: #2f5a1a; opacity: 1; filter: none; transform: rotate(-2deg); }
.s-item.poor .tag b { color: #8a3a22; }

/* ---------- «Книга грибника»: тканевая обложка, разворот, закладки справа ---------- */
#book {
  width: min(980px, calc(95vw / var(--ui, 1))); height: min(640px, calc(88vh / var(--ui, 1))); max-height: none;
  padding: 0; overflow: hidden; border-radius: 14px; color: var(--text);
  background:
    radial-gradient(ellipse at 25% 15%, rgba(255, 255, 255, .07), transparent 55%),
    repeating-linear-gradient(45deg, rgba(0, 0, 0, .05) 0 2px, transparent 2px 4px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, .025) 0 2px, transparent 2px 4px),
    linear-gradient(160deg, #3e4d2d, #26331c);
  border: 1px solid rgba(0, 0, 0, .55);
  box-shadow: 0 28px 80px rgba(0, 0, 0, .6), inset 0 0 0 5px rgba(0, 0, 0, .12), inset 0 0 0 6px rgba(234, 196, 120, .32);
}
#book.show { display: flex; flex-direction: column; }
#book h3 {
  position: static; margin: 0; padding: 10px 14px 6px 22px; background: none; flex-shrink: 0;
  font-family: var(--hand); font-size: 25px; font-weight: 700; color: #efd8a4; letter-spacing: .3px;
}
.book-body { flex: 1; min-height: 0; display: flex; padding: 0 0 16px 16px; }
.book-spread {
  position: relative; z-index: 1; flex: 1; min-width: 0; min-height: 0; display: grid; grid-template-columns: minmax(190px, 32%) 1fr; grid-template-rows: minmax(0, 1fr);
  border-radius: 6px 3px 3px 6px; overflow: hidden; color: var(--ink); text-shadow: none;
  background: var(--paper); box-shadow: 0 8px 22px rgba(0, 0, 0, .45), 0 0 0 1px rgba(60, 40, 20, .4);
  /* на бумаге «светлые» цвета интерфейса становятся чернилами: вкладки других систем читаются без своих стилей */
  --text: var(--ink); --text-dim: var(--ink-dim); --accent-hi: var(--ink-red); --accent: #a8602a; --accent-ink: #fff8e8;
  --good: var(--ink-green); --bad: #b0321e; --line: rgba(80, 60, 30, .18); --line-strong: rgba(80, 60, 30, .32);
  --glass: rgba(120, 85, 40, .08); --glass-strong: rgba(120, 85, 40, .12); --tshadow: none;
}
/* левая страница: заглавие раздела, сводка, клавиши */
.book-left {
  position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; padding: 26px 20px 18px; overflow: hidden;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0) 78%, rgba(90, 58, 24, .22) 100%),
    radial-gradient(ellipse at 30% 15%, rgba(255, 255, 255, .4), transparent 55%),
    radial-gradient(ellipse at 70% 95%, rgba(150, 105, 45, .16), transparent 60%),
    var(--paper);
}
.bl-ic { font-size: 40px; line-height: 1; filter: drop-shadow(0 2px 2px rgba(80, 50, 20, .3)); }
#book .bl-title { font-size: 34px; line-height: 1.1; margin: 0; color: var(--ink-red); font-weight: 700; }
.bl-lines { font-size: 14px; line-height: 1.55; color: var(--ink); margin-top: 4px; }
.bl-lines b { color: var(--ink-red); }
.bl-lines i { color: var(--ink-dim); font-size: 13px; }
.bl-mark { width: 58px; height: 58px; margin-top: auto; opacity: .55; transform: rotate(-12deg); filter: sepia(.4); }
.bl-keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 10px; font-size: 11.5px; color: var(--ink-dim); margin-top: 8px; }
.bl-keys kbd, #book .book-page kbd { background: rgba(255, 255, 255, .5); border-color: rgba(80, 60, 30, .35); color: var(--ink); font-size: 10.5px; min-width: 18px; padding: 0 4px; }
/* правая страница: линейка и красное поле, линии едут вместе с текстом */
.book-right {
  overflow: auto; overscroll-behavior: contain; padding: 14px 22px 22px 44px; user-select: text; -webkit-user-select: text;
  background:
    linear-gradient(90deg, rgba(90, 58, 24, .24) 0, rgba(90, 58, 24, 0) 20px),
    linear-gradient(90deg, transparent 32px, var(--margin) 32px 33px, transparent 33px),
    repeating-linear-gradient(180deg, transparent 0 25px, var(--rule) 25px 26px),
    var(--paper);
  background-attachment: local;
  scrollbar-color: rgba(90, 60, 30, .45) transparent;
}
.book-page { font-size: 14px; line-height: 1.55; }
#book .dim { opacity: 1; color: var(--ink-dim); }
#book h4, #book .hand {
  font-family: var(--hand); color: var(--ink-red); font-size: 23px; line-height: 1.2; font-weight: 700;
  text-transform: none; letter-spacing: 0; margin: 12px 0 4px;
}
#book .book-page > h4:first-child, #book .book-page > div > .j-sec:first-child h4 { margin-top: 2px; }
.book-page .note { margin-top: 10px; font-style: italic; }
/* закладки */
.book-tabs { display: flex; flex-direction: column; gap: 5px; padding: 16px 0 6px; width: 160px; flex-shrink: 0; overflow-x: hidden; overflow-y: auto; scrollbar-width: none; }
.b-tab { flex-shrink: 0; }
.b-tab {
  --tc: #e9c46a;
  display: flex; align-items: center; gap: 7px; text-align: left; padding: 8px 10px 8px 16px; margin-left: -8px;
  border: none; border-radius: 0 10px 10px 0; cursor: pointer; color: var(--ink); text-shadow: none;
  background: linear-gradient(90deg, rgba(0, 0, 0, .14), rgba(0, 0, 0, 0) 14px), var(--tc);
  box-shadow: 2px 2px 5px rgba(0, 0, 0, .35); transform: translateX(-10px); transition: transform .15s, filter .15s;
}
.b-tab.c1 { --tc: #e39a7c; }
.b-tab.c2 { --tc: #a9c98f; }
.b-tab.c3 { --tc: #9dbdd6; }
.b-tab.c4 { --tc: #cdb0d9; }
.b-tab:hover { transform: translateX(-5px); filter: brightness(1.05); }
.b-tab.on { transform: translateX(0); filter: brightness(1.08); box-shadow: 3px 3px 8px rgba(0, 0, 0, .45); }
.b-tab.on .bt-t { font-weight: 800; }
.b-tab:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 1px; }
.bt-ic { font-size: 16px; line-height: 1; }
.bt-t { font-family: var(--hand); font-size: 18px; line-height: 1.1; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* содержимое книги на бумаге: дневник, задания, справочник, достижения */
.j-sec { margin: 8px 0; }
.j-list { display: flex; flex-wrap: wrap; gap: 4px; }
.j-list span { background: rgba(120, 85, 40, .1); border: 1px solid rgba(120, 85, 40, .22); border-radius: 7px; padding: 1px 8px; font-size: 12.5px; }
.j-list span.off { opacity: .45; border-style: dashed; }
#journal table { width: 100%; font-size: 13.5px; border-collapse: collapse; }
#journal td { padding: 2px 4px; border-bottom: 1px dotted rgba(80, 60, 30, .3); }
#journal td:last-child { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.q-day { padding: 3px 0; border-bottom: 1px dashed rgba(80, 60, 30, .22); }
.q-day.done { color: var(--ink-green); }
.q-day.fail { color: #a33a2a; text-decoration: line-through; }
#book .tk-sub { color: var(--ink-dim); font-size: 12.5px; }
.q-item { padding: 7px 0; border-bottom: 1px dashed rgba(80, 60, 30, .22); font-size: 13.5px; }
.q-item .name { font-weight: 700; }
.q-item .q-rew { color: #9a5a12; font-size: 12px; font-weight: 700; }
.q-item .desc { color: var(--ink-dim); font-size: 12.5px; }
.q-item .prog { display: flex; align-items: center; gap: 8px; font-size: 12px; color: #8a4f12; font-variant-numeric: tabular-nums; }
.q-bar { width: 130px; height: 6px; border-radius: 3px; overflow: hidden; background: rgba(80, 60, 30, .15); box-shadow: inset 0 0 0 1px rgba(80, 60, 30, .18); }
.q-bar span { display: block; height: 100%; background: linear-gradient(90deg, #c8853a, #a8602a); }
.q-item.done .name { color: var(--ink-green); }
.q-item.done .q-bar span { background: linear-gradient(90deg, #7fae55, #4f8a30); }
.g-item { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px dashed rgba(80, 60, 30, .22); }
.g-item canvas { background: radial-gradient(circle at 50% 60%, rgba(255, 255, 255, .55), rgba(120, 85, 40, .12)); border-radius: 50%; flex-shrink: 0; box-shadow: inset 0 0 0 1px rgba(80, 60, 30, .2); }
.g-item .name { font-weight: 700; }
.g-item .pts { font-size: 12.5px; color: var(--ink-dim); }
.g-item .pts i { color: var(--ink); }
.g-item.edible .name { color: var(--ink-green); }
.g-item.poison .name { color: #b0321e; }
#book .ach { border-bottom: 1px dashed rgba(80, 60, 30, .22); opacity: .5; }
#book .ach.on { opacity: 1; }

/* ---------- экран загрузки ---------- */
#loading {
  position: absolute; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, #22301d 0%, #11180f 70%); transition: opacity .6s;
}
#loading.fade { opacity: 0; pointer-events: none; }
.load-box { text-align: center; }
.load-box .brand-mark { width: 84px; height: 84px; animation: bob 2.4s ease-in-out infinite; }
.load-box h1 { font-size: 44px; font-weight: 800; letter-spacing: 1px; margin: 8px 0 18px; }
.load-bar { width: 200px; height: 3px; margin: 0 auto; border-radius: 9px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.load-bar span { display: block; width: 40%; height: 100%; border-radius: 9px; background: var(--accent); animation: loadRun 1.3s ease-in-out infinite; }
.load-text { margin-top: 12px; font-size: 13px; color: var(--text-dim); }
@keyframes bob { 50% { transform: translateY(-6px); } }
@keyframes loadRun { 0% { transform: translateX(-100%); } 100% { transform: translateX(250%); } }

/* ---------- узкий экран с мышью ---------- */
@media (max-width: 760px) {
  .card.menu { width: 100%; }
  .screen { padding: 5vh 24px 4vh; }
  .brand h1 { font-size: 48px; }
  .brand-mark { width: 58px; height: 58px; }
  .pause-grid { grid-template-columns: 1fr; }
  #overlay.mode-menu { background: linear-gradient(90deg, rgba(9, 13, 7, .8), rgba(9, 13, 7, .4)); }
}
/* книга на узком или невысоком экране: одна страница, закладки сверху */
@media (max-width: 760px), (max-height: 520px) {
  .book-body { flex-direction: column; padding: 0 10px 10px; }
  .book-tabs { order: -1; flex-direction: row; width: auto; padding: 0 4px; gap: 4px; overflow-x: auto; scrollbar-width: none; flex-shrink: 0; }
  .b-tab { margin: 0; padding: 6px 10px 9px; border-radius: 9px 9px 0 0; transform: translateY(5px); background: var(--tc); }
  .b-tab:hover { transform: translateY(3px); }
  .b-tab.on { transform: none; }
  .bt-t { font-size: 16px; }
  .book-spread { grid-template-columns: 1fr; border-radius: 4px; }
  .book-left { display: none; }
  .book-right { padding: 10px 14px 16px 36px; background-position: 0 0, -6px 0, 0 0, 0 0; }
  #book h3 { font-size: 21px; padding: 6px 10px 4px 16px; }
}
/* невысокий экран (телефон лёжа): меню плотнее */
@media (max-height: 560px) {
  .screen { padding-top: 16px; padding-bottom: 12px; }
  .screen.sub { padding-top: 8px; padding-bottom: 8px; }
  .screen.sub::before { top: 4px; bottom: 4px; }
  .brand { gap: 12px; margin-bottom: 4px; }
  .brand h1 { font-size: 38px; }
  .brand-mark { width: 44px; height: 44px; }
  .tagline { font-size: 13px; margin-top: 2px; }
  .info-line { margin-bottom: 8px; font-size: 13px; }
  .mbtn { font-size: 17px; padding: 5px 16px; }
  .menu-foot { display: none; }
  .card.glass { padding: 16px 20px; }
  .card h1 { font-size: 24px; margin-bottom: 8px; }
}
/* невысокое окно с мышью: карта поменьше, чтобы не наезжала на задания */
@media (max-height: 640px) and (hover: hover) {
  .map-ring { width: 124px; height: 124px; }
}


/* «Начать всё с нуля»: красная, чтобы не нажать случайно */
.btn.danger { background: linear-gradient(180deg, #b8402e, #8a2a1c); color: #fff; border: 1px solid rgba(0, 0, 0, .4); padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 700; margin: 4px 0 6px; }
.btn.danger:hover { filter: brightness(1.12); }
.mbtn.wipe-btn { color: #ffb4a6; }
