/* ==========================================================================
   components.css — Header / Drawer / Footer / Cards / Buttons
   ========================================================================== */

/* ----- App Header ----- */
.app-header {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--page-max-w);
  height: var(--header-h);
  background: rgba(15, 16, 35, 0.92);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  padding: 0 var(--gap-3);
  z-index: 80;
}

.app-header__brand {
  display: flex;
  align-items: center;
  gap: var(--gap-2);
  flex: 1;
  min-width: 0;
}

.app-header__logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--c-accent) 0%, var(--c-accent-2) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-2);
  overflow: hidden;
}
.app-header__logo img { width: 100%; height: 100%; object-fit: contain; }

.app-header__name {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
  min-width: 0;
}
.app-header__name strong {
  font-size: 16px;
  letter-spacing: -0.01em;
  color: var(--c-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.app-header__name span {
  font-size: 11px;
  color: var(--c-text-3);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.app-header__actions {
  display: flex;
  align-items: center;
  gap: var(--gap-2);
}

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.15s ease;
  position: relative;
}
.icon-btn:active { transform: scale(0.94); background: rgba(255, 255, 255, 0.12); }
.icon-btn img { width: 22px; height: 22px; }

/* ----- Drawer ----- */
.drawer-mask {
  position: fixed;
  inset: 0;
  background: var(--c-overlay);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}
.drawer-mask.open { opacity: 1; pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  width: 84%;
  max-width: 320px;
  background: linear-gradient(180deg, #1a1c40 0%, #14162e 100%);
  z-index: 100;
  transform: translateX(-105%);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  display: flex;
  flex-direction: column;
  box-shadow: 8px 0 32px rgba(0, 0, 0, 0.5);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}
.drawer.open { transform: translateX(0); }

.drawer__head {
  padding: 22px 18px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.drawer__logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--c-accent) 0%, var(--c-accent-2) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-2);
  flex-shrink: 0;
  overflow: hidden;
}
.drawer__logo img { width: 100%; height: 100%; object-fit: contain; border-radius: 10px; }
.drawer__title strong { display: block; font-size: 17px; }
.drawer__title span { font-size: 12px; color: var(--c-text-3); letter-spacing: 0.06em; text-transform: uppercase; }

.drawer__nav {
  flex: 1;
  overflow-y: auto;
  padding: 14px 10px 18px;
}

.drawer__group-label {
  padding: 10px 14px 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--c-text-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.drawer__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  color: var(--c-text);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s ease;
  cursor: pointer;
}
.drawer__item:active { background: rgba(255, 255, 255, 0.08); }
.drawer__item.active { background: rgba(255, 206, 0, 0.12); color: var(--c-accent); }
.drawer__item img {
  width: 20px;
  height: 20px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.4));
  flex-shrink: 0;
}

.drawer__divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.06);
  margin: 8px 6px;
}

.drawer__foot {
  padding: 12px 18px calc(14px + var(--safe-bottom));
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11px;
  color: var(--c-text-3);
  text-align: center;
}

/* ----- Footer ----- */
.app-footer {
  margin-top: auto;
  padding: 24px 16px calc(18px + var(--safe-bottom));
  background: #0a0b1c;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  text-align: center;
}
.app-footer__brand {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}
.app-footer__brand strong {
  font-size: 15px;
  background: linear-gradient(135deg, var(--c-accent) 0%, var(--c-accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.app-footer__tagline { font-size: 12px; color: var(--c-text-3); margin-bottom: 14px; }
.app-footer__links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 14px;
  margin-bottom: 14px;
}
.app-footer__links a {
  font-size: 12px;
  color: var(--c-text-2);
  padding: 4px 2px;
  transition: color 0.15s ease;
}
.app-footer__links a:active { color: var(--c-accent); }
.app-footer__meta {
  font-size: 11px;
  color: var(--c-text-3);
  line-height: 1.7;
}
.app-footer__meta a { color: var(--c-text-2); }

/* ----- Game Card ----- */
.game-card {
  position: relative;
  display: block;
  background: var(--c-card);
  border-radius: var(--radius-3);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  border: 1px solid rgba(255, 255, 255, 0.04);
}
.game-card:active { transform: scale(0.97); }

.game-card__cover {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background: var(--c-bg-2);
  overflow: hidden;
}
.game-card__cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}
.game-card:active .game-card__cover img { transform: scale(1.06); }
.game-card__cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, 0.45) 100%);
  pointer-events: none;
}

.game-card__badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  color: var(--c-text);
}
.game-card__badge--hot { background: linear-gradient(135deg, var(--c-accent-2), #ff7e4d); color: #1a1a1a; }
.game-card__badge--new { background: linear-gradient(135deg, var(--c-accent-3), #6affd0); color: #053; }
.game-card__badge--top { background: linear-gradient(135deg, var(--c-accent), #ff9a3d); color: #1a1a1a; }

.game-card__play {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 3;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-accent) 0%, var(--c-accent-2) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(255, 93, 143, 0.5);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.game-card__play img { width: 18px; height: 18px; }
.game-card:active .game-card__play { opacity: 1; transform: scale(1); }

.game-card__meta {
  padding: 10px 10px 12px;
}
.game-card__title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.game-card__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--c-text-3);
}
.game-card__rating {
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--c-accent);
  font-weight: 600;
}
.game-card__rating img { width: 12px; height: 12px; }
.game-card__plays { color: var(--c-text-3); }

/* ----- Game Card (wide / horizontal) ----- */
.game-card--wide {
  display: flex;
  align-items: stretch;
  height: 96px;
}
.game-card--wide .game-card__cover { width: 96px; height: 96px; aspect-ratio: auto; flex-shrink: 0; }
.game-card--wide .game-card__meta { flex: 1; padding: 10px 12px; display: flex; flex-direction: column; justify-content: center; }

/* ----- Section / Rail ----- */
.section { padding: 0 var(--gap-4); margin-bottom: var(--gap-5); }

.section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--gap-3);
}
.section__title {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section__title .accent-bar {
  width: 4px;
  height: 18px;
  border-radius: 2px;
  background: linear-gradient(180deg, var(--c-accent), var(--c-accent-2));
}
.section__more {
  font-size: 12px;
  color: var(--c-text-3);
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
}
.section__more img { width: 12px; height: 12px; }
.section__more:active { background: rgba(255, 206, 0, 0.15); color: var(--c-accent); }

/* ----- Grid layouts ----- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--gap-3);
}
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(2, 1fr); }

@media (max-width: 360px) {
  .grid--3 { grid-template-columns: repeat(2, 1fr); }
}

/* ----- Category chip ----- */
.chip-row {
  display: flex;
  gap: var(--gap-2);
  overflow-x: auto;
  padding: 0 var(--gap-4) var(--gap-3);
  margin: 0 calc(-1 * var(--gap-4)) var(--gap-2);
  scroll-snap-type: x mandatory;
}
.chip {
  flex-shrink: 0;
  padding: 8px 14px;
  background: var(--c-card);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text-2);
  white-space: nowrap;
  scroll-snap-align: start;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip.active {
  background: linear-gradient(135deg, var(--c-accent) 0%, var(--c-accent-2) 100%);
  color: #1a1a1a;
  border-color: transparent;
}
.chip:active { transform: scale(0.96); }

/* ----- Loading / Skeleton ----- */
.skeleton {
  background: linear-gradient(90deg, #1f2244 0%, #2a2f5e 50%, #1f2244 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: var(--radius-2);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ----- Toast ----- */
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  background: rgba(20, 22, 50, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--c-text);
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
  box-shadow: var(--shadow-3);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
