/* ============================================================================
   Журнал Путешественника — оформление в стиле игрового интерфейса.
   Тёмно-синие панели с золотой рамкой, медальоны категорий с процентом,
   плитки с иконками, золотые полосы прогресса.
   ========================================================================== */

@font-face {
  font-family: 'GI';
  src: url('../fonts/gi.woff') format('woff');
  font-display: swap;
}

:root {
  /* тёмная тема — основная, как в игре */
  --bg: #0d1524;
  --bg-2: #101a2c;
  --panel: #1b2a4a;
  --panel-2: #22345c;
  --panel-3: #16233d;
  --panel-4: #0c1424;
  --bd: #35486e;
  --bd-soft: #2a3a5c;
  --gold: #e7c983;
  --gold-2: #c9a558;
  --gold-3: #8a6f38;
  --gold-glow: rgba(231, 201, 131, .45);
  --tx: #ece4d4;
  --mut: #97a5c0;
  --ok: #7fd39a;
  --warn: #e8a33d;
  --danger: #e2705f;
  --shadow: 0 6px 18px rgb(0 0 0 / 30%);

  --pyro: #ef6b4a;
  --hydro: #4aa8ef;
  --anemo: #3fbf9c;
  --electro: #a56be0;
  --dendro: #7fb83a;
  --cryo: #6cc3d8;
  --geo: #d9a82f;

  --r5: #e0a528;
  --r4: #a46be0;

  --r-sm: 4px;
  --r: 6px;
  --r-lg: 12px;
  --nav-h: 64px;
  color-scheme: dark;
}

/* светлая тема — светлые панели с теми же золотыми акцентами */
:root[data-theme='light'] {
  color-scheme: light;
  --bg: #e8edf6;
  --bg-2: #dfe6f2;
  --panel: #ffffff;
  --panel-2: #f4f7fc;
  --panel-3: #f7f9fd;
  --panel-4: #eaeff8;
  --bd: #c6d1e4;
  --bd-soft: #d8e0ee;
  --gold: #a8802a;
  --gold-2: #8c6a22;
  --gold-3: #d8c9a4;
  --gold-glow: rgba(168, 128, 42, .28);
  --tx: #2c3550;
  --mut: #6c7891;
  --ok: #3f9e63;
  --warn: #b8730f;
  --danger: #c0472f;
  --shadow: 0 5px 16px rgb(44 53 80 / 12%);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme='dark']) {
    color-scheme: light;
    --bg: #e8edf6;
    --bg-2: #dfe6f2;
    --panel: #ffffff;
    --panel-2: #f4f7fc;
    --panel-3: #f7f9fd;
    --panel-4: #eaeff8;
    --bd: #c6d1e4;
    --bd-soft: #d8e0ee;
    --gold: #a8802a;
    --gold-2: #8c6a22;
    --gold-3: #d8c9a4;
    --gold-glow: rgba(168, 128, 42, .28);
    --tx: #2c3550;
    --mut: #6c7891;
    --ok: #3f9e63;
    --warn: #b8730f;
    --danger: #c0472f;
    --shadow: 0 5px 16px rgb(44 53 80 / 12%);
  }
}

* { box-sizing: border-box; }

/* Скрытые окна и уведомления не должны перехватывать нажатия:
   без этого правила display:grid у .modal-root перебивал атрибут hidden,
   и в Safari невидимое окно накрывало всё приложение. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--panel-2) 60%, transparent), transparent 70%),
    var(--bg);
  color: var(--tx);
  font: 15px/1.45 'GI', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  overscroll-behavior-y: none;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, b, strong, summary { font-weight: 400; font-synthesis: none; }
b, strong, summary { font-weight: 600; }

h1 { font-size: 17px; margin: 0; }
h2 { font-size: 16px; margin: 18px 0 8px; color: var(--gold); }
h3 { font-size: 15px; margin: 14px 0 6px; color: var(--gold); }

a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--panel);
  padding: 10px 14px;
  z-index: 100;
}
.skip:focus { left: 0; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: var(--r-sm); }

/* ---------- шапка ---------- */
header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(9px + env(safe-area-inset-top, 0px)) 14px 9px;
  background: var(--bg);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.3) blur(10px);
  -webkit-backdrop-filter: saturate(1.3) blur(10px);
  border-bottom: 1px solid var(--bd-soft);
}
header::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-3), transparent);
  opacity: .7;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex: 1 1 auto;
  color: var(--gold);
  font-size: 17px;
}
.brand .mark { font-size: 18px; color: var(--gold); text-shadow: 0 0 10px var(--gold-glow); }
.brand span[data-title-text] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbtns { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }

.icon-btn {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  font: inherit;
  font-size: 15px;
  color: var(--gold);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--gold-3);
  border-radius: 50%;
  cursor: pointer;
}
.icon-btn:hover { border-color: var(--gold); }

/* кнопка профиля: аватар со значком состояния синхронизации */
.avatar-btn {
  position: relative;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid var(--gold-3);
  border-radius: 50%;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  cursor: pointer;
  display: grid;
  place-items: center;
}
.avatar-btn:hover { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold-glow); }
.avatar-art {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  font-size: 14px;
  color: var(--gold);
  background: radial-gradient(circle at 50% 35%, var(--panel-2), var(--panel-4));
  border: 1px solid var(--gold-3);
  border-radius: 50%;
}
.avatar-btn[data-signed='1'] .avatar-art { color: var(--bg); background: linear-gradient(180deg, var(--gold), var(--gold-2)); }
.avatar-dot {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 2px solid var(--bg);
  background: var(--mut);
}
.avatar-dot[data-state='synced'] { background: var(--ok); }
.avatar-dot[data-state='busy'] { background: var(--gold); }
.avatar-dot[data-state='error'] { background: var(--danger); }
.avatar-dot[data-state='offline'] { background: var(--warn); }

main {
  max-width: 780px;
  margin: 0 auto;
  padding: 14px;
  outline: none;
}

/* ---------- нижняя навигация ---------- */
nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  background: linear-gradient(180deg, var(--panel), var(--panel-4));
  border-top: 1px solid var(--gold-3);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
nav button {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--mut);
  font: inherit;
  font-size: 11px;
  padding: 9px 2px 8px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  position: relative;
}
nav button b { font-size: 18px; font-weight: 400; line-height: 1; }
nav button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
nav button.on { color: var(--gold); }
nav button.on::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 26px;
  height: 2px;
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold-glow);
}

/* ---------- панели ---------- */
.card,
.panel {
  position: relative;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--gold-3);
  border-radius: var(--r);
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: var(--shadow), inset 0 1px 0 rgb(255 255 255 / 6%);
}
.card::after,
.panel::after {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px solid color-mix(in srgb, var(--gold) 16%, transparent);
  border-radius: calc(var(--r) - 2px);
  pointer-events: none;
}
.card > :first-child, .panel > :first-child { margin-top: 0; }
.card > :last-child, .panel > :last-child { margin-bottom: 0; }

/* панель внутри панели — без двойной рамки */
.card .card, .panel .panel {
  background: var(--panel-3);
  border-color: var(--bd-soft);
  box-shadow: none;
}
.card .card::after, .panel .panel::after { display: none; }

/* заголовок раздела с эмблемой и золотой линией */
.section-head {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 16px 0 10px;
}
.section-head .emblem { color: var(--gold); font-size: 17px; line-height: 1; }
.section-head h2 { margin: 0; font-size: 16px; color: var(--gold); }
.section-head .rule {
  flex: 1 1 auto;
  height: 1px;
  background: linear-gradient(90deg, var(--gold-3), transparent);
}
.section-head .count { color: var(--mut); font-size: 12px; white-space: nowrap; }

.cols { display: grid; grid-template-columns: 1fr; gap: 10px; align-items: start; }
.cols > .card { margin-bottom: 0; }

.row { display: flex; align-items: center; gap: 10px; }
.row.sp { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }

.mut { color: var(--mut); font-size: 13px; }
.small { font-size: 12px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.hide { display: none !important; }
.mono { font-variant-numeric: tabular-nums; }

/* ---------- кнопки и чипсы ---------- */
.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 4px 0 10px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  font: inherit;
  font-size: 13px;
  color: var(--tx);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--gold-3);
  border-radius: var(--r);
  padding: 7px 12px;
  cursor: pointer;
}
.chip.on {
  background: linear-gradient(180deg, var(--gold), var(--gold-2));
  border-color: var(--gold);
  color: #1a1508;
  font-weight: 600;
}
.chip.ghost { background: none; color: var(--mut); border-color: var(--bd); }

.btn {
  font: inherit;
  font-weight: 600;
  color: #1a1508;
  background: linear-gradient(180deg, var(--gold), var(--gold-2));
  border: 1px solid var(--gold-2);
  border-radius: var(--r);
  padding: 10px 15px;
  cursor: pointer;
  box-shadow: 0 3px 10px rgb(0 0 0 / 25%);
}
.btn.g { background: none; color: var(--tx); border-color: var(--gold-3); box-shadow: none; }
.btn.d { background: none; color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, var(--bd)); box-shadow: none; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.block { width: 100%; }

input, select, textarea {
  font: inherit;
  color: var(--tx);
  background: var(--panel-4);
  border: 1px solid var(--bd);
  border-radius: var(--r);
  padding: 9px 10px;
  width: 100%;
  min-width: 0;
}
input:focus, select:focus, textarea:focus { border-color: var(--gold-3); outline: none; }
input::placeholder, textarea::placeholder { color: var(--mut); }
textarea { min-height: 64px; resize: vertical; }
label { display: block; font-size: 12px; color: var(--mut); margin: 10px 0 4px; }
input[type='file'] { padding: 7px; }
select option { background: var(--panel); color: var(--tx); }

.slots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }

@media (hover: hover) {
  .chip:hover, .btn:hover { filter: brightness(1.08); }
  .ach:hover { background: color-mix(in srgb, var(--gold) 8%, transparent); }
}

/* ---------- полосы прогресса (в стиле ранга приключений) ---------- */
.bar, .rank {
  height: 9px;
  border-radius: 5px;
  background: var(--panel-4);
  border: 1px solid var(--bd-soft);
  overflow: hidden;
}
.bar i, .rank i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--gold-2), var(--gold));
  box-shadow: 0 0 8px var(--gold-glow);
  transition: width .35s ease;
}
.bar.ok i, .rank.ok i { background: linear-gradient(90deg, #4f9d69, var(--ok)); box-shadow: none; }

/* ---------- медальоны категорий и регионов ---------- */
.crests {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(94px, 1fr));
  gap: 8px;
}
.crest {
  position: relative;
  font: inherit;
  color: var(--tx);
  background: none;
  border: 0;
  padding: 0 0 2px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  content-visibility: auto;
  contain-intrinsic-size: auto 132px;
}
.crest-art { width: 100%; max-width: 92px; display: block; }
.crest-art svg { width: 100%; height: auto; display: block; }
.crest-name {
  font-size: 11.5px;
  line-height: 1.2;
  text-align: center;
  color: var(--tx);
  overflow-wrap: anywhere;
  max-width: 100%;
}
.crest-pct { font-size: 11px; color: var(--mut); font-variant-numeric: tabular-nums; }
.crest-full .crest-pct, .crest-full .crest-name { color: var(--gold); }
.crest:hover .crest-art, .crest:focus-visible .crest-art { filter: brightness(1.12) drop-shadow(0 0 8px var(--gold-glow)); }
.crest:active { transform: translateY(1px); }

/* части медальона задаются классами — так они подчиняются теме оформления */
.crest-plate {
  fill: color-mix(in srgb, var(--crest-tint, var(--gold)) 16%, var(--panel-4));
  stroke: color-mix(in srgb, var(--crest-tint, var(--gold-3)) 75%, var(--gold-3));
  stroke-width: 2.5;
}
.crest-inner {
  fill: none;
  stroke: color-mix(in srgb, var(--gold) 32%, transparent);
  stroke-width: 1;
}
.crest-glyph { fill: var(--crest-tint, var(--gold)); color: var(--crest-tint, var(--gold)); }
.crest-full .crest-plate {
  fill: color-mix(in srgb, var(--gold) 30%, var(--panel-4));
  stroke: var(--gold);
}
.crest-full .crest-glyph { fill: var(--gold); color: var(--gold); }
.crest-full .crest-art { filter: drop-shadow(0 0 6px var(--gold-glow)); }
.emblem-svg { width: 1.15em; height: 1.15em; vertical-align: -.2em; }
.icon-svg { width: 1.05em; height: 1.05em; color: var(--gold); vertical-align: -.16em; }

/* ---------- плитки с иконками ---------- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr));
  gap: 8px;
}
.tile {
  font: inherit;
  color: var(--tx);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--bd);
  border-radius: var(--r);
  padding: 10px 6px 9px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.tile .ico {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  font-size: 18px;
  color: var(--gold);
  border: 1px solid var(--gold-3);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, var(--panel-2), var(--panel-4));
}
.tile .t-name { font-size: 11.5px; line-height: 1.2; }
@media (hover: hover) { .tile:hover { border-color: var(--gold-3); } }

/* ---------- достижения ---------- */
details {
  border: 1px solid var(--bd-soft);
  border-radius: var(--r);
  background: var(--panel-3);
  margin-bottom: 8px;
  padding: 8px 12px;
}
details > summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; align-items: baseline; gap: 6px; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: '▸'; color: var(--gold); font-size: 12px; }
details[open] > summary::before { content: '▾'; }

.ach {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 9px 0;
  border-bottom: 1px solid var(--bd-soft);
  cursor: pointer;
  content-visibility: auto;
  contain-intrinsic-size: auto 62px;
}
.ach:last-child { border-bottom: 0; }
.ach .ck {
  flex: none;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border: 2px solid var(--bd);
  border-radius: 7px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 13px;
  line-height: 1;
}
.done .ck { background: linear-gradient(180deg, var(--ok), #4f9d69); border-color: var(--ok); }
.done .t { text-decoration: line-through; color: var(--mut); }
.ach .t { line-height: 1.3; }
.ach .meta { color: var(--mut); font-size: 12px; margin-top: 2px; }

/* заголовок открытой категории */
.cat-head { display: flex; align-items: center; gap: 12px; }
.cat-head .crest-art { width: 54px; flex: none; }

/* ---------- персонажи ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; }

.ch {
  position: relative;
  border: 1px solid var(--bd);
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  padding: 8px 6px 9px;
  text-align: center;
  cursor: pointer;
  opacity: .55;
  transition: transform .15s ease, opacity .15s ease;
  content-visibility: auto;
  contain-intrinsic-size: auto 150px;
}
.ch.own { opacity: 1; border-color: var(--gold-3); }
.ch:active { transform: scale(.97); }
@media (hover: hover) { .ch:hover { transform: translateY(-2px); } }
.ch.q5 { box-shadow: inset 0 -3px 0 var(--r5); }
.ch.q4 { box-shadow: inset 0 -3px 0 var(--r4); }
.ch .pic {
  width: 100%;
  aspect-ratio: 104 / 79;
  object-fit: cover;
  border-radius: var(--r-sm);
  margin: 0 auto 6px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 24px;
  background: var(--panel-4);
}
.ch .nm { display: block; font-size: 13px; line-height: 1.2; margin-bottom: 2px; overflow-wrap: anywhere; }
.ch small { display: block; color: var(--mut); font-size: 11px; line-height: 1.25; overflow-wrap: anywhere; }
.st { font-size: 11px; letter-spacing: .5px; margin-bottom: 3px; }
.st.r5 { color: var(--r5); }
.st.r4 { color: var(--r4); }
.ch .ok {
  position: absolute;
  top: 4px;
  right: 5px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--gold), var(--gold-2));
  color: #1a1508;
  font-size: 12px;
  display: grid;
  place-items: center;
  box-shadow: 0 1px 4px rgb(0 0 0 / 35%);
}

.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }

/* ---------- отряды ---------- */
.res { font-size: 13px; color: var(--gold); margin-top: 6px; }
.member { display: inline-flex; align-items: center; gap: 2px; }

/* ---------- модальные окна ---------- */
.modal-root {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgb(4 8 16 / 65%);
  display: grid;
  place-items: center;
  padding: 14px;
  overflow: auto;
}
.md {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--gold-3);
  border-radius: var(--r-lg);
  padding: 16px;
  width: 100%;
  max-width: 560px;
  max-height: min(88vh, 900px);
  overflow: auto;
  box-shadow: 0 24px 60px rgb(0 0 0 / 50%);
}
.md h2 { margin-top: 0; }
.md h3 { margin-top: 18px; }
.md p { margin: 10px 0; }
.md ol, .md ul { padding-left: 20px; margin: 8px 0; }
.md li { margin-bottom: 5px; }
.md code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: var(--panel-4);
  border: 1px solid var(--bd-soft);
  border-radius: var(--r-sm);
  padding: 1px 5px;
  overflow-wrap: anywhere;
  color: var(--gold);
}
.sep { height: 1px; background: linear-gradient(90deg, transparent, var(--gold-3), transparent); margin: 16px 0; border: 0; }

/* карточка аккаунта */
.account {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: var(--r);
  background:
    radial-gradient(140px 90px at 88% 20%, color-mix(in srgb, var(--gold) 22%, transparent), transparent 70%),
    linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--gold-3);
}
.account-avatar {
  width: 62px;
  height: 62px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--gold-3);
  background: radial-gradient(circle at 50% 30%, var(--panel-2), var(--panel-4));
  display: grid;
  place-items: center;
  font-size: 26px;
  color: var(--gold);
}
.account-name { font-size: 17px; color: var(--gold); line-height: 1.2; overflow-wrap: anywhere; }
.account-line { display: flex; justify-content: space-between; gap: 10px; font-size: 12px; margin-top: 6px; }
.account-line span:first-child { color: var(--mut); }
.account-rank { margin-top: 8px; }

/* ---------- события ---------- */
.event-pic {
  width: 72px;
  height: 72px;
  flex: none;
  border-radius: var(--r-sm);
  border: 1px solid var(--gold-3);
  object-fit: cover;
  background: var(--panel-4);
}
.event-pic-empty { display: grid; place-items: center; color: var(--gold); font-size: 22px; }

.banner-star { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 92px; text-align: center; }
.banner-star img {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid var(--gold-3);
  background: var(--panel-4);
  object-fit: cover;
}
.banner-star .small { line-height: 1.15; font-size: 11.5px; }

/* ---------- уведомления и состояния ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 14px);
  transform: translateX(-50%);
  z-index: 60;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--gold-3);
  color: var(--tx);
  padding: 10px 16px;
  border-radius: var(--r);
  font-size: 13px;
  max-width: 90vw;
  box-shadow: 0 10px 30px rgb(0 0 0 / 45%);
  animation: toast-in .18s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 8px); } }

.boot { display: grid; place-items: center; gap: 12px; padding: 60px 0; color: var(--mut); }
.spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--bd);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.sync-state { display: flex; align-items: center; gap: 6px; }
.pill {
  display: inline-block;
  font-size: 12px;
  padding: 2px 9px;
  border-radius: var(--r-sm);
  border: 1px solid var(--bd);
  color: var(--mut);
}
.pill.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 45%, var(--bd)); }
.pill.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, var(--bd)); }

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

/* ---------- широкий экран: боковое меню ---------- */
@media (min-width: 900px) {
  :root { --nav-h: 0px; }
  body { padding-left: 244px; padding-bottom: 28px; }
  header { padding: 12px 26px 11px; }
  .brand { font-size: 20px; }
  main { max-width: 1180px; padding: 20px 26px 40px; }
  nav {
    top: 0;
    right: auto;
    bottom: 0;
    width: 244px;
    flex-direction: column;
    justify-content: flex-start;
    gap: 3px;
    border-top: 0;
    border-right: 1px solid var(--gold-3);
    padding: 22px 12px;
  }
  nav button {
    flex: none;
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    font-size: 15px;
    padding: 11px 14px;
    border-radius: var(--r);
    text-align: left;
  }
  nav button b { font-size: 18px; }
  nav button.on { background: color-mix(in srgb, var(--gold) 12%, transparent); }
  nav button.on::before {
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    width: 3px;
    height: 22px;
    box-shadow: 0 0 10px var(--gold-glow);
  }
  @media (hover: hover) { nav button:hover { background: color-mix(in srgb, var(--gold) 7%, transparent); color: var(--tx); } }
  .cols { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; }
  .crests { grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 12px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(142px, 1fr)); gap: 12px; }
  .tiles { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .toast { bottom: 24px; }
}
@media (min-width: 1500px) {
  main { max-width: 1380px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)); }
  .crests { grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); }
}
