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

:root {
  --grid-size: 76px;
  --row-width: 824px; /* 3 * 260 + 2 * 22 */
}

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

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

body,
input,
button {
  font-family: "DM Sans", sans-serif;
}

body {
  position: relative;
  background: #000;
}

/* grid background only */
#grid-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-color: #000;
  background-image:
    linear-gradient(rgba(255,255,255,.085) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.085) 1px, transparent 1px);
  background-size: var(--grid-size) var(--grid-size);
  background-position: 0 0;
}

/* layering */
#topbar,
#header,
#header-hero,
#home,
#search-wrap,
.card {
  position: relative;
}

#topbar { z-index: 30; }

#header,
#header-hero,
#home {
  z-index: 10;
  background: transparent;
}

#search-wrap,
.card {
  z-index: 20;
}

/* floating dock */
#topbar {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(var(--row-width), calc(100vw - 32px));
  height: 60px;
  padding: 0 20px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,.01)),
    rgba(8,8,10,.74);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.06),
    0 10px 24px rgba(0,0,0,.22);
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 100%;
}

.brand {
  font-size: 19px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.5px;
}

.version {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,.72);
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
}

.top-link {
  color: rgba(255,255,255,.86);
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  font-weight: 700;
}

.top-link:hover {
  color: #fff;
}

.top-btn {
  height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 999px;
  background: #3469bf;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.10),
    0 5px 14px rgba(52,105,191,.16);
}

/* header / search */
#header {
  padding: 112px 0 20px;
}

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

.random-message {
  width: 100%;
  max-width: 420px;
  text-align: center;
  font-size: 17px;
  font-weight: 400;
  color: #fff;
  min-height: 22px;
  line-height: 1.2;
}

#search-wrap {
  width: 100%;
  max-width: 420px;
}

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

#search {
  width: 100%;
  height: 42px;
  padding: 0 14px 0 38px;
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 14px;
  color: #fff;
  font-size: 14px;
  outline: none;
  background: rgba(255,255,255,.02);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.05),
    0 4px 12px rgba(0,0,0,.10);
  transition: border-color .2s ease, background .2s ease;
}

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

#search:focus {
  border-color: rgba(255,255,255,.14);
  background: rgba(255,255,255,.028);
}

/* app area */
#home {
  padding: 22px 24px 64px;
}

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

/* panels */
.card {
  cursor: pointer;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  animation: fadeUp .24s ease forwards;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.02);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.05),
    0 8px 16px rgba(0,0,0,.12);
  transition:
    border-color .18s ease-out,
    background .18s ease-out,
    box-shadow .18s ease-out;
}

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

.card:hover {
  border-color: rgba(255,255,255,.14);
  background: rgba(255,255,255,.026);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.07),
    0 10px 18px rgba(0,0,0,.14);
}

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

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

.card-label {
  padding: 11px 10px 13px;
  font-size: 15px;
  font-weight: 700;
  color: rgba(255,255,255,.94);
  line-height: 1.25;
  text-align: center;
  background: rgba(255,255,255,.032);
  border-top: 1px solid rgba(255,255,255,.08);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  transition:
    background .16s ease,
    border-color .16s ease;
}

.card:hover .card-label {
  background: rgba(255,255,255,.065);
  border-top-color: rgba(255,255,255,.14);
}

/* launch */
#launch {
  display: none;
  align-items: center;
  justify-content: center;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: #000;
}

#launch-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 80%;
  max-width: 320px;
  gap: 18px;
  text-align: center;
  transform: translateY(26px);
}

#launch-icon {
  width: 84px;
  height: 84px;
  border-radius: 20px;
  box-shadow: 0 4px 24px rgba(0,0,0,.4);
}

#launch p {
  font-size: 14px;
  color: rgba(255,255,255,.74);
  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: #3469bf;
  border-radius: 99px;
  transition: width .35s ease;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255,255,255,.14);
  border-top-color: #3469bf;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

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

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

@media (max-width: 980px) {
  .grid {
    grid-template-columns: repeat(2, 260px);
  }

  #topbar {
    width: calc(100vw - 32px);
  }
}

@media (max-width: 700px) {
  #topbar {
    width: calc(100vw - 20px);
    top: 10px;
    height: 56px;
    padding: 0 14px;
  }

  .brand {
    font-size: 24px;
  }

  .topbar-right {
    gap: 12px;
  }

  .top-link {
    display: none;
  }

  #header {
    padding-top: 100px;
  }

  .grid {
    grid-template-columns: 260px;
  }

  .random-message {
    font-size: 15px;
  }
}