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

:root {
  --bg: #07070c;
  --surface: rgba(18, 18, 28, 0.72);
  --surface-hover: rgba(26, 26, 40, 0.88);
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.18);
  --text: #f0f0f8;
  --muted: #9494ae;
  --radius: 20px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100dvh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  overflow-x: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ── Ambient background ── */
.ambient {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.45;
  animation: drift 18s var(--ease) infinite alternate;
}

.orb-a {
  width: min(70vw, 420px);
  height: min(70vw, 420px);
  background: #3b2a6e;
  top: -12%;
  left: -8%;
}

.orb-b {
  width: min(55vw, 340px);
  height: min(55vw, 340px);
  background: #1a4a5c;
  bottom: -10%;
  right: -6%;
  animation-delay: -6s;
}

.orb-c {
  width: min(40vw, 260px);
  height: min(40vw, 260px);
  background: #5c2a4a;
  top: 40%;
  left: 55%;
  animation-delay: -12s;
  opacity: 0.25;
}

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(4%, 6%) scale(1.08); }
}

/* ── Hub layout ── */
.hub {
  position: relative;
  z-index: 1;
  max-width: 920px;
  margin: 0 auto;
  padding:
    max(2rem, env(safe-area-inset-top))
    max(1.25rem, env(safe-area-inset-right))
    max(2.5rem, env(safe-area-inset-bottom))
    max(1.25rem, env(safe-area-inset-left));
}

.hub-header {
  text-align: center;
  margin-bottom: 2.25rem;
  animation: rise 0.7s var(--ease) both;
}

.hub-hero-img {
  display: block;
  width: min(420px, 88vw);
  height: auto;
  margin: 0 auto 1rem;
  border-radius: var(--radius);
  box-shadow: 0 12px 48px rgba(0, 168, 255, 0.15);
}

.eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.65rem;
}

.hub-header h1 {
  font-size: clamp(2.2rem, 8vw, 3.2rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.05;
  background: linear-gradient(135deg, #fff 0%, #b8b8d8 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  margin-top: 0.65rem;
  color: var(--muted);
  font-size: clamp(0.95rem, 2.8vw, 1.05rem);
  max-width: 28ch;
  margin-inline: auto;
}

/* ── App grid ── */
.apps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

@media (min-width: 520px) {
  .apps-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

@media (min-width: 820px) {
  .apps-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1100px) {
  .hub {
    max-width: 1040px;
  }
}

.app-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 148px;
  padding: 1.1rem 1.15rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  overflow: hidden;
  transition:
    transform 0.35s var(--ease),
    border-color 0.35s var(--ease),
    background 0.35s var(--ease),
    box-shadow 0.35s var(--ease);
  animation: rise 0.7s var(--ease) both;
}

.app-card:nth-child(1) { animation-delay: 0.04s; }
.app-card:nth-child(2) { animation-delay: 0.07s; }
.app-card:nth-child(3) { animation-delay: 0.10s; }
.app-card:nth-child(4) { animation-delay: 0.13s; }
.app-card:nth-child(5) { animation-delay: 0.16s; }
.app-card:nth-child(6) { animation-delay: 0.19s; }
.app-card:nth-child(7) { animation-delay: 0.22s; }
.app-card:nth-child(8) { animation-delay: 0.25s; }
.app-card:nth-child(9) { animation-delay: 0.28s; }
.app-card:nth-child(10) { animation-delay: 0.31s; }
.app-card:nth-child(11) { animation-delay: 0.34s; }
.app-card:nth-child(12) { animation-delay: 0.37s; }
.app-card:nth-child(13) { animation-delay: 0.40s; }
.app-card:nth-child(14) { animation-delay: 0.43s; }
.app-card:nth-child(15) { animation-delay: 0.46s; }

.app-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 80% 60% at 20% 0%, var(--glow, transparent), transparent 70%);
  opacity: 0.9;
  pointer-events: none;
}

.app-card::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--accent, #888) 0%, transparent 50%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: 0.35;
  pointer-events: none;
  transition: opacity 0.35s var(--ease);
}

@media (hover: hover) {
  .app-card:hover {
    transform: translateY(-3px);
    border-color: var(--border-hover);
    background: var(--surface-hover);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
  }

  .app-card:hover::after {
    opacity: 0.7;
  }

  .app-card:hover .card-arrow {
    transform: translateX(4px);
    opacity: 1;
  }
}

.app-card:active {
  transform: scale(0.985);
}

.card-body {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding-top: 3.5rem;
}

.app-card h2 {
  font-size: 1.12rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.2rem;
}

.app-card p {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.card-arrow {
  position: absolute;
  right: 1rem;
  bottom: 1rem;
  z-index: 1;
  font-size: 1.1rem;
  color: var(--accent, var(--muted));
  opacity: 0.55;
  transition: transform 0.35s var(--ease), opacity 0.35s var(--ease);
}

/* ── Card previews (CSS micro-demos) ── */
.preview {
  position: absolute;
  top: 1rem;
  left: 1.15rem;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.preview-ribbon {
  background:
    linear-gradient(135deg, rgba(232, 180, 188, 0.15), transparent),
    #1a1a24;
}

.preview-ribbon::before,
.preview-ribbon::after {
  content: "";
  position: absolute;
  inset: 18% 10%;
  border: 2px solid rgba(232, 180, 188, 0.7);
  border-radius: 50%;
  animation: ribbon-wobble 3s ease-in-out infinite;
}

.preview-ribbon::after {
  inset: 28% 22%;
  border-color: rgba(255, 255, 255, 0.25);
  animation-delay: -1.2s;
}

@keyframes ribbon-wobble {
  0%, 100% { transform: rotate(-8deg) scale(1); }
  50% { transform: rotate(8deg) scale(1.05); }
}

.preview-tunnel {
  background: radial-gradient(circle, #fff 1px, transparent 1px);
  background-size: 8px 8px;
  animation: tunnel-zoom 2.5s linear infinite;
}

@keyframes tunnel-zoom {
  from { background-size: 8px 8px; opacity: 0.5; }
  to { background-size: 22px 22px; opacity: 1; }
}

.preview-ripple {
  background: linear-gradient(160deg, #0d3d4a, #062028);
}

.preview-ripple::before {
  content: "";
  position: absolute;
  inset: 30%;
  border: 2px solid rgba(94, 234, 212, 0.6);
  border-radius: 50%;
  animation: ripple-pulse 2.2s ease-out infinite;
}

.preview-ripple::after {
  content: "";
  position: absolute;
  inset: 38%;
  border: 1px solid rgba(94, 234, 212, 0.35);
  border-radius: 50%;
  animation: ripple-pulse 2.2s ease-out infinite 0.5s;
}

@keyframes ripple-pulse {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(1.8); opacity: 0; }
}

.preview-kaleido {
  background: conic-gradient(from 0deg, #c4b5fd, #f0abfc, #93c5fd, #c4b5fd);
  animation: kaleido-spin 8s linear infinite;
  opacity: 0.75;
}

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

.preview-strobe {
  background: repeating-conic-gradient(#fff 0deg 90deg, #111 90deg 180deg);
  animation: strobe-flash 2.8s ease-in-out infinite alternate;
}

@keyframes strobe-flash {
  from { filter: invert(0); opacity: 0.75; }
  to { filter: invert(1); opacity: 1; }
}

.preview-balls {
  background: #1a1020;
}

.preview-balls::before,
.preview-balls::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  animation: ball-bounce 1.4s ease-in-out infinite;
}

.preview-balls::before {
  background: #fb7185;
  left: 14px;
  bottom: 12px;
}

.preview-balls::after {
  background: #fbbf24;
  right: 12px;
  bottom: 18px;
  animation-delay: -0.5s;
}

@keyframes ball-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-18px); }
}

.preview-jelly {
  background: linear-gradient(160deg, #0f2a24, #091816);
}

.preview-jelly::before {
  content: "";
  position: absolute;
  inset: 14%;
  background-image: radial-gradient(circle, rgba(126, 224, 198, 0.85) 1.5px, transparent 1.5px);
  background-size: 7px 7px;
  animation: jelly-wobble 2.6s ease-in-out infinite;
}

.preview-jelly::after {
  content: "";
  position: absolute;
  inset: 22% 18%;
  border: 1.5px solid rgba(126, 224, 198, 0.35);
  border-radius: 4px;
  animation: jelly-wobble 2.6s ease-in-out infinite reverse;
}

@keyframes jelly-wobble {
  0%, 100% { transform: skewX(-5deg) scale(1); }
  50% { transform: skewX(7deg) scale(1.07); }
}

.preview-moire {
  background-color: #1a1810;
  background-image:
    repeating-linear-gradient(45deg, rgba(253, 230, 138, 0.55) 0 1.5px, transparent 1.5px 5px),
    repeating-linear-gradient(-45deg, rgba(253, 230, 138, 0.35) 0 1.5px, transparent 1.5px 5px);
  animation: moire-shift 3.5s ease-in-out infinite alternate;
}

@keyframes moire-shift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 7px 3px, -5px 4px; }
}

.preview-smoke {
  background: #1a1208;
}

.preview-smoke::before {
  content: "";
  position: absolute;
  width: 65%;
  height: 65%;
  left: 18%;
  top: 22%;
  background: radial-gradient(circle, rgba(253, 186, 116, 0.8) 0%, rgba(253, 186, 116, 0.15) 55%, transparent 72%);
  animation: smoke-drift 3.4s ease-in-out infinite alternate;
}

.preview-smoke::after {
  content: "";
  position: absolute;
  width: 40%;
  height: 40%;
  left: 8%;
  top: 38%;
  background: radial-gradient(circle, rgba(253, 210, 160, 0.5) 0%, transparent 70%);
  animation: smoke-drift 3.4s ease-in-out infinite alternate-reverse;
}

@keyframes smoke-drift {
  from { transform: translate(0, 0) scale(1); opacity: 0.7; }
  to { transform: translate(6px, -5px) scale(1.15); opacity: 1; }
}

.preview-sand {
  background: linear-gradient(180deg, #141008 35%, #221a0c 100%);
}

.preview-sand::before {
  content: "";
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-bottom: 20px solid rgba(232, 195, 106, 0.9);
}

.preview-sand::after {
  content: "";
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(238, 210, 122, 0.95);
  left: 62%;
  top: 18%;
  animation: sand-fall 2.2s ease-in infinite;
  box-shadow:
    -14px 4px 0 rgba(212, 168, 75, 0.8),
    6px 8px 0 rgba(196, 146, 58, 0.7);
}

@keyframes sand-fall {
  0% { transform: translateY(0); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translateY(22px); opacity: 0; }
}

.preview-tilt {
  background: #0d1520;
}

.preview-tilt::before,
.preview-tilt::after {
  content: "";
  position: absolute;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  animation: tilt-roll 2.8s ease-in-out infinite;
}

.preview-tilt::before {
  background: #e74c3c;
  left: 12px;
  top: 28px;
}

.preview-tilt::after {
  background: #3498db;
  right: 10px;
  top: 18px;
  animation-delay: -1.1s;
}

@keyframes tilt-roll {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(10px, 8px); }
}

.preview-pop {
  background: #2a1420;
  background-image: radial-gradient(circle, rgba(249, 168, 212, 0.35) 4px, transparent 4px);
  background-size: 14px 14px;
}

.preview-pop::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 50%;
  top: 50%;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  border: 2px solid rgba(249, 168, 212, 0.9);
  animation: pop-burst 2.4s ease-out infinite;
}

@keyframes pop-burst {
  0% { transform: scale(1); opacity: 1; }
  40% { transform: scale(1.15); opacity: 1; }
  55% { transform: scale(0.4); opacity: 0; }
  100% { transform: scale(0.4); opacity: 0; }
}

.preview-firefly {
  background: radial-gradient(circle at 50% 80%, #1a1808, #0a0a06);
}

.preview-firefly::before,
.preview-firefly::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fde047;
  box-shadow: 0 0 8px 2px rgba(253, 224, 71, 0.7);
  animation: firefly-float 3.2s ease-in-out infinite;
}

.preview-firefly::before {
  left: 16px;
  top: 20px;
}

.preview-firefly::after {
  right: 14px;
  top: 30px;
  animation-delay: -1.6s;
  width: 4px;
  height: 4px;
}

@keyframes firefly-float {
  0%, 100% { transform: translate(0, 0); opacity: 0.5; }
  50% { transform: translate(8px, -6px); opacity: 1; }
}

.preview-magnet {
  background: #140808;
}

.preview-magnet::before {
  content: "";
  position: absolute;
  width: 10px;
  height: 10px;
  left: 50%;
  top: 50%;
  margin: -5px 0 0 -5px;
  border-radius: 50%;
  background: #f87171;
  box-shadow: 0 0 10px rgba(248, 113, 113, 0.6);
}

.preview-magnet::after {
  content: "";
  position: absolute;
  inset: 18%;
  border: 1.5px dashed rgba(248, 113, 113, 0.35);
  border-radius: 50%;
  animation: magnet-orbit 2.6s linear infinite;
}

@keyframes magnet-orbit {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.preview-spiro {
  background: #12121a;
}

.preview-spiro::before {
  content: "";
  position: absolute;
  inset: 16%;
  border: 1.5px solid rgba(165, 180, 252, 0.5);
  border-radius: 50%;
  animation: spiro-spin 4s linear infinite;
}

.preview-spiro::after {
  content: "";
  position: absolute;
  inset: 28%;
  border: 1.5px solid rgba(165, 180, 252, 0.35);
  border-radius: 50%;
  animation: spiro-spin 4s linear infinite reverse;
}

@keyframes spiro-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Footer ── */
.hub-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  margin-top: 2.75rem;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  animation: rise 0.7s var(--ease) 0.35s both;
}

.hub-footer .mark {
  opacity: 0.5;
  font-size: 0.65rem;
}

@media (prefers-reduced-motion: reduce) {
  .orb,
  .app-card,
  .hub-header,
  .hub-footer,
  .preview-tunnel,
  .preview-ribbon::before,
  .preview-ribbon::after,
  .preview-ripple::before,
  .preview-ripple::after,
  .preview-kaleido,
  .preview-strobe,
  .preview-balls::before,
  .preview-balls::after,
  .preview-jelly::before,
  .preview-jelly::after,
  .preview-moire,
  .preview-smoke::before,
  .preview-smoke::after,
  .preview-sand::after,
  .preview-tilt::before,
  .preview-tilt::after,
  .preview-pop::before,
  .preview-firefly::before,
  .preview-firefly::after,
  .preview-magnet::after,
  .preview-spiro::before,
  .preview-spiro::after {
    animation: none !important;
  }

  .app-card:hover {
    transform: none;
  }
}
