*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #08080f;
  --surface: rgba(255,255,255,0.04);
  --surface-hover: rgba(255,255,255,0.07);
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.18);
  --text-primary: #f0f0f8;
  --text-secondary: rgba(240,240,248,0.5);
  --text-muted: rgba(240,240,248,0.3);
  --accent: #ff3c00;
  --accent-glow: rgba(255,60,0,0.3);
  --green: #00e676;
  --green-glow: rgba(0,230,118,0.25);
  --yellow: #ffb300;
  --yellow-glow: rgba(255,179,0,0.25);
  --red: #ff1744;
  --red-glow: rgba(255,23,68,0.25);
  --radius: 20px;
  --radius-sm: 10px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: 'Outfit', system-ui, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ── Background canvas ── */
#bg-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.noise-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.4;
}

/* ── Header ── */
.hub-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 48px;
  background: linear-gradient(180deg, rgba(8,8,15,0.95) 0%, transparent 100%);
  backdrop-filter: blur(12px);
}

.logo {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo-emblem {
  width: 42px; height: 42px;
  background: linear-gradient(135deg, var(--accent), #ff6b35);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 22px;
  color: #fff;
  box-shadow: 0 0 24px var(--accent-glow);
  letter-spacing: -1px;
}

.logo-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.logo-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: 0.12em;
  color: var(--text-primary);
}

.logo-sub {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.35em;
  color: var(--accent);
  text-transform: uppercase;
  margin-top: 2px;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 8px 18px;
}

.status-pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: background 0.4s;
  flex-shrink: 0;
}
.status-pulse.online { background: var(--green); box-shadow: 0 0 8px var(--green-glow); animation: pulse 2s infinite; }
.status-pulse.partial { background: var(--yellow); box-shadow: 0 0 8px var(--yellow-glow); }
.status-pulse.offline { background: var(--red); box-shadow: 0 0 8px var(--red-glow); }

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.3); }
}

/* ── Hero ── */
.hero {
  position: relative;
  z-index: 10;
  min-height: 70vh;
  display: flex;
  align-items: center;
  padding: 140px 48px 80px;
  overflow: hidden;
}

.hero-inner {
  max-width: 960px;
  position: relative;
  z-index: 2;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(255,60,0,0.1);
  border: 1px solid rgba(255,60,0,0.25);
  border-radius: 100px;
  padding: 6px 16px;
  margin-bottom: 28px;
}

.hero-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  animation: pulse 2s infinite;
}

.hero-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 900;
  line-height: 0.9;
  margin-bottom: 32px;
  text-transform: uppercase;
}

.hero-title .line-1 {
  display: block;
  font-size: clamp(52px, 7vw, 96px);
  color: var(--text-primary);
  letter-spacing: -0.04em;
}

.hero-title .line-2 {
  display: block;
  font-size: clamp(52px, 7vw, 96px);
  background: linear-gradient(90deg, var(--accent) 0%, #ff6b35 50%, #ffb300 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -0.04em;
}

.hero-desc {
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 520px;
  margin-bottom: 48px;
  font-weight: 400;
}

.hero-stats {
  display: flex;
  align-items: center;
  gap: 32px;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-num {
  font-family: 'Outfit', sans-serif;
  font-size: 32px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1;
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  text-transform: uppercase;
}

.stat-divider {
  width: 1px;
  height: 40px;
  background: var(--border);
}

.hero-visual {
  position: absolute;
  right: -100px;
  top: 50%;
  transform: translateY(-50%);
  width: 600px;
  height: 600px;
  pointer-events: none;
}

.speed-lines {
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at center, rgba(255,60,0,0.08) 0%, transparent 70%);
}

/* ── Apps Section ── */
.apps-section {
  position: relative;
  z-index: 10;
  padding: 0 48px 120px;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 24px;
  margin-bottom: 40px;
}

.section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

.section-line {
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ── App Grid ── */
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 24px;
}

/* ── Loading ── */
.loading-state {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 80px;
  color: var(--text-muted);
  font-size: 15px;
}

.loading-spinner {
  width: 24px; height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── App Card ── */
.app-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 20px;
  text-decoration: none;
  color: inherit;
}

.app-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--card-color, #fff), transparent);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.app-card.is-online {
  --glow: color-mix(in srgb, var(--card-color, #fff) 30%, transparent);
}

.app-card.is-online:hover {
  border-color: color-mix(in srgb, var(--card-color, #fff) 40%, transparent);
  background: var(--surface-hover);
  transform: translateY(-4px);
  box-shadow: 0 24px 64px -16px color-mix(in srgb, var(--card-color, #000) 20%, transparent);
}

.app-card.is-online:hover::before { opacity: 0.04; }

.app-card.is-offline,
.app-card.is-maintenance {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.app-card.is-maintenance {
  pointer-events: auto;
  cursor: default;
}

/* ── Card top bar ── */
.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.card-icon {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--card-color, #fff) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--card-color, #fff) 20%, transparent);
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
  flex-shrink: 0;
  transition: transform 0.3s;
}

.app-card.is-online:hover .card-icon {
  transform: scale(1.08) rotate(-3deg);
}

.card-status {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid transparent;
}

.card-status.online {
  color: var(--green);
  background: rgba(0,230,118,0.08);
  border-color: rgba(0,230,118,0.2);
}
.card-status.maintenance {
  color: var(--yellow);
  background: rgba(255,179,0,0.08);
  border-color: rgba(255,179,0,0.2);
}
.card-status.offline {
  color: var(--red);
  background: rgba(255,23,68,0.08);
  border-color: rgba(255,23,68,0.2);
}
.card-status.unknown {
  color: var(--text-muted);
  background: var(--surface);
  border-color: var(--border);
}

.card-badges {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.card-access {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 4px 12px;
  border-radius: 100px;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.card-access.manual { color: var(--yellow); border-color: rgba(255,179,0,0.25); }
.card-access.members { color: var(--text-secondary); border-color: rgba(108,99,255,0.35); }
.card-access.closed { color: var(--text-muted); border-style: dashed; }

.card-status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.card-status.online .card-status-dot {
  animation: pulse 2s infinite;
}

/* ── Card body ── */
.card-body { flex: 1; }

.card-category {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--card-color, #fff) 70%, transparent);
  margin-bottom: 8px;
}

.card-name {
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.2;
  margin-bottom: 10px;
  letter-spacing: -0.02em;
}

.card-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── Card maintenance message ── */
.card-message {
  font-size: 12px;
  color: var(--yellow);
  background: rgba(255,179,0,0.06);
  border: 1px solid rgba(255,179,0,0.15);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  line-height: 1.5;
}

/* ── Card footer ── */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.card-subdomain {
  font-size: 11px;
  color: var(--text-muted);
  font-family: 'Space Grotesk', monospace;
}

.card-cta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: color-mix(in srgb, var(--card-color, #fff) 85%, transparent);
  transition: gap 0.2s;
}

.app-card.is-online:hover .card-cta { gap: 10px; }

.card-cta-arrow {
  font-size: 16px;
  transition: transform 0.2s;
}
.app-card.is-online:hover .card-cta-arrow { transform: translateX(3px); }

/* Color accent line at top of card */
.card-accent-line {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--card-color, transparent), transparent);
  opacity: 0;
  transition: opacity 0.3s;
}
.app-card.is-online:hover .card-accent-line { opacity: 1; }

/* ── Grid meta (last updated) ── */
.grid-meta {
  margin-top: 24px;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

/* ── Footer ── */
.hub-footer {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 48px;
  border-top: 1px solid var(--border);
}

.footer-logo {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-muted);
  letter-spacing: 0.05em;
}

.footer-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-muted);
}

.footer-sep { opacity: 0.3; }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: rgba(20,20,30,0.95);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 12px 24px;
  font-size: 14px;
  color: var(--text-primary);
  backdrop-filter: blur(16px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 1000;
  pointer-events: none;
}

.toast.show { transform: translateX(-50%) translateY(0); }

/* ── Responsive ── */
@media (max-width: 768px) {
  .hub-header { padding: 16px 20px; }
  .hero { padding: 120px 20px 60px; }
  .hero-visual { display: none; }
  .hero-title .line-1,
  .hero-title .line-2 { font-size: clamp(40px, 10vw, 64px); }
  .apps-section { padding: 0 20px 80px; }
  .apps-grid { grid-template-columns: 1fr; }
  .hub-footer { padding: 20px; flex-direction: column; gap: 8px; text-align: center; }
}
