:root {
  --void: #0d0716;
  --ember: #ff7a14;
  --ecto: #8dff6a;
  --bone: #f4ead6;
  --gold: #ffcf4a;
  --muted: #c9b8e2;
  font-family: 'Gowun Dodum', system-ui, sans-serif;
  font-size: clamp(14px, 1.3vmin + 7px, 21px);
  color: var(--bone);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--void);
  -webkit-tap-highlight-color: transparent;
}

.hub {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: clamp(16px, 4vh, 44px) 16px clamp(10px, 2vh, 20px);
}

/* ─── 배경 ─── */
.hero {
  position: absolute;
  inset: -3%;
  background: var(--void) url('images/hero.webp') center 40% / cover no-repeat;
  animation: drift 30s ease-in-out infinite alternate;
}

@keyframes drift {
  from {
    transform: scale(1.02) translate(-0.8%, 0.4%);
  }
  to {
    transform: scale(1.08) translate(0.8%, -0.8%);
  }
}

.shade {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 38% at 50% 16%, rgba(13, 7, 22, 0.55), transparent 70%),
    linear-gradient(180deg, rgba(13, 7, 22, 0.35) 0%, rgba(13, 7, 22, 0) 30%, rgba(13, 7, 22, 0.15) 50%, rgba(13, 7, 22, 0.88) 78%, rgba(13, 7, 22, 0.97) 100%);
}

.fog {
  position: absolute;
  inset: auto -20% 18% -20%;
  height: 30%;
  background:
    radial-gradient(ellipse 30% 50% at 20% 60%, rgba(141, 255, 106, 0.12), transparent 70%),
    radial-gradient(ellipse 35% 50% at 70% 50%, rgba(170, 120, 255, 0.14), transparent 70%);
  filter: blur(10px);
  animation: fog 18s ease-in-out infinite alternate;
  pointer-events: none;
}

@keyframes fog {
  to {
    transform: translateX(8%);
  }
}

.sky {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.bat {
  position: absolute;
  width: 34px;
  height: 14px;
  background: #07030c;
  clip-path: polygon(0 30%, 18% 0, 34% 40%, 50% 20%, 66% 40%, 82% 0, 100% 30%, 78% 100%, 62% 70%, 50% 100%, 38% 70%, 22% 100%);
  animation: fly 16s linear infinite;
}

.bat.b1 { top: 14%; animation-duration: 18s; }
.bat.b2 { top: 24%; animation-duration: 23s; animation-delay: -8s; transform: scale(0.7); }
.bat.b3 { top: 9%; animation-duration: 27s; animation-delay: -15s; }

@keyframes fly {
  0% { left: -6%; translate: 0 0; }
  25% { translate: 0 -30px; }
  50% { translate: 0 10px; }
  75% { translate: 0 -20px; }
  100% { left: 106%; translate: 0 0; }
}

.spark {
  position: absolute;
  bottom: 30%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--ecto);
  box-shadow: 0 0 10px 3px rgba(141, 255, 106, 0.7);
  opacity: 0;
  animation: rise 7s ease-in infinite;
}

.spark.s1 { left: 18%; animation-delay: 0s; }
.spark.s2 { left: 34%; animation-delay: -2s; background: var(--gold); box-shadow: 0 0 10px 3px rgba(255, 207, 74, 0.7); }
.spark.s3 { left: 52%; animation-delay: -4.5s; }
.spark.s4 { left: 66%; animation-delay: -1s; background: #c79bff; box-shadow: 0 0 10px 3px rgba(199, 155, 255, 0.7); }
.spark.s5 { left: 80%; animation-delay: -3s; }
.spark.s6 { left: 44%; animation-delay: -5.5s; background: var(--gold); box-shadow: 0 0 10px 3px rgba(255, 207, 74, 0.7); }

@keyframes rise {
  0% { opacity: 0; transform: translateY(0); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-45vh) translateX(20px); }
}

/* ─── 제목 ─── */
.title {
  position: relative;
  z-index: 2;
  text-align: center;
  animation: titleIn 1s cubic-bezier(0.2, 1.3, 0.4, 1) both;
}

@keyframes titleIn {
  from {
    opacity: 0;
    transform: translateY(-30px) scale(0.9);
  }
}

.eyebrow {
  margin: 0;
  font-family: 'Jua', sans-serif;
  font-size: 1.35em;
  letter-spacing: 0.4em;
  padding-left: 0.4em;
  color: var(--gold);
  text-shadow: 0 3px 0 #000, 0 0 20px rgba(255, 179, 71, 0.7);
}

h1 {
  margin: 0.05em 0 0;
  font-family: 'Black Han Sans', 'Jua', sans-serif;
  font-weight: 400;
  font-size: clamp(48px, 9.5vmin, 118px);
  line-height: 1;
  letter-spacing: 0.02em;
  color: #fff3dc;
  -webkit-text-stroke: 2px #1a0a26;
  text-shadow:
    0 5px 0 #1a0a26,
    0 9px 0 #ff7a14,
    0 14px 24px rgba(0, 0, 0, 0.8),
    0 0 50px rgba(255, 122, 20, 0.55);
}

h1 span:last-child {
  color: #d6ffbf;
  text-shadow:
    0 5px 0 #1a0a26,
    0 9px 0 #3fae2a,
    0 14px 24px rgba(0, 0, 0, 0.8),
    0 0 50px rgba(141, 255, 106, 0.5);
}

.tag {
  margin: 0.5em 0 0;
  font-family: 'East Sea Dokdo', cursive;
  font-size: 1.9em;
  color: var(--bone);
  text-shadow: 0 2px 0 #000, 0 0 12px rgba(0, 0, 0, 0.9);
}

/* ─── 앱 카드 ─── */
.cards {
  position: relative;
  z-index: 2;
  width: min(1400px, 100%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(14px, 2vw, 28px);
  margin-top: 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: #2a1a10;
  padding: 10px 10px 12px;
  border-radius: 6px 12px 8px 14px;
  background:
    repeating-linear-gradient(0deg, rgba(120, 90, 50, 0.05) 0 2px, transparent 2px 5px),
    linear-gradient(170deg, #f8eed8, #e2cfa6);
  box-shadow:
    0 0 0 3px #f8eed8,
    0 0 0 5px #1a0f08,
    0 14px 0 rgba(0, 0, 0, 0.45),
    0 24px 40px rgba(0, 0, 0, 0.55);
  transform: rotate(var(--r));
  transition: transform 0.25s cubic-bezier(0.2, 1.6, 0.4, 1), box-shadow 0.25s;
  animation: cardIn 0.7s cubic-bezier(0.2, 1.4, 0.4, 1) both;
  animation-delay: var(--d);
  outline: none;
}

.card.c1 { --r: -2.2deg; --d: 0.25s; --glow: 255, 122, 20; }
.card.c2 { --r: 1.6deg; --d: 0.35s; --glow: 255, 220, 120; }
.card.c3 { --r: -1.2deg; --d: 0.45s; --glow: 120, 220, 255; }
.card.c4 { --r: 2.2deg; --d: 0.55s; --glow: 141, 255, 106; }

@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(80px) rotate(calc(var(--r) * 4)) scale(0.85);
  }
}

.card:hover,
.card:focus-visible {
  transform: translateY(-12px) rotate(0deg) scale(1.04);
  box-shadow:
    0 0 0 3px #f8eed8,
    0 0 0 5px #1a0f08,
    0 20px 0 rgba(0, 0, 0, 0.4),
    0 0 50px rgba(var(--glow), 0.6),
    0 30px 50px rgba(0, 0, 0, 0.6);
}

.card:active {
  transform: translateY(-4px) scale(0.97);
}

.tape {
  position: absolute;
  top: -13px;
  left: 50%;
  width: 78px;
  height: 24px;
  margin-left: -39px;
  background: rgba(var(--glow), 0.7);
  transform: rotate(-4deg);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
  z-index: 2;
}

.thumb {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  border-radius: 4px;
  overflow: hidden;
  background: #1a0f24;
  box-shadow: inset 0 0 0 2px rgba(26, 15, 8, 0.6);
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.6s ease;
}

.thumb::after {
  /* 종이 결 + 가장자리 그늘 */
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.45);
}

.card:hover .thumb img {
  transform: scale(1.08);
}

.info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 4px 0;
  text-align: center;
}

.info strong {
  font-family: 'Jua', sans-serif;
  font-weight: 400;
  font-size: 1.3em;
  line-height: 1.15;
}

.info small {
  font-size: 0.8em;
  color: #5a4630;
  line-height: 1.3;
}

.info em {
  align-self: center;
  margin-top: 6px;
  font-style: normal;
  font-family: 'Jua', sans-serif;
  font-size: 0.78em;
  padding: 0.15em 0.8em;
  border-radius: 999px;
  background: #2a1a3a;
  color: var(--bone);
}

.foot {
  position: relative;
  z-index: 2;
  margin-top: 18px;
  font-size: 0.78em;
  color: rgba(201, 184, 226, 0.6);
}

/* 세로 화면: 2×2 */
@media (max-aspect-ratio: 23/20) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 340px));
    justify-content: center;
    gap: 26px 22px;
  }
  .hub {
    justify-content: flex-start;
    gap: 3vh;
  }
}

/* 낮은 화면(4:3 태블릿 가로 등): 제목과 카드 글씨를 줄여 한 화면에 */
@media (max-height: 820px) and (min-aspect-ratio: 23/20) {
  h1 {
    font-size: clamp(44px, 8.5vmin, 96px);
  }
  .tag {
    font-size: 1.5em;
  }
  .info small {
    display: none;
  }
  .card {
    padding: 8px 8px 10px;
  }
}

@media (max-width: 520px) {
  .cards {
    grid-template-columns: 1fr;
    max-width: 360px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
