/* 개인오락실: 밤에 불 켜진 동네 오락실. 간판 하나가 주인공이고, 게임기는 바닥 위에 나란히 선다. */
:root {
  --room: #241a30;       /* 오락실 안쪽 벽 */
  --room-deep: #1a1324;
  --floor-a: #33284a;    /* 바닥 타일 */
  --floor-b: #251c35;
  --text: #f1ebf6;
  --muted: #b7aac6;
  --paper: #fbf9fc;      /* 글 페이지 종이 */
  --ink: #1d1626;
  --ink-muted: #5f5470;
  --rule: #d8d0e0;
  --sign: #d0283a;       /* 간판 */
  --sign-dark: #8a1424;
  --bulb: #ffd23f;       /* 전구, 동전 */
  --display: "Black Han Sans", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --body: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--room-deep); }
body {
  margin: 0; min-height: 100vh; color: var(--text);
  font: 16px/1.65 var(--body); word-break: keep-all; overflow-wrap: anywhere;
  background:
    radial-gradient(ellipse 60% 340px at 50% 0, rgba(208, 40, 58, .22), transparent 70%),
    linear-gradient(var(--room) 0, var(--room-deep) 100%) fixed;
  padding: 0 max(16px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(16px, env(safe-area-inset-left));
}
a { color: inherit; }
a:focus-visible, button:focus-visible { outline: 3px solid var(--bulb); outline-offset: 3px; border-radius: 4px; }

/* ---------- 머리말과 간판 ---------- */
.top {
  max-width: 1080px; margin: 0 auto; padding: 18px 0 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.top nav { display: flex; gap: 20px; font-size: 15px; font-weight: 500; }
.top nav a { text-decoration: none; color: var(--muted); padding: 4px 0; border-bottom: 2px solid transparent; }
.top nav a:hover, .top nav a[aria-current] { color: var(--text); border-color: var(--bulb); }

.sign {
  position: relative; display: inline-block; text-decoration: none;
  background: var(--sign); color: #fff; border-radius: 10px;
  padding: 10px 20px 12px; box-shadow: 0 4px 0 var(--sign-dark);
}
.sign-text { position: relative; font-family: var(--display); font-size: 22px; line-height: 1; letter-spacing: .02em; text-shadow: 2px 2px 0 var(--sign-dark); }
/* 간판 테두리 전구: 점 줄무늬를 한 칸씩 밀어 불이 흐르는 것처럼 보이게 함 */
.bulbs {
  position: absolute; inset: 4px; border-radius: 7px; pointer-events: none;
  background:
    radial-gradient(circle, var(--bulb) 2px, transparent 2.6px) 0 0 / 12px 12px repeat-x,
    radial-gradient(circle, var(--bulb) 2px, transparent 2.6px) 6px 100% / 12px 12px repeat-x;
  animation: chase 1.2s steps(2) infinite;
}
@keyframes chase { to { background-position: 12px 0, 18px 100%; } }

/* 첫 화면: 간판을 가게 정면 가운데에 */
.home .top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; padding-top: 22px; }
.home .top nav { grid-column: 3; justify-self: end; }
.home .sign {
  grid-column: 2; grid-row: 1; margin-top: 34px;
  padding: 26px 40px 30px; border-radius: 16px;
  box-shadow: 0 6px 0 var(--sign-dark), 0 0 60px rgba(208, 40, 58, .45);
}
.home .sign-text { font-size: clamp(46px, 9vw, 92px); text-shadow: 4px 4px 0 var(--sign-dark); white-space: nowrap; }
.home .bulbs {
  inset: 7px; border-radius: 11px; animation-name: chase-lg;
  background:
    radial-gradient(circle, var(--bulb) 3.2px, transparent 4px) 0 0 / 20px 20px repeat-x,
    radial-gradient(circle, var(--bulb) 3.2px, transparent 4px) 10px 100% / 20px 20px repeat-x;
  filter: drop-shadow(0 0 3px rgba(255, 210, 63, .8));
}
@keyframes chase-lg { to { background-position: 20px 0, 30px 100%; } }

main { max-width: 1080px; margin: 0 auto; }

/* ---------- 첫 화면 ---------- */
.intro p { margin: 26px auto 56px; max-width: 30em; text-align: center; font-size: 18px; color: var(--muted); }

/* 게임 아이콘들이 놓인 바닥 */
.floor { position: relative; padding: 0 0 72px; isolation: isolate; }
.floor::after {
  content: ""; position: absolute; z-index: -1; left: 50%; bottom: 0; width: 100vw; height: 170px; transform: translateX(-50%);
  border-top: 1px solid rgba(255, 255, 255, .06);
  background: repeating-conic-gradient(var(--floor-a) 0 25%, var(--floor-b) 0 50%) 0 0 / 40px 40px;
  -webkit-mask-image: linear-gradient(#0008, #000 70%); mask-image: linear-gradient(#0008, #000 70%);
}
.tiles {
  --size: clamp(92px, 26vw, 148px);
  list-style: none; margin: 0 auto; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, var(--size)); justify-content: center; gap: 28px clamp(18px, 4vw, 40px);
}
.tile { display: flex; flex-direction: column; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.tile .icon {
  width: var(--size); height: var(--size); border-radius: 28%; overflow: hidden; display: block;
  background: var(--c0);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c1) 60%, transparent), 0 10px 0 -2px rgba(0, 0, 0, .35),
    0 0 36px color-mix(in srgb, var(--c1) 26%, transparent);
  transition: transform .12s ease, box-shadow .12s ease;
}
.tile .icon svg { display: block; width: 100%; height: 100%; }
.tile .initial { display: grid; place-items: center; height: 100%; font: 64px/1 var(--display); color: var(--c1); }
.tile .name { font-size: 16px; font-weight: 500; text-align: center; line-height: 1.3; }
.tile:hover .icon { transform: translateY(-3px); box-shadow: 0 0 0 3px var(--c1), 0 13px 0 -2px rgba(0, 0, 0, .35), 0 0 44px color-mix(in srgb, var(--c1) 40%, transparent); }
.tile:focus-visible { outline: none; }
.tile:focus-visible .icon { outline: 3px solid var(--bulb); outline-offset: 5px; }
.tile.empty .icon { background: transparent; box-shadow: inset 0 0 0 2px #463a58; background-image: repeating-linear-gradient(45deg, transparent 0 10px, rgba(255, 255, 255, .025) 10px 20px); }
.tile.empty .name { color: #8a7d9c; }

/* ---------- 설명창 ---------- */
.detail {
  width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; border: 0; border-radius: 20px; overflow: auto;
  background: var(--c0); color: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c1) 50%, transparent), 0 30px 80px rgba(0, 0, 0, .6);
}
.detail::backdrop { background: rgba(14, 9, 20, .72); backdrop-filter: blur(3px); }
.detail[open] { animation: rise .18s ease-out; }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }
.detail .art { aspect-ratio: 4 / 3; background: #000; }
.detail .art svg { display: block; width: 100%; height: 100%; }
.detail .body { padding: 20px 22px 24px; }
.detail h2 { margin: 0 0 8px; font: 400 28px/1.15 var(--display); color: var(--c1); }
.detail h2 .en { font: 500 14px var(--body); color: rgba(255, 255, 255, .6); margin-left: 4px; }
.detail p { margin: 0 0 12px; color: rgba(255, 255, 255, .86); font-size: 15px; line-height: 1.65; }
.detail .x {
  position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; border: 0; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #fff; font-size: 24px; line-height: 1; cursor: pointer;
}
.tags { list-style: none; margin: 0 0 20px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { font-size: 12px; padding: 2px 9px; border-radius: 999px; background: rgba(255, 255, 255, .09); color: rgba(255, 255, 255, .78); }
.actions { display: flex; align-items: center; gap: 18px; }
.play {
  display: inline-flex; align-items: center; gap: 10px; text-decoration: none;
  background: var(--bulb); color: #2b2100; font: 400 20px/1 var(--display);
  padding: 13px 20px 12px; border-radius: 10px; box-shadow: 0 4px 0 #c99a00;
}
/* 동전 넣는 구멍 */
.play::before { content: ""; width: 4px; height: 16px; border-radius: 2px; background: #2b2100; opacity: .55; }
.play:hover { background: #ffdc5e; }
.play:active { transform: translateY(3px); box-shadow: 0 1px 0 #c99a00; }
.more { color: rgba(255, 255, 255, .85); font-size: 15px; }

/* ---------- 게임 팝업 ---------- */
html.playing, html.playing body { overflow: hidden; }
.player { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; background: var(--room-deep); }
.player[hidden] { display: none; }
.player .bar {
  display: flex; align-items: center; gap: 16px; padding: 8px max(12px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
  padding-top: max(8px, env(safe-area-inset-top)); font-size: 14px;
}
.player .bar b { flex: 1; font: 400 18px/1 var(--display); color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player .bar a { color: var(--muted); }
.player .bar button {
  font: inherit; font-weight: 700; border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer;
  background: var(--sign); color: #fff; box-shadow: 0 3px 0 var(--sign-dark);
}
.player .stage { flex: 1; min-height: 0; display: flex; justify-content: center; }
.player iframe { display: block; width: 100%; height: 100%; border: 0; background: #000; }
/* 세로형 게임은 PC에서 폰 화면 폭으로 가운데에 (양옆은 나중에 광고 자리) */
@media (min-width: 720px) {
  .player[data-frame="portrait"] .stage { padding: 0 0 16px; }
  .player[data-frame="portrait"] iframe { width: 460px; border-radius: 16px; box-shadow: 0 0 0 3px #3a2f4a; }
  .player[data-frame="full"] .stage { padding: 0 16px 16px; }
  .player[data-frame="full"] iframe { border-radius: 12px; }
}

/* ---------- 글 페이지 ---------- */
.doc {
  background: var(--paper); color: var(--ink); border-radius: 14px; padding: clamp(20px, 5vw, 48px);
  margin: 12px auto 48px; max-width: 780px;
}
.doc h1 { font: 400 clamp(30px, 6vw, 40px)/1.15 var(--display); margin: 0 0 8px; }
.doc .lead { color: var(--ink-muted); margin: 0 0 28px; font-size: 17px; }
.doc h2 { font-size: 20px; margin: 36px 0 8px; }
.doc h3 { font-size: 17px; margin: 24px 0 6px; }
.doc p, .doc li { max-width: 40em; }
.doc ul, .doc ol { padding-left: 1.3em; }
.doc li + li { margin-top: 4px; }
.doc table { border-collapse: collapse; width: 100%; font-size: 15px; margin: 8px 0 16px; }
.doc th, .doc td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.doc th { font-weight: 700; }
.doc a:focus-visible { outline-color: var(--ink); }
.doc .cta { margin-top: 32px; }
.doc small, .doc .note { color: var(--ink-muted); font-size: 14px; }

/* ---------- 꼬리말 ---------- */
.bottom { max-width: 1080px; margin: 0 auto; padding: 20px 0 36px; border-top: 1px solid rgba(255, 255, 255, .1); font-size: 14px; color: var(--muted); }
.bottom nav { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-bottom: 6px; }
.bottom nav a { color: var(--text); }
.bottom p { margin: 0; }
.home .bottom { text-align: center; border-top: 0; padding-top: 28px; }
.home .bottom nav { justify-content: center; }

@media (prefers-reduced-motion: reduce) { .bulbs, .detail[open] { animation: none; } .play:active, .tile:hover .icon { transform: none; } }
@media (max-width: 640px) {
  .home .top { grid-template-columns: 1fr; justify-items: center; gap: 0; padding-top: 12px; }
  .home .top nav { grid-column: 1; grid-row: 1; justify-self: end; }
  .home .sign { grid-column: 1; grid-row: 2; margin-top: 18px; padding: 18px 24px 22px; }
  .intro p { font-size: 17px; margin: 20px auto 30px; }
}
