* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; overflow: hidden; color: var(--fg); font-family: var(--font-body); font-size: 15px; line-height: 1.55;
  background:
    radial-gradient(110% 55% at 50% -12%, rgba(255, 43, 71, 0.15), transparent 60%),
    linear-gradient(rgba(255, 255, 255, 0.017) 1px, transparent 1px) 0 0 / 100% 32px,
    var(--bg);
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--red); outline-offset: 2px; }
h1, h2, h3, h4 { text-wrap: balance; }

.shell { height: 100%; display: grid; grid-template-rows: 1fr auto; }
.rail { grid-row: 2; }
.view { grid-row: 1; overflow-y: auto; overflow-x: hidden; min-height: 0; }
.view[data-mode='chat'] { overflow: hidden; }

/* Нижнее меню (телефон) */
.rail {
  border-top: 1px solid var(--line); background: rgba(8, 7, 10, 0.96); backdrop-filter: blur(10px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
}
.rail-brand, .rail-foot { display: none; }
.nav-items { display: grid; grid-template-columns: repeat(4, 1fr); }
.nav-lbl .long { display: none; }
.nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 2px 8px;
  background: none; border: 0; color: var(--muted); font-size: 11px; font-weight: 600;
}
.nav-btn.active { color: var(--fg); }
.nav-btn.active .nav-ic { color: var(--red); filter: drop-shadow(0 0 6px rgba(255, 43, 71, 0.7)); }

/* Боковая панель (широкий экран) */
@media (min-width: 900px) {
  .shell { grid-template-rows: none; grid-template-columns: var(--rail) 1fr; }
  .rail {
    grid-row: 1; grid-column: 1; border-top: 0; border-right: 1px solid var(--line);
    display: flex; flex-direction: column; gap: 22px;
    padding-block: 22px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: 16px;
  }
  .view { grid-row: 1; grid-column: 2; }
  .rail-brand { display: flex; align-items: center; gap: 10px; padding: 4px; background: none; border: 0; text-align: left; color: var(--fg); }
  .rail-brand-txt { line-height: 1.1; }
  .rail-brand-txt b { display: block; font-family: var(--font-display); font-weight: 800; font-size: 14px; letter-spacing: 0.06em; }
  .rail-brand-txt span { font-family: var(--font-mono); font-size: 10px; color: var(--red); letter-spacing: 0.16em; }
  .nav-items { display: flex; flex-direction: column; gap: 4px; }
  .nav-lbl .long { display: inline; } .nav-lbl .short { display: none; }
  .nav-btn { flex-direction: row; gap: 12px; padding: 10px 12px; border-radius: 11px; font-size: 14px; }
  .nav-btn:hover { background: var(--panel); color: var(--fg); }
  .nav-btn.active { background: var(--red-soft); box-shadow: inset 0 0 0 1px rgba(255, 43, 71, 0.35); }
  .rail-foot { display: flex; flex-direction: column; gap: 10px; margin-top: auto; }
  .rail-about { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 10px; background: none; border: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 600; }
  .rail-about:hover, .rail-about.active { color: var(--fg); border-color: var(--red); }
  .rail-note { margin: 0 4px; font-size: 12px; color: var(--muted); }
}

.page {
  max-width: 1000px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px;
  padding-block: 20px 40px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.mark {
  width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: #0b0a0d; border: 1px solid var(--red); box-shadow: var(--glow);
}

.page-head { display: flex; align-items: center; gap: 12px; }
.page-head-txt { flex: 1; min-width: 0; }
.page-head h1 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: clamp(20px, 4.4vw, 28px); line-height: 1.15; }
.eyebrow { display: block; font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--red); margin-bottom: 4px; }
.back {
  width: 38px; height: 38px; flex: none; border-radius: 11px; border: 1px solid var(--line); background: var(--panel);
  display: grid; place-items: center; color: var(--fg);
}
.back:hover { border-color: var(--red); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.page.wide { max-width: 1180px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.only-sm { display: none; }
@media (max-width: 1099px) { .only-sm { display: inline-flex; } }
