/* ===================================================
   MOAPICK GAMES HUB
   =================================================== */
:root {
  --gsb-w: 220px;
  --gtb-h: 52px;
}

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

.games-shell {
  display: flex;
  min-height: 100vh;
  background: var(--bg, #f7f8fa);
  color: var(--text, #111);
  font-family: -apple-system, 'Apple SD Gothic Neo', 'Noto Sans KR', sans-serif;
}

/* ── Sidebar ── */
.gsidebar {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: var(--gsb-w);
  background: var(--surface, #fff);
  border-right: 1px solid var(--border, #e8e8e8);
  display: flex;
  flex-direction: column;
  z-index: 200;
  transition: transform .24s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}

.gsb-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 14px 16px;
  border-bottom: 1px solid var(--border, #e8e8e8);
  flex-shrink: 0;
}

.gsb-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text, #111);
  flex: 1;
  min-width: 0;
}

.gsb-logo img { width: 26px; height: 26px; flex-shrink: 0; }

.gsb-logo-text { min-width: 0; }
.gsb-logo-text strong { display: block; font-size: 14px; font-weight: 700; }
.gsb-logo-text small  { display: block; font-size: 11px; color: var(--muted, #888); font-weight: 400; }

.gsb-close {
  display: none;
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted, #888);
  padding: 2px 4px;
  flex-shrink: 0;
}

.gsb-nav {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
  scrollbar-width: thin;
}

.gsb-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted, #aaa);
  padding: 10px 18px 4px;
}

.gnav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  margin: 2px 8px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text, #333);
  font-size: 13.5px;
  cursor: pointer;
  background: none;
  border: none;
  width: calc(100% - 16px);
  text-align: left;
  transition: background .12s;
}

.gnav-item:hover     { background: var(--hover-bg, #f2f2f2); }
.gnav-item.is-active {
  background: var(--primary-bg, #fff8dc);
  color: var(--primary-text, #6d5200);
  font-weight: 600;
}

.gnav-ico  { font-size: 15px; width: 20px; text-align: center; flex-shrink: 0; }
.gnav-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gnav-count {
  font-size: 11px;
  background: var(--tag-bg, #eee);
  color: var(--muted, #666);
  padding: 1px 5px;
  border-radius: 10px;
}

.gsb-foot {
  border-top: 1px solid var(--border, #e8e8e8);
  padding: 8px;
  flex-shrink: 0;
}

/* ── Main ── */
.gmain {
  margin-left: var(--gsb-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* ── Topbar ── */
.gtopbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--gtb-h);
  background: var(--surface, #fff);
  border-bottom: 1px solid var(--border, #e8e8e8);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  flex-shrink: 0;
}

.gtb-menu {
  display: none;
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text, #111);
  padding: 4px;
  line-height: 1;
}

.gtb-title { font-weight: 700; font-size: 16px; flex: 1; }

.gtb-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 17px;
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--text, #111);
  transition: background .12s;
}
.gtb-btn:hover { background: var(--hover-bg, #f2f2f2); }

/* ── Views ── */
.gview { flex: 1; padding: 20px; }

.gsec-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
}

.gsec-title { font-size: 16px; font-weight: 700; }
.gsec-count { font-size: 13px; color: var(--muted, #888); }

/* ── Game Grid ── */
.ggrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.gcard {
  display: block;
  text-decoration: none;
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #e8e8e8);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  color: var(--text, #111);
}

.gcard:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 22px rgba(0,0,0,.09);
}

.gcard-thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, #e8f0fe 0%, #d4e1fd 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 44px;
  position: relative;
  overflow: hidden;
}

.gcard-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.gcard-body { padding: 10px 12px 12px; }
.gcard-name { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.gcard-cats { font-size: 11px; color: var(--muted, #888); }

.gempty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted, #888);
  font-size: 14px;
}

/* ── Game Player ── */
.gplayer-wrap {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--gtb-h));
}

.gplayer-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  background: var(--surface, #f8f8f8);
  border-bottom: 1px solid var(--border, #e8e8e8);
  flex-shrink: 0;
}

.gplayer-back {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary, #ffd21a);
  padding: 5px 10px;
  border-radius: 6px;
  transition: background .12s;
}
.gplayer-back:hover { background: var(--hover-bg, #f2f2f2); }

.gplayer-title {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #111);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gplayer-fs {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 17px;
  color: var(--muted, #888);
  padding: 4px;
}

#gIframe {
  flex: 1;
  border: none;
  width: 100%;
  display: block;
}

/* ── Mobile sidebar backdrop ── */
.gsb-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.38);
  z-index: 199;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .gsidebar {
    transform: translateX(-100%);
  }
  .gsidebar.is-open {
    transform: translateX(0);
    box-shadow: 4px 0 20px rgba(0,0,0,.15);
  }
  .gsb-backdrop.is-visible { display: block; }
  .gsb-close  { display: block; }
  .gmain      { margin-left: 0; }
  .gtb-menu   { display: block; }
  .gview      { padding: 12px; }
  .ggrid      { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .gplayer-wrap { height: calc(100vh - var(--gtb-h)); }
}

/* ── Dark mode ── */
html.dark .gsidebar,
html.dark .gtopbar,
html.dark .gplayer-bar {
  background: #1e1e1e;
  border-color: #333;
}

html.dark .gnav-item:hover         { background: rgba(255,255,255,.06); }
html.dark .gnav-item.is-active     { background: rgba(255,210,26,.14); color: #ffd21a; }
html.dark .gcard                   { background: #252525; border-color: #333; }
html.dark .gcard-name              { color: #e5e7eb; }
html.dark .gtb-btn:hover           { background: rgba(255,255,255,.07); }
html.dark .gplayer-back:hover      { background: rgba(255,255,255,.07); }
html.dark .gsb-logo                { color: #e5e7eb; }
html.dark .gsb-logo-text small     { color: #888; }
html.dark .gsb-section-label      { color: #666; }
html.dark .gnav-count              { background: #333; color: #aaa; }
