:root {
  --bg: #0f1220;
  --bg-soft: #171b31;
  --card: #1d2240;
  --card-hover: #262d55;
  --line: #2e355e;
  --text: #e8eaf6;
  --muted: #9aa2c9;
  --accent: #7c8cff;
  --accent-2: #ff8ac4;
  --ok: #4fd1a5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(1200px 600px at 50% -10%, #23294d 0%, var(--bg) 60%);
  color: var(--text);
  font-family: "Pretendard", "Segoe UI", -apple-system, BlinkMacSystemFont, "Malgun Gothic", sans-serif;
  line-height: 1.6;
}

.wrap {
  max-width: 960px;
  margin: 0 auto;
  padding: 56px 20px 80px;
}

header.hero {
  text-align: center;
  margin-bottom: 48px;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(36px, 7vw, 60px);
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
}

.group {
  margin: 40px 0 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.group:first-child { margin-top: 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.card {
  display: block;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: inherit;
  text-decoration: none;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}

.card:hover {
  transform: translateY(-4px);
  background: var(--card-hover);
  border-color: var(--accent);
}

.card .emoji { font-size: 34px; display: block; margin-bottom: 10px; }
.card h3 { margin: 0 0 6px; font-size: 19px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; }

footer {
  margin-top: 56px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

footer a { color: var(--accent); }

/* ---- 게임 페이지 공통 ---- */
.game-wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 40px 20px 60px;
  text-align: center;
}

.back {
  display: inline-block;
  margin-bottom: 20px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
}
.back:hover { color: var(--accent); }

.game-wrap h1 { margin: 0 0 8px; font-size: 30px; }
.status { min-height: 28px; color: var(--muted); margin-bottom: 20px; }
.status strong { color: var(--ok); }

button.btn {
  margin-top: 22px;
  padding: 10px 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--text);
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
}
button.btn:hover { border-color: var(--accent); background: var(--card-hover); }

/* ---- 링크 복사 안내 ---- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(86px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(8px);
  z-index: 60;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 11px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-soft);
  box-shadow: 0 8px 24px rgba(0, 0, 0, .45);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast strong { display: block; font-size: 14px; }
/* 주소가 길어도 잘리지 않고 접히도록 */
.toast span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
}

/* ---- FAQ ---- */
.fab-row {
  position: fixed;
  right: 20px;
  bottom: calc(20px + env(safe-area-inset-bottom));
  z-index: 50;
  display: flex;
  gap: 10px;
  align-items: center;
}

.fab {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 13px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}

.fab:hover { transform: translateY(-2px); background: var(--card-hover); border-color: var(--accent); }
.fab span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent);
  color: #12152b;
  font-size: 12px;
  font-weight: 800;
}

.faq-modal {
  width: min(540px, calc(100vw - 32px));
  max-height: min(78vh, 720px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  color: var(--text);
  overflow: hidden;
}

.faq-modal::backdrop { background: rgba(6, 8, 20, .72); }

/* dialog를 지원하지 않는 브라우저에서도 숨겨진 채로 시작하도록 */
.faq-modal:not([open]) { display: none; }

.faq-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}

.faq-head h2 { margin: 0; font-size: 19px; }

.faq-close {
  flex: none;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card);
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}
.faq-close:hover { color: var(--text); border-color: var(--accent); }

.faq-body {
  padding: 8px 20px;
  overflow-y: auto;
  max-height: calc(78vh - 210px);
  -webkit-overflow-scrolling: touch;
}

.faq-body details { border-bottom: 1px solid var(--line); }
.faq-body details:last-child { border-bottom: 0; }

.faq-body summary {
  padding: 14px 26px 14px 0;
  position: relative;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  list-style: none;
}
.faq-body summary::-webkit-details-marker { display: none; }

.faq-body summary::after {
  content: "+";
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent);
  font-size: 18px;
  font-weight: 700;
}
.faq-body details[open] summary::after { content: "\2212"; }

.faq-body summary:hover { color: var(--accent); }

.faq-body details p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
}
.faq-body details p strong { color: var(--text); }

.faq-contact {
  padding: 18px 20px calc(20px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
  text-align: center;
}

.faq-contact > p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }

.faq-mail {
  display: block;
  padding: 13px 20px;
  border-radius: 12px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #12152b;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}
.faq-mail:hover { filter: brightness(1.08); }

.faq-addr { margin: 10px 0 0; color: var(--muted); font-size: 12px; }

@media (max-width: 480px) {
  .fab-row { right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); gap: 8px; }
  .fab { padding: 13px 16px; font-size: 13px; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
  .faq-modal { max-height: 85vh; }
  .faq-body { max-height: calc(85vh - 210px); }
}
