@font-face {
  font-family: "Manrope UI";
  src: url("/static/fonts/Manrope-VariableFont_wght.ttf") format("truetype");
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono UI";
  src: url("/static/fonts/IBMPlexMono-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono UI";
  src: url("/static/fonts/IBMPlexMono-SemiBold.ttf") format("truetype");
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
}
/* Совместимый псевдоним для старых экранных правил. Файл остается локальным. */
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/IBMPlexMono-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/static/fonts/IBMPlexMono-SemiBold.ttf") format("truetype");
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
}

@font-face {
  font-family: "Academy Game";
  src: url("/static/fonts/academy-regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Blambot Game";
  src: url("/static/fonts/blambot-casual-cyr.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Caslon Antique Game";
  src: url("/static/fonts/caslon-antique-cyr.ttf") format("truetype");
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
}
@font-face {
  font-family: "Academy Game";
  src: url("/static/fonts/academy-italic.ttf") format("truetype");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Academy Game";
  src: url("/static/fonts/academy-bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700 900;
  font-display: swap;
}
@font-face {
  font-family: "Academy Game";
  src: url("/static/fonts/academy-bold-italic.ttf") format("truetype");
  font-style: italic;
  font-weight: 700 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #15110d;
  --bg-soft: #1e1812;
  --panel: #291f17;
  --panel-2: #34271c;
  --panel-3: #403023;
  --line: #5b4734;
  --line-bright: #806548;
  --paper: #f7ecd5;
  --paper-dim: #d8c8ad;
  --muted: #b4a38a;
  --blue: #d2a259;
  --green: #76b38a;
  --amber: #e0aa59;
  --orange: #c96f43;
  --red: #c65d4a;
  --ink: #271a12;
  --parchment: #f2dfae;
  --focus: #f0ca7c;
  --shadow: 0 22px 60px rgba(0, 0, 0, .38);
  font-family: "Manrope UI", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
.topbar-actions { display:flex; align-items:center; justify-content:flex-end; gap:10px; min-width:0; flex-wrap:wrap; }
.topbar-actions > nav { min-width:0; }
.language-switcher { position:static; z-index:auto; display:inline-flex; flex:0 0 auto; align-items:center; gap:4px; padding:3px; border:1px solid var(--line); border-radius:999px; background:rgba(30,22,16,.92); box-shadow:none; }
.language-switcher button { min-width:44px; min-height:44px; padding:6px 10px; border:0; border-radius:999px; background:transparent; color:inherit; font:700 12px/1 "IBM Plex Mono UI", monospace; cursor:pointer; }
.language-switcher button.active { background:var(--orange); color:#fff; }
@media print { .language-switcher { display:none; } }
@media(max-width:560px) { .topbar-actions { width:100%; justify-content:space-between; } .language-switcher { margin-left:auto; } }
html, body { min-height: 100%; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Manrope UI", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--paper);
  background:
    radial-gradient(circle at 14% -12%, rgba(190, 130, 65, .18), transparent 36rem),
    radial-gradient(circle at 88% 10%, rgba(116, 81, 43, .12), transparent 28rem),
    linear-gradient(180deg, #1b1510, var(--bg));
}
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: 4px;
  z-index: 100;
  background: linear-gradient(90deg, #f5f5f2 0 33.33%, #2b70b5 33.33% 66.66%, #cf3f45 66.66%);
}
button, input, select, textarea { font: inherit; }
button, input, select, textarea, [role="button"] { min-height: 44px; }
button, a, [role="button"] { touch-action: manipulation; -webkit-tap-highlight-color: rgba(240, 202, 124, .22); }
button { cursor: pointer; }
a { color: var(--blue); }
h1, h2, h3 { text-wrap: balance; }
.hidden { display: none !important; }
.mono, code, .metric { font-family: "IBM Plex Mono UI", ui-monospace, monospace; }
.muted { color: var(--muted); }

:focus-visible {
  outline: 3px solid var(--focus) !important;
  outline-offset: 3px;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 10px;
  min-height: 44px;
  padding: 10px 14px;
  border: 2px solid var(--focus);
  border-radius: 8px;
  color: var(--ink);
  background: var(--parchment);
  font-weight: 800;
  text-decoration: none;
  transform: translateY(-160%);
  transition: transform .16s ease;
}
.skip-link:focus { transform: translateY(0); }

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 1px solid var(--line-bright);
  border-radius: 9px 13px 10px 12px;
  overflow: hidden;
  padding: 2px;
  color: #3a281a;
  background: linear-gradient(145deg, #f3dda4, #d7b66f);
  box-shadow: 0 4px 0 rgba(31, 19, 11, .48);
  font: 700 12px/1 "IBM Plex Mono", monospace;
}
.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 7px 10px 8px 9px;
  object-fit: cover;
}
.game-logo-full {
  display: block;
  height: auto;
  border: 0;
  background: transparent;
}
.brand-title { font-weight: 800; letter-spacing: -.03em; }
.brand-title span { color: var(--amber); }
.brand-sub {
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font: 500 10px/1.3 "IBM Plex Mono", monospace;
  letter-spacing: .08em;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 14px 19px 15px 17px;
  background: linear-gradient(145deg, rgba(47, 36, 26, .97), rgba(24, 18, 13, .98));
  box-shadow: var(--shadow);
}
.kicker {
  color: var(--blue);
  font: 700 10px/1.3 "IBM Plex Mono", monospace;
  letter-spacing: .12em;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: "Caslon Antique Game", Georgia, "Times New Roman", serif; }
h1 { letter-spacing: -.045em; }
h2 { letter-spacing: -.03em; }

.btn {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 15px;
  border: 1px solid var(--line-bright);
  border-radius: 8px 12px 9px 11px;
  color: var(--paper);
  background: var(--panel-2);
  font-family: "Manrope UI", system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .01em;
}
.btn:hover { border-color: var(--amber); background: var(--panel-3); }
.btn:disabled { cursor: not-allowed; opacity: .48; }
.btn.primary {
  border-color: transparent;
  color: #2b1d12;
  background: linear-gradient(135deg, #f0ca7c, var(--orange));
  box-shadow: 0 4px 0 rgba(64, 36, 20, .58);
}
.btn.success {
  border-color: transparent;
  color: #08261d;
  background: linear-gradient(135deg, #78deb4, #45b886);
}
.btn.danger {
  border-color: rgba(239, 112, 93, .5);
  color: #ffd7cf;
  background: rgba(119, 37, 39, .38);
}

.resource-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.resource {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 7px 10px 8px 9px;
  color: var(--muted);
  background: rgba(22, 16, 11, .7);
  font: 600 11px/1.2 "IBM Plex Mono", monospace;
}
.resource b { color: var(--green); }
.resource.warn b { color: var(--amber); }

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--amber);
}
.status-dot.online { background: var(--green); box-shadow: 0 0 12px rgba(100, 210, 162, .55); }

.toast {
  position: fixed;
  z-index: 120;
  right: 18px;
  bottom: 18px;
  max-width: min(440px, calc(100vw - 36px));
  padding: 13px 15px;
  border: 1px solid rgba(239, 182, 92, .5);
  border-radius: 12px;
  color: #ffe4ae;
  background: #30281c;
  box-shadow: var(--shadow);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(16, 11, 7, .91);
  backdrop-filter: blur(9px);
}
dialog.modal:not([open]), dialog.confirm-layer:not([open]) { display: none; }
dialog.modal[open], dialog.confirm-layer[open] {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  border: 0;
  color: inherit;
}
dialog.modal::backdrop, dialog.confirm-layer::backdrop { background: transparent; }
.modal-card {
  width: min(760px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: clamp(24px, 5vw, 48px);
  border: 1px solid var(--line-bright);
  border-radius: 17px 23px 19px 21px;
  background: linear-gradient(145deg, #382b20, #1c1611);
  box-shadow: 0 35px 100px rgba(0, 0, 0, .55);
}
.modal-card h2 { margin: 8px 0 13px; font-size: clamp(28px, 5vw, 48px); }
.modal-card p { color: var(--muted); line-height: 1.55; }

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(114, 84, 52, .34);
}
.progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green));
}

@media (max-width: 700px) {
  .brand-sub { max-width: 210px; }
  .modal { padding: 10px; }
}

/* Читаемая типографика: обычный текст не должен выглядеть служебной сноской. */
@media screen {
  .brand-sub { font-size: 12px; line-height: 1.45; }
  .kicker { font-size: 12px; line-height: 1.45; }
  .resource { font-size: 13px; line-height: 1.35; }
  .modal-card > p { font-size: 17px; line-height: 1.58; }
  .toast { font-size: 14px; line-height: 1.5; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
