:root {
  --bg-0: #0A141E;
  --bg-1: #0d1b2a;
  --bg-2: #1b263b;
  --bg-3: #111827;

  --text: #E0E1DD;
  --muted: rgba(224, 225, 221, 0.72);

  --blue-500: #3b82f6;
  --blue-300: #60a5fa;
  --violet-500: #8b5cf6;
  --violet-300: #c084fc;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-0);
  color: var(--text);
  background: linear-gradient(-45deg, var(--bg-0), var(--bg-1), var(--bg-2), var(--bg-3));
  background-size: 400% 400%;
  animation: gradient-animation 15s ease infinite;
  padding-bottom: 3rem;
}

body.with-header .screen.visible {
  padding-top: calc(1rem + 3.75rem + env(safe-area-inset-top));
}

html, body {
  height: 100%;
}

.font-display { font-family: 'Playfair Display', serif; }

#main-particles-js {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  z-index: 0;
}

@keyframes gradient-animation {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.screen {
  width: 100%;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 1rem;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease-in-out, transform 0.5s ease-in-out;
  position: absolute;
  top: 0;
  left: 0;
  min-height: 100svh;
  z-index: 1;
}

.screen.visible {
  display: flex;
  opacity: 1;
  transform: translateY(0);
  position: relative;
  min-height: 100svh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Give room for mobile nav */
@media (max-width: 768px) {
  .screen.visible {
    padding-bottom: 5.5rem;
  }
}

.card {
  background: rgba(27, 38, 59, 0.7);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 16px 42px rgba(0,0,0,0.25);
}

.auth-input {
  background: rgba(9, 20, 36, 0.65);
  border: 1px solid rgba(255,255,255,0.12);
  outline: none;
}

.auth-input:focus {
  border-color: rgba(96, 165, 250, 0.6);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.25);
}

.btn {
  transition: all 0.2s ease-out;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(0,0,0,0.18);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(to right, var(--blue-500), var(--blue-300));
  color: #ffffff;
}

.btn-secondary {
  background: linear-gradient(to right, #4A5568, #2D3748);
  color: var(--text);
}

.btn-ai {
  background: linear-gradient(to right, var(--violet-500), var(--violet-300));
  color: #ffffff;
}

.tile {
  --tile-accent: var(--blue-300);
  --tile-accent-secondary: var(--violet-300);
  --tile-glow: rgba(96, 165, 250, 0.35);
  background: rgba(13, 27, 42, 0.75);
  backdrop-filter: blur(10px);
  border: 1px solid transparent;
  border-image: linear-gradient(135deg, var(--tile-accent), var(--tile-accent-secondary)) 1;
  transition: transform 0.3s ease-out, background 0.3s ease-out, box-shadow 0.3s ease-out, border-image 0.3s ease-out;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.25);
  position: relative;
  overflow: hidden;
  z-index: 0;
}

.tile::after {
  content: '';
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background: rgba(8, 18, 35, 0.9);
  z-index: 0;
  pointer-events: none;
}

.tile > * { position: relative; z-index: 2; }

.tile:hover:not(:disabled) {
  transform: translateY(-8px) scale(1.02);
  background: rgba(13, 27, 42, 0.95);
  box-shadow: 0 18px 45px var(--tile-glow);
  border-image: linear-gradient(135deg, var(--tile-accent-secondary), var(--tile-accent)) 1;
}

@keyframes shimmer-sweep {
  0% { transform: translateX(-150%) skewX(-30deg); }
  100% { transform: translateX(250%) skewX(-30deg); }
}

.tile.anim-shimmer::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 50%;
  height: 100%;
  background: linear-gradient(to right, rgba(96, 165, 250, 0) 0%, rgba(96, 165, 250, 0.2) 50%, rgba(96, 165, 250, 0) 100%);
  animation: shimmer-sweep 4s ease-in-out infinite;
  z-index: 1;
  pointer-events: none;
  border-radius: inherit;
}

.tile-icon {
  display: block;
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

.pill {
  background: rgba(0,0,0,0.18);
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(10px);
  border-radius: 9999px;
  padding: 0.5rem 0.85rem;
  font-size: 0.875rem;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 12, 22, 0.55);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 90;
  padding: 1rem;
}

.modal-content {
  width: 100%;
  max-width: 520px;
  background: rgba(13, 27, 42, 0.9);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 1rem;
  padding: 1.25rem;
  box-shadow: 0 18px 56px rgba(0,0,0,0.4);
}



.toast {
  position: fixed;
  z-index: 60;
  top: 1rem;
  right: 1rem;
  width: min(420px, calc(100vw - 2rem));
  padding: 0.9rem 1rem;
  border-radius: 0.85rem;
  background: rgba(13, 27, 42, 0.95);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 18px 56px rgba(0,0,0,0.35);
  color: var(--text);
}

.toast strong { color: #ffffff; }

/* App header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 58;
  padding-top: env(safe-area-inset-top);
  background: rgba(13, 27, 42, 0.72);
  border-bottom: 1px solid rgba(255,255,255,0.10);
  backdrop-filter: blur(14px);
}

.app-header__inner {
  width: min(1100px, calc(100vw - 1.5rem));
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0;
}

.app-header__brand {
  display: grid;
  gap: 0.1rem;
  text-align: left;
}

.app-header__link {
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(9, 20, 36, 0.45);
  color: rgba(224, 225, 221, 0.9);
  border-radius: 9999px;
  padding: 0.45rem 0.8rem;
  font-weight: 700;
  font-size: 0.9rem;
}

.app-header__link:hover {
  background: rgba(9, 20, 36, 0.7);
}

.app-header__menu {
  border: 1px solid rgba(255,255,255,0.12);
  background: rgba(9, 20, 36, 0.55);
  color: rgba(224, 225, 221, 0.92);
  border-radius: 9999px;
  padding: 0.55rem 0.9rem;
  font-weight: 800;
}

.app-header__danger {
  border-color: rgba(248, 113, 113, 0.28);
  color: rgba(254, 226, 226, 0.98);
}

.app-header__mobile {
  width: min(1100px, calc(100vw - 1.5rem));
  margin: 0 auto;
  padding: 0.25rem 0 0.8rem;
  display: grid;
  gap: 0.5rem;
}

.app-header__mobileLink {
  text-align: left;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(9, 20, 36, 0.55);
  color: rgba(224, 225, 221, 0.92);
  border-radius: 1rem;
  padding: 0.8rem 0.9rem;
  font-weight: 800;
}

#header-menu-backdrop {
  z-index: 57;
  background: rgba(4, 12, 22, 0.55);
  backdrop-filter: blur(6px);
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(720px, calc(100vw - 1.5rem));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  padding: 0.5rem;
  border-radius: 1.25rem;
  background: rgba(13, 27, 42, 0.75);
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(12px);
  z-index: 55;
}

.bottom-nav__btn {
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(9, 20, 36, 0.55);
  color: rgba(224, 225, 221, 0.82);
  border-radius: 1rem;
  padding: 0.75rem 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.bottom-nav__btn:hover {
  transform: translateY(-1px);
}

.bottom-nav__btn--active {
  background: linear-gradient(to right, rgba(59,130,246,0.9), rgba(96,165,250,0.9));
  color: #fff;
  border-color: rgba(96,165,250,0.45);
}

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