/* =========================================================
   게임허브 — Apple 스타일 카드 + worm 로더 오버레이
   styles.css 의 토큰/컴포넌트를 재사용
   ========================================================= */

.topbar__home {
  position: absolute;
  right: 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary);
}
.topbar { position: relative; }

.hub { width: 100%; max-width: 900px; text-align: center; }
.hub__title {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.5px;
  margin: 0 0 14px;
}
.hub__lead { font-size: 19px; color: var(--ink-muted-80); margin: 0 0 40px; }
.hub__hint { margin: 36px 0 0; font-size: 14px; color: var(--ink-muted-48); }
.hub__hint b { color: var(--primary); }

/* ---------- Game grid ---------- */
.game-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  text-align: left;
}
.game-grid > li { display: flex; }

.game-card {
  font-family: var(--font-text);
  width: 100%;
  background: var(--canvas);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--card-shadow);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  text-align: left;
  transition: transform 0.12s, box-shadow 0.2s;
}
.game-card:hover { transform: translateY(-3px); box-shadow: 0 2px 6px rgba(0,0,0,0.06), 0 14px 40px rgba(0,0,0,0.10); }
.game-card:active { transform: scale(0.98); }
.game-card:focus-visible { outline: 2px solid var(--primary-focus); outline-offset: 3px; }

.game-card__art {
  height: 120px;
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  margin-bottom: 10px;
}
.game-card__art--subway { background: linear-gradient(150deg, #fdd835, #fb8c00); }
.game-card__art--geo    { background: linear-gradient(150deg, #000000, #0066ff); }
.game-card__art--soon   { background: var(--parchment); }

.game-card__title { font-family: var(--font-display); font-size: 19px; font-weight: 600; letter-spacing: -0.3px; color: var(--ink); }
.game-card__desc  { font-size: 14px; color: var(--ink-muted-48); }
.game-card__play  { margin-top: 8px; font-size: 15px; font-weight: 600; color: var(--primary); }
.game-card__play--muted { color: var(--ink-muted-48); }

.game-card--soon { cursor: default; opacity: 0.75; }
.game-card--soon:hover { transform: none; box-shadow: var(--card-shadow); }

/* ---------- Game overlay ---------- */
.game-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #000;
  display: flex;
  flex-direction: column;
}
.game-overlay__bar {
  flex: none;
  height: 48px;
  background: #0b0b0d;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  color: #fff;
}
.game-overlay__title { font-size: 15px; font-weight: 600; }
.game-overlay__close {
  font-family: var(--font-text);
  font-size: 14px;
  color: #fff;
  background: rgba(255,255,255,0.14);
  border: none;
  border-radius: var(--r-pill);
  padding: 7px 16px;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}
.game-overlay__close:hover { background: rgba(255,255,255,0.24); }
.game-overlay__close:active { transform: scale(0.95); }

.game-frame {
  flex: 1;
  width: 100%;
  border: 0;
  background: #000;
}

/* ---------- Worm loader ---------- */
.game-loader {
  position: absolute;
  inset: 48px 0 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: hsl(223, 10%, 10%);
  z-index: 2;
}
.game-loader[hidden] { display: none; }
.game-loader__text { color: hsl(223, 10%, 90%); font-size: 15px; margin: 0; }

.pl,
.pl__worm {
  animation-duration: 3s;
  animation-iteration-count: infinite;
}
.pl {
  animation-name: bump;
  animation-timing-function: linear;
  width: 8em;
  height: 8em;
}
.pl__ring { stroke: hsla(223, 10%, 90%, 0.1); }
.pl__worm {
  animation-name: worm;
  animation-timing-function: cubic-bezier(0.42, 0.17, 0.75, 0.83);
}

@keyframes bump {
  from, 42%, 46%, 51%, 55%, 59%, 63%, 67%, 71%, 74%, 78%, 81%, 85%, 88%, 92%, to {
    transform: translate(0, 0);
  }
  44% { transform: translate(1.33%, 6.75%); }
  53% { transform: translate(-16.67%, -0.54%); }
  61% { transform: translate(3.66%, -2.46%); }
  69% { transform: translate(-0.59%, 15.27%); }
  76% { transform: translate(-1.92%, -4.68%); }
  83% { transform: translate(9.38%, 0.96%); }
  90% { transform: translate(-4.55%, 1.98%); }
}
@keyframes worm {
  from { stroke-dashoffset: 10; }
  25%  { stroke-dashoffset: 295; }
  to   { stroke-dashoffset: 1165; }
}

/* ---------- Responsive ---------- */
@media (max-width: 833px) {
  .game-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .hub__title { font-size: 30px; }
  .hub__lead { font-size: 16px; }
  .game-grid { grid-template-columns: 1fr; }
  .game-card__art { height: 96px; font-size: 46px; }
}
