/* Arcade Pocket — components */

/* —— Buttons —— */
.ap-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  transition: transform 0.12s, box-shadow 0.15s, background 0.15s;
}

.ap-btn:active {
  transform: scale(0.96);
}

.ap-btn--primary {
  background: var(--ap-blue);
  color: #fff;
}

.ap-btn--primary:hover {
  background: var(--ap-blue-dark);
  box-shadow: var(--ap-glow);
}

.ap-btn--surprise {
  background: var(--ap-teal);
  color: #0f172a;
  flex-shrink: 0;
  padding: 10px 16px;
  font-size: 0.85rem;
}

.ap-btn--surprise:hover {
  background: var(--ap-teal-dark);
}

.ap-btn--play {
  background: var(--ap-blue);
  color: #fff;
  font-weight: 800;
  border-radius: var(--ap-radius-md);
  box-shadow: var(--ap-glow);
}

.ap-btn--ghost {
  background: var(--ap-surface-2);
  color: var(--ap-text);
  border: 1px solid var(--ap-border);
}

.ap-btn--fav {
  width: 48px;
  height: 48px;
  padding: 0;
  justify-content: center;
  border-radius: var(--ap-radius-md);
  background: var(--ap-surface-2);
  border: 1px solid var(--ap-border);
  flex-shrink: 0;
}

.ap-btn--fav.is-active {
  background: rgba(244, 114, 182, 0.15);
  border-color: #f472b6;
  color: #f472b6;
}

/* —— Promo banner —— */
.ap-promo-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--ap-blue-dark) 0%, #4f46e5 100%);
  border-radius: var(--ap-radius-lg);
  min-height: 88px;
}

.ap-promo-banner__art {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
}

.ap-promo-banner__art img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.ap-promo-banner__text {
  flex: 1;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  min-width: 0;
}

/* —— Featured pick —— */
.ap-featured-pick {
  border-radius: var(--ap-radius-xl);
  overflow: hidden;
}

.ap-featured-pick__visual {
  display: block;
  position: absolute;
  inset: 0;
}

.ap-featured-pick__media {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--ap-surface);
}

.ap-featured-pick__visual > img:first-child {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ap-featured-pick__shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, transparent 50%);
}

.ap-featured-pick__meta {
  position: absolute;
  left: 14px;
  bottom: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 2;
}

.ap-featured-pick__icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.ap-featured-pick__title {
  font-size: 1.05rem;
  font-weight: 800;
}

.ap-featured-pick__label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.75rem;
  color: var(--ap-teal);
  font-weight: 600;
  margin-top: 2px;
}

.ap-featured-pick__play {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 3;
  padding: 12px 28px;
  font-size: 1rem;
}

/* —— Category lanes (home) —— */
.ap-cat-lane {
  margin-bottom: 22px;
}

.ap-cat-lane:last-child {
  margin-bottom: 0;
}

.ap-cat-lane__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.ap-cat-lane__title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.ap-cat-lane__more {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ap-teal);
  background: rgba(45, 212, 191, 0.12);
  border: 1px solid rgba(45, 212, 191, 0.25);
  transition: background 0.15s, transform 0.12s;
}

.ap-cat-lane__more:active {
  transform: scale(0.96);
  background: rgba(45, 212, 191, 0.2);
}

/* —— Game grid —— */
.ap-game-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.ap-game-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.12s;
}

.ap-game-card:active {
  transform: scale(0.97);
}

.ap-game-card__thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--ap-radius-md);
  overflow: hidden;
  background: var(--ap-surface);
}

.ap-game-card__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ap-game-card__badge {
  position: absolute;
  top: 6px;
  left: 6px;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
  line-height: 1.2;
}

.ap-game-card__badge--hot {
  background: var(--ap-orange);
}

.ap-game-card__badge--updated {
  background: var(--ap-green);
}

.ap-game-card__badge--original {
  background: var(--ap-purple);
}

.ap-game-card__title {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--ap-text-muted);
  text-align: center;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* —— Related card —— */
.ap-related-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: center;
  transition: transform 0.12s;
}

.ap-related-card:active {
  transform: scale(0.97);
}

.ap-related-card img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--ap-radius-md);
  object-fit: cover;
}

.ap-related-card span {
  font-size: 0.7rem;
  color: var(--ap-text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* —— Drawer —— */
.ap-drawer-backdrop,
.ap-fav-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.ap-drawer-backdrop.is-visible,
.ap-fav-backdrop.is-visible {
  opacity: 1;
  visibility: visible;
}

.ap-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(300px, 85vw);
  background: var(--ap-surface);
  z-index: 201;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  padding: calc(var(--ap-topbar-h) + env(safe-area-inset-top, 0)) 0 24px;
  overflow-y: auto;
  border-right: 1px solid var(--ap-border);
}

.ap-drawer.is-open {
  transform: translateX(0);
}

.ap-drawer__head {
  padding: 0 20px 16px;
  border-bottom: 1px solid var(--ap-border);
  margin-bottom: 8px;
}

.ap-drawer__head .ap-brand__name {
  font-size: 1.1rem;
}

.ap-drawer__section {
  padding: 8px 12px;
}

.ap-drawer__label {
  padding: 8px 8px 4px;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ap-text-muted);
}

.ap-drawer__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 10px;
  border-radius: var(--ap-radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  transition: background 0.15s;
}

.ap-drawer__link span {
  font-size: 0.8rem;
  color: var(--ap-text-muted);
  font-weight: 500;
}

.ap-drawer__link:hover,
.ap-drawer__link:active {
  background: var(--ap-surface-2);
}

/* —— Search overlay —— */
.ap-search-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(13, 15, 20, 0.97);
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top, 0) + 12px) 14px 24px;
  opacity: 0;
  transition: opacity 0.2s;
}

.ap-search-overlay.is-open {
  opacity: 1;
}

.ap-search-overlay[hidden] {
  display: none;
}

.ap-search-overlay:not([hidden]).is-open {
  display: flex;
}

.ap-search-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.ap-search-bar form {
  flex: 1;
  display: flex;
  gap: 8px;
}

.ap-search-bar input {
  flex: 1;
  padding: 12px 16px;
  border-radius: var(--ap-radius-md);
  border: 1px solid var(--ap-border);
  background: var(--ap-surface);
  color: var(--ap-text);
  font: inherit;
  outline: none;
}

.ap-search-bar input:focus {
  border-color: var(--ap-blue);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.ap-search-empty {
  text-align: center;
  color: var(--ap-text-muted);
  padding: 32px 16px;
}

.ap-game-grid--search {
  overflow-y: auto;
  flex: 1;
  align-content: start;
}

/* —— Favorites panel —— */
.ap-fav-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(340px, 92vw);
  background: var(--ap-surface);
  z-index: 201;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  padding: calc(env(safe-area-inset-top, 0) + 16px) 16px 24px;
  overflow-y: auto;
  border-left: 1px solid var(--ap-border);
}

.ap-fav-panel.is-open {
  transform: translateX(0);
}

.ap-fav-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.ap-fav-panel__head h2 {
  font-size: 1.15rem;
  font-weight: 800;
}

.ap-fav-section__title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ap-text-muted);
  margin: 16px 0 10px;
}

.ap-fav-empty {
  color: var(--ap-text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 12px 0;
}

.ap-game-grid--fav {
  grid-template-columns: repeat(3, 1fr);
}

/* —— Detail badge & accordion —— */
.ap-detail-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #fff;
}

.ap-detail-badge--hot { background: var(--ap-orange); }
.ap-detail-badge--updated { background: var(--ap-green); }
.ap-detail-badge--original { background: var(--ap-purple); }

.ap-detail-category {
  font-size: 0.85rem;
  color: var(--ap-text-muted);
}

.ap-accordion {
  border-top: 1px solid var(--ap-border);
}

.ap-accordion__trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
  font-weight: 700;
  font-size: 0.95rem;
  text-align: left;
}

.ap-accordion__trigger svg {
  transition: transform 0.2s;
  flex-shrink: 0;
  color: var(--ap-text-muted);
}

.ap-accordion__trigger[aria-expanded="true"] svg {
  transform: rotate(180deg);
}

.ap-accordion__panel {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

.ap-accordion__panel.is-open {
  max-height: 800px;
}

#ap-detail-about-panel.is-open {
  max-height: 9999px;
}

.ap-accordion__panel p,
.ap-accordion__panel .ap-faq {
  padding-bottom: 16px;
  color: var(--ap-text-muted);
  font-size: 0.9rem;
  line-height: 1.65;
}

/* Overview: 300px preview + expand */
.ap-overview-viewport {
  position: relative;
  overflow: hidden;
  transition: max-height 0.35s ease;
}

.ap-overview-viewport.is-collapsed {
  max-height: var(--ap-overview-collapsed-h, 300px);
}

.ap-overview-viewport.is-expanded {
  max-height: none;
}

.ap-overview-viewport__inner p {
  margin: 0 0 0.75rem;
  color: var(--ap-text-muted);
  font-size: 0.9rem;
  line-height: 1.65;
}

.ap-overview-viewport__fade {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 80px;
  background: linear-gradient(to bottom, transparent, var(--ap-surface) 85%);
  pointer-events: none;
}

.ap-overview-viewport.is-expanded .ap-overview-viewport__fade {
  display: none;
}

.ap-overview-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 10px 0 16px;
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--ap-blue);
  transition: color 0.15s;
}

.ap-overview-toggle:active {
  color: var(--ap-teal);
}

.ap-overview-toggle__icon {
  transition: transform 0.25s ease;
}

.ap-overview-viewport.is-expanded + .ap-overview-toggle .ap-overview-toggle__icon {
  transform: rotate(180deg);
}

.ap-disclosure {
  font-size: 0.8rem;
  color: var(--ap-text-muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

.ap-disclosure a {
  color: var(--ap-blue);
}
