/* 한판 오락실(가칭) — 웹창 공통 스타일. 밤하늘 · 광산 · 안전모 노랑. 외부 글꼴 없음(외부 요청 0) */
:root {
  --bg: #11152a;
  --bg-deep: #0b0e1d;
  --panel: #191e3a;
  --panel-2: #20264a;
  --line: #2d3466;
  --text: #ece6d6;
  --muted: #aaa8c4;
  --gold: #f5c443;
  --gold-ink: #2a1d05;
  --wood: #8a5a2e;
  --soil: #5b3a1f;
  --focus: #8fd3e8;
  --radius: 12px;
  --gap-ad: 160px;          /* 게임 칸과 광고 칸 사이 — 애드센스 권고 150px 이상, 부서 기준 160px */
  --head-h: 52px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.65 system-ui, -apple-system, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Noto Sans", sans-serif;
  word-break: keep-all;
  overflow-wrap: anywhere;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--gold); text-underline-offset: 3px; }
a:hover { color: #ffd970; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { line-height: 1.25; text-wrap: balance; margin: 0; }
h1 { font-size: clamp(28px, 4.4vw, 40px); letter-spacing: -0.01em; }
h2 { font-size: clamp(22px, 3vw, 28px); }
h3 { font-size: 18px; }
p { margin: 0; }
.wrap { width: 100%; max-width: 1100px; margin-inline: auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.prose { max-width: 70ch; }

/* 머리줄 */
.top { position: sticky; top: 0; z-index: 20; background: rgba(11, 14, 29, 0.94); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px); }
.top .wrap { height: var(--head-h); display: flex; align-items: center; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 17px; letter-spacing: 0.01em; white-space: nowrap; }
.brand img.logo { height: 24px; width: auto; flex: none; }
.brand span { padding-left: 10px; border-left: 1px solid var(--line); line-height: 1.2; }
.logo-big { height: 56px; width: auto; }
.top nav { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.top nav a { color: var(--muted); text-decoration: none; font-size: 15px; padding: 6px 10px; border-radius: 8px; }
.top nav a:hover, .top nav a[aria-current="page"] { color: var(--text); background: var(--panel); }
.top nav a.lang { border: 1px solid var(--line); color: var(--text); font-weight: 600; }

/* 첫 화면 */
.hero { padding-block: 40px 28px; background: linear-gradient(180deg, var(--bg-deep), var(--bg)); border-bottom: 1px solid var(--line); }
.hero .wrap { display: grid; gap: 14px; }
.hero .eyebrow { font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.hero p.lead { font-size: 18px; color: var(--muted); max-width: 60ch; }
.section { padding-block: 36px; }
.section > .wrap { display: grid; gap: 18px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.card { display: grid; grid-template-rows: auto 1fr; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--text); text-decoration: none; transition: transform .15s ease, border-color .15s ease; }
.card:hover { transform: translateY(-2px); border-color: var(--gold); color: var(--text); }
.card img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; image-rendering: pixelated; background: var(--bg-deep); }
.card .body { padding: 14px 16px 16px; display: grid; gap: 8px; align-content: start; }
.card .name { font-size: 19px; font-weight: 800; }
.card .one { color: var(--muted); font-size: 15px; }
.card .play { justify-self: start; margin-top: 4px; background: var(--gold); color: var(--gold-ink); font-weight: 800; border-radius: 999px; padding: 6px 16px; font-size: 15px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
.tags li { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.facts-list { display: grid; gap: 10px; list-style: none; padding: 0; margin: 0; }
.facts-list li { padding-left: 18px; position: relative; }
.facts-list li::before { content: ""; position: absolute; left: 0; top: 0.62em; width: 8px; height: 8px; background: var(--gold); }

/* 게임 페이지 */
.game-head { padding-block: 16px 12px; }
.game-head .wrap { display: grid; gap: 6px; }
.game-head h1 { font-size: clamp(26px, 3vw, 34px); }
.game-head p { color: var(--muted); font-size: 16px; max-width: 95ch; }
.stage { display: grid; grid-template-columns: minmax(0, 1fr); justify-content: center; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.frame-wrap {
  position: relative; width: min(960px, 100%); margin-inline: auto;
  aspect-ratio: 16 / 9; max-height: calc(100vh - 210px); max-height: calc(100svh - 210px); min-height: 320px;   /* PC: 머리줄 + 제목 아래로 게임 칸 전체가 첫 화면에 들어오게 */
  background: #000; border-radius: var(--radius); overflow: hidden;
  box-shadow: 0 0 0 1px var(--line), 0 14px 40px rgba(0, 0, 0, 0.45);
}
.frame-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; background: #000; }
.frame-wrap:fullscreen { width: 100%; max-height: none; border-radius: 0; }
.frame-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 18px; padding: 12px 16px 0; color: var(--muted); font-size: 14px; text-align: center; }
.btn { appearance: none; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: inherit; font-weight: 700; border-radius: 999px; padding: 7px 16px; cursor: pointer; }
.btn:hover { border-color: var(--gold); }
.ui { display: inline-block; padding: 0 6px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); font-weight: 700; font-size: 0.92em; line-height: 1.5; }

/* 휴대폰 · 태블릿 세로, 휴대폰 가로: 게임 칸을 머리줄 바로 아래 맨 위로 — 첫 화면에 게임 전체(아래쪽 버튼 포함)가 보이게. 제목 · 소개는 게임 칸 아래로 */
@media (orientation: portrait) and (max-width: 820px), (orientation: landscape) and (max-height: 560px) {
  .game-main { display: flex; flex-direction: column; }
  .game-main > .stage { order: 1; padding-top: 8px; }
  .game-main > .frame-tools { order: 2; }
  .game-main > .game-head { order: 3; padding-block: 18px 4px; }
  .game-main > .ad-below { order: 4; }
  .game-main > .guide-wrap { order: 5; }
  .game-head p { font-size: 15px; }
}
/* 세로: 높이 = 화면 − 머리줄 (게임 QA 최소 320×568) */
@media (orientation: portrait) and (max-width: 820px) {
  .frame-wrap { aspect-ratio: auto; width: 100%; height: calc(100vh - var(--head-h) - 16px); height: calc(100svh - var(--head-h) - 16px); max-height: 1100px; min-height: 568px; border-radius: 10px; }
}
/* 가로 휴대폰: 높이 = 화면 − 머리줄 (게임 QA 최소 568×320) */
@media (orientation: landscape) and (max-height: 560px) {
  .frame-wrap { width: 100%; max-height: calc(100vh - var(--head-h) - 16px); max-height: calc(100svh - var(--head-h) - 16px); min-height: 320px; }
}

.gtoc { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.gtoc a { display: inline-block; text-decoration: none; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; font-size: 14px; }
.gtoc a:hover { border-color: var(--gold); }
.info { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin: 0; max-width: 70ch; }
.info dt { color: var(--muted); }
.info dd { margin: 0; }
.guide { display: grid; gap: 40px; padding-block: 8px 24px; }
.guide section { display: grid; gap: 14px; scroll-margin-top: calc(var(--head-h) + 12px); }
.guide h2 { padding-bottom: 8px; border-bottom: 2px solid var(--line); }
.guide h2::before { content: ""; display: inline-block; width: 12px; height: 12px; background: var(--gold); margin-right: 10px; vertical-align: 0.12em; }
.guide p, .guide li { max-width: 70ch; }
.guide .lbl { color: var(--gold); font-weight: 800; }
.guide ol, .guide ul { margin: 0; padding-left: 1.4em; display: grid; gap: 10px; }
.steps li::marker, .tips li::marker { color: var(--gold); font-weight: 800; }
.ctrl { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.ctrl > div { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; display: grid; gap: 8px; align-content: start; }
.ctrl ul { gap: 6px; }
.tbl { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.tbl table { border-collapse: collapse; width: 100%; min-width: 640px; font-size: 15px; }
.tbl th, .tbl td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl th { background: var(--panel-2); color: var(--muted); font-weight: 700; font-size: 13px; letter-spacing: 0.04em; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.n { color: var(--muted); font-variant-numeric: tabular-nums; width: 3em; }
.tbl td.ore { font-weight: 800; white-space: nowrap; }
.dot { display: inline-block; width: 12px; height: 12px; margin-right: 8px; vertical-align: -1px; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25); }
.faq { display: grid; gap: 18px; }
.faq h3 { font-size: 17px; margin-bottom: 4px; }
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.gallery figure { margin: 0; display: grid; gap: 8px; align-content: start; }
.gallery img { border-radius: 10px; border: 1px solid var(--line); image-rendering: pixelated; width: 100%; background: var(--bg-deep); }
.gallery figcaption { color: var(--muted); font-size: 14px; }
.gallery .tall img { max-height: 520px; width: auto; margin-inline: auto; }
.note { color: var(--muted); font-size: 14px; }

/* 광고 칸 — 광고 코드가 있을 때(ads-on) 또는 자리 미리보기(?ads=preview)일 때만 보인다 */
.ad { display: none; }
.ads-on .ad, .ads-preview .ad { display: grid; gap: 4px; justify-items: center; align-content: start; }
.ad-label { font-size: 11px; letter-spacing: 0.08em; color: var(--muted); }
.ad-box { width: 100%; display: grid; place-items: center; }
.ads-preview .ad-box { border: 2px dashed #6b6f9a; color: #8e91b8; background: repeating-linear-gradient(45deg, transparent 0 10px, rgba(255, 255, 255, 0.03) 10px 20px); font-size: 13px; }
.ad-side { display: none !important; }
.ad-side .ad-box { width: 160px; height: 600px; }
.ad-wide { margin-inline: auto; width: 100%; max-width: 728px; padding-inline: 16px; }
.ads-preview .ad-wide .ad-box { min-height: 100px; }
.ad-below { margin-top: var(--gap-ad); }       /* 게임 칸 아래 도구 줄 다음 160px — 게임 칸과는 그보다 더 멀다 */
.ad-content { margin-block: 8px; }
.ad-home { margin-block: 24px; }
/* 넓은 화면에서만 양옆 칸: 160 + 160 + 960 + 160 + 160 = 1,600px + 여백 */
@media (min-width: 1640px) {
  .ads-on .stage, .ads-preview .stage { grid-template-columns: 160px minmax(0, 960px) 160px; column-gap: var(--gap-ad); }
  .ads-on .ad-side, .ads-preview .ad-side { display: grid !important; }
}

/* 바닥줄 */
.foot { margin-top: 40px; border-top: 1px solid var(--line); background: var(--bg-deep); color: var(--muted); font-size: 14px; }
.foot .wrap { padding-block: 24px 32px; display: grid; gap: 10px; }
.foot nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.foot a { color: var(--text); }

/* 언어 고르기 · 404 */
.center { min-height: 100vh; min-height: 100svh; display: grid; place-items: center; text-align: center; }
.center .box { display: grid; gap: 18px; justify-items: center; padding: 24px; }
.center .langs { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
.center .langs a { background: var(--gold); color: var(--gold-ink); text-decoration: none; font-weight: 800; border-radius: 999px; padding: 10px 26px; font-size: 18px; }
.policy { padding-block: 28px 8px; }
.policy .wrap { display: grid; gap: 22px; }
.policy section { display: grid; gap: 10px; max-width: 72ch; }
.policy ul { margin: 0; padding-left: 1.3em; display: grid; gap: 6px; }
.policy table { border-collapse: collapse; }
.policy th, .policy td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; font-size: 15px; }
@media (prefers-reduced-motion: reduce) { .card { transition: none; } .card:hover { transform: none; } }
