/* 다이스파크 홈페이지. 외부 리소스 없이 시스템 폰트만 씁니다. */
:root {
  color-scheme: dark;
  --bg: #0b101c;
  --bg-alt: #0f1626;
  --surface: #151e32;
  --surface-2: #1b2640;
  --border: #26324f;
  --text: #e9edf5;
  --muted: #9aa5bb;
  --accent: #ffb547;
  --accent-strong: #ff9f1c;
  --accent-ink: #1a1203;
  --info: #5cc8f0;
  --radius: 14px;
  --header-h: 64px;
  --font: system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

/* 모달이 열려 있는 동안 뒤 페이지가 스크롤되지 않게 합니다. */
html.modal-open,
html.modal-open body { overflow: hidden; }

img { max-width: 100%; display: block; }
a { color: inherit; }
code {
  font-family: var(--mono);
  font-size: 0.88em;
  padding: 0.1em 0.4em;
  border-radius: 6px;
  background: var(--surface-2);
  color: #ffd38a;
  white-space: nowrap;
}
h1, h2, h3 { line-height: 1.3; margin: 0; }

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute;
  left: 12px; top: -48px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus { top: 12px; }

:focus-visible {
  outline: 2px solid var(--info);
  outline-offset: 3px;
}

/* ── 버튼 ───────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 10px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, transform 0.15s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-strong); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--muted); background: var(--surface); }
.btn-small { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn-close { background: var(--surface-2); color: var(--text); border-color: var(--border); }
.btn-close:hover { background: #2a3657; }

/* ── 머리말(고정 메뉴) ───────────────── */
.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(11, 16, 28, 0.86);
  backdrop-filter: saturate(140%) blur(10px);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 0.01em;
  text-decoration: none;
}
.site-nav { display: flex; gap: 4px; }
.site-nav a {
  padding: 8px 14px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 600;
  font-size: 15px;
  text-decoration: none;
  transition: color 0.15s, background-color 0.15s;
}
.site-nav a:hover { color: var(--text); background: var(--surface); }
.site-nav a.is-active { color: var(--accent); }

.nav-toggle {
  display: none;
  width: 44px; height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  position: relative;
}
.nav-toggle-bar,
.nav-toggle-bar::before,
.nav-toggle-bar::after {
  position: absolute;
  left: 50%;
  width: 20px; height: 2px;
  margin-left: -10px;
  border-radius: 2px;
  background: var(--text);
  transition: transform 0.2s, opacity 0.2s;
}
.nav-toggle-bar { top: 50%; margin-top: -1px; }
.nav-toggle-bar::before,
.nav-toggle-bar::after { content: ""; left: 0; margin-left: 0; }
.nav-toggle-bar::before { top: -6px; }
.nav-toggle-bar::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::after { transform: translateY(-6px) rotate(-45deg); }

/* ── 구역 공통 ───────────────────────── */
.section {
  padding: 96px 0;
  scroll-margin-top: var(--header-h);
}
.section-alt { background: var(--bg-alt); }
.section-head { max-width: 720px; margin-bottom: 40px; }
.section-head h2 { font-size: clamp(26px, 3.4vw, 36px); }
.section-desc { margin: 14px 0 0; color: var(--muted); }
.eyebrow {
  margin: 0 0 10px;
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.08em;
}

/* ── 소개(히어로) ────────────────────── */
.hero {
  padding-top: calc(var(--header-h) + 88px);
  background:
    radial-gradient(900px 420px at 85% 10%, rgba(255, 181, 71, 0.13), transparent 60%),
    radial-gradient(700px 400px at 0% 100%, rgba(92, 200, 240, 0.10), transparent 60%),
    var(--bg);
  scroll-margin-top: 0;
}
.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 56px;
  align-items: center;
}
.hero h1 { font-size: clamp(32px, 5vw, 52px); letter-spacing: -0.01em; }
.hero h1 .line { display: block; }
.accent { color: var(--accent); }
.lead { margin: 22px 0 0; color: #c5cddc; font-size: 18px; max-width: 560px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.hero-flow {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 14px;
  counter-reset: flow;
}
.hero-flow li {
  position: relative;
  padding: 18px 20px 18px 64px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  counter-increment: flow;
}
.hero-flow li::before {
  content: counter(flow);
  position: absolute;
  left: 18px; top: 18px;
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--accent);
  font-weight: 800;
}
.hero-flow li:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 33px; bottom: -15px;
  width: 2px; height: 14px;
  background: var(--border);
}
.hero-flow strong { display: block; font-size: 17px; }
.hero-flow span { color: var(--muted); font-size: 15px; }

/* ── 특징 ───────────────────────────── */
.feature-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.feature {
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.feature-icon {
  display: grid;
  place-items: center;
  width: 44px; height: 44px;
  margin-bottom: 18px;
  border-radius: 12px;
  background: rgba(255, 181, 71, 0.12);
  color: var(--accent);
  font-size: 22px;
  font-weight: 800;
}
.feature h3 { font-size: 19px; margin-bottom: 10px; }
.feature p { margin: 0; color: var(--muted); font-size: 15px; }

/* ── 게임 데모 ───────────────────────── */
.game-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 24px;
}
.game-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.game-thumb {
  aspect-ratio: 16 / 9;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.game-thumb img { width: 100%; height: 100%; object-fit: cover; }
.game-body { display: flex; flex-direction: column; flex: 1; padding: 22px; }
.game-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; }
.game-title h3 { font-size: 21px; }
.game-gtype { color: var(--muted); font-family: var(--mono); font-size: 13px; }
.game-summary { margin: 10px 0 0; color: var(--muted); font-size: 15px; }
.game-tags { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.game-tags li {
  padding: 2px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: #c5cddc;
  font-size: 13px;
}
.game-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: auto; padding-top: 20px; }
.game-actions .btn { flex: 1 1 140px; }
.notice { color: var(--muted); }

/* ── 연동 방식 ───────────────────────── */
.steps {
  list-style: none;
  margin: 0 0 40px;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  counter-reset: step;
}
.step {
  position: relative;
  padding: 22px 18px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  counter-increment: step;
}
.step::before {
  content: "STEP " counter(step);
  display: block;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}
.step h3 { font-size: 17px; margin-bottom: 8px; }
.step p { margin: 0; color: var(--muted); font-size: 14px; }

.api-tables {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.api-table {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.api-table h3 { font-size: 18px; }
.api-dir { margin: 4px 0 14px; color: var(--muted); font-size: 14px; }
.api-table table { width: 100%; border-collapse: collapse; font-size: 15px; }
.api-table th,
.api-table td {
  padding: 10px 8px;
  border-top: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
.api-table thead th { border-top: 0; color: var(--muted); font-size: 13px; font-weight: 600; }
.api-table tbody th { width: 34%; font-weight: 700; white-space: nowrap; }
.api-table td { color: #c5cddc; }

.spec-notes { margin: 28px 0 0; padding-left: 20px; color: var(--muted); font-size: 15px; }
.spec-notes li + li { margin-top: 6px; }

/* ── 문의 ───────────────────────────── */
.contact-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
}
.contact-item {
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.contact-item dt { color: var(--muted); font-size: 14px; }
.contact-item dd { margin: 4px 0 0; font-size: 18px; font-weight: 700; }
.contact-item dd.is-empty { color: #c5cddc; font-weight: 600; }
.contact-item a { color: var(--accent); text-decoration: none; }
.contact-item a:hover { text-decoration: underline; }

/* ── 꼬리말 ─────────────────────────── */
.site-footer { border-top: 1px solid var(--border); padding: 28px 0; color: var(--muted); font-size: 14px; }
.footer-inner { display: flex; justify-content: space-between; gap: 16px; }
.footer-inner a { text-decoration: none; }
.footer-inner a:hover { color: var(--text); }

/* ── 데모 모달 ───────────────────────── */
.demo-modal {
  width: min(1280px, calc(100vw - 48px));
  height: min(820px, calc(100vh - 48px));
  height: min(820px, calc(100dvh - 48px));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #000;
  color: var(--text);
  overflow: hidden;
}
.demo-modal[open] { display: flex; flex-direction: column; }
.demo-modal::backdrop { background: rgba(3, 6, 12, 0.78); }
.demo-modal-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px 8px 18px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.demo-modal-title {
  font-size: 16px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.demo-modal-actions { display: flex; gap: 8px; flex-shrink: 0; }
.demo-modal-body { position: relative; flex: 1; min-height: 0; }
.demo-modal-body iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

/* ── 반응형 ─────────────────────────── */
@media (max-width: 1000px) {
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .steps .step:last-child { grid-column: 1 / -1; }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; gap: 40px; }
  .api-tables { grid-template-columns: 1fr; }
  .contact-list { grid-template-columns: 1fr; }
}

/* 모바일: 메뉴는 버튼으로 펼칩니다. */
@media (max-width: 760px) {
  :root { --header-h: 58px; }
  .container { padding: 0 16px; }
  .section { padding: 64px 0; }
  .hero { padding-top: calc(var(--header-h) + 48px); }
  .lead { font-size: 16px; }
  .section-head { margin-bottom: 28px; }

  .nav-toggle { display: block; }
  .site-nav {
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    flex-direction: column;
    gap: 2px;
    padding: 8px 12px 14px;
    background: var(--bg); /* 불투명: 뒤 제목이 메뉴 글자 사이로 비치지 않게 */
    border-bottom: 1px solid var(--border);
    display: none;
  }
  .site-nav.is-open { display: flex; }
  .site-nav a { padding: 12px 12px; font-size: 16px; }

  .feature-grid { grid-template-columns: 1fr; }
  .feature { padding: 22px; }
  .steps { grid-template-columns: 1fr; }
  .hero-actions .btn { flex: 1 1 auto; }

  /* 모바일 모달은 화면 전체를 씁니다. */
  .demo-modal {
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
  }
  .demo-modal-bar { padding: 6px 8px 6px 14px; }
  .demo-modal-title { font-size: 15px; }
}

@media (max-width: 400px) {
  .demo-modal-actions .btn { padding: 0 10px; }
  .api-table { padding: 18px 14px; }
  .api-table tbody th { white-space: normal; }
}
