/* Arcade Pocket — layout: topbar, feed, footer, detail, play */

/* —— Topbar —— */
.ap-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--ap-topbar-h);
  background: #080a0e;
  border-bottom: 1px solid var(--ap-border);
  padding-top: env(safe-area-inset-top, 0);
}

.ap-topbar__inner {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 8px;
  height: var(--ap-topbar-h);
}

.ap-menu-btn {
  width: 44px;
  height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border-radius: var(--ap-radius-sm);
  transition: background 0.15s;
}

.ap-menu-btn:active {
  background: var(--ap-surface);
}

.ap-menu-btn__bar {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--ap-text);
  border-radius: 2px;
}

.ap-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.ap-brand__pad {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--ap-blue) 0%, #6366f1 100%);
  border-radius: 10px;
  color: #fff;
}

.ap-brand__name {
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ap-topbar__actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ap-icon-btn {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--ap-radius-sm);
  color: var(--ap-text);
  transition: background 0.15s, transform 0.12s;
}

.ap-icon-btn:active {
  transform: scale(0.92);
  background: var(--ap-surface);
}

.ap-icon-btn.is-active {
  color: #f472b6;
}

/* —— Main feed —— */
.ap-feed {
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0));
}

.ap-feed__section {
  margin-bottom: 18px;
}

/* —— Ad slots —— */
.ap-ad-slot {
  padding-block: 8px;
  min-height: 50px;
}

.ap-ad-slot--inset {
  margin-block: 18px;
}

/* —— Footer —— */
.ap-foot {
  background: var(--ap-surface);
  border-top: 1px solid var(--ap-border);
  padding: 28px 0 calc(20px + env(safe-area-inset-bottom, 0));
  margin-top: 24px;
}

.ap-foot__brand {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: 16px;
}

.ap-foot__grid {
  display: grid;
  gap: 20px;
}

.ap-foot__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.ap-foot__nav a {
  color: var(--ap-text-muted);
  font-size: 0.875rem;
  transition: color 0.15s;
}

.ap-foot__nav a:hover {
  color: var(--ap-blue);
}

.ap-foot__bottom {
  margin-top: 20px;
  font-size: 0.8rem;
  color: var(--ap-text-muted);
}

/* —— Detail page layout —— */
.ap-detail-page {
  padding-bottom: calc(40px + env(safe-area-inset-bottom, 0));
}

.ap-detail-hero {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--ap-surface);
}

.ap-detail-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ap-detail-hero__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(13, 15, 20, 0.95) 0%, transparent 55%);
}

.ap-detail-body {
  margin-top: -48px;
  position: relative;
  z-index: 2;
}

.ap-detail-card {
  background: var(--ap-surface);
  border-radius: var(--ap-radius-xl) var(--ap-radius-xl) 0 0;
  padding: 20px var(--ap-shell-pad) 28px;
  border-top: 1px solid var(--ap-border);
}

.ap-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.ap-detail-title {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
}

.ap-detail-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.ap-detail-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.ap-detail-actions .ap-btn--play {
  flex: 1;
  justify-content: center;
  padding: 14px 24px;
  font-size: 1.05rem;
}

.ap-related {
  padding: 0 var(--ap-shell-pad) 24px;
  max-width: var(--ap-max-w);
  margin-inline: auto;
}

.ap-related__title {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.ap-related-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

/* —— Category page —— */
.ap-category-page {
  padding: 16px 0 40px;
}

.ap-category-head {
  margin-bottom: 16px;
}

.ap-category-head h1 {
  font-size: 1.6rem;
  font-weight: 800;
}

.ap-category-count {
  color: var(--ap-text-muted);
  font-size: 0.875rem;
  margin-top: 4px;
}

.ap-breadcrumb {
  font-size: 0.8rem;
  color: var(--ap-text-muted);
  margin-bottom: 12px;
}

.ap-breadcrumb a:hover {
  color: var(--ap-blue);
}

/* —— Play page —— */
.ap-play-body {
  background: var(--ap-bg);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.ap-play-body > main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: #000;
}

.ap-play-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--ap-bg);
  border-bottom: 1px solid var(--ap-border);
  flex-shrink: 0;
}

.ap-play-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: var(--ap-surface);
  border-radius: var(--ap-radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
}

.ap-play-title {
  font-size: 0.9rem;
  font-weight: 600;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ap-play-stage {
  flex: 1;
  display: flex;
  min-height: 0;
}

.ap-play-frame {
  width: 100%;
  height: 100%;
  min-height: 320px;
  border: 0;
  background: #000;
}

/* —— Static / legal prose —— */
.ap-prose {
  padding: 24px 0 48px;
  max-width: 720px;
}

.ap-prose h1 {
  font-size: 1.75rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.ap-prose h3, .ap-prose h4 {
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}

.ap-prose p, .ap-prose li {
  color: var(--ap-text-muted);
  margin-bottom: 0.75rem;
}

.ap-prose ul {
  padding-left: 1.25rem;
}

.ap-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ap-text-muted);
}

.ap-sentinel {
  text-align: center;
  padding: 16px;
  color: var(--ap-text-muted);
  font-size: 0.85rem;
}

@media (min-width: 768px) {
  .ap-game-grid {
    grid-template-columns: repeat(4, 1fr) !important;
  }
}

@media (min-width: 1024px) {
  .ap-game-grid {
    grid-template-columns: repeat(5, 1fr) !important;
  }

  .ap-topbar__inner {
    max-width: var(--ap-max-w);
    margin-inline: auto;
    padding-inline: var(--ap-shell-pad);
  }
}
