:root {
  --bg-deep: #0f0d14;
  --bg-card: rgba(22, 18, 30, 0.86);
  --bg-card-hover: rgba(30, 24, 40, 0.94);
  --border: rgba(255, 255, 255, 0.07);
  --border-bright: rgba(244, 114, 182, 0.22);
  --accent: #f472b6;
  --accent-dim: #db2777;
  --accent-glow: rgba(244, 114, 182, 0.3);
  --warm: #fbbf24;
  --lavender: #a78bfa;
  --warning: #fb923c;
  --text: #f5f0fa;
  --text-muted: #a89bb5;
  --online: #4ade80;
  --offline: #f87171;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --radius: 16px;
  --radius-sm: 10px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ── Photo mosaic background ── */
.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: linear-gradient(145deg, #1a0f24 0%, #0f0d14 45%, #141028 100%);
  pointer-events: none;
  overflow: hidden;
}

.photo-mosaic {
  position: absolute;
  inset: -8%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(118px, 1fr));
  gap: 7px;
  transform: rotate(-1.5deg) scale(1.06);
  padding: 4px;
}

.photo-tile {
  aspect-ratio: 1;
  background-image: var(--photo);
  background-size: cover;
  background-position: center;
  border-radius: 10px;
  opacity: 0.44;
  filter: saturate(1.15) contrast(1.05);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.photo-tile:nth-child(4n) { opacity: 0.38; }
.photo-tile:nth-child(6n+1) { opacity: 0.5; }
.photo-tile:nth-child(7n+3) { transform: scale(1.03); }

.ambient-gradient {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      160deg,
      rgba(26, 15, 36, 0.82) 0%,
      rgba(15, 13, 20, 0.78) 35%,
      rgba(36, 18, 42, 0.72) 70%,
      rgba(15, 13, 20, 0.85) 100%
    ),
    radial-gradient(ellipse 80% 60% at 15% 10%, rgba(244, 114, 182, 0.18), transparent 55%),
    radial-gradient(ellipse 70% 50% at 85% 90%, rgba(167, 139, 250, 0.14), transparent 50%),
    radial-gradient(ellipse 100% 80% at 50% 50%, rgba(15, 13, 20, 0.35), transparent 70%);
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  animation: pulse 12s ease-in-out infinite;
}

.glow-1 {
  width: 420px;
  height: 420px;
  top: -8%;
  left: -5%;
  background: rgba(244, 114, 182, 0.18);
}

.glow-2 {
  width: 360px;
  height: 360px;
  top: 40%;
  right: -8%;
  background: rgba(167, 139, 250, 0.14);
  animation-delay: -4s;
}

.glow-3 {
  width: 300px;
  height: 300px;
  bottom: -5%;
  left: 30%;
  background: rgba(251, 191, 36, 0.1);
  animation-delay: -8s;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.4; }
  50% { transform: scale(1.08); opacity: 0.55; }
}

/* ── Layout ── */
.top-bar, .main-content, .footer {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-top: 2rem;
  padding-bottom: 1.5rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-icon {
  width: 52px;
  height: 52px;
  color: var(--accent);
  filter: drop-shadow(0 0 14px var(--accent-glow));
}

.brand h1 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.brand .accent { color: var(--accent); }

.tagline {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  max-width: 420px;
}

/* ── Status panel ── */
.status-panel {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.25rem;
  backdrop-filter: blur(16px);
}

.status-ring {
  position: relative;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
}

.status-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: rgba(255,255,255,0.06);
  stroke-width: 3;
}

.ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  transition: stroke-dasharray 0.6s ease, stroke 0.4s ease;
}

.ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--accent);
}

.status-label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.status-value {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
}

.status-host {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Hero ── */
.hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  background: linear-gradient(135deg, rgba(244,114,182,0.1) 0%, rgba(22,18,30,0.85) 45%, rgba(167,139,250,0.08) 100%);
  border: 1px solid var(--border-bright);
  border-radius: calc(var(--radius) + 4px);
  padding: 2rem 2.25rem;
  margin-bottom: 2.5rem;
  backdrop-filter: blur(20px);
  flex-wrap: wrap;
}

.hero-badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--accent);
  background: rgba(244,114,182,0.1);
  border: 1px solid rgba(244,114,182,0.2);
  border-radius: 999px;
  padding: 0.3rem 0.85rem;
  margin-bottom: 0.75rem;
}

.hero-content h2 {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 0.5rem;
}

.hero-content p {
  color: var(--text-muted);
  max-width: 540px;
  font-size: 0.95rem;
}

.hero-stats {
  display: flex;
  gap: 1.5rem;
}

.stat {
  text-align: center;
  min-width: 72px;
}

.stat-num {
  display: block;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}

.stat-lbl {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

/* ── Category sections ── */
.category-section {
  margin-bottom: 2.75rem;
}

.section-header {
  margin-bottom: 1.1rem;
  padding-left: 0.25rem;
}

.section-header h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
}

.section-header p {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

/* ── Service cards ── */
.service-card {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
  transition: transform 0.25s ease, border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
  backdrop-filter: blur(12px);
}

.service-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0.7;
  transition: opacity 0.25s ease;
}

.card-glow {
  position: absolute;
  top: -40%;
  right: -30%;
  width: 120px;
  height: 120px;
  background: var(--accent);
  opacity: 0;
  filter: blur(50px);
  border-radius: 50%;
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.service-card:hover {
  transform: translateY(-4px);
  border-color: color-mix(in srgb, var(--accent) 40%, transparent);
  background: var(--bg-card-hover);
  box-shadow: 0 12px 40px rgba(0,0,0,0.35), 0 0 0 1px color-mix(in srgb, var(--accent) 15%, transparent);
}

.service-card:hover .card-glow { opacity: 0.18; }
.service-card:hover .launch-label { color: var(--accent); transform: translateX(3px); }

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.card-emoji {
  font-size: 1.6rem;
  line-height: 1;
}

.card-status {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--text-muted);
  box-shadow: 0 0 0 3px rgba(255,255,255,0.04);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.card-status.online {
  background: var(--online);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.45);
}

.card-status.offline {
  background: var(--offline);
  box-shadow: 0 0 8px rgba(248, 113, 113, 0.4);
}

.service-card h4 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.card-tagline {
  font-size: 0.8rem;
  color: var(--text-muted);
  flex: 1;
  margin-bottom: 1rem;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.port-badge {
  font-family: monospace;
  font-size: 0.72rem;
  color: var(--text-muted);
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  padding: 0.15rem 0.45rem;
}

.launch-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: color 0.25s ease, transform 0.25s ease;
}

/* ── Footer ── */
.footer {
  padding: 2.5rem 1.5rem 3rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.footer strong { color: var(--accent-dim); }

.footer-note {
  margin-top: 0.4rem;
  opacity: 0.75;
}

/* ── Responsive ── */
@media (max-width: 640px) {
  .top-bar { padding-top: 1.25rem; }
  .hero-card { padding: 1.5rem; }
  .hero-stats { width: 100%; justify-content: space-around; }
  .card-grid { grid-template-columns: 1fr 1fr; }
  .brand h1 { font-size: 1.3rem; }

  .photo-mosaic {
    inset: -4%;
    grid-template-columns: repeat(auto-fill, minmax(68px, 1fr));
    gap: 5px;
    transform: rotate(-1deg) scale(1.04);
  }

  .photo-tile {
    border-radius: 7px;
    opacity: 0.42;
  }
}

@media (max-width: 400px) {
  .card-grid { grid-template-columns: 1fr; }
}

/* ── Login page ── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-shell {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 420px;
  padding: 1.5rem;
}

.login-card {
  background: rgba(22, 18, 30, 0.82);
  border: 1px solid var(--border-bright);
  border-radius: calc(var(--radius) + 4px);
  padding: 2rem 2rem 1.75rem;
  backdrop-filter: blur(24px);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.login-brand {
  text-align: center;
  margin-bottom: 1.75rem;
}

.login-brand .brand-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 1rem;
  color: var(--accent);
  filter: drop-shadow(0 0 14px var(--accent-glow));
}

.login-brand h1 {
  font-family: var(--font-display);
  font-size: 1.65rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.login-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.login-error {
  background: rgba(248, 113, 113, 0.12);
  border: 1px solid rgba(248, 113, 113, 0.35);
  color: #fecaca;
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field span {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.field input {
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 50%, transparent);
  box-shadow: 0 0 0 3px rgba(244, 114, 182, 0.15);
}

.login-btn {
  margin-top: 0.25rem;
  font: inherit;
  font-weight: 600;
  color: #1a0f18;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dim) 100%);
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.login-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px var(--accent-glow);
}

.login-footnote {
  margin-top: 1.25rem;
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Top bar actions / logout ── */
.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.logout-form {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.user-chip {
  font-size: 0.78rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
}

.logout-btn {
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}

.logout-btn:hover {
  border-color: rgba(244, 114, 182, 0.35);
  color: var(--accent);
}
