:root {
  --ink: #0b1720;
  --ink-soft: #526574;
  --paper: #f5f8fa;
  --line: rgba(11, 23, 32, 0.1);
  --teal: #0e7c6f;
  --teal-deep: #0a5a51;
  --warn: #c45c26;
  --font-display: "Syne", sans-serif;
  --font-body: "Figtree", sans-serif;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow: 0 20px 44px rgba(11, 23, 32, 0.1);
}

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

html,
body.store {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background: #e7eef2;
  line-height: 1.4;
}

body.store {
  height: 100dvh;
  max-height: 100dvh;
  position: relative;
}

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

img {
  max-width: 100%;
  display: block;
}

button {
  font: inherit;
}

/* Canvas background — fully out of document flow */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.bg-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.page {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

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

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes mark-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.anim-rise {
  opacity: 0;
  animation: rise-in 0.75s var(--ease) forwards;
  animation-delay: var(--d, 0s);
}

/* Header — pinned to top */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  width: 100%;
  padding: 1rem clamp(1.1rem, 4vw, 2.5rem);
  border-bottom: 1px solid rgba(11, 23, 32, 0.08);
  background: rgba(245, 248, 250, 0.82);
  backdrop-filter: blur(14px);
}

.lead {
  flex: 0 0 auto;
  margin: 0 0 clamp(1rem, 2.5vh, 1.5rem);
  max-width: 34rem;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.6vw, 1.55rem);
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.03em;
  color: var(--ink);
}

/* Brand */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.25rem, 2.5vw, 1.55rem);
  letter-spacing: -0.03em;
}

.brand__mark {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 5px;
  background: linear-gradient(135deg, var(--teal), var(--teal-deep));
  position: relative;
  animation: mark-pulse 3.6s var(--ease) infinite;
}

.brand__mark::after {
  content: "";
  position: absolute;
  inset: 28% 22% auto;
  height: 22%;
  background: rgba(245, 248, 250, 0.92);
  border-radius: 1px;
}

/* Admin shared */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.9rem clamp(1.25rem, 4vw, 3rem);
  backdrop-filter: blur(14px);
  background: rgba(245, 248, 250, 0.72);
  border-bottom: 1px solid var(--line);
}

.topbar .brand {
  font-size: 1.15rem;
  font-weight: 700;
}

.topbar .brand__mark {
  width: 1.1rem;
  height: 1.1rem;
  animation: none;
}

.topbar .btn--ghost {
  margin-left: auto;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 1.1rem;
  border-radius: 10px;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.92rem;
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: transform 0.25s var(--ease), background 0.25s ease, border-color 0.25s ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn--primary {
  background: var(--teal);
  color: #f4f8fa;
  border-color: var(--teal-deep);
}

.btn--primary:hover {
  background: var(--teal-deep);
}

.btn--ghost {
  background: rgba(245, 248, 250, 0.55);
  border-color: var(--line);
  color: var(--ink);
}

.btn--ghost:hover {
  border-color: rgba(14, 124, 111, 0.4);
}

.btn--download {
  width: auto;
  min-width: 8.5rem;
  align-self: flex-start;
  background: var(--ink);
  color: var(--paper);
  border-radius: 11px;
  padding: 0.8rem 1.25rem;
}

.btn--download:hover {
  background: var(--teal-deep);
}

.btn--download.is-busy {
  pointer-events: none;
  opacity: 0.7;
}

/* Stage */
.stage {
  flex: 1 1 auto;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: clamp(1rem, 3vh, 1.75rem) clamp(1.1rem, 4vw, 2.5rem) clamp(1rem, 2.5vh, 1.5rem);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.gallery {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.cards {
  list-style: none;
  margin: 0;
  padding: 0.2rem;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-content: start;
  overflow: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.cards::-webkit-scrollbar {
  display: none;
}

/* Professional horizontal app cards */
.app-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: stretch;
  width: 100%;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid rgba(11, 23, 32, 0.08);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 32px rgba(11, 23, 32, 0.06);
  opacity: 0;
  animation: card-in 0.7s var(--ease) forwards;
  animation-delay: var(--d, 0s);
  transition: transform 0.35s var(--ease), border-color 0.3s ease, background 0.3s ease, box-shadow 0.35s var(--ease);
}

.app-card:hover {
  transform: translateY(-4px);
  border-color: rgba(14, 124, 111, 0.28);
  background: #fff;
  box-shadow: var(--shadow);
}

.app-card__icon {
  width: clamp(9.5rem, 16vw, 12.5rem);
  height: clamp(9.5rem, 16vw, 12.5rem);
  border-radius: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.8rem, 3.5vw, 2.5rem);
  color: #f4f8fa;
  letter-spacing: -0.03em;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: none;
  animation: none;
}

.app-card__icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.app-card__content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 0.85rem;
  min-width: 0;
  padding: 1.1rem 1.2rem;
}

.app-card__text {
  min-width: 0;
  width: 100%;
}

.app-card__name {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.2vw, 1.55rem);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.app-card__desc {
  margin: 0.4rem 0 0;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--ink-soft);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.app-card__meta {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(82, 101, 116, 0.85);
}

@media (max-width: 760px) {
  .cards {
    grid-template-columns: 1fr;
  }

  .app-card__icon {
    width: clamp(8.5rem, 28vw, 11rem);
    height: clamp(8.5rem, 28vw, 11rem);
  }
}

@media (max-width: 480px) {
  .app-card {
    grid-template-columns: 1fr;
  }

  .app-card__icon {
    width: 100%;
    height: 10rem;
  }

  .btn--download {
    width: 100%;
  }
}

.empty {
  margin: auto;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ink-soft);
  letter-spacing: -0.02em;
}

.empty[hidden] {
  display: none;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: 1.25rem;
  transform: translateX(-50%) translateY(120%);
  z-index: 60;
  padding: 0.8rem 1.15rem;
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  font-weight: 600;
  font-size: 0.92rem;
  box-shadow: var(--shadow);
  transition: transform 0.4s var(--ease);
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .anim-rise,
  .app-card {
    opacity: 1;
    transform: none;
  }
}
