/* ============================
   CSS Custom Properties
   ============================ */
:root {
  /* Colors */
  --bg:           #07070f;
  --surface:      #0f0f1e;
  --card:         #161628;
  --card-hover:   #1c1c35;
  --border:       #2a2a4a;
  --border-glow:  rgba(139, 92, 246, 0.3);

  --primary:      #8b5cf6;
  --primary-dim:  #6d3fd1;
  --primary-glow: rgba(139, 92, 246, 0.18);
  --primary-light: rgba(139, 92, 246, 0.08);

  --gold:         #d4a853;
  --gold-dim:     #b8902e;
  --gold-glow:    rgba(212, 168, 83, 0.18);
  --gold-light:   rgba(212, 168, 83, 0.08);

  --text:         #e8e6ff;
  --text-dim:     #a8a6c8;
  --muted:        #5a5878;

  --success:      #34d399;
  --success-bg:   rgba(52, 211, 153, 0.1);
  --danger:       #f87171;
  --danger-bg:    rgba(248, 113, 113, 0.1);
  --warning:      #fbbf24;
  --warning-bg:   rgba(251, 191, 36, 0.1);
  --info:         #60a5fa;
  --info-bg:      rgba(96, 165, 250, 0.1);

  /* Spacing */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-8:  32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;

  /* Typography */
  --font-display: 'Cinzel', Georgia, serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --text-xs:   11px;
  --text-sm:   13px;
  --text-base: 15px;
  --text-md:   17px;
  --text-lg:   20px;
  --text-xl:   24px;
  --text-2xl:  30px;
  --text-3xl:  38px;

  /* Radii */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 3px rgba(0,0,0,0.4);
  --shadow-md:  0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 24px var(--primary-glow);
  --shadow-gold: 0 0 24px var(--gold-glow);

  /* Layout */
  --nav-height:    60px;
  --bnav-height:   68px;
  --max-width:     900px;
  --content-pad:   var(--space-4);

  /* Transitions */
  --ease:       cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast:   120ms;
  --dur-base:   220ms;
  --dur-slow:   380ms;
}

/* ============================
   Reset & Base
   ============================ */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  color: var(--text);
}

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

button {
  cursor: pointer;
  font-family: inherit;
  border: none;
  background: none;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
}

ul, ol {
  list-style: none;
}

/* ============================
   Typography
   ============================ */
h1, h2, h3, h4, h5 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
}

h1 { font-size: var(--text-3xl); }
h2 { font-size: var(--text-2xl); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }
h5 { font-size: var(--text-md); }

p { color: var(--text-dim); line-height: 1.7; }

.text-gold    { color: var(--gold); }
.text-primary { color: var(--primary); }
.text-muted   { color: var(--muted); }
.text-dim     { color: var(--text-dim); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-center  { text-align: center; }
.text-sm      { font-size: var(--text-sm); }
.text-xs      { font-size: var(--text-xs); }
.text-lg      { font-size: var(--text-lg); }
.font-display { font-family: var(--font-display); }
.font-medium  { font-weight: 500; }
.font-semibold { font-weight: 600; }

/* ============================
   Layout
   ============================ */
#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

#main-content {
  flex: 1;
  padding-top: var(--nav-height);
  padding-bottom: 0;
}

#main-content.has-bnav {
  padding-bottom: var(--bnav-height);
}

.page {
  min-height: calc(100dvh - var(--nav-height));
  padding: var(--space-6) var(--content-pad);
  max-width: var(--max-width);
  margin: 0 auto;
  width: 100%;
}

.page-full {
  min-height: calc(100dvh - var(--nav-height));
  padding: 0;
  width: 100%;
}

.page-center {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6) var(--content-pad);
}

.section { margin-bottom: var(--space-8); }
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}
.section-title {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* ============================
   Top Navigation
   ============================ */
.top-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: rgba(7, 7, 15, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 var(--space-5);
  gap: var(--space-6);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  flex-shrink: 0;
}

.brand-sigil {
  color: var(--gold);
  font-size: 18px;
  animation: sigil-pulse 4s ease-in-out infinite;
}

.brand-name {
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.04em;
}

.nav-links {
  display: flex;
  gap: var(--space-2);
  flex: 1;
}

.nav-link {
  color: var(--text-dim);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
  text-decoration: none;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text);
  background: var(--primary-light);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.nav-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background: var(--primary-glow);
  border: 1px solid var(--border-glow);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease);
}

.nav-avatar:hover { border-color: var(--primary); }

.avatar-initial {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--primary);
}

/* ============================
   Bottom Navigation
   ============================ */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--bnav-height);
  background: rgba(7, 7, 15, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 var(--space-2);
  padding-bottom: env(safe-area-inset-bottom);
}

.bnav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: var(--space-2) var(--space-3);
  color: var(--muted);
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease);
  min-width: 52px;
}

.bnav-item svg {
  width: 22px;
  height: 22px;
}

.bnav-item span {
  font-size: 10px;
  font-weight: 500;
}

.bnav-item.active,
.bnav-item:hover {
  color: var(--primary);
}

.bnav-center {
  width: 52px;
  height: 52px;
  background: var(--primary);
  border-radius: var(--radius-full);
  display: flex !important;
  align-items: center;
  justify-content: center;
  margin-top: -20px;
  box-shadow: 0 0 20px var(--primary-glow), var(--shadow-md);
  color: #fff !important;
  min-width: auto;
  padding: 0;
  flex-direction: row;
}

.bnav-center svg {
  width: 24px;
  height: 24px;
}

.bnav-center span { display: none; }

/* ============================
   Utility Classes
   ============================ */
.hidden { display: none !important; }
.invisible { visibility: hidden; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }
.w-full { width: 100%; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.p-4 { padding: var(--space-4); }
.p-6 { padding: var(--space-6); }
.opacity-0 { opacity: 0; }
.relative { position: relative; }
.absolute { position: absolute; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================
   Dividers & Ornaments
   ============================ */
.divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--muted);
  font-size: var(--text-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin: var(--space-6) 0;
}

.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ============================
   Scrollbar
   ============================ */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ============================
   Focus Styles
   ============================ */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ============================
   Responsive
   ============================ */
@media (min-width: 768px) {
  .bottom-nav { display: none !important; }

  #main-content.has-bnav {
    padding-bottom: 0;
  }

  .page {
    padding: var(--space-8) var(--space-6);
  }
}

@media (max-width: 767px) {
  .nav-links { display: none; }
}
