* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  color-scheme: dark;
  --bg: #0b0b0f;
  --panel: rgba(22, 22, 29, 0.94);
  --line: rgba(255, 255, 255, 0.1);
  --text: #ffffff;
  --muted: #9b9ba5;
  --accent: #8b5cf6;
  --accent-2: #a78bfa;
}

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, system-ui, sans-serif;
  overflow: hidden;
}

body {
  overscroll-behavior: none;
}

button, a {
  font: inherit;
}

button {
  border: 0;
}

.app {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  padding-top: env(safe-area-inset-top);
}

.topbar {
  height: 58px;
  min-height: 58px;
  display: grid;
  grid-template-columns: 52px 1fr 52px;
  align-items: center;
  padding: 0 4px;
  background: rgba(11, 11, 15, 0.92);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 20;
}

.top-title {
  text-align: center;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.icon-button {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  display: grid;
  place-items: center;
}

.icon-button:active {
  background: rgba(255, 255, 255, 0.08);
}

.back-icon {
  font-size: 34px;
  line-height: 1;
  font-weight: 300;
  transform: translateY(-2px);
}

.more-icon {
  font-size: 17px;
  letter-spacing: 2px;
}

.content {
  position: relative;
  flex: 1;
  min-height: 0;
  background: #000;
}

#siteFrame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.frame-loading {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-content: center;
  gap: 14px;
  background: #0b0b0f;
  transition: opacity 0.35s ease, visibility 0.35s ease;
}

.frame-loading.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.mini-logo,
.splash-logo {
  width: 76px;
  height: 76px;
  margin: 0 auto;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #a78bfa, #6d28d9);
  color: white;
  font-size: 42px;
  font-weight: 800;
  box-shadow: 0 18px 50px rgba(124, 58, 237, 0.35);
}

.mini-logo {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  font-size: 28px;
}

.mini-dots,
.dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 7px;
}

.mini-dots span,
.dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-2);
  animation: bounce 0.9s infinite ease-in-out;
}

.mini-dots span:nth-child(2),
.dots span:nth-child(2) {
  animation-delay: 0.15s;
}

.mini-dots span:nth-child(3),
.dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes bounce {
  0%, 70%, 100% {
    transform: translateY(0);
    opacity: 0.55;
  }
  35% {
    transform: translateY(-9px);
    opacity: 1;
  }
}

.bottom-nav {
  min-height: calc(64px + env(safe-area-inset-bottom));
  padding: 6px 12px calc(6px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: rgba(15, 15, 20, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 30;
}

.nav-item {
  min-width: 0;
  color: var(--muted);
  background: transparent;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 14px;
  font-size: 11px;
  font-weight: 600;
}

.nav-item.active,
.nav-item:active {
  color: var(--accent-2);
}

.nav-icon {
  font-size: 22px;
  line-height: 24px;
  font-weight: 500;
}

.more-menu {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  background: rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.more-menu.open {
  opacity: 1;
  visibility: visible;
}

.menu-panel {
  width: 100%;
  max-height: 78vh;
  padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  border-radius: 24px 24px 0 0;
  background: var(--panel);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  transform: translateY(24px);
  transition: transform 0.25s ease;
}

.more-menu.open .menu-panel {
  transform: translateY(0);
}

.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 2px 12px;
  font-size: 19px;
  font-weight: 800;
}

.close-button {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 24px;
  line-height: 1;
}

.custom-links {
  display: grid;
  gap: 8px;
  overflow: auto;
  max-height: calc(78vh - 75px);
}

.custom-link {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  text-decoration: none;
  font-weight: 650;
}

.custom-link:active {
  background: rgba(255, 255, 255, 0.12);
}

.custom-link span:last-child {
  color: var(--muted);
  font-size: 22px;
}

.splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 16px;
  background: #0b0b0f;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.splash.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-title {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.4px;
}

@media (min-width: 700px) {
  .app {
    max-width: 520px;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 100%;
    box-shadow: 0 0 80px rgba(0, 0, 0, 0.5);
  }
}

.splash-logo-image {
  width: 170px;
  max-width: 72vw;
  height: auto;
  object-fit: contain;
  filter: drop-shadow(0 18px 45px rgba(0, 110, 255, 0.3));
}

.mini-logo-image {
  width: 90px;
  height: 70px;
  margin: 0 auto;
  object-fit: contain;
  filter: drop-shadow(0 10px 30px rgba(0, 110, 255, 0.25));
}
