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

html, body {
  min-height: 100%;
  background: #0a0a0f;
  font-family: "DM Sans", sans-serif;
  font-weight: 400;
  color: #fff;
  overflow-x: hidden;
  scrollbar-width: none;
}

html::-webkit-scrollbar, body::-webkit-scrollbar { display: none; }

/* Ensure all normal text uses DM Sans */
body, input, button {
  font-family: "DM Sans", sans-serif;
  font-weight: 400;
}

/* ── Header ── */
#header {
  padding: 0 0 20px;
  position: sticky; top: 0; z-index: 10;
  background: rgba(10,10,15,.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(255,255,255,.07);
}

/* Top bar */
#header-top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px 0;
}

#header-logo-small {
  font-size: 20px;
  font-family: "Syne", sans-serif;
  font-weight: 700;
  letter-spacing: -.3px;
  color: #fff;
}

#header-logo-small span { color: #a78bfa; }

/* Hero */
#header-hero {
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; padding: 18px 16px 0;
}

#header h1 {
  font-size: 42px;
  font-family: "Syne", sans-serif;
  font-weight: 700;
  letter-spacing: -.8px;
  line-height: 1;
}

#header h1 span { color: #a78bfa; }

#signout-btn {
  background: rgba(167,139,250,.12);
  border: 1px solid rgba(167,139,250,.3);
  color: #a78bfa;
  padding: 10px 22px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 700;
  font-family: "DM Sans", sans-serif;
  transition: background .2s, border-color .2s;
  white-space: nowrap;
}

#signout-btn:hover {
  background: rgba(167,139,250,.25);
  border-color: rgba(167,139,250,.5);
}

/* ── Search ── */
#search-wrap { position: relative; width: 100%; max-width: 420px; }

#search-wrap svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  opacity: .4;
  pointer-events: none;
}

#search {
  width: 100%;
  padding: 11px 14px 11px 38px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 14px;
  color: #fff;
  font-size: 15px;
  outline: none;
  transition: border-color .2s, background .2s;
}

#search::placeholder { color: rgba(255,255,255,.35); }

#search:focus {
  border-color: rgba(167,139,250,.5);
  background: rgba(255,255,255,.1);
}

/* ── Grid ── */
#home { padding: 28px 24px 64px; }

.grid {
  display: grid;
  grid-template-columns: repeat(5, 260px);
  gap: 16px;
  justify-content: center;
  margin: 0 auto;
}

/* ── Card ── */
.card {
  cursor: pointer;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  display: flex; flex-direction: column;
  opacity: 0;
  animation: fadeUp .3s ease forwards;
}

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

.card:active { transform: scale(.95); }

.card:hover {
  transform: scale(1.04);
  box-shadow: 0 12px 32px rgba(167,139,250,.28);
  border-color: rgba(167,139,250,.5);
}

.card-img-wrap {
  width: 100%;
  aspect-ratio: 1 / 1;
  background: rgba(255,255,255,.06);
  overflow: hidden;
  flex-shrink: 0;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-label {
  padding: 8px 8px 10px;
  font-size: 13px;
  font-weight: 700;
  color: rgba(255,255,255,.9);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-align: center;
}

/* ── Launch overlay ── */
#launch {
  display: none;
  align-items: center;
  justify-content: center;
  height: 100vh;
  text-align: center;
  background: #0a0a0f;
  position: fixed;
  inset: 0;
  z-index: 999;
}

#launch-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 80%;
  max-width: 320px;
  gap: 20px;
}

#launch-inner > img {
  width: 80px;
  height: 80px;
  border-radius: 20px;
  box-shadow: 0 4px 24px rgba(0,0,0,.4);
}

#launch p {
  font-size: 14px;
  color: rgba(255,255,255,.7);
  font-weight: 500;
  min-height: 20px;
}

.prog-track {
  width: 100%;
  background: rgba(255,255,255,.1);
  border-radius: 99px;
  height: 6px;
  overflow: hidden;
}

.prog-fill {
  height: 100%;
  background: #a78bfa;
  border-radius: 99px;
  transition: width .35s ease;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,.1);
  border-top-color: #a78bfa;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.error {
  color: #f87171;
  max-width: 300px;
  font-size: 14px;
  line-height: 1.7;
}

#back {
  background: none;
  border: 1px solid rgba(255,255,255,.15);
  color: rgba(255,255,255,.5);
  padding: 6px 18px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 13px;
  font-family: "DM Sans", sans-serif;
}

#back:hover {
  border-color: #a78bfa;
  color: #a78bfa;
}