:root {
  --paper: #f7f3ec;
  --ink: #1f1c18;
  --muted: #6b645b;
  --card: #ffffff;
  --chip: #efe9df;
  --line: rgba(31, 28, 24, .08);
  --accent: #ff5a4e;
  --new: #ffd23f;
  --shadow: 0 1px 0 rgba(31, 28, 24, .06), 0 10px 28px -14px rgba(31, 28, 24, .35);
  --shadow-up: 0 1px 0 rgba(31, 28, 24, .06), 0 22px 40px -18px rgba(31, 28, 24, .45);
  --display: "Jua", "Noto Sans KR", system-ui, sans-serif;
  --text: "Noto Sans KR", system-ui, -apple-system, "Apple SD Gothic Neo", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16140f;
    --ink: #f2ede4;
    --muted: #a39c90;
    --card: #221f1a;
    --chip: #2f2b25;
    --line: rgba(242, 237, 228, .08);
    --shadow: 0 1px 0 rgba(0, 0, 0, .4), 0 10px 28px -14px rgba(0, 0, 0, .8);
    --shadow-up: 0 1px 0 rgba(0, 0, 0, .4), 0 22px 40px -18px rgba(0, 0, 0, .9);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.55 var(--text);
  word-break: keep-all;
  overflow-wrap: anywhere;
}
a { color: inherit; }

/* ── masthead ─────────────────────────────────────────── */
.masthead {
  text-align: center;
  padding: clamp(40px, 8vw, 84px) 16px clamp(28px, 5vw, 48px);
}
.masthead.small { padding-bottom: 8px; }
.wordmark {
  margin: 0;
  font: 400 clamp(44px, 9vw, 88px)/1 var(--display);
  letter-spacing: -.01em;
}
.masthead.small .wordmark { font-size: 36px; }
.wordmark a { text-decoration: none; }
.wm-dot { color: var(--accent); }
.wm-rest { color: var(--muted); }
.tagline {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: clamp(15px, 2.2vw, 18px);
}

/* ── grid of toys ─────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: clamp(20px, 3vw, 32px);
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 16px 24px;
}
.card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 18px;
  overflow: hidden;
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .18s ease, box-shadow .18s ease;
}
.card:hover, .card:focus-visible {
  transform: translateY(-5px) rotate(-.8deg);
  box-shadow: var(--shadow-up);
}
.card:nth-child(even):hover, .card:nth-child(even):focus-visible { transform: translateY(-5px) rotate(.8deg); }
.card:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.card:active { transform: translateY(-2px) scale(.99); }

.thumb { position: relative; display: block; aspect-ratio: 16 / 10; background: var(--chip); }
.thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
/* 썸네일이 아직 없는 게임 — 제목 글자 카드 */
.thumb.ph { display: grid; place-items: center; padding: 16px; text-align: center; color: #fff; }
.thumb.ph span { font: 400 clamp(28px, 4vw, 40px)/1.15 var(--display); text-shadow: 0 2px 0 rgba(0, 0, 0, .2); }
.ph-0 { background: linear-gradient(135deg, #ff7a59, #ff4d6d); }
.ph-1 { background: linear-gradient(135deg, #3fb6ff, #6a5cff); }
.ph-2 { background: linear-gradient(135deg, #2fcf8f, #1e9bb8); }
.ph-3 { background: linear-gradient(135deg, #ffb938, #ff7a2f); }
.ph-4 { background: linear-gradient(135deg, #b36bff, #ff5ab4); }
.ph-5 { background: linear-gradient(135deg, #4a5568, #1f2937); }
.badge {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 9px 1px;
  border-radius: 999px;
  background: var(--new);
  color: #1f1c18;
  font: 400 13px/1.4 var(--display);
  letter-spacing: .04em;
  vertical-align: 4px;
  transform: rotate(-4deg);
}
.body { display: flex; flex-direction: column; gap: 6px; padding: 14px 18px 18px; flex: 1; }
.title { font: 400 24px/1.2 var(--display); }
.blurb { color: var(--muted); font-size: 15px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 6px; }
.chip {
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--chip);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.card.soon {
  align-items: center;
  justify-content: center;
  min-height: 220px;
  background: transparent;
  border: 2px dashed var(--line);
  box-shadow: none;
  color: var(--muted);
  font: 400 20px/1.3 var(--display);
}
.card.soon:hover { transform: none; }

/* ── footer, credits, 404 ─────────────────────────────── */
.foot {
  text-align: center;
  padding: 40px 16px 56px;
  color: var(--muted);
  font-size: 14px;
}
.foot a { text-decoration: none; border-bottom: 1px solid var(--line); }
.foot a:hover { color: var(--ink); }

.credits { max-width: 720px; margin: 0 auto; padding: 0 16px; }
.credits h1 { font: 400 32px/1.2 var(--display); text-align: center; margin: 8px 0 28px; }
.credits section {
  background: var(--card);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.credits h2 { font: 400 22px/1.3 var(--display); margin: 0 0 6px; }
.credits h2 a { text-decoration: none; }
.credits ul { margin: 0; padding-left: 20px; color: var(--muted); font-size: 15px; }

.lost { min-height: 100vh; display: grid; place-content: center; text-align: center; padding: 16px; }
.lost-code { font: 400 96px/1 var(--display); margin: 0; color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  .card, .card:hover, .card:focus-visible, .card:nth-child(even):hover { transition: none; transform: none; }
}
