* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: radial-gradient(circle at 12% 4%, rgba(255, 255, 255, 0.07), transparent 33%),
              radial-gradient(circle at 90% -5%, rgba(255, 255, 255, 0.06), transparent 35%),
              linear-gradient(155deg, var(--bg-0) 0%, var(--bg-1) 44%, var(--bg-2) 100%);
  color: var(--ink-0);
  font-family: "Manrope", "Avenir Next", "Segoe UI", sans-serif;
}

body::before,
body::after {
  content: "";
  position: fixed;
  border-radius: 999px;
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
  opacity: 0.28;
}

body::before {
  width: 280px;
  height: 280px;
  left: -120px;
  top: 10vh;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0));
}

body::after {
  width: 260px;
  height: 260px;
  right: -100px;
  bottom: 12vh;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0));
}

body.app-booting {
  overflow: hidden;
}

body.app-booting .app {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 42;
  overflow: hidden;
  display: grid;
  place-items: center;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.018), rgba(255, 255, 255, 0) 36%),
    radial-gradient(circle at 50% 34%, rgba(216, 228, 238, 0.026), transparent 18%),
    radial-gradient(circle at 50% 50%, rgba(116, 129, 143, 0.02), transparent 36%),
    linear-gradient(180deg, #040506 0%, #07090b 48%, #0c0f12 100%);
  transition: opacity 260ms ease, visibility 260ms ease;
}

body:not(.app-booting) .boot-screen {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.boot-screen::before,
.boot-screen::after {
  content: "";
  position: absolute;
  inset: 50%;
  border-radius: 999px;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.boot-screen::before {
  width: min(54vw, 560px);
  height: min(54vw, 560px);
  background: radial-gradient(circle, rgba(230, 238, 246, 0.022), rgba(230, 238, 246, 0) 68%);
  filter: blur(22px);
  opacity: 0.14;
  animation: boot-aura-breathe 4.8s ease-in-out infinite;
}

.boot-screen::after {
  width: min(82vw, 920px);
  height: min(82vw, 920px);
  border: 1px solid rgba(255, 255, 255, 0.04);
  opacity: 0.1;
}

.boot-screen__ambient {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.03) 0, rgba(255, 255, 255, 0) 58%),
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.045) 0, rgba(255, 255, 255, 0) 54%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: auto, auto, 72px 72px, 72px 72px;
  mask-image: radial-gradient(circle at center, rgba(0, 0, 0, 0.92), transparent 76%);
  opacity: 0.1;
  pointer-events: none;
}

.boot-screen__ambient::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.05) 0.5px, transparent 0.7px),
    radial-gradient(rgba(255, 255, 255, 0.035) 0.4px, transparent 0.65px);
  background-size: 6px 6px, 9px 9px;
  background-position: 0 0, 3px 4px;
  opacity: 0.08;
  mix-blend-mode: soft-light;
}

.boot-screen__core {
  position: relative;
  z-index: 1;
  width: min(38vw, 240px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  animation: boot-core-float 5.2s ease-in-out infinite;
}

.boot-screen__core::before,
.boot-screen__core::after {
  content: "";
  position: absolute;
  inset: 50%;
  border-radius: 999px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.boot-screen__core::before {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(236, 242, 247, 0.11);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.02),
    0 0 18px rgba(205, 218, 230, 0.025);
  animation: boot-orbit-spin 14s linear infinite;
}

.boot-screen__core::after {
  width: 78%;
  height: 78%;
  border: 1px solid rgba(255, 255, 255, 0.045);
  opacity: 0.55;
  animation: boot-orbit-spin-reverse 10s linear infinite;
}

.boot-screen__mark {
  position: relative;
  width: 54%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.boot-screen__mark::before {
  content: "";
  position: absolute;
  inset: -18%;
  border-radius: 36px;
  background: radial-gradient(circle, rgba(12, 14, 17, 0.78), rgba(12, 14, 17, 0) 72%);
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.34),
    0 0 42px rgba(216, 226, 236, 0.03);
}

.boot-screen__mark::after {
  content: "";
  position: absolute;
  inset: -18%;
  border-radius: 36px;
  background: linear-gradient(120deg, rgba(255, 255, 255, 0) 28%, rgba(255, 255, 255, 0.16) 50%, rgba(255, 255, 255, 0) 72%);
  opacity: 0.16;
  mix-blend-mode: screen;
  animation: boot-mark-sheen 3.8s ease-in-out infinite;
}

.boot-screen__mark-symbol {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
  background: linear-gradient(180deg, rgba(241, 244, 247, 0.94), rgba(197, 205, 213, 0.82));
  -webkit-mask-image: url("../north_app.jpg?v=1");
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  -webkit-mask-mode: luminance;
  mask-image: url("../north_app.jpg?v=1");
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  mask-mode: luminance;
  filter: drop-shadow(0 16px 30px rgba(0, 0, 0, 0.18));
  opacity: 0.88;
}

.boot-screen__caption {
  position: absolute;
  left: 50%;
  top: calc(50% + min(22vw, 146px));
  transform: translateX(-50%);
  margin: 0;
  font-family: "Space Grotesk", monospace;
  font-size: 0.82rem;
  letter-spacing: 0.16rem;
  text-transform: uppercase;
  color: rgba(214, 222, 230, 0.56);
  white-space: nowrap;
  pointer-events: none;
}

.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;
}

@keyframes boot-aura-breathe {
  0%, 100% { transform: translate(-50%, -50%) scale(0.96); opacity: 0.34; }
  50% { transform: translate(-50%, -50%) scale(1.05); opacity: 0.56; }
}

@keyframes boot-core-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes boot-orbit-spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes boot-orbit-spin-reverse {
  from { transform: translate(-50%, -50%) rotate(360deg); }
  to { transform: translate(-50%, -50%) rotate(0deg); }
}

@keyframes boot-mark-sheen {
  0%, 100% { transform: translateX(-22%) translateY(-6%) rotate(14deg); opacity: 0.08; }
  50% { transform: translateX(18%) translateY(6%) rotate(14deg); opacity: 0.22; }
}

.app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  width: min(var(--app-max), 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 18px 16px calc(var(--menu-h) + var(--safe-bottom) + 18px);
  gap: 14px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: linear-gradient(170deg, rgba(14, 15, 17, 0.86), rgba(13, 14, 16, 0.62));
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(16px) saturate(120%);
  -webkit-backdrop-filter: blur(16px) saturate(120%);
  padding: 9px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 1px;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.44), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.nf-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.nf-logo {
  width: 34px;
  height: 34px;
  max-width: 34px;
  max-height: 34px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.03);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
  overflow: hidden;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  padding: 3px;
}

.nf-logo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
  border-radius: 8px;
}

.nf-kicker {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.22rem 0.6rem;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--ink-2);
  letter-spacing: 0.09em;
  text-transform: uppercase;
  font-size: 0.66rem;
  line-height: 1;
  white-space: nowrap;
  font-weight: 620;
}

.nf-lang {
  position: relative;
  flex: 0 0 auto;
  touch-action: manipulation;
}

.nf-lang__trigger {
  position: relative;
  min-width: 54px;
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  background: rgba(10, 11, 13, 0.78);
  color: var(--ink-0);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.3rem 0.6rem;
  font: inherit;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  transition: border-color var(--ease), background var(--ease), box-shadow var(--ease);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.nf-lang__trigger:hover {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(12, 14, 17, 0.9);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.nf-lang__trigger:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 2px;
}

.nf-lang__trigger span {
  font-size: 0.64rem;
  font-weight: 650;
  letter-spacing: 0.09em;
  line-height: 1;
  text-transform: uppercase;
}

.nf-lang__trigger i {
  width: 0.31rem;
  height: 0.31rem;
  border-right: 1px solid rgba(255, 255, 255, 0.66);
  border-bottom: 1px solid rgba(255, 255, 255, 0.66);
  transform: rotate(45deg) translateY(-1px);
  opacity: 0.74;
  flex: 0 0 auto;
}

.nf-lang__menu {
  position: absolute;
  right: 0;
  top: calc(100% + 9px);
  min-width: 158px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  background: rgba(8, 10, 13, 0.96);
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.44);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 0.36rem;
  display: grid;
  gap: 0.24rem;
  opacity: 0;
  transform: translateY(-2px);
  pointer-events: none;
  transition: opacity 130ms ease, transform 130ms ease;
  z-index: 12;
}

.nf-lang.is-open .nf-lang__menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.nf-lang__option {
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-1);
  text-align: left;
  padding: 0.5rem 0.6rem;
  font: inherit;
  font-size: 0.86rem;
  line-height: 1.2;
  cursor: pointer;
  transition: background var(--ease), color var(--ease), border-color var(--ease);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.nf-lang__option:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--ink-0);
}

.nf-lang__option.is-active {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink-0);
  font-weight: 600;
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07);
}
