:root {
  --hypr-cyan: #50c8ff;
  --pill-bg: rgba(12, 12, 14, 0.55);
  --pill-border: rgba(255, 255, 255, 0.08);
  --text: #f2f2f5;
  --muted: rgba(255, 255, 255, 0.72);
  --page-bg: #0b0b0d;
  --nav-stack-offset: 78px;
  --touch-min: 44px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  color-scheme: dark;
  -webkit-tap-highlight-color: rgba(80, 200, 255, 0.12);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--page-bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

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

  .nav-btn,
  .icon-btn,
  .nav-mobile-sheet,
  .nav-mobile__toggle-lines span,
  .lang-switcher__caret {
    transition: none !important;
  }
}

.nav-dock {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding-top: max(12px, env(safe-area-inset-top, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  pointer-events: none;
}

@media (min-width: 480px) {
  .nav-dock {
    padding-top: max(16px, env(safe-area-inset-top, 0px));
    padding-right: max(16px, env(safe-area-inset-right, 0px));
    padding-left: max(16px, env(safe-area-inset-left, 0px));
  }
}

.nav-dock-inner {
  pointer-events: auto;
  max-width: 1280px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(10px, 3vw, 16px);
}

.pill {
  display: flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  padding: 10px 18px;
  background: var(--pill-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--pill-border);
  border-radius: 9999px;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.pill--brand {
  flex-shrink: 0;
  padding-left: 14px;
  gap: 10px;
}

.brand-mark {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  color: var(--hypr-cyan);
}

.brand-name {
  font-weight: 600;
  font-size: clamp(13px, 3.8vw, 15px);
  letter-spacing: -0.02em;
  color: var(--hypr-cyan);
  min-width: 0;
}

.nav-actions--desktop {
  flex-shrink: 0;
  width: fit-content;
  max-width: 100%;
  flex-wrap: wrap;
  align-items: center;
  row-gap: 8px;
  padding: 8px 16px 8px 14px;
  gap: 10px;
}

.nav-mobile {
  display: none;
  position: relative;
  z-index: 2;
  flex-shrink: 0;
}

.nav-mobile__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-min);
  height: var(--touch-min);
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  padding: 0;
  border: none;
  cursor: pointer;
  touch-action: manipulation;
  font: inherit;
  color: var(--muted);
  background: transparent;
  border-radius: 50%;
  transition: color 0.15s ease, background 0.15s ease;
}

@media (hover: hover) and (pointer: fine) {
  .nav-mobile__toggle:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
  }
}

.nav-mobile__toggle[aria-expanded="true"] {
  color: var(--hypr-cyan);
  background: rgba(80, 200, 255, 0.12);
}

.nav-mobile__toggle-lines {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 20px;
  pointer-events: none;
}

.nav-mobile__toggle-lines span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.nav-mobile__toggle[aria-expanded="true"] .nav-mobile__toggle-lines span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-mobile__toggle[aria-expanded="true"] .nav-mobile__toggle-lines span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}

.nav-mobile__toggle[aria-expanded="true"] .nav-mobile__toggle-lines span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-mobile-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1001;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.nav-mobile-backdrop.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.nav-mobile__pill {
  padding: 4px 6px !important;
  width: fit-content;
  gap: 0;
}

.nav-mobile-sheet {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  z-index: 1002;
  width: min(300px, calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px) - 24px));
  max-height: min(72dvh, calc(100dvh - 120px));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px;
  padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
  background: rgba(14, 14, 18, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--pill-border);
  border-radius: 18px;
  box-shadow:
    0 20px 50px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.nav-mobile-sheet.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.nav-mobile-sheet__body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nav-mobile-icons {
  display: flex;
  gap: 8px;
}

.nav-mobile-icons .icon-btn {
  flex: 1;
  width: auto;
  min-width: 0;
  border-radius: 12px;
  height: var(--touch-min);
}

.nav-mobile-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-mobile-actions .nav-btn {
  width: 100%;
  min-height: var(--touch-min);
}

html.nav-menu-open,
html.nav-menu-open body {
  overflow: hidden;
}

html.nav-menu-open {
  touch-action: none;
}

.icon-row {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.nav-btn,
.icon-btn,
.pill--brand {
  touch-action: manipulation;
}

.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch-min);
  padding: 10px 18px;
  font-size: clamp(12px, 3.4vw, 13px);
  font-weight: 600;
  line-height: 1.2;
  border-radius: 9999px;
  white-space: nowrap;
  transition:
    color 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s ease,
    filter 0.18s ease;
}

.nav-btn:focus-visible {
  outline: 2px solid var(--hypr-cyan);
  outline-offset: 2px;
}

.nav-btn--ghost {
  border: 1px solid rgba(80, 200, 255, 0.42);
  color: rgba(255, 255, 255, 0.92);
  background: rgba(255, 255, 255, 0.04);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.nav-btn--ghost:active {
  background: rgba(80, 200, 255, 0.14);
  border-color: var(--hypr-cyan);
}

.nav-btn--primary {
  border: 1px solid transparent;
  color: #07080a;
  background: linear-gradient(180deg, #6ad4ff 0%, var(--hypr-cyan) 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 6px 22px rgba(80, 200, 255, 0.32);
}

.nav-btn--primary:active {
  transform: translateY(0);
  filter: brightness(0.96);
}

@media (hover: hover) and (pointer: fine) {
  .nav-btn--ghost:hover {
    border-color: var(--hypr-cyan);
    background: rgba(80, 200, 255, 0.1);
    color: #fff;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.08),
      0 0 24px rgba(80, 200, 255, 0.15);
  }

  .nav-btn--primary:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
    box-shadow:
      0 1px 0 rgba(255, 255, 255, 0.4) inset,
      0 10px 28px rgba(80, 200, 255, 0.42);
  }
}

.lang-switcher {
  position: relative;
  flex-shrink: 0;
  align-self: center;
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "PingFang SC",
    "Hiragino Sans GB",
    "Microsoft YaHei",
    "Noto Sans CJK SC",
    sans-serif;
}

.lang-switcher__trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 36px;
  padding: 0 12px;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.lang-switcher__trigger:hover {
  color: var(--text);
  border-color: rgba(80, 200, 255, 0.35);
  background: rgba(80, 200, 255, 0.08);
}

.lang-switcher__trigger[aria-expanded="true"] {
  color: var(--hypr-cyan);
  border-color: rgba(80, 200, 255, 0.45);
  background: rgba(80, 200, 255, 0.12);
  box-shadow: 0 0 0 1px rgba(80, 200, 255, 0.12);
}

.lang-switcher__trigger:focus-visible {
  outline: 2px solid var(--hypr-cyan);
  outline-offset: 2px;
}

.lang-switcher__code {
  min-width: 1.75em;
  text-align: center;
  line-height: 1.2;
}

.lang-switcher__caret {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  opacity: 0.85;
  transition: transform 0.2s ease;
}

.lang-switcher__trigger[aria-expanded="true"] .lang-switcher__caret {
  transform: rotate(180deg);
}

.lang-switcher__menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 1100;
  min-width: 148px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: rgba(14, 14, 18, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--pill-border);
  border-radius: 14px;
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.lang-switcher__menu[hidden] {
  display: none;
}

.lang-switcher__menu li {
  margin: 0;
  padding: 0;
}

.lang-switcher__option {
  display: flex;
  width: 100%;
  align-items: center;
  margin: 0;
  padding: 10px 12px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: color 0.12s ease, background 0.12s ease;
}

.lang-switcher__option:hover,
.lang-switcher__option:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  outline: none;
}

.lang-switcher__option[aria-selected="true"] {
  color: var(--hypr-cyan);
  background: rgba(80, 200, 255, 0.1);
}

.lang-switcher--sheet {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
}

.lang-switcher__sheet-label {
  flex: 1 1 auto;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

.lang-switcher--sheet .lang-switcher__trigger--sheet {
  margin-left: auto;
}

.lang-switcher--sheet .lang-switcher__menu {
  left: 0;
  right: 0;
  min-width: 0;
}

.nav-divider {
  width: 1px;
  height: 22px;
  align-self: center;
  background: rgba(255, 255, 255, 0.1);
  margin-right: 12px;
  flex-shrink: 0;
}

.icon-btn {
  width: var(--touch-min);
  height: var(--touch-min);
  min-width: var(--touch-min);
  min-height: var(--touch-min);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px solid transparent;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.icon-btn:active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

@media (hover: hover) and (pointer: fine) {
  .icon-btn:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.08);
  }
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

main {
  padding-top: calc(96px + env(safe-area-inset-top, 0px));
  padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px));
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
  min-height: calc(100vh + 70vh);
  min-height: calc(100dvh + 70dvh);
}

@media (min-width: 721px) {
  .nav-mobile {
    display: none;
  }
}

@media (max-width: 720px) {
  .nav-actions--desktop {
    display: none;
  }

  .nav-mobile {
    display: block;
  }

  .nav-dock {
    padding-top: max(10px, env(safe-area-inset-top, 0px));
    padding-right: max(12px, env(safe-area-inset-right, 0px));
    padding-left: max(12px, env(safe-area-inset-left, 0px));
  }

  .nav-dock-inner {
    flex-wrap: nowrap;
    gap: 10px;
  }

  .pill--brand {
    flex: 1 1 auto;
    min-width: 0;
    padding: 8px 14px;
  }

  .brand-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  main {
    padding-top: calc(var(--nav-stack-offset) + env(safe-area-inset-top, 0px));
  }
}

@media (max-width: 720px) and (orientation: landscape) {
  :root {
    --nav-stack-offset: 72px;
  }
}
