/* 바이브 오락실 — 게임기 진열장: 상단 코인 투입구(검색·랜덤), 장르 칩 줄, 썸네일 카드 그리드, 클릭하면 상세 창 */
:root {
  --bg: #eceef4;
  --surface: #ffffff;
  --surface-2: #f5f6fa;
  --ink: #1b1e2e;
  --muted: #5b6078;
  --line: #d7dae6;
  --coin: #e5a116;
  --coin-ink: #241a02;
  --accent: #3a3eb4;
  --good: #1f8a4c;
  --warn: #b26a00;
  --bad: #c0392b;
  --chip-bg-l: 92%;
  --chip-fg-l: 28%;
  --chip-s: 55%;
  --shadow: 0 1px 2px rgb(27 30 46 / .06), 0 8px 24px rgb(27 30 46 / .06);
  --font-display: "Do Hyeon", "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-body: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11121b; --surface: #1a1c29; --surface-2: #222536; --ink: #eceef6; --muted: #9a9fb8;
    --line: #2d3046; --coin: #f2b43e; --coin-ink: #241a02; --accent: #9296ff;
    --good: #5fd08f; --warn: #f0b04a; --bad: #ff7a6b;
    --chip-bg-l: 22%; --chip-fg-l: 80%; --chip-s: 40%;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11121b; --surface: #1a1c29; --surface-2: #222536; --ink: #eceef6; --muted: #9a9fb8;
  --line: #2d3046; --coin: #f2b43e; --coin-ink: #241a02; --accent: #9296ff;
  --good: #5fd08f; --warn: #f0b04a; --bad: #ff7a6b;
  --chip-bg-l: 22%; --chip-fg-l: 80%; --chip-s: 40%;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 8px 24px rgb(0 0 0 / .25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.6 var(--font-body); }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.wrap {
  max-width: 1200px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* 상단 */
header.top { padding-block: 32px 0; }
.brand { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; }
.logo { color: inherit; text-decoration: none; }
.brand h1 { margin: 0; font: 400 clamp(40px, 7vw, 64px)/1 var(--font-display); letter-spacing: -.01em; }
.coin-dot {
  display: inline-block; width: .42em; height: .42em; border-radius: 50%;
  background: var(--coin); box-shadow: inset 0 -3px 0 rgb(0 0 0 / .18);
  margin-left: .12em; vertical-align: .12em;
}
.brand p { margin: 8px 0 0; color: var(--muted); max-width: 60ch; text-wrap: pretty; }
.top-side { display: grid; gap: 10px; justify-items: end; }
.stats { font: 500 13px/1.4 var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
.stats b { color: var(--ink); font-weight: 500; }
.account { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--accent); color: var(--surface); font-weight: 600; font-size: 14px;
}
.tabs { display: flex; gap: 4px; align-items: flex-end; margin-top: 18px; }
.tab {
  padding: 8px 14px; border-radius: 10px 10px 0 0; text-decoration: none; color: var(--muted); font-weight: 500;
  border-bottom: 3px solid transparent;
}
.tab[aria-current="page"] { color: var(--ink); border-bottom-color: var(--coin); }
.tabs .btn { margin-left: auto; margin-bottom: 6px; }

/* 조작부 */
.controls {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-block: 1px solid var(--line);
}
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--bg); }
.controls .wrap { padding-block: 12px; display: grid; gap: 10px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.search {
  flex: 1 1 240px; min-width: 0; display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px;
}
.search svg { flex: none; color: var(--muted); }
.search input { border: 0; background: transparent; padding: 10px 0; width: 100%; outline: none; }
select, .toggle { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; cursor: pointer; }
.toggle[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.coin-btn {
  border: 0; border-radius: 10px; padding: 10px 16px; cursor: pointer;
  background: var(--coin); color: var(--coin-ink); font: 400 17px/1 var(--font-display);
  box-shadow: inset 0 -3px 0 rgb(0 0 0 / .16); transition: transform .12s;
}
.coin-btn:hover { transform: translateY(-1px); }
.coin-btn:active { transform: translateY(1px); box-shadow: inset 0 -1px 0 rgb(0 0 0 / .16); }

.chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  --h: 230; flex: none; border: 1px solid transparent; border-radius: 999px; padding: 5px 12px; cursor: pointer;
  background: hsl(var(--h) var(--chip-s) var(--chip-bg-l)); color: hsl(var(--h) var(--chip-s) var(--chip-fg-l));
  font-size: 13.5px; font-weight: 500; white-space: nowrap; text-decoration: none;
}
.chip .n { font: 500 12px var(--font-mono); opacity: .7; margin-left: 4px; }
.chip[aria-pressed="true"] { border-color: currentColor; box-shadow: 0 0 0 1px currentColor inset; }
.chip.all { background: var(--surface); color: var(--ink); border-color: var(--line); }
.chip.all[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); box-shadow: none; }

/* 그리드 */
main { padding-block: 24px 64px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card {
  position: relative; display: flex; flex-direction: column; min-width: 0;
  background: var(--surface); border-radius: 14px; overflow: hidden; color: inherit; text-decoration: none;
  box-shadow: var(--shadow); transition: transform .15s;
}
.card:hover { transform: translateY(-3px); }
.thumb {
  --h: 230; position: relative; aspect-ratio: 16 / 10; max-width: 100%; overflow: hidden;
  background:
    repeating-linear-gradient(0deg, transparent 0 3px, rgb(0 0 0 / .05) 3px 4px),
    linear-gradient(135deg, hsl(var(--h) 45% 32%), hsl(calc(var(--h) + 40) 50% 20%));
}
.thumb .ph {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 16px; text-align: center;
  font: 400 clamp(22px, 3vw, 28px)/1.15 var(--font-display); color: hsl(var(--h) 60% 92%); text-wrap: balance;
}
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top; opacity: 0; transition: opacity .3s; }
.thumb img.ok { opacity: 1; }
.card-body { padding: 14px 16px 16px; display: grid; gap: 6px; flex: 1; align-content: start; }
.meta-top { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.mini-chip {
  --h: 230; font-size: 12px; font-weight: 600; border-radius: 6px; padding: 1px 7px;
  background: hsl(var(--h) var(--chip-s) var(--chip-bg-l)); color: hsl(var(--h) var(--chip-s) var(--chip-fg-l));
}
.tag { font-size: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 0 6px; }
.new { font: 500 11px var(--font-mono); color: var(--coin-ink); background: var(--coin); border-radius: 4px; padding: 1px 5px; letter-spacing: .04em; }
.card h3 { margin: 2px 0 0; font: 600 17px/1.35 var(--font-body); text-wrap: balance; }
.card .sum { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .foot { margin-top: 6px; display: flex; justify-content: space-between; gap: 8px; font: 500 12px var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.card .foot .who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-body); }
.card .foot .right { display: flex; gap: 10px; flex: none; }
.played { color: var(--good); }
.fav {
  position: absolute; top: 10px; right: 10px; z-index: 2; width: 34px; height: 34px; border-radius: 50%;
  border: 0; cursor: pointer; display: grid; place-items: center; background: rgb(17 18 27 / .55); color: #fff; backdrop-filter: blur(4px);
}
.fav[aria-pressed="true"] { color: var(--coin); }
.fav svg { width: 18px; height: 18px; }

/* 광고 칸: 카드와 같은 크기로 그리드에 끼움 */
.ad-slot {
  position: relative; min-width: 0; min-height: 250px; border-radius: 14px; overflow: hidden;
  background: var(--surface-2); border: 1px dashed var(--line); display: grid; place-items: center; padding: 22px 8px 8px;
}
.ad-slot ins { width: 100%; }
.ad-label { position: absolute; top: 6px; left: 10px; font: 500 11px var(--font-mono); color: var(--muted); letter-spacing: .06em; }
.page-game .ad-slot { min-height: 120px; }

.empty { text-align: center; padding: 64px 16px; color: var(--muted); }
.empty strong { display: block; font: 400 28px var(--font-display); color: var(--ink); margin-bottom: 6px; }

/* 라이브러리 */
.lib { display: grid; gap: 14px; }
.lib-note { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
.lib-note p { margin: 0; color: var(--muted); max-width: 70ch; }
.lib-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.stat { background: var(--surface); border-radius: 12px; padding: 14px 16px; box-shadow: var(--shadow); }
.stat b { display: block; font: 400 32px/1.1 var(--font-display); font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
h2.sec { margin: 18px 0 0; font: 400 26px var(--font-display); }
.list { display: grid; gap: 8px; }
.list-row {
  display: grid; grid-template-columns: 96px 1fr auto; gap: 14px; align-items: center;
  background: var(--surface); border-radius: 12px; padding: 8px; box-shadow: var(--shadow); cursor: pointer; text-align: left; border: 0; width: 100%;
}
.list-row .thumb { border-radius: 8px; }
.list-row .thumb .ph { font-size: 14px; padding: 4px; }
.list-row .t { min-width: 0; }
.list-row .t strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .t span { font-size: 13px; color: var(--muted); }
.list-row .n { font: 500 13px var(--font-mono); color: var(--muted); text-align: right; padding-right: 8px; font-variant-numeric: tabular-nums; }
.pill { font-size: 12px; font-weight: 600; border-radius: 999px; padding: 2px 9px; border: 1px solid currentColor; }
.pill.pending { color: var(--warn); }
.pill.approved { color: var(--good); }
.pill.rejected { color: var(--bad); }
.muted-box { color: var(--muted); padding: 18px; border: 1px dashed var(--line); border-radius: 12px; text-align: center; }

footer { border-top: 1px solid var(--line); padding-block: 24px 40px; color: var(--muted); font-size: 13px; }
footer p { margin: 4px 0; max-width: 75ch; }

/* 버튼 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; cursor: pointer;
  border-radius: 10px; padding: 10px 16px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); font-weight: 500;
}
.btn.small { padding: 6px 12px; font-size: 14px; }
.btn.primary { background: var(--coin); color: var(--coin-ink); border-color: transparent; font: 400 18px/1 var(--font-display); padding: 12px 20px; box-shadow: inset 0 -3px 0 rgb(0 0 0 / .16); }
.btn.link { border: 0; background: none; padding: 4px; color: var(--muted); text-decoration: underline; }

/* 창 */
dialog {
  width: min(920px, calc(100% - 24px)); max-height: calc(100% - 24px); padding: 0; border: 0;
  border-radius: 16px; background: var(--surface); color: var(--ink); box-shadow: 0 24px 64px rgb(0 0 0 / .35);
}
dialog.small-dlg { width: min(520px, calc(100% - 24px)); }
dialog::backdrop { background: rgb(10 11 18 / .6); backdrop-filter: blur(3px); }
.d-stage { position: relative; aspect-ratio: 16 / 9; max-width: 100%; background: #0d0e15; }
.d-stage .thumb { position: absolute; inset: 0; aspect-ratio: auto; }
.d-close {
  position: absolute; top: 10px; right: 10px; z-index: 3; width: 38px; height: 38px; border-radius: 50%;
  border: 0; cursor: pointer; background: rgb(17 18 27 / .7); color: #fff; font-size: 20px; line-height: 1;
}
.d-close.plain { background: var(--surface-2); color: var(--ink); }
.d-body { padding: 20px 24px 24px; display: grid; gap: 12px; }
.d-body h2 { margin: 0; font: 400 34px/1.1 var(--font-display); text-wrap: balance; padding-right: 40px; }
.d-body .desc { margin: 0; max-width: 68ch; }
.d-body ul { margin: 0; padding-left: 1.2em; color: var(--muted); }
.d-meta { font: 500 13px var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums; }
.d-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.d-mine { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.d-mine-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.d-mine-head span { font: 500 13px var(--font-mono); color: var(--muted); font-variant-numeric: tabular-nums; }
textarea, .form input, .form select {
  width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; resize: vertical;
}

/* 별점·후기 */
.rate { color: var(--warn); }
.rv-summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rv-score { font: 400 40px/1 var(--font-display); font-variant-numeric: tabular-nums; }
.rv-stars { color: var(--coin); font-size: 20px; letter-spacing: 1px; }
.rv-stars.small { font-size: 14px; }
.rv-count { font-size: 14px; color: var(--muted); line-height: 1.4; }
.rv-count small { font-size: 12px; }
.rv-gate { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; }
.rv-gate p { margin: 0; font-size: 14px; color: var(--muted); }
.rv-form { display: grid; gap: 8px; }
.rv-pick { display: flex; gap: 2px; }
.rv-pick button { border: 0; background: none; cursor: pointer; font-size: 30px; line-height: 1; padding: 2px; color: var(--line); }
.rv-pick button.on { color: var(--coin); }
.rv-list { display: grid; gap: 10px; max-height: 320px; overflow-y: auto; }
.rv-item { border-top: 1px solid var(--line); padding-top: 8px; }
.rv-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.rv-head b { color: var(--ink); font-weight: 600; }
.rv-head .btn.link { margin-left: auto; font-size: 12px; }
.rv-item p { margin: 4px 0 0; font-size: 14px; overflow-wrap: anywhere; }
.rv-empty { margin: 0; font-size: 14px; color: var(--muted); }

/* 폼 */
.form { display: grid; gap: 6px; }
.form label, .form legend { font-size: 14px; font-weight: 500; margin-top: 6px; }
.form em { font-style: normal; font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 4px; }
.form fieldset { border: 0; padding: 0; margin: 0; }
.form .row input { flex: 1 1 200px; min-width: 0; width: auto; }
.form .btn.primary { margin-top: 10px; justify-self: start; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 4px; }
.checks label { display: flex; gap: 6px; align-items: center; font-weight: 400; margin: 0; }
.checks input { width: auto; }
.form-msg { margin: 0; font-size: 14px; min-height: 1.4em; }
.form-msg.err { color: var(--bad); }
.form-msg.ok { color: var(--good); }
.form-gate { background: var(--surface-2); border-radius: 12px; padding: 14px; display: grid; gap: 10px; }
.form-gate p { margin: 0; color: var(--muted); }
.auth-btns { display: grid; gap: 8px; }
.auth-btns .btn { width: 100%; padding: 12px; }
.btn.kakao { background: #fee500; color: #191600; border-color: transparent; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 50;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow);
  max-width: calc(100% - 32px);
}

/* 게임 상세 페이지 (g/*.html) */
.page-game main { display: grid; gap: 16px; max-width: 860px; }
.page-game .shot { border-radius: 14px; overflow: hidden; box-shadow: var(--shadow); }
.page-game h1.title { margin: 0; font: 400 clamp(32px, 6vw, 48px)/1.1 var(--font-display); text-wrap: balance; }
.page-game .crumb { font-size: 14px; color: var(--muted); }
.page-game .crumb a { color: inherit; }
.related { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.related a { background: var(--surface); border-radius: 12px; padding: 12px 14px; text-decoration: none; color: inherit; box-shadow: var(--shadow); display: grid; gap: 2px; }
.related a span { font-size: 13px; color: var(--muted); }

@media (max-width: 560px) {
  header.top { padding-block: 24px 0; }
  .top-side { justify-items: start; }
  .stats { text-align: left; }
  .grid { grid-template-columns: 1fr; }
  .d-body { padding: 16px; }
  .d-body h2 { font-size: 28px; }
  select { flex: 1 1 auto; }
  .list-row { grid-template-columns: 72px 1fr; }
  .list-row .n { grid-column: 2; text-align: left; padding: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
