/* Shared Vibes site theme — chrome neon / cyberpunk (matches music player) */
@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap");

:root {
  --vibes-logo-path: /vibes-logo-circle.png;
  --vibes-nav-h: 64px;
  --vibes-page-header-h: 64px;
  --vibes-page-tabs-h: 46px;
  --vibes-bg: #000000;
  --vibes-panel: rgba(8, 10, 18, 0.92);
  --vibes-cyan: #22d3ee;
  --vibes-cyan-glow: rgba(34, 211, 238, 0.35);
  --vibes-purple: #a78bfa;
  --vibes-purple-glow: rgba(167, 139, 250, 0.28);
  --vibes-border: rgba(34, 211, 238, 0.28);
  --vibes-border-purple: rgba(167, 139, 250, 0.32);
  --vibes-text: #e8ecf4;
  --vibes-muted: #8b95a8;
  --vibes-accent: #6366f1;
  --vibes-accent-soft: rgba(99, 102, 241, 0.18);
  --flow-teal: #0e8fad;
  --flow-indigo: #5b66c9;
  --flow-border-bg: linear-gradient(
    90deg,
    var(--flow-teal) 0%,
    var(--flow-teal) 38%,
    var(--flow-indigo) 62%,
    var(--flow-indigo) 100%
  );
  --rgb-border-duration: 48s;
}

html {
  background: var(--vibes-bg);
}

/* —— Page shell + ambient background (all Vibes pages) —— */
.vibes-body {
  margin: 0;
  min-height: 100vh;
  font-family: "Outfit", system-ui, sans-serif;
  color: var(--vibes-text);
  background: var(--vibes-bg);
  position: relative;
  overflow-x: hidden;
}

.music-body {
  margin: 0;
  min-height: 100vh;
  font-family: "Outfit", system-ui, sans-serif;
  color: var(--vibes-text);
  background: transparent;
  position: relative;
  overflow-x: visible;
  overflow-y: visible;
  isolation: isolate;
}

.vibes-bg-grid,
.vibes-bg-stardust,
.vibes-bg-circuit,
.vibes-bg-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.vibes-bg-grid {
  background:
    linear-gradient(rgba(34, 211, 238, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(167, 139, 250, 0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 0%, black, transparent 75%);
}

.vibes-bg-stardust,
.music-bg-stardust {
  opacity: 0.45;
  background-image: radial-gradient(circle at center, rgba(34, 211, 238, 0.85) 0.5px, transparent 0.6px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse 90% 80% at 50% 20%, black 20%, transparent 70%);
}

.vibes-bg-circuit,
.music-bg-circuit {
  opacity: 0.12;
  background:
    linear-gradient(90deg, transparent 49%, rgba(34, 211, 238, 0.35) 50%, transparent 51%) 0 0 / 120px 80px,
    linear-gradient(transparent 49%, rgba(34, 211, 238, 0.2) 50%, transparent 51%) 0 0 / 80px 120px;
  mask-image: radial-gradient(ellipse 70% 60% at 85% 50%, black, transparent 75%);
}

.vibes-bg-glow,
.music-bg-glow {
  background:
    radial-gradient(ellipse 100% 70% at 50% -20%, rgba(34, 211, 238, 0.18), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 35%, rgba(167, 139, 250, 0.14), transparent 50%),
    radial-gradient(ellipse 55% 45% at 0% 80%, rgba(124, 58, 237, 0.1), transparent 45%);
  animation: vibes-bg-drift 18s ease-in-out infinite alternate;
}

@keyframes vibes-bg-drift {
  from { opacity: 0.85; transform: scale(1); }
  to { opacity: 1; transform: scale(1.02); }
}

.vibes-body > *:not(.vibes-bg-grid):not(.vibes-bg-glow):not(.vibes-bg-stardust):not(.vibes-bg-circuit):not(.vibes-site-nav) {
  position: relative;
  z-index: 1;
}

/* Music page: header stays pinned above the player stage */
.vibes-body.music-body > .vibes-site-nav {
  position: fixed;
  z-index: 9999;
}

/* —— Logo (nav + hero) —— */
.vibes-brand-logo,
.nav-brand-mark.vibes-brand-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  line-height: 0;
  font-size: 0;
  filter: none;
}

.vibes-brand-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 5px rgba(34, 211, 238, 0.22));
}

.vibes-hero-logo {
  display: block;
  width: clamp(240px, 28vw, 336px);
  height: auto;
  margin: 0 auto 1.25rem;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(34, 211, 238, 0.18)) drop-shadow(0 0 14px rgba(167, 139, 250, 0.12));
}

.vibes-site-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
  padding: 0.65rem 1.25rem;
  background: rgba(8, 10, 18, 0.92);
  border-bottom: 1px solid var(--vibes-border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  min-height: var(--vibes-nav-h);
  box-sizing: border-box;
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.45),
    0 0 24px rgba(34, 211, 238, 0.06);
}

.vibes-site-nav .nav-brand {
  flex-shrink: 0;
}

.vibes-site-nav .nav-links {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: flex-start;
  flex: 1 1 auto;
  min-width: 0;
}

.vibes-account-slot {
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* —— Shared account menu (all pages) —— */
.vibes-account-menu {
  position: relative;
}

.vibes-account-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  border: 1px solid var(--vibes-border-purple);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--vibes-text);
  padding: 0.35rem 0.75rem 0.35rem 0.35rem;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  max-width: min(240px, 42vw);
}

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

.vibes-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  object-fit: cover;
  border: 2px solid rgba(167, 139, 250, 0.45);
  box-shadow: 0 0 12px rgba(34, 211, 238, 0.12);
  flex-shrink: 0;
}

.vibes-user-avatar-fallback {
  display: inline-grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.9), rgba(49, 212, 255, 0.8));
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
}

/* Circular animated avatar ring (shared account menu + music player) */
@keyframes rgb-border-flow {
  0% { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

.avatar-flow-ring {
  --avatar-ring-size: 32px;
  --avatar-ring-pad: 2px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(var(--avatar-ring-size) + var(--avatar-ring-pad) * 2);
  height: calc(var(--avatar-ring-size) + var(--avatar-ring-pad) * 2);
  border-radius: 50%;
  flex-shrink: 0;
  isolation: isolate;
  vertical-align: middle;
}

.avatar-flow-ring::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  padding: var(--avatar-ring-pad);
  background: var(--flow-border-bg);
  background-size: 280% 100%;
  animation: rgb-border-flow var(--rgb-border-duration, 48s) ease-in-out infinite alternate;
  opacity: 0.92;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
  z-index: 2;
  filter: drop-shadow(0 0 8px rgba(99, 102, 241, 0.28));
}

.avatar-flow-ring > img,
.avatar-flow-ring > .vibes-user-avatar,
.avatar-flow-ring > .vibes-user-avatar-fallback {
  position: relative;
  z-index: 1;
  width: var(--avatar-ring-size);
  height: var(--avatar-ring-size);
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: none;
  background: #151822;
  box-sizing: border-box;
  box-shadow: inset 0 0 0 1px rgba(10, 14, 26, 0.65);
}

.avatar-flow-ring > .vibes-user-avatar-fallback {
  display: inline-grid;
  place-items: center;
  font-weight: 800;
  color: #fff;
}

.avatar-flow-ring--xs { --avatar-ring-size: 22px; --avatar-ring-pad: 1.5px; }
.avatar-flow-ring--sm { --avatar-ring-size: 24px; --avatar-ring-pad: 2px; }
.avatar-flow-ring--md { --avatar-ring-size: 32px; }
.avatar-flow-ring--badge { --avatar-ring-size: 34px; --avatar-ring-pad: 2px; }
.avatar-flow-ring--active { --avatar-ring-size: 44px; }
.avatar-flow-ring--history { --avatar-ring-size: 30px; }

.vibes-account-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 0.45rem);
  min-width: 150px;
  padding: 0.45rem;
  border-radius: 16px;
  border: 1px solid rgba(190, 210, 255, 0.22);
  background: rgba(16, 20, 38, 0.96);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.38);
  z-index: 120;
}

.vibes-account-dropdown button {
  width: 100%;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #eef2f8;
  padding: 0.65rem 0.75rem;
  text-align: left;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
}

.vibes-account-dropdown button:hover {
  background: rgba(255, 255, 255, 0.08);
}

.vibes-account-signin {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, 0.35);
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.35), rgba(99, 102, 241, 0.25));
  color: var(--vibes-text);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 0 20px rgba(34, 211, 238, 0.15);
}

.vibes-account-signin:hover {
  background: linear-gradient(135deg, rgba(8, 145, 178, 0.5), rgba(99, 102, 241, 0.4));
  box-shadow: 0 0 28px rgba(34, 211, 238, 0.25);
}

/* —— Sticky page chrome: header + tabs fixed, content scrolls —— */
.vibes-app-frame {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--vibes-nav-h));
  overflow: hidden;
  box-sizing: border-box;
}

/* In app frames, chrome is flex siblings above the scroll pane — not sticky overlays */
.vibes-app-frame > .vibes-page-header,
.vibes-app-frame > .vibes-page-tabs {
  position: relative;
  top: auto;
  flex-shrink: 0;
}

.vibes-page-header {
  position: sticky;
  top: var(--vibes-nav-h);
  flex-shrink: 0;
  z-index: 92;
  background: rgba(8, 10, 18, 0.94);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--vibes-border);
  box-sizing: border-box;
}

.vibes-page-tabs {
  position: sticky;
  top: calc(var(--vibes-nav-h) + var(--vibes-page-header-h));
  flex-shrink: 0;
  z-index: 91;
  background: rgba(8, 10, 18, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--vibes-border-purple);
  box-sizing: border-box;
}

/* Dungeon character view: toolbar + tabs are flex chrome above the scroll pane (not sticky) */
.dungeon-char-frame .char-toolbar.vibes-page-header,
.dungeon-char-frame .tabs.vibes-page-tabs {
  position: relative;
  top: auto;
}

.vibes-scroll-main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.vibes-site-nav .nav-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: inherit;
  flex-shrink: 0;
}

.vibes-site-nav .nav-brand-mark {
  font-size: 1.35rem;
  line-height: 1;
}

.vibes-site-nav .nav-brand-text {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #f8fafc 0%, #94a3b8 30%, #22d3ee 55%, #c4b5fd 85%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.vibes-site-nav .nav-brand-sub {
  display: block;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--vibes-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.vibes-site-nav .nav-links a {
  padding: 0.45rem 0.85rem;
  border-radius: 10px;
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--vibes-muted);
  border: 1px solid transparent;
  transition: background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.vibes-site-nav .nav-links a:hover {
  color: #a5f3fc;
  background: rgba(34, 211, 238, 0.08);
  border-color: rgba(34, 211, 238, 0.22);
}

.vibes-site-nav .nav-links a.active {
  color: #e8ecf4;
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(167, 139, 250, 0.35);
  box-shadow: 0 0 18px rgba(167, 139, 250, 0.12);
}

.vibes-site-nav .nav-links a.nav-music.active {
  background: rgba(34, 211, 238, 0.1);
  border-color: rgba(34, 211, 238, 0.4);
  color: #a5f3fc;
  box-shadow: 0 0 18px rgba(34, 211, 238, 0.18);
}

.vibes-site-nav .nav-links a.nav-dungeon.active {
  background: rgba(201, 162, 39, 0.12);
  border-color: rgba(201, 162, 39, 0.38);
  color: #f0d78c;
  box-shadow: 0 0 18px rgba(201, 162, 39, 0.12);
}

.vibes-site-nav .nav-links a.nav-panel.active {
  background: rgba(99, 102, 241, 0.14);
  border-color: rgba(167, 139, 250, 0.4);
  color: #ddd6fe;
  box-shadow: 0 0 18px rgba(167, 139, 250, 0.15);
}

/* Home landing */
.vibes-home {
  min-height: calc(100vh - var(--vibes-nav-h, 64px));
  color: var(--vibes-text);
  background: transparent;
}

.vibes-home-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
}

.vibes-hero {
  text-align: center;
  margin-bottom: 3rem;
}

.vibes-hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  margin: 0 0 0.75rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #f8fafc 0%, #94a3b8 25%, #22d3ee 50%, #c4b5fd 80%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 20px rgba(34, 211, 238, 0.15));
}

.vibes-hero .lead {
  max-width: 540px;
  margin: 0 auto 1.5rem;
  color: var(--vibes-muted);
  font-size: 1.1rem;
  line-height: 1.55;
}

.vibes-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.vibes-card {
  display: block;
  padding: 1.5rem 1.75rem;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.06) 0%, transparent 42%),
    linear-gradient(145deg, rgba(15, 18, 28, 0.97), rgba(6, 8, 14, 0.94));
  border: 1px solid var(--vibes-border-purple);
  border-radius: 18px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 12px 40px rgba(0, 0, 0, 0.45),
    0 0 28px rgba(34, 211, 238, 0.06);
  position: relative;
  overflow: visible;
  animation: vibes-panel-glow 4s ease-in-out infinite;
}

@keyframes vibes-panel-glow {
  0%, 100% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.08),
      0 12px 40px rgba(0, 0, 0, 0.45),
      0 0 28px rgba(34, 211, 238, 0.06);
  }
  50% {
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.1),
      0 16px 48px rgba(0, 0, 0, 0.5),
      0 0 40px rgba(167, 139, 250, 0.1);
  }
}

.vibes-card:hover {
  transform: translateY(-4px);
  border-color: rgba(34, 211, 238, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 20px 56px rgba(0, 0, 0, 0.55),
    0 0 36px rgba(34, 211, 238, 0.14);
}

.vibes-card.dungeon:hover {
  border-color: rgba(201, 162, 39, 0.45);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 20px 56px rgba(0, 0, 0, 0.55),
    0 0 36px rgba(201, 162, 39, 0.12);
}

.vibes-card-icon {
  font-size: 2rem;
  margin-bottom: 0.75rem;
}

.vibes-card h2 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.vibes-card p {
  margin: 0;
  color: var(--vibes-muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.vibes-card .cta {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--vibes-cyan);
}

.vibes-card.dungeon .cta {
  color: #c9a227;
}

.vibes-home footer {
  margin-top: 3rem;
  text-align: center;
  font-size: 0.85rem;
  color: #6b7a8f;
}

.vibes-home footer a {
  text-decoration: none;
  font-weight: 700;
}

.vibes-home footer a:hover {
  text-decoration: underline;
}

.footer-dungeon {
  color: #f0d78c;
}

.footer-panel {
  color: #a78bfa;
}

.footer-music {
  color: #67e8f9;
}

/* Hide nav sign-in when the page already shows an in-app login card */
.music-body:has(#view-login:not(.hidden)) .vibes-account-signin,
.dungeon-app:has(#view-login:not(.hidden)) .vibes-account-signin {
  display: none;
}

/* Panel login gate — blur site nav too */
body.panel-auth-locked .vibes-site-nav {
  filter: blur(6px);
  pointer-events: none;
  user-select: none;
}

/* Standalone /login page */
.vibes-login-main {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--vibes-nav-h));
  padding: 2rem 1.5rem 3rem;
  box-sizing: border-box;
}

.vibes-login-page .panel-login-card {
  width: min(440px, 100%);
}

@media (max-width: 720px) {
  .vibes-site-nav {
    padding: 0.5rem 0.85rem;
    gap: 0.45rem 0.65rem;
  }

  .vibes-site-nav .nav-links {
    order: 3;
    flex: 1 1 100%;
    justify-content: center;
    gap: 0.25rem;
  }

  .vibes-site-nav .nav-links a {
    padding: 0.35rem 0.55rem;
    font-size: 0.82rem;
  }

  .vibes-account-slot {
    margin-left: auto;
  }

  .vibes-brand-logo,
  .nav-brand-mark.vibes-brand-logo {
    width: 44px;
    height: 44px;
  }

  .vibes-site-nav .nav-brand-text {
    font-size: 1rem;
  }
}
