/* 영어 수업 게임 놀이터 (play.13w.kr) */
:root {
  color-scheme: light;
  --bg: #fffaf3;
  --bg-2: #fff1df;
  --card: #ffffff;
  --ink: #1c2333;
  --ink-2: #3c4458;
  --muted: #6a7184;
  --line: rgba(28, 35, 51, 0.1);
  --chip: #f4f1ea;
  --accent: #ff6b3d;
  --accent-ink: #ffffff;
  --accent-hover: #f0551f;
  --blue: #2f7cf6;
  --mint: #12a88d;
  --sun: #ffc94a;
  --shadow: 0 1px 2px rgba(28, 35, 51, 0.06), 0 10px 30px -12px rgba(28, 35, 51, 0.22);
  --radius: 22px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    color-scheme: dark;
    --bg: #12141b;
    --bg-2: #1a1d27;
    --card: #1c202b;
    --ink: #f3f4f8;
    --ink-2: #d3d6df;
    --muted: #a0a6b6;
    --line: rgba(255, 255, 255, 0.1);
    --chip: #272c39;
    --accent: #ff7a50;
    --accent-hover: #ff8f6b;
    --blue: #6aa3ff;
    --mint: #3fd0b4;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 30px -14px rgba(0, 0, 0, 0.7);
  }
}
:root[data-theme='dark'] {
  color-scheme: dark;
  --bg: #12141b;
  --bg-2: #1a1d27;
  --card: #1c202b;
  --ink: #f3f4f8;
  --ink-2: #d3d6df;
  --muted: #a0a6b6;
  --line: rgba(255, 255, 255, 0.1);
  --chip: #272c39;
  --accent: #ff7a50;
  --accent-hover: #ff8f6b;
  --blue: #6aa3ff;
  --mint: #3fd0b4;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 30px -14px rgba(0, 0, 0, 0.7);
}

* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Pretendard, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Noto Sans KR', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
a {
  color: inherit;
}
img {
  max-width: 100%;
  display: block;
}
code {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.92em;
  background: var(--chip);
  padding: 1px 6px;
  border-radius: 6px;
}
.wrap {
  width: min(1180px, 100% - 32px);
  margin-inline: auto;
}

/* ───── 버튼 ───── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 8px 16px;
  border-radius: 12px;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease, border-color 0.12s ease;
}
.btn:hover {
  border-color: color-mix(in srgb, var(--ink) 30%, transparent);
}
.btn:active {
  transform: translateY(1px);
}
.btn.go {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn.go:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding-inline: 8px;
}
.btn.ghost:hover {
  color: var(--ink);
}
.btn.big {
  min-height: 52px;
  padding: 12px 24px;
  font-size: 17px;
  border-radius: 16px;
  box-shadow: 0 10px 24px -10px color-mix(in srgb, var(--accent) 70%, transparent);
}
:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--blue) 70%, transparent);
  outline-offset: 2px;
}

/* ───── 첫 화면 ───── */
.hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(60% 80% at 85% 20%, color-mix(in srgb, var(--blue) 22%, transparent), transparent 70%),
    radial-gradient(50% 70% at 10% 90%, color-mix(in srgb, var(--sun) 35%, transparent), transparent 70%),
    radial-gradient(40% 60% at 50% 0%, color-mix(in srgb, var(--mint) 16%, transparent), transparent 70%),
    var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(color-mix(in srgb, var(--ink) 9%, transparent) 1.2px, transparent 1.3px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 85%);
  pointer-events: none;
}
.hero-in {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: center;
  gap: 28px;
  padding: 56px 0 48px;
}
.eyebrow {
  display: inline-block;
  margin: 0 0 14px;
  padding: 4px 12px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--card) 80%, transparent);
  border: 1px solid var(--line);
  font-weight: 700;
  font-size: 14px;
  color: var(--ink-2);
}
h1 {
  margin: 0;
  font-size: clamp(30px, 4.2vw, 46px);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 850;
}
.hl {
  background: linear-gradient(transparent 62%, color-mix(in srgb, var(--sun) 75%, transparent) 62%);
  padding: 0 2px;
}
.lead {
  margin: 16px 0 0;
  font-size: clamp(16px, 1.8vw, 19px);
  color: var(--ink-2);
}
.perks {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 20px 0 26px;
}
.perks li {
  padding: 6px 12px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  font-weight: 650;
  font-size: 15px;
  box-shadow: 0 1px 2px rgba(28, 35, 51, 0.05);
}
.hero-art {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 18px 30px rgba(28, 35, 51, 0.18));
  animation: float 6s ease-in-out infinite;
}
@keyframes float {
  50% {
    transform: translateY(-8px);
  }
}

/* ───── 시작 방법 ───── */
.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: -22px;
  position: relative;
  z-index: 2;
}
.step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
}
.step b {
  flex: 0 0 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 17px;
}
.step:nth-child(2) b {
  background: var(--blue);
}
.step:nth-child(3) b {
  background: var(--mint);
}
.step p {
  margin: 2px 0 0;
  color: var(--ink-2);
  font-size: 15px;
  line-height: 1.5;
}
.step strong {
  color: var(--ink);
}

/* ───── 고르기 ───── */
#games {
  margin-top: 44px;
  scroll-margin-top: 8px;
}
.filters {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 12px 0;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
}
.seg {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.seg-label {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  margin-right: 2px;
}
.seg button {
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  padding: 6px 12px;
  min-height: 36px;
  border-radius: 99px;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--ink-2);
  cursor: pointer;
}
.seg button[aria-pressed='true'] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.count {
  margin: 0 0 0 auto;
  color: var(--muted);
  font-size: 14px;
}
.count b {
  color: var(--ink);
}

/* ───── 카드 ───── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  gap: 22px;
}
.game {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.game:hover {
  transform: translateY(-4px);
  box-shadow: 0 2px 4px rgba(28, 35, 51, 0.06), 0 22px 40px -16px rgba(28, 35, 51, 0.32);
}
.game[hidden] {
  display: none;
}
.cover {
  position: relative;
  display: block;
  aspect-ratio: 3 / 2;
  background: var(--chip);
  overflow: hidden;
}
.cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.game:hover .cover img {
  transform: scale(1.04);
}
.cover .emoji {
  position: absolute;
  left: 14px;
  bottom: -18px;
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  font-size: 28px;
  border-radius: 16px;
  background: var(--card);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  transform: translateY(-24px);
}
.cover .new {
  position: absolute;
  right: 12px;
  top: 12px;
  padding: 3px 10px;
  border-radius: 99px;
  background: var(--sun);
  color: #3a2a00;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 18px 20px 20px;
}
.sub {
  margin: 0;
  font-size: 13px;
  font-weight: 750;
  color: var(--accent);
  letter-spacing: 0.01em;
}
.game h3 {
  margin: 2px 0 6px;
  font-size: 23px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  font-weight: 850;
}
.game h3 a {
  text-decoration: none;
}
.game h3 a:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}
.one {
  margin: 0;
  font-weight: 700;
  color: var(--ink-2);
}
.desc {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14.5px;
  line-height: 1.6;
}
.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  margin: 14px 0 0;
}
.chips li {
  padding: 4px 10px;
  border-radius: 10px;
  background: var(--chip);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
}
.chips li.dev {
  background: color-mix(in srgb, var(--blue) 14%, var(--card));
  color: var(--ink);
}
.foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 12px;
}
.skills {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.skills span {
  font-size: 12px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--mint) 45%, transparent);
  color: color-mix(in srgb, var(--mint) 75%, var(--ink));
}
.upd {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 16px;
}
.actions .go {
  flex: 1 1 150px;
}
.empty {
  text-align: center;
  color: var(--muted);
  padding: 40px 0;
}

/* ───── 자주 묻는 것 ───── */
.faq {
  margin-top: 64px;
  max-width: 820px;
}
.faq h2 {
  font-size: 26px;
  margin: 0 0 14px;
}
.faq details {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 2px 18px;
  margin-bottom: 10px;
}
.faq summary {
  cursor: pointer;
  font-weight: 750;
  padding: 14px 0;
  list-style-position: outside;
}
.faq details p {
  margin: 0 0 16px;
  color: var(--ink-2);
}
.foot-note {
  margin-top: 48px;
  padding: 28px 0 48px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}

/* ───── 화면 보기 ───── */
dialog#peek {
  width: min(880px, 100% - 24px);
  max-height: calc(100% - 24px);
  padding: 0;
  border: 0;
  border-radius: 22px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}
dialog#peek::backdrop {
  background: rgba(14, 18, 28, 0.55);
  backdrop-filter: blur(3px);
}
.peek-body {
  padding: 22px 22px 18px;
}
.peek-body h3 {
  margin: 0 40px 14px 0;
  font-size: 22px;
}
.peek-body img {
  width: 100%;
  height: auto;
  border-radius: 14px;
  border: 1px solid var(--line);
  margin-bottom: 12px;
  background: var(--chip);
}
.peek-body .tip {
  margin: 4px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--sun) 22%, var(--card));
  color: var(--ink-2);
  font-size: 15px;
}
.peek-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0 0;
}
dialog#peek .close {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font-size: 18px;
  cursor: pointer;
}

/* ───── 좁은 화면 ───── */
@media (max-width: 860px) {
  .hero-in {
    grid-template-columns: minmax(0, 1fr);
    padding: 36px 0 40px;
    gap: 10px;
  }
  .hero-art {
    max-width: 520px;
    margin: 0 auto;
  }
  .steps {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
}
@media (max-width: 560px) {
  .filters {
    gap: 8px;
    /* 좁은 화면에서는 따라다니면 카드가 가려져서 */
    position: static;
  }
  .seg {
    flex-wrap: nowrap;
    overflow-x: auto;
    max-width: 100%;
    scrollbar-width: none;
  }
  .seg button {
    flex: 0 0 auto;
  }
  .count {
    margin-left: 0;
  }
  .body {
    padding: 16px 16px 18px;
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .hero-art {
    animation: none;
  }
  .game,
  .cover img,
  .btn {
    transition: none;
  }
}
