:root {
  --navy: #07122c;
  --royal: #1f4fd8;
  --royal-3: #b9cbff;
  --ice: #eef3ff;
  --muted: #b4c2e0;
  --gold: #d7b483;
  --gold-2: #f3e2c6;
  --line: rgba(238, 243, 255, 0.16);
  --line-strong: rgba(238, 243, 255, 0.32);
  --font: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  --header: 76px;
  --shell: 1180px;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: clip;
  font-family: var(--font);
  font-weight: 300;
  font-size: 1.05rem;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

body.theme-light {
  --muted: #5e5e5e;
  --line: rgba(0, 0, 0, 0.08);
  --line-strong: rgba(0, 0, 0, 0.16);
  --royal: #1f4ed8;
  --royal-3: #1f4ed8;
  color: #141414;
  background: #e4e4e1;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

.sheet {
  position: relative;
  background: #fff;
  margin: 10px;
  border-radius: 24px;
  min-height: calc(100vh - 20px);
  min-height: calc(100dvh - 20px);
  max-width: calc(100% - 20px);
  overflow-x: clip;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

a:hover {
  color: var(--gold-2);
}

.theme-light a:hover {
  color: var(--royal);
}

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

::selection {
  background: var(--royal);
  color: white;
}

.skip {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 20;
  padding: 8px 12px;
  background: var(--ice);
  color: var(--navy);
  border-radius: 8px;
}

.skip:focus {
  top: 12px;
}

.shell {
  width: min(var(--shell), calc(100% - clamp(20px, 5vw, 40px) - env(safe-area-inset-left) - env(safe-area-inset-right)));
  margin-inline: auto;
}

[id] {
  scroll-margin-top: calc(var(--header) + 12px);
}

.site-header,
.site-footer,
main {
  position: relative;
  z-index: 1;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 6;
  height: var(--header);
  display: flex;
  align-items: center;
  backdrop-filter: blur(16px);
  background: rgba(7, 18, 44, 0.72);
  border-bottom: 1px solid var(--line);
}

.theme-light .site-header {
  background: rgba(255, 255, 255, 0.92);
  border-bottom-color: rgba(0, 0, 0, 0.06);
  border-radius: 24px 24px 0 0;
}

.header-inner,
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(var(--shell), calc(100% - clamp(20px, 5vw, 40px) - env(safe-area-inset-left) - env(safe-area-inset-right)));
  margin-inline: auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font);
  font-weight: 560;
  font-size: 1.35rem;
  letter-spacing: -0.03em;
}

.brand img,
.footer-brand img {
  display: block;
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.footer-brand {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 46rem;
}

.footer-brand p {
  margin: 0;
  max-width: 40rem;
  line-height: 1.5;
}

.login-menu {
  position: relative;
}

.login-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: #d6ee4a;
  color: #141414;
  font: inherit;
  font-weight: 600;
  font-size: 0.98rem;
  letter-spacing: -0.02em;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(180, 196, 40, 0.32);
}

.login-trigger:hover {
  background: #c6e22a;
  color: #141414;
}

.login-chev {
  width: 7px;
  height: 7px;
  margin-top: -2px;
  border-right: 1.6px solid currentColor;
  border-bottom: 1.6px solid currentColor;
  transform: rotate(45deg);
  transition: transform 0.18s ease;
}

.login-trigger[aria-expanded="true"] .login-chev {
  transform: rotate(225deg);
  margin-top: 3px;
}

.login-panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  left: auto;
  width: 260px;
  padding: 12px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  box-shadow: 0 22px 50px rgba(20, 20, 20, 0.14);
  z-index: 8;
}

.login-panel p {
  margin: 2px 8px 8px;
  color: #8a8a84;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.login-panel ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.login-panel a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 12px;
  text-decoration: none;
  color: #111;
}

.login-panel a:hover {
  background: #f4f4f1;
}

.login-panel strong {
  font-weight: 600;
  letter-spacing: -0.03em;
}

.login-panel small {
  color: #777;
  font-size: 0.78rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.btn-short {
  display: none;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.btn-primary {
  background: var(--ice);
  color: var(--navy);
}

.btn-primary:hover {
  background: white;
  color: var(--royal);
}

.btn-ghost {
  border-color: var(--line-strong);
  color: var(--ice);
  background: rgba(255, 255, 255, 0.03);
}

.btn-ghost:hover {
  border-color: var(--gold);
  color: var(--gold-2);
}

.theme-light .btn-primary {
  background: #1f4ed8;
  color: #fff;
}

.theme-light .btn-primary:hover {
  background: #173eae;
  color: #fff;
}

.theme-light .btn-ghost {
  background: #fff;
  color: #161616;
  border-color: #dededb;
}

.theme-light .btn-ghost:hover {
  border-color: #111;
  color: #111;
}

.site-footer {
  margin-top: 40px;
  padding: 36px 0 48px;
  border-top: 1px solid var(--line);
}

.site-footer .footer-inner {
  align-items: flex-start;
  gap: 28px;
}

.theme-light .site-footer {
  border-top-color: rgba(16, 24, 43, 0.08);
}

.footer-brand p,
.footer-meta {
  margin: 6px 0 0;
  color: var(--muted);
}

.footer-meta {
  font-size: 0.78rem;
}

.theme-light .footer-brand p,
.theme-light .footer-meta {
  color: #55627d;
}

.footer-brand strong {
  font-family: var(--font);
  font-size: 1.4rem;
  font-weight: 560;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 22px;
}

.footer-links a {
  text-decoration: none;
  font-weight: 500;
}

.not-found {
  min-height: calc(100vh - 220px);
  display: grid;
  align-content: center;
  padding: 64px 0;
}

.not-found h1 {
  margin: 0;
  font-family: var(--font);
  font-weight: 560;
  font-size: clamp(3rem, 8vw, 6rem);
  letter-spacing: -0.04em;
  line-height: 0.9;
}

.not-found p {
  max-width: 36rem;
  color: var(--muted);
}

@media (max-width: 1040px) {
  .login-panel {
    position: absolute;
    right: 0;
    left: auto;
    width: min(260px, 80vw);
  }

  .header-actions .btn-ghost,
  .btn-long {
    display: none;
  }

  .btn-short {
    display: inline;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .footer-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
  }
}

@media (max-width: 720px) {
  :root {
    --header: 64px;
  }

  .sheet {
    margin: 0;
    border-radius: 0;
    max-width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .theme-light .site-header {
    border-radius: 0;
  }

  .shell,
  .header-inner,
  .footer-inner {
    width: min(var(--shell), calc(100% - 28px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  }

  .login-panel {
    position: fixed;
    top: calc(var(--header) + 8px);
    right: max(14px, env(safe-area-inset-right));
    left: max(14px, env(safe-area-inset-left));
    width: auto;
    max-height: min(70dvh, 420px);
    overflow: auto;
  }

  .footer-links a {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }

  .not-found .btn {
    width: 100%;
  }

  .brand img,
  .footer-brand img {
    width: 36px;
    height: 36px;
  }

  .brand {
    font-size: 1.15rem;
    gap: 8px;
  }

  .header-inner {
    gap: 10px;
  }

  .header-actions .btn {
    min-height: 40px;
    padding-inline: 12px;
  }

  .site-footer {
    padding-bottom: calc(36px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 420px) {
  .brand span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .header-actions .btn {
    padding-inline: 10px;
    font-size: 0.92rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
