*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #FF3366;
  --primary-dark: #cc2952;
  --primary-glow: rgba(255, 51, 102, 0.3);
  --secondary: #00D4FF;
  --secondary-glow: rgba(0, 212, 255, 0.3);
  --accent: #FFE500;
  --accent-glow: rgba(255, 229, 0, 0.3);
  --background: #0D0D0D;
  --surface: #1A1A2E;
  --surface-light: #252542;
  --surface-hover: #2E2E4A;
  --text-primary: #FFFFFF;
  --text-secondary: #A0A0B0;
  --text-muted: #6B6B80;
  --success: #00FF88;
  --success-glow: rgba(0, 255, 136, 0.3);
  --warning: #FF9500;
  --error: #FF4444;
  --error-glow: rgba(255, 68, 68, 0.3);

  --font-heading: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-accent: 'Space Grotesk', monospace;

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;

  --header-h: 60px;
  --bottom-nav-h: 68px;
  --max-width: 1200px;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background: var(--background);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  height: 100vh;
  width: 100vw;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

#app {
  position: relative;
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

a {
  color: var(--secondary);
  text-decoration: none;
  transition: color 0.2s;
}
a:hover { color: var(--primary); }

button {
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

input, textarea, select {
  font-family: var(--font-body);
  font-size: 1rem;
  -webkit-appearance: none;
  appearance: none;
}

img {
  max-width: 100%;
  display: block;
}

ul { list-style: none; }

/* ─── HEADER ─── */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  z-index: 100;
  background: rgba(13, 13, 13, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  transition: background 0.3s, box-shadow 0.3s;
}

.app-header.scrolled {
  background: rgba(13, 13, 13, 0.95);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
}

.header-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-icon { display: block; }

.logo-text {
  font-family: var(--font-heading);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-secondary);
  flex: 1;
  text-align: center;
  transition: opacity 0.3s, transform 0.3s;
}

.header-title.animating {
  opacity: 0;
  transform: translateY(-4px);
}

.header-cta {
  padding: 7px 16px;
  background: linear-gradient(135deg, var(--primary), #ff1a4f);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  color: white;
  transition: transform 0.2s, box-shadow 0.2s;
  flex-shrink: 0;
  animation: pulseGlow 3s infinite;
}

.header-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px var(--primary-glow);
}

.header-cta:active { transform: scale(0.97); }

.main-content {
  flex: 1;
  margin-top: var(--header-h);
  margin-bottom: var(--bottom-nav-h);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: var(--surface-light) transparent;
}

.main-content::-webkit-scrollbar { width: 4px; }
.main-content::-webkit-scrollbar-track { background: transparent; }
.main-content::-webkit-scrollbar-thumb { background: var(--surface-light); border-radius: 4px; }

.view-container {
  position: relative;
  min-height: 100%;
}

.view {
  display: none;
  padding: 20px 16px 32px;
  max-width: var(--max-width);
  margin: 0 auto;
  animation: viewFadeIn 0.4s ease-out;
}

.view.active { display: block; }

.view-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.6rem;
  margin-bottom: 4px;
  background: linear-gradient(135deg, var(--text-primary), var(--text-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.view-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.section-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.35rem;
  margin-bottom: 20px;
  color: var(--text-primary);
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 40px;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 4px;
}

.section-title.centered {
  display: block;
  text-align: center;
}

.section-title.centered::after {
  left: 50%;
  transform: translateX(-50%);
}

.section-title .highlight {
  color: var(--primary);
}

.section-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 24px;
  line-height: 1.6;
}

/* ─── BOTTOM NAV ─── */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-h);
  z-index: 100;
  background: rgba(13, 13, 13, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 4px;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  transition: transform 0.2s, color 0.2s;
  color: var(--text-muted);
  position: relative;
  min-width: 56px;
}

.nav-item:hover { color: var(--text-secondary); }
.nav-item:active { transform: scale(0.92); }

.nav-item.active {
  color: var(--primary);
}

.nav-item.active .nav-icon {
  filter: drop-shadow(0 0 8px var(--primary-glow));
}

.nav-item.active::after {
  content: '';
  position: absolute;
  top: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 24px;
  height: 3px;
  background: var(--primary);
  border-radius: 0 0 4px 4px;
  box-shadow: 0 0 12px var(--primary-glow);
}

.nav-icon { display: block; }

.nav-label {
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.03em;
}

/* ─── TOAST ─── */
.toast-container {
  position: fixed;
  top: calc(var(--header-h) + 10px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  width: calc(100% - 32px);
  max-width: 400px;
}

.toast {
  padding: 14px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  pointer-events: auto;
  animation: toastSlideIn 0.35s ease-out;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}

.toast.success { background: rgba(0, 255, 136, 0.15); border: 1px solid var(--success); color: var(--success); }
.toast.error { background: rgba(255, 68, 68, 0.15); border: 1px solid var(--error); color: var(--error); }
.toast.warning { background: rgba(255, 149, 0, 0.15); border: 1px solid var(--warning); color: var(--warning); }
.toast.info { background: rgba(0, 212, 255, 0.15); border: 1px solid var(--secondary); color: var(--secondary); }

.toast.exiting { animation: toastSlideOut 0.3s ease-in forwards; }

/* ─── RESPONSIVE ─── */
@media (min-width: 768px) {
  .header-inner { padding: 0 24px; }
  .view { padding: 28px 24px 40px; }
  .view-title { font-size: 2rem; }
  .nav-label { font-size: 0.65rem; }
  .section-title { font-size: 1.6rem; }
}

@media (min-width: 1024px) {
  .header-inner { padding: 0 32px; }
  .view { padding: 32px 32px 48px; }
  .bottom-nav {
    max-width: 500px;
    left: 50%;
    transform: translateX(-50%);
    border-radius: var(--radius-md) var(--radius-md) 0 0;
  }
  .section-title { font-size: 1.8rem; }
}

@media (min-width: 1200px) {
  .view { padding: 40px 32px 56px; }
}
