/* Оболочка сайта: верхняя панель и сцена с фреймами блоков.
   Цвета и шрифты — только из tokens.css (общие с блоком 2). */
:root { --bar-h: 52px; --rail-h: 40px; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--c-void); overflow: hidden; }
body { display: flex; flex-direction: column; font-family: var(--f-pixel); color: var(--c-paper); -webkit-font-smoothing: none; }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- панель ---------- */
.bar {
  flex: none; height: var(--bar-h); display: flex; align-items: stretch; gap: 12px;
  padding: 0 12px 0 8px; background: var(--c-desk-0);
  border-bottom: 4px solid var(--c-desk-3);
  box-shadow: inset 0 -4px 0 var(--c-void);
  position: relative; z-index: 30; min-width: 0;
}
.bar__brand {
  flex: none; display: flex; align-items: center; gap: 10px; padding: 0 8px 0 4px;
  background: none; border: 0; text-align: left;
}
.bar__brand img { width: 36px; height: 36px; image-rendering: pixelated; display: block; }
.bar__brand-text { font-family: var(--f-8bit); font-size: 10px; line-height: 1.6; letter-spacing: .04em; color: var(--c-amber-l); text-transform: uppercase; white-space: nowrap; }
.bar__brand:hover .bar__brand-text { color: var(--c-paper); }

.tabs { flex: none; display: flex; align-items: flex-end; gap: 4px; padding-top: 8px; }
.tabs__sep { align-self: center; width: 4px; height: 24px; margin: 0 6px; background: var(--c-desk-3); }
.tab {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px;
  background: var(--c-desk-2); border: 0; border-top: 4px solid var(--c-desk-3);
  color: var(--c-paper-2); font-size: 22px; font-weight: 600; letter-spacing: .02em; white-space: nowrap;
}
.tab:hover { background: var(--c-desk-3); color: var(--c-paper); }
.tab:focus-visible, .inblock button:focus-visible, .pdf:focus-visible, .bar__fs:focus-visible, .bar__brand:focus-visible, .menu__item:focus-visible { outline: 4px solid var(--c-amber-l); outline-offset: -4px; }
.tab__no {
  display: grid; place-items: center; width: 24px; height: 24px; background: var(--c-desk-0); color: var(--c-amber-l);
  font-family: var(--f-8bit); font-size: 12px; line-height: 1;
}
.tab.is-active { background: var(--c-paper); border-top-color: var(--c-amber); color: var(--c-ink); height: 40px; }
.tab.is-active .tab__no { background: var(--c-red); color: var(--c-paper); }
.tab.is-hint { animation: tab-hint 1.2s steps(6, end) 1; }
@keyframes tab-hint { 0%, 40%, 80% { background: var(--c-amber); color: var(--c-ink); } 20%, 60%, 100% { background: var(--c-desk-2); } }

/* навигация внутри блока */
.inblock { flex: 1 1 auto; min-width: 0; overflow: hidden; display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.inblock__menu {
  flex: 0 1 460px; min-width: 120px; max-width: 460px; height: 36px; display: flex; align-items: center; gap: 10px; padding: 0 12px;
  background: var(--c-wall); border: 0; box-shadow: inset 0 0 0 2px var(--c-wall-3);
  color: var(--c-paper); font-size: 20px; font-weight: 500;
}
.inblock__menu:hover, .inblock__menu[aria-expanded="true"] { background: var(--c-wall-2); }
.inblock__burger { flex: none; width: 16px; height: 12px; background: linear-gradient(var(--c-amber-l) 0 0) 0 0 / 100% 2px no-repeat, linear-gradient(var(--c-amber-l) 0 0) 0 5px / 100% 2px no-repeat, linear-gradient(var(--c-amber-l) 0 0) 0 10px / 100% 2px no-repeat; }
.inblock__title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inblock__pos { flex: none; min-width: 84px; text-align: center; font-family: var(--f-8bit); font-size: 12px; color: var(--c-paper-2); white-space: nowrap; }

/* кнопка карты памяти */
.pdf {
  flex: none; align-self: center; height: 38px; display: flex; align-items: center; gap: 10px; padding: 0 14px 0 10px;
  background: var(--c-amber); color: var(--c-ink); text-decoration: none;
  box-shadow: inset 0 -4px 0 var(--c-amber-d), inset 0 0 0 2px var(--c-amber-l);
  font-size: 22px; font-weight: 700; line-height: 1; white-space: nowrap;
}
.pdf:hover { background: var(--c-amber-l); }
.pdf:active { transform: translateY(2px); box-shadow: inset 0 -2px 0 var(--c-amber-d), inset 0 0 0 2px var(--c-amber-l); }
.pdf__text { display: flex; flex-direction: column; gap: 3px; }
.pdf__text small { font-family: var(--f-8bit); font-size: 8px; letter-spacing: .06em; color: var(--c-ink-2); }
.pdf__icon { width: 20px; height: 22px; background:
  linear-gradient(var(--c-ink) 0 0) 8px 0 / 4px 12px no-repeat,
  linear-gradient(var(--c-ink) 0 0) 4px 8px / 12px 4px no-repeat,
  linear-gradient(var(--c-ink) 0 0) 6px 12px / 8px 4px no-repeat,
  linear-gradient(var(--c-ink) 0 0) 0 18px / 20px 4px no-repeat; }

.bar__fs { flex: none; align-self: center; margin-left: auto; width: 36px; height: 36px; padding: 0; background: var(--c-desk-2); border: 0; box-shadow: inset 0 0 0 2px var(--c-desk-3); display: grid; place-items: center; }
.bar__fs:hover { background: var(--c-desk-3); }
.bar__fs span { width: 16px; height: 16px; background:
  linear-gradient(var(--c-paper) 0 0) 0 0 / 6px 2px no-repeat, linear-gradient(var(--c-paper) 0 0) 0 0 / 2px 6px no-repeat,
  linear-gradient(var(--c-paper) 0 0) 100% 0 / 6px 2px no-repeat, linear-gradient(var(--c-paper) 0 0) 100% 0 / 2px 6px no-repeat,
  linear-gradient(var(--c-paper) 0 0) 0 100% / 6px 2px no-repeat, linear-gradient(var(--c-paper) 0 0) 0 100% / 2px 6px no-repeat,
  linear-gradient(var(--c-paper) 0 0) 100% 100% / 6px 2px no-repeat, linear-gradient(var(--c-paper) 0 0) 100% 100% / 2px 6px no-repeat; }

/* ---------- сцена ---------- */
.stage { flex: 1 1 auto; min-height: 0; position: relative; background: var(--c-void); }
.stage__frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: var(--c-void); }
.stage__loading { position: absolute; inset: 0; display: grid; place-items: center; z-index: 5; background: var(--c-desk-0); }
.stage__loading-card { display: flex; align-items: center; gap: 16px; padding: 20px 28px; background: var(--c-paper); color: var(--c-ink); font-size: 28px; font-weight: 600; box-shadow: var(--sh-paper); }
.stage__loading-dot { width: 16px; height: 16px; background: var(--c-red); animation: blink 1s steps(2, end) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- нижняя рейка: сквозное листание ---------- */
.rail {
  flex: none; height: var(--rail-h); position: relative; z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 0 8px 0 16px; background: var(--c-desk-0); border-top: 4px solid var(--c-desk-3);
}
.rail__progress { position: absolute; left: 0; right: 0; top: -4px; height: 4px; background: var(--c-desk-3); }
.rail__progress span { display: block; height: 100%; width: 0; background: var(--c-amber); transition: width var(--t-med) steps(8, end); }
.rail__where { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 19px; font-weight: 500; letter-spacing: .02em; color: var(--c-paper-2); }
.rail__hint { flex: none; font-family: var(--f-doc); font-size: 13px; color: var(--c-paper-3); white-space: nowrap; }
@media (max-width: 1100px) { .rail__hint { display: none; } }
.rail__where b { color: var(--c-amber-l); font-weight: 600; }
.rail__btn { flex: none; height: 30px; padding: 0; border: 0; display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 22px; font-weight: 700; line-height: 1; white-space: nowrap; }
.rail__btn i { font-style: normal; font-size: 14px; }
.rail__btn--prev { width: 44px; background: var(--c-desk-2); color: var(--c-paper); box-shadow: inset 0 0 0 2px var(--c-desk-3); font-size: 14px; }
.rail__btn--prev:hover { background: var(--c-desk-3); }
.rail__btn--next { min-width: 168px; padding: 0 16px; background: var(--c-amber); color: var(--c-ink); box-shadow: inset 0 -4px 0 var(--c-amber-d), inset 0 0 0 2px var(--c-amber-l); }
.rail__btn--next:hover { background: var(--c-amber-l); }
.rail__btn:active { transform: translateY(2px); }
.rail__btn:focus-visible { outline: 4px solid var(--c-paper); outline-offset: -4px; }
.rail__btn.is-end { background: var(--c-desk-2); color: var(--c-paper-3); box-shadow: inset 0 0 0 2px var(--c-desk-3); }

/* ---------- содержание блока ---------- */
.menu-backdrop { position: fixed; inset: var(--bar-h) 0 var(--rail-h) 0; z-index: 20; background: rgba(13, 12, 11, .55); }
.menu {
  position: fixed; top: calc(var(--bar-h) + 8px); right: 12px; bottom: calc(var(--rail-h) + 12px); z-index: 25; width: min(520px, calc(100vw - 24px));
  display: flex; flex-direction: column; background: var(--c-paper); color: var(--c-ink);
  box-shadow: 0 0 0 4px var(--c-ink), var(--sh-lift);
}
.menu__head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 8px 10px 16px; background: var(--c-ink); color: var(--c-paper); font-size: 24px; font-weight: 700; }
.menu__close { width: 36px; height: 36px; padding: 0; background: none; border: 0; color: var(--c-paper); font-family: var(--f-doc); font-size: 28px; line-height: 1; }
.menu__close:hover { background: var(--c-red); }
.menu__list { flex: 1 1 auto; overflow-y: auto; padding: 4px 0 12px; scrollbar-color: var(--c-paper-4) var(--c-paper-2); }
.menu__group { padding: 14px 16px 6px; font-family: var(--f-8bit); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--c-red-d); border-bottom: 2px solid var(--c-paper-3); margin-bottom: 2px; }
.menu__item { width: 100%; display: flex; align-items: baseline; gap: 12px; padding: 7px 16px; background: none; border: 0; text-align: left; font-family: var(--f-doc); font-size: 16px; line-height: 1.35; color: var(--c-ink); }
.menu__item:hover { background: var(--c-paper-2); }
.menu__item.is-current { background: var(--c-amber-l); font-weight: 700; }
.menu__no { flex: none; min-width: 2ch; font-family: var(--f-doc); font-size: 14px; font-weight: 700; color: var(--c-ink-3); }
.menu__item.is-current .menu__no { color: var(--c-red-d); }

/* ---------- узкие окна (ноутбук 1280–1500) ---------- */
@media (max-width: 1800px) {
  .bar__brand-text { display: none; }
}
@media (max-width: 1560px) {
  .bar { gap: 8px; }
  .tab { padding: 0 10px; font-size: 20px; }
  .inblock__menu { max-width: 300px; }
}
@media (max-width: 1470px) {
  .tab { padding: 0 8px; font-size: 18px; gap: 6px; }
  .inblock__menu { max-width: 200px; font-size: 18px; }
  .pdf__text small { display: none; }
  .inblock__pos { min-width: 70px; }
}
@media (max-width: 1340px) {
  .bar { gap: 6px; padding: 0 8px 0 4px; }
  .bar__brand { padding: 0 2px; }
  .tab { padding: 0 6px; font-size: 17px; gap: 5px; }
  .tab__no { width: 20px; height: 20px; font-size: 10px; }
  .tabs__sep { margin: 0 2px; }
  .inblock { gap: 4px; }
  .inblock__menu { min-width: 96px; padding: 0 8px; gap: 6px; }
  .inblock__pos { min-width: 62px; font-size: 10px; }
  .pdf { padding: 0 10px 0 8px; font-size: 19px; gap: 6px; }
}
