/* ==========================================================================
   MU Code — слой бренда поверх site.css.

   site.css — перекрашенный словарь модулей (формы, таблицы, панели).
   Здесь — то, что делает сайт MU Code: пиксельный мир логотипа (DESIGN.md).
     · ночь (data-theme="dark") — игра; иней (data-theme="frost") — студия;
     · пиксельные углы и жёсткие тени без размытия, как у букв логотипа;
     · Golos Text — заголовки, цифры и текст (Pixelify убран 29.11: не читался), JetBrains Mono — подписи данных;
     · сапфир — главное действие, лёд — ссылки и «сейчас».
   ========================================================================== */

/* --- Иней: светлая тема студии ----------------------------------------- */
:root[data-theme="frost"] {
  color-scheme: light;
  --blue: #0f3ad8;
  --blue-deep: #0b1437;
  --blue-soft: #56627f;
  --heading: #0b1437;
  --text: #1c2650;
  --muted: #56627f;
  --sky: #eef5ff;
  --sky-deep: #d8e9fd;
  --plate: #ffffff;
  --plate-warm: #f6f9ff;
  --line: rgba(11, 20, 55, 0.16);
  --line-soft: rgba(11, 20, 55, 0.08);
  --plate-edge: #0b1437;
  --shadow-sm: 3px 3px 0 #0b1437;
  --shadow-md: 5px 5px 0 #0b1437;
  --shadow-lg: 8px 8px 0 #0b1437;
  --shadow-plate: 6px 6px 0 #0b1437;
  --ok: #157347;
  --bad: #b42318;
}

/* --- Основа ------------------------------------------------------------- */
body { background: var(--sky); color: var(--text); font-family: var(--body); font-size: 16px; }
::selection { background: var(--sapphire); color: #fff; }
:focus-visible { outline: 2px solid var(--ice); outline-offset: 3px; border-radius: 0; }
:root[data-theme="frost"] :focus-visible { outline-color: var(--sapphire); }
a { color: var(--blue); text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); }
a:hover { color: var(--blue-deep); }

h1, h2, h3, h4, .page-title { text-transform: none; letter-spacing: 0.01em; }
.mono, code, kbd { font-family: var(--mono); }

/* Ночь игры: пиксельный пейзаж стоит под страницей, приглушённый вуалью,
   чтобы текст модулей читался. Картинка 400x225 растянута без сглаживания. */
.is-game { background: var(--night); }
.is-game::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    linear-gradient(180deg, rgba(11, 20, 55, 0.9) 0%, rgba(11, 20, 55, 0.8) 55%, rgba(11, 20, 55, 0.55) 100%),
    url("../img/night-1x.png") center bottom / cover no-repeat;
  image-rendering: pixelated;
}
.is-game.page-home::before { display: none; }

/* --- Переключатель «Играть · Студия» — одинаковый в обеих темах ---------- */
.switchbar {
  position: relative; z-index: 45;
  background: var(--abyss);
  border-bottom: 1px solid rgba(128, 137, 162, 0.35);
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase;
}
.switchbar__inner {
  max-width: var(--shell); margin: 0 auto; padding: 0 var(--gutter);
  height: 36px; display: flex; align-items: stretch; gap: 2px;
}
.switchbar__tab {
  display: inline-flex; align-items: center; gap: 9px; padding: 0 14px;
  color: #a8c1e7; text-decoration: none; white-space: nowrap;
}
.switchbar__tab:hover { color: #fff; background: rgba(168, 193, 231, 0.08); }
.switchbar__tab.is-on { color: #fff; background: #101939; box-shadow: inset 0 -2px 0 #65c8ff; }
.switchbar__dot { width: 8px; height: 8px; background: #626b85; flex: none; }
.switchbar__tab.is-on .switchbar__dot { background: #65c8ff; box-shadow: 0 0 0 2px #021ab5; }
.switchbar__hint { margin-left: auto; align-self: center; color: #8089a2; white-space: nowrap; }
.switchbar__lang { align-self: center; margin-left: 14px; }
.switchbar .lang__button {
  height: 26px; padding: 0 8px; gap: 6px; background: transparent;
  border: 1px solid rgba(128, 137, 162, 0.5); border-radius: 0; box-shadow: none;
}
.switchbar .lang__button img:first-child { display: none; }
.switchbar .lang__button img { filter: brightness(0) invert(0.85); }
.switchbar .lang__button span { color: #d8e9fd; font-family: var(--mono); font-size: 12px; }
.switchbar .lang__button:hover { background: rgba(168, 193, 231, 0.1); border-color: #65c8ff; }
.switchbar .lang__list { right: 0; left: auto; min-width: 88px; background: #101939; border: 2px solid #626b85; border-radius: 0; box-shadow: 4px 4px 0 #010b32; }
.switchbar .lang__item { color: #d8e9fd; font-family: var(--mono); border-radius: 0; }
.switchbar .lang__item:hover, .switchbar .lang__item.is-active { background: #022ef6; color: #fff; }
@media (max-width: 720px) { .switchbar__hint { display: none; } .switchbar__lang { margin-left: auto; } .switchbar__tab { padding: 0 10px; } }

/* --- Шапка -------------------------------------------------------------- */
.masthead {
  background: rgba(11, 20, 55, 0.94);
  border-bottom: 2px solid var(--abyss);
  backdrop-filter: saturate(1.2) blur(6px);
}
.masthead.is-stuck { box-shadow: 0 4px 0 rgba(1, 11, 50, 0.6); border-bottom-color: var(--abyss); }
:root[data-theme="frost"] .masthead { background: rgba(247, 250, 255, 0.95); border-bottom-color: #0b1437; }
:root[data-theme="frost"] .masthead.is-stuck { box-shadow: 0 4px 0 rgba(11, 20, 55, 0.12); }
.masthead__inner { height: 66px; }
.brand { gap: 10px; }
.brand__logo { display: block; width: 150px; height: auto; }
.brand__tag {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 3px 6px; color: #0b1437; background: #65c8ff; box-shadow: 2px 2px 0 #0b1437;
}

.nav a, .navdrop__toggle {
  font-family: var(--display); font-weight: 500; font-size: 16px; letter-spacing: 0.02em; text-transform: none;
  color: var(--frost); border-radius: 0; height: 40px;
}
.nav a:hover, .nav a[aria-current="page"], .navdrop__toggle:hover, .navdrop.is-open .navdrop__toggle, .navdrop__toggle.is-current,
:root[data-theme="dark"] .nav a:hover, :root[data-theme="dark"] .nav a[aria-current="page"] {
  background: rgba(2, 46, 246, 0.22); color: #fff; box-shadow: inset 0 -2px 0 var(--ice);
}
:root[data-theme="frost"] .nav a { color: #0b1437; }
:root[data-theme="frost"] .nav a:hover { background: rgba(2, 46, 246, 0.08); color: #021ab5; box-shadow: inset 0 -2px 0 #022ef6; }
.navdrop__menu {
  background: var(--night-2); border: 2px solid var(--steel); border-radius: 0; box-shadow: 6px 6px 0 var(--abyss);
}
.navdrop__menu a { border-radius: 0; }
.navdrop__menu a:hover, .navdrop__menu a[aria-current="page"] { background: rgba(2, 46, 246, 0.25); box-shadow: none; }
.navdrop__title { font-family: var(--display); font-size: 15px; color: var(--frost); text-transform: none; letter-spacing: 0.02em; }
.navdrop__desc { color: var(--frost-2); }
.navdrop__icon { color: var(--ice); }

/* --- Кнопки: сапфир с жёсткой тенью; нажатие «садится» в тень ------------ */
.btn, .btn-primary, button.btn, .mlink--accent, .acct__submit, .reg__submit, .vip-plan__buy, .mbtn--gold, .mc-btn,
:root[data-theme="dark"] .btn, :root[data-theme="dark"] .btn-primary, :root[data-theme="dark"] .acct__submit,
:root[data-theme="dark"] .vip-plan__buy, :root[data-theme="dark"] .mlink--accent, :root[data-theme="dark"] .btn--gold,
:root[data-theme="dark"] .page-login .form-horizontal .btn, :root[data-theme="dark"] .page-register .form-horizontal .btn,
:root[data-theme="dark"] .page-forgotpassword .form-horizontal .btn {
  color: #fff;
  background: var(--sapphire);
  border: 2px solid var(--abyss);
  border-radius: 0;
  box-shadow: 4px 4px 0 var(--abyss), inset 0 -3px 0 var(--sapphire-deep), inset 0 2px 0 rgba(255, 255, 255, 0.22);
  font-family: var(--display); font-weight: 700; letter-spacing: 0.03em; text-transform: none;
  filter: none;
  transition: transform 0.08s steps(2), box-shadow 0.08s steps(2), background 0.12s;
}
.btn:hover, .btn-primary:hover, .mlink--accent:hover, .acct__submit:hover, .reg__submit:hover, .vip-plan__buy:not(:disabled):hover, .mbtn--gold:hover, .mc-btn:hover,
:root[data-theme="dark"] .btn:not(.btn--ghost):not(.btn-default):not(.btn-xs):not(:disabled):hover,
:root[data-theme="dark"] .mlink.mlink--accent:hover, :root[data-theme="dark"] .acct__submit:hover, :root[data-theme="dark"] .reg__submit:hover {
  color: #fff; background: var(--sapphire-hi); border-color: var(--abyss);
  box-shadow: 4px 4px 0 var(--abyss), inset 0 -3px 0 var(--sapphire-deep), inset 0 2px 0 rgba(255, 255, 255, 0.3);
}
.btn:active, .btn-primary:active, .mlink--accent:active, .acct__submit:active, .reg__submit:active, .mc-btn:active {
  transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--abyss), inset 0 -2px 0 var(--sapphire-deep);
}
.mbtn--gold::after, .mlink--accent::after { display: none; }
:root[data-theme="frost"] .mlink--accent { border-color: #0b1437; box-shadow: 4px 4px 0 #0b1437, inset 0 -3px 0 var(--sapphire-deep); }

/* Второстепенные: прозрачные, стальная рамка. */
.btn-default, .btn--ghost, .btn-xs, .mlink, .mc-btn--ghost,
:root[data-theme="dark"] .btn-default, :root[data-theme="dark"] .btn--ghost, :root[data-theme="dark"] .btn-xs, :root[data-theme="dark"] .mlink {
  color: var(--frost); background: transparent; border: 2px solid var(--steel-2); border-radius: 0; box-shadow: none;
  font-family: var(--display); text-transform: none; letter-spacing: 0.02em;
}
.btn-default:hover, .btn--ghost:hover, .btn-xs:hover, .mlink:hover, .mc-btn--ghost:hover,
:root[data-theme="dark"] .btn-default:hover, :root[data-theme="dark"] .btn--ghost:hover, :root[data-theme="dark"] .mlink:hover {
  color: #fff; background: rgba(2, 46, 246, 0.2); border-color: var(--ice);
}
:root[data-theme="frost"] .mlink:not(.mlink--accent) { color: #0b1437; border-color: #0b1437; }

/* --- Поверхности: плашки с пиксельными углами ---------------------------- */
.panel, .plate, .reg, .ac, .vip-plan, .pay, .dl-group,
:root[data-theme="dark"] .panel, :root[data-theme="dark"] .plate, :root[data-theme="dark"] .reg {
  background: var(--plate);
  border: 2px solid rgba(128, 137, 162, 0.5);
  border-radius: 0;
  box-shadow: var(--shadow-plate);
}
.panel-heading, .plate__head { border-bottom: 2px solid rgba(128, 137, 162, 0.25); }
.reg__side, :root[data-theme="dark"] .reg__side { background: var(--plate-warm); }

/* Поля ввода. */
.form-control, input.form-control, select.form-control, textarea.form-control, .rf__input, .acct__field input,
:root[data-theme="dark"] .form-control, :root[data-theme="dark"] .rf__input, :root[data-theme="dark"] .acct__field input {
  background: var(--abyss); color: var(--blue-deep);
  border: 2px solid rgba(128, 137, 162, 0.55); border-radius: 0; box-shadow: none;
}
.form-control:focus, .rf__input:focus, .acct__field input:focus,
:root[data-theme="dark"] .form-control:focus, :root[data-theme="dark"] .rf__input:focus {
  background: var(--abyss); border-color: var(--ice); box-shadow: 0 0 0 2px var(--sapphire);
}

/* Заголовки модулей: пиксельный шрифт и «блок» льда под ним вместо линии. */
.page-title {
  font-family: var(--display); font-weight: 700; color: var(--heading);
  font-size: clamp(26px, 3vw, 36px); line-height: 1.1;
  border-bottom: 0; padding-bottom: 14px; position: relative;
}
.page-title::after, :root[data-theme="dark"] .page-title::after {
  content: ""; display: block !important; position: static; width: 56px; height: 6px; margin-top: 12px;
  background: var(--ice); box-shadow: 4px 4px 0 var(--sapphire-deep);
}
.page-title + .page-title::after, .page-title ~ .page-title::after { display: none !important; }

/* Таблицы рейтингов и кабинета. */
.table thead th, .rankings-table tr:first-child td, .general-table-ui tr:first-child td,
:root[data-theme="dark"] .table thead th, :root[data-theme="dark"] .rankings-table tr:first-child td {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--frost-2); background: var(--abyss);
}
.table td, .rankings-table td { font-variant-numeric: tabular-nums; }

/* Меню аккаунта и выпадашки. */
.acct__menu, .lang__list, :root[data-theme="dark"] .lang__list {
  background: var(--night-2); border: 2px solid var(--steel); border-radius: 0; box-shadow: 6px 6px 0 var(--abyss);
}
.acct__menu::before { display: none; }
.umenu__purse { border-radius: 0; background: var(--abyss); border: 2px solid var(--sapphire-deep); }
.umenu__purse-fig { font-family: var(--display); color: var(--ice); }
.umenu__avatar { border-radius: 0; background: var(--sapphire); color: #fff; font-family: var(--display); }
.umenu__list a, .umenu__out, .umenu__help { border-radius: 0; }
.umenu__list a:hover, .umenu__out:hover, .umenu__help:hover { background: rgba(2, 46, 246, 0.22); }

/* --- Подвал ------------------------------------------------------------- */
.footer, :root[data-theme="dark"] .footer { background: var(--abyss); border-top: 2px solid #626b85; position: relative; z-index: 1; }
.footer__inner {
  display: grid; grid-template-columns: minmax(220px, 1.6fr) repeat(3, minmax(130px, 1fr)); gap: 28px 32px;
  align-items: start; padding-top: 40px; padding-bottom: 28px;
}
.footer__brand, :root[data-theme="dark"] .footer__brand { display: block; text-transform: none; letter-spacing: 0; color: #a8c1e7; font-family: var(--body); font-size: 14px; }
.footer__brand img { display: block; width: 150px; height: auto; margin-bottom: 12px; }
.footer__brand p, :root[data-theme="dark"] .footer__brand p { font-size: 14px; letter-spacing: 0; color: #a8c1e7; max-width: 26em; }
.footer__col { display: flex; flex-direction: column; gap: 8px; }
.footer__h { font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: #8089a2; margin-bottom: 4px; }
.footer__col a { color: #d8e9fd; text-decoration: none; font-size: 14.5px; }
.footer__col a:hover { color: #65c8ff; text-decoration: underline; }
.footer__meta, :root[data-theme="dark"] .footer__meta {
  grid-column: 1 / -1; text-align: left; max-width: none; color: #8089a2; font-size: 12.5px;
  border-top: 1px solid rgba(128, 137, 162, 0.3); padding-top: 16px; display: flex; flex-wrap: wrap; gap: 4px 24px;
}
@media (max-width: 860px) { .footer__inner { grid-template-columns: 1fr 1fr; } .footer__brand { grid-column: 1 / -1; } }

/* --- Общие мелочи -------------------------------------------------------- */
.mc-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 50px; padding: 0 26px; font-size: 17px; text-decoration: none; cursor: pointer; white-space: nowrap; }
.mc-arrow { width: 16px; height: 16px; flex: none; }
.mc-btn--ghost { color: var(--frost); }
.mc-tag { display: inline-block; font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ice); }
.mc-px { clip-path: var(--px-corners); }

@media (prefers-reduced-motion: reduce) {
  .btn, .mc-btn, .mlink--accent { transition: none; }
}

/* Акцентная кнопка шапки остаётся сапфировой поверх правила второстепенных
   (у того выше специфичность из-за :root[data-theme]). */
.masthead .mlink.mlink--accent, :root[data-theme="dark"] .masthead .mlink.mlink--accent, :root[data-theme="frost"] .masthead .mlink.mlink--accent {
  color: #fff; background: var(--sapphire); border: 2px solid var(--abyss);
  box-shadow: 3px 3px 0 var(--abyss), inset 0 -3px 0 var(--sapphire-deep), inset 0 2px 0 rgba(255, 255, 255, 0.22);
}
.masthead .mlink.mlink--accent:hover { background: var(--sapphire-hi); color: #fff; }
:root[data-theme="frost"] .masthead .mlink.mlink--accent { border-color: #0b1437; box-shadow: 3px 3px 0 #0b1437, inset 0 -3px 0 var(--sapphire-deep); }
/* На средней ширине у кнопки аккаунта остаётся значок, а «Регистрация» —
   с текстом: пустая сапфировая рамка ничего не говорит. */
@media (max-width: 1080px) { .masthead__tools .mlink--accent span { display: inline; } .nav a, .navdrop__toggle { font-size: 15px; padding: 0 10px; } }
@media (max-width: 860px) {
  .nav, :root[data-theme="dark"] .nav { top: 66px; background: var(--night-2); border-bottom: 2px solid var(--abyss); box-shadow: 0 6px 0 rgba(1, 11, 50, 0.6); }
  :root[data-theme="frost"] .nav { background: #f7faff; border-bottom-color: #0b1437; }
  .nav-toggle { border-radius: 0; border: 2px solid var(--steel-2); background: transparent; }
  .nav-toggle span { background: var(--frost); }
  :root[data-theme="frost"] .nav-toggle span { background: #0b1437; }
}
@media (max-width: 520px) { .masthead__tools .mlink--accent { display: none; } .brand__logo { width: 128px; } }

/* Временный текстовый знак вместо логотипа (новый логотип — в работе). */
.brand__word { font-family: var(--body); font-weight: 800; font-size: 21px; letter-spacing: -0.01em; color: var(--blue-deep); white-space: nowrap; }
:root[data-theme="frost"] .brand__word { color: #0b1437; }
.footer .brand__word { display: block; margin-bottom: 12px; color: #fff; }
.hero__word { display: block; font-family: var(--body); font-weight: 800; font-size: clamp(52px, 9vw, 112px); line-height: 1; letter-spacing: -0.03em; color: #fff; }
