/* =========================================================
   GamePool - 공통 스타일
   ========================================================= */
:root {
  --bg: #0c0d14;
  --bg-2: #13141f;
  --surface: #1b1c2b;
  --surface-2: #24253a;
  --border: #2d2f48;
  --text: #f1f1f7;
  --text-2: #a6a8c3;
  --text-3: #6f7191;
  --accent: #7c5cff;
  --accent-2: #9d85ff;
  --accent-soft: rgba(124, 92, 255, .16);
  --hot: #ff5c7a;
  --new: #2fd18a;
  --radius: 12px;
  --header-h: 60px;
  --sidebar-w: 220px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  font-family: "Pretendard", "Noto Sans KR", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
img { max-width: 100%; display: block; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px;
  background: rgba(12, 13, 20, .92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.menu-btn {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border: 0; border-radius: 10px; background: transparent;
}
.menu-btn:hover { background: var(--surface); }
.logo {
  display: flex; align-items: center; gap: 8px;
  font-weight: 800; font-size: 1.25rem; letter-spacing: -.02em;
  white-space: nowrap;
}
.logo-mark {
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #ff5ca8);
  display: grid; place-items: center; font-size: 18px;
}
.logo b { color: var(--accent-2); }
.search {
  flex: 1; max-width: 520px; margin: 0 auto;
  position: relative;
}
.search input {
  width: 100%; height: 40px;
  padding: 0 16px 0 42px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text); font: inherit; font-size: .95rem;
  outline: none;
}
.search input:focus { border-color: var(--accent); }
.search svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--text-3);
}
.header-actions { display: flex; gap: 8px; }
.pill-btn {
  display: inline-flex; align-items: center;
  height: 38px; padding: 0 16px;
  border-radius: 999px; border: 0;
  background: var(--accent); color: #fff; font-weight: 700; font-size: .9rem;
  white-space: nowrap;
}
.pill-btn:hover { background: var(--accent-2); }
.pill-btn.ghost { background: var(--surface); color: var(--text); }
.pill-btn.ghost:hover { background: var(--surface-2); }

/* ---------- Layout ---------- */
.layout { display: flex; }
.sidebar {
  position: sticky; top: var(--header-h);
  width: var(--sidebar-w); flex-shrink: 0;
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 12px 10px 24px;
  border-right: 1px solid var(--border);
  background: var(--bg);
}
.sidebar nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; margin-bottom: 2px;
  border-radius: 10px;
  color: var(--text-2); font-size: .93rem; font-weight: 500;
}
.sidebar nav a:hover { background: var(--surface); color: var(--text); }
.sidebar nav a.active { background: var(--accent-soft); color: var(--text); }
.sidebar nav a .ico { width: 22px; text-align: center; font-size: 1.05rem; }
.sidebar hr { border: 0; border-top: 1px solid var(--border); margin: 12px 6px; }
.sidebar .side-foot { padding: 8px 12px; font-size: .78rem; color: var(--text-3); }
.sidebar .side-foot a { display: inline; padding: 0; margin: 0 8px 4px 0; font-size: .78rem; color: var(--text-3); }
.sidebar .side-foot a:hover { color: var(--text-2); background: none; }

.main { flex: 1; min-width: 0; padding: 20px 24px 40px; }

body.sidebar-collapsed .sidebar { width: 72px; }
body.sidebar-collapsed .sidebar nav a { justify-content: center; }
body.sidebar-collapsed .sidebar nav a span:not(.ico),
body.sidebar-collapsed .sidebar .side-foot,
body.sidebar-collapsed .sidebar hr { display: none; }

.backdrop { display: none; }

/* ---------- Sections ---------- */
.section { margin-bottom: 32px; }
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.section-head h2 { margin: 0; font-size: 1.2rem; letter-spacing: -.01em; }
.section-head a { color: var(--accent-2); font-size: .88rem; font-weight: 600; }
.page-title { font-size: 1.6rem; margin: 4px 0 16px; letter-spacing: -.02em; }
.muted { color: var(--text-2); }

/* ---------- Hero ---------- */
.hero {
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px;
  margin-bottom: 32px;
}
.hero-card {
  position: relative; overflow: hidden;
  border-radius: 16px; min-height: 180px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform .2s;
}
.hero-card:first-child { grid-row: span 2; min-height: 374px; }
.hero-card:hover { transform: translateY(-3px); }
.hero-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.hero-card .hero-info {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 40px 18px 16px;
  background: linear-gradient(transparent, rgba(0,0,0,.85));
}
.hero-card h3 { margin: 0 0 4px; font-size: 1.15rem; }
.hero-card:first-child h3 { font-size: 1.7rem; }
.hero-card p { margin: 0; color: #d6d6e6; font-size: .88rem; }
.hero-card .play-chip {
  display: inline-block; margin-top: 10px;
  padding: 6px 16px; border-radius: 999px;
  background: var(--accent); font-weight: 700; font-size: .85rem;
}

/* ---------- Game Grid ---------- */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}
.game-row {
  display: grid; grid-auto-flow: column;
  grid-auto-columns: minmax(190px, 1fr);
  gap: 14px; overflow-x: auto;
  padding-bottom: 6px;
  scrollbar-width: thin;
}
.game-card {
  position: relative; display: block;
  border-radius: var(--radius); overflow: hidden;
  background: var(--surface);
  aspect-ratio: 16 / 10;
  transition: transform .18s, box-shadow .18s;
}
.game-card:hover { transform: translateY(-3px) scale(1.02); box-shadow: 0 0 0 2px var(--accent), var(--shadow); z-index: 1; }
.game-card img { width: 100%; height: 100%; object-fit: cover; }
.game-card .card-title {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 26px 10px 8px;
  background: linear-gradient(transparent, rgba(0,0,0,.85));
  font-weight: 700; font-size: .92rem;
  opacity: 0; transform: translateY(6px);
  transition: .18s;
}
.game-card:hover .card-title, .game-card:focus-visible .card-title { opacity: 1; transform: none; }
.badge {
  position: absolute; top: 8px; left: 8px;
  padding: 2px 8px; border-radius: 6px;
  font-size: .7rem; font-weight: 800; letter-spacing: .03em;
  color: #fff;
}
.badge.hot { background: var(--hot); }
.badge.new { background: var(--new); color: #06281a; }
.badge.soon { background: var(--surface-2); color: var(--text-2); }
.game-card.coming { pointer-events: none; filter: grayscale(.7) brightness(.6); }

.empty {
  padding: 48px 16px; text-align: center; color: var(--text-2);
  border: 1px dashed var(--border); border-radius: var(--radius);
}

/* ---------- Category chips ---------- */
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.chip {
  padding: 7px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
  font-size: .87rem; color: var(--text-2);
}
.chip:hover, .chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--text); }

/* ---------- Ads ---------- */
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 28px; width: 100%;
  min-height: 90px;
  border-radius: var(--radius);
  overflow: hidden;
}
.ad-slot.placeholder {
  border: 1px dashed var(--border);
  color: var(--text-3); font-size: .78rem; letter-spacing: .08em;
  background: repeating-linear-gradient(45deg, transparent 0 10px, rgba(255,255,255,.015) 10px 20px);
}
.ad-slot.vertical { min-height: 600px; width: 160px; }
.ad-slot.rect { min-height: 250px; max-width: 336px; }

/* ---------- Game page ---------- */
.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 20px; }
.player {
  position: relative;
  border-radius: 14px; overflow: hidden;
  background: #000;
  box-shadow: var(--shadow);
}
.player-frame { position: relative; width: 100%; aspect-ratio: 16 / 10; background: #000; }
.player-frame.portrait { aspect-ratio: 3 / 4; max-height: 78vh; margin: 0 auto; }
.player-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.player-cover {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background-size: cover; background-position: center;
}
.player-cover::before { content: ""; position: absolute; inset: 0; background: rgba(8, 8, 16, .72); backdrop-filter: blur(6px); }
.player-cover > * { position: relative; }
.player-cover img { width: 180px; border-radius: 14px; box-shadow: var(--shadow); }
.player-cover h1 { margin: 0; font-size: 1.6rem; }
.play-btn {
  padding: 12px 42px; border: 0; border-radius: 999px;
  background: var(--accent); color: #fff;
  font-size: 1.15rem; font-weight: 800;
  box-shadow: 0 6px 20px rgba(124, 92, 255, .5);
  transition: transform .15s;
}
.play-btn:hover { transform: scale(1.06); background: var(--accent-2); }
.player-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
}
.player-bar .title { font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 12px;
  border: 0; border-radius: 10px;
  background: var(--surface-2); color: var(--text-2); font-size: .85rem; font-weight: 600;
}
.icon-btn:hover { color: var(--text); background: var(--border); }
.icon-btn.on { color: #fff; background: var(--accent); }

.game-info {
  margin-top: 20px; padding: 20px;
  border-radius: 14px; background: var(--surface);
}
.game-info h2 { margin: 0 0 8px; font-size: 1.3rem; }
.game-info h3 { margin: 20px 0 8px; font-size: 1rem; color: var(--text-2); }
.game-info p { margin: 0; color: var(--text-2); }
.meta { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0 14px; }
.controls-list { margin: 0; padding-left: 18px; color: var(--text-2); }
.controls-list li { margin-bottom: 4px; }
kbd {
  display: inline-block; padding: 1px 7px; border-radius: 5px;
  background: var(--surface-2); border: 1px solid var(--border); border-bottom-width: 2px;
  font-family: inherit; font-size: .82rem; color: var(--text);
}
.side-col .game-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
.side-col h3 { margin: 0 0 10px; font-size: 1rem; }

/* ---------- Static pages ---------- */
.prose { max-width: 820px; }
.prose h1 { font-size: 1.8rem; margin-top: 0; }
.prose h2 { font-size: 1.2rem; margin-top: 28px; }
.prose p, .prose li { color: var(--text-2); }
.prose a { color: var(--accent-2); text-decoration: underline; }

/* ---------- Footer ---------- */
.site-footer {
  margin-top: 40px; padding-top: 20px;
  border-top: 1px solid var(--border);
  color: var(--text-3); font-size: .83rem;
  display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between;
}
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; }
.site-footer a:hover { color: var(--text-2); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 100;
  transform: translate(-50%, 20px); opacity: 0;
  padding: 10px 18px; border-radius: 999px;
  background: var(--surface-2); box-shadow: var(--shadow);
  font-size: .9rem; transition: .25s; pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .game-layout { grid-template-columns: 1fr; }
  .side-col .game-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .side-col .ad-slot.rect { max-width: 100%; }
}
@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: var(--header-h); z-index: 60;
    transform: translateX(-100%); transition: transform .25s;
    width: 260px;
  }
  body.sidebar-open .sidebar { transform: none; }
  body.sidebar-open .backdrop {
    display: block; position: fixed; inset: var(--header-h) 0 0 0; z-index: 55;
    background: rgba(0,0,0,.55);
  }
  body.sidebar-collapsed .sidebar { width: 260px; }
  body.sidebar-collapsed .sidebar nav a { justify-content: flex-start; }
  body.sidebar-collapsed .sidebar nav a span:not(.ico) { display: inline; }
  .hero { grid-template-columns: 1fr 1fr; }
  .hero-card:first-child { grid-column: span 2; grid-row: auto; min-height: 240px; }
}
@media (max-width: 640px) {
  .main { padding: 16px 16px 32px; }
  .header-actions .pill-btn.ghost { display: none; }
  .logo .logo-text { display: none; }
  .game-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .game-row { grid-auto-columns: 44%; gap: 10px; }
  .game-card .card-title { opacity: 1; transform: none; font-size: .82rem; }
  .hero { grid-template-columns: 1fr; }
  .hero-card:first-child { grid-column: auto; min-height: 200px; }
  .hero-card { min-height: 150px; }
  .player-bar { gap: 6px; padding: 8px 10px; }
  .player-bar .label { display: none; }
  .player-bar .title { display: none; }
  .player-bar .icon-btn { flex: 1; justify-content: center; padding: 0 6px; }
}
