/* ===== PS5 Home UI ===== */
:root {
  --bg-deep: #0a0a0c;
  --bg-panel: rgba(20, 22, 28, 0.72);
  --text: #f0f2f5;
  --text-dim: rgba(240, 242, 245, 0.55);
  --text-muted: rgba(240, 242, 245, 0.35);
  --accent: #0070d1;
  --accent-bright: #1a9fff;
  --accent-glow: rgba(0, 112, 209, 0.45);
  --focus-ring: #ffffff;
  --card-w: 148px;
  --card-h: 198px;
  --card-focused-w: 188px;
  --card-focused-h: 252px;
  --radius: 12px;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition: 0.35s var(--ease-out);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

/* ===== Shell ===== */
.ps5-shell {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===== Background ===== */
.bg-layer {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.bg-image {
  position: absolute;
  inset: -8%;
  background-size: cover;
  background-position: center;
  filter: blur(28px) saturate(1.2) brightness(0.45);
  transform: scale(1.08);
  transition: opacity 0.8s var(--ease-out), background-image 0.8s ease;
  opacity: 1;
  animation: bgDrift 28s ease-in-out infinite alternate;
}

@keyframes bgDrift {
  0% { transform: scale(1.08) translate(0, 0); }
  100% { transform: scale(1.14) translate(-1.5%, 1%); }
}

.bg-gradient {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 10, 16, 0.55) 0%, rgba(8, 10, 16, 0.2) 28%, rgba(8, 10, 16, 0.55) 55%, rgba(8, 10, 16, 0.95) 100%),
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(0, 80, 180, 0.18), transparent 60%);
  pointer-events: none;
}

.bg-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  animation: floatParticle linear infinite;
  opacity: 0;
}

@keyframes floatParticle {
  0% { transform: translateY(100vh) scale(0.4); opacity: 0; }
  10% { opacity: 0.5; }
  90% { opacity: 0.25; }
  100% { transform: translateY(-10vh) scale(1); opacity: 0; }
}

/* ===== Top bar ===== */
.top-bar {
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 40px 12px;
  animation: slideDown 0.7s var(--ease-out) both;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-16px); }
  to { opacity: 1; transform: translateY(0); }
}

.top-left {
  display: flex;
  align-items: center;
  gap: 28px;
}

.ps-logo {
  color: var(--text);
  opacity: 0.9;
  display: flex;
  align-items: center;
  transition: transform 0.3s var(--ease-spring), color 0.3s;
}

.ps-logo:hover {
  color: var(--accent-bright);
  transform: scale(1.08);
}

.main-tabs {
  display: flex;
  gap: 8px;
}

.tab {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  padding: 8px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: color var(--transition), background var(--transition), box-shadow var(--transition), transform 0.2s;
  outline: none;
  letter-spacing: 0.02em;
}

.tab:hover {
  color: var(--text);
}

.tab.active,
.tab.focused {
  color: var(--text);
  background: rgba(255, 255, 255, 0.12);
}

.tab.focused {
  box-shadow: 0 0 0 2px var(--focus-ring);
  transform: scale(1.04);
}

.top-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.status-icons {
  display: flex;
  gap: 6px;
}

.icon-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: var(--text-dim);
  transition: color 0.25s, background 0.25s;
  cursor: default;
}

.icon-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulseBadge 2.5s ease-in-out infinite;
}

@keyframes pulseBadge {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 0 6px transparent; }
}

.clock {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  min-width: 48px;
  text-align: center;
}

.profile {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  transition: background 0.25s;
}

.profile:hover {
  background: rgba(255, 255, 255, 0.1);
}

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0070d1, #00a0ff);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
  box-shadow: 0 0 16px var(--accent-glow);
}

.profile-name {
  font-size: 14px;
  font-weight: 500;
  padding-right: 4px;
}

/* ===== Main content ===== */
.main-content {
  position: relative;
  z-index: 5;
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 0 40px 8px;
  min-height: 0;
}

/* ===== Hero ===== */
.hero {
  flex: 0 0 auto;
  min-height: 140px;
  max-height: 200px;
  display: flex;
  align-items: flex-end;
  padding-bottom: 16px;
  margin-top: auto;
  animation: fadeInUp 0.8s var(--ease-out) 0.15s both;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-info {
  max-width: 560px;
}

.hero-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-bright);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 8px;
  opacity: 0;
  animation: fadeIn 0.4s ease both;
}

.hero-title {
  font-size: clamp(28px, 4vw, 42px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  text-shadow: 0 2px 24px rgba(0, 0, 0, 0.5);
  transition: opacity 0.35s, transform 0.35s var(--ease-out);
}

.hero-meta {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 18px;
  transition: opacity 0.35s;
}

.hero-info.switching .hero-label,
.hero-info.switching .hero-title,
.hero-info.switching .hero-meta {
  opacity: 0;
  transform: translateY(8px);
}

.hero-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn-primary,
.btn-secondary {
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 999px;
  padding: 12px 28px;
  cursor: pointer;
  transition: transform 0.2s var(--ease-spring), box-shadow 0.25s, background 0.25s, opacity 0.25s;
  outline: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: #fff;
  color: #0a0a0c;
  box-shadow: 0 4px 20px rgba(255, 255, 255, 0.2);
}

.btn-primary:hover,
.btn-primary.focused {
  transform: scale(1.05);
  box-shadow: 0 6px 28px rgba(255, 255, 255, 0.35);
}

.btn-primary.focused {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
}

.btn-icon {
  font-size: 11px;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text);
  backdrop-filter: blur(8px);
}

.btn-secondary:hover,
.btn-secondary.focused {
  background: rgba(255, 255, 255, 0.2);
  transform: scale(1.04);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ===== Carousel ===== */
.carousel-section {
  flex: 0 0 auto;
  padding: 12px 0 20px;
  overflow: visible;
  animation: fadeInUp 0.8s var(--ease-out) 0.3s both;
}

.carousel-track {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  padding: 24px 8px 16px;
  overflow-x: auto;
  overflow-y: visible;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

/* Game card */
.game-card {
  position: relative;
  flex: 0 0 auto;
  width: var(--card-w);
  height: var(--card-h);
  border-radius: var(--radius);
  cursor: pointer;
  transition:
    width var(--transition),
    height var(--transition),
    transform var(--transition),
    box-shadow var(--transition),
    opacity 0.35s;
  outline: none;
  transform-origin: center bottom;
  opacity: 0.85;
}

.game-card::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: calc(var(--radius) + 3px);
  border: 2px solid transparent;
  transition: border-color 0.3s, box-shadow 0.3s;
  pointer-events: none;
  z-index: 2;
}

.game-card .card-art {
  width: 100%;
  height: 100%;
  border-radius: var(--radius);
  background-size: cover;
  background-position: center;
  overflow: hidden;
  position: relative;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  transition: box-shadow var(--transition);
}

.game-card .card-pattern {
  position: absolute;
  inset: 0;
  opacity: 0.2;
  background-image:
    radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.35) 0%, transparent 40%),
    radial-gradient(circle at 80% 80%, rgba(0, 0, 0, 0.4) 0%, transparent 45%),
    repeating-linear-gradient(
      -18deg,
      transparent,
      transparent 6px,
      rgba(255, 255, 255, 0.03) 6px,
      rgba(255, 255, 255, 0.03) 7px
    );
  pointer-events: none;
}

.game-card .card-mono {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -55%);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.55);
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.5);
  z-index: 1;
  transition: font-size var(--transition), color 0.3s, transform var(--transition);
  pointer-events: none;
  white-space: nowrap;
}

.game-card.focused .card-mono {
  font-size: 28px;
  color: rgba(255, 255, 255, 0.75);
  transform: translate(-50%, -60%);
}

.game-card .card-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.55) 100%);
  opacity: 0.7;
  transition: opacity 0.3s;
  z-index: 1;
}

.game-card .card-shine {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: linear-gradient(
    125deg,
    transparent 30%,
    rgba(255, 255, 255, 0.12) 45%,
    transparent 60%
  );
  background-size: 200% 200%;
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
  z-index: 2;
}

.game-card .card-title {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
  z-index: 3;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s, transform 0.3s var(--ease-out);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Focused card — PS5 style enlarge */
.game-card.focused {
  width: var(--card-focused-w);
  height: var(--card-focused-h);
  opacity: 1;
  z-index: 3;
  transform: translateY(-4px);
}

.game-card.focused::before {
  border-color: var(--focus-ring);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15), 0 0 32px var(--accent-glow);
}

.game-card.focused .card-art {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.55), 0 0 40px var(--accent-glow);
}

.game-card.focused .card-art::after {
  opacity: 0.3;
}

.game-card.focused .card-shine {
  opacity: 1;
  animation: shineSweep 2.8s ease-in-out infinite;
}

.game-card.focused .card-title {
  opacity: 1;
  transform: translateY(0);
  font-size: 13px;
}

@keyframes shineSweep {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.game-card.dimmed {
  opacity: 0.45;
  transform: scale(0.96);
}

/* New / progress badge on card */
.game-card .card-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 3;
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--accent);
  color: #fff;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.3s;
}

.game-card.focused .card-badge {
  opacity: 1;
}

/* ===== Bottom quick access ===== */
.bottom-row {
  display: flex;
  gap: 12px;
  padding: 8px 0 4px;
  flex: 0 0 auto;
  animation: fadeInUp 0.8s var(--ease-out) 0.45s both;
}

.quick-card {
  flex: 1;
  max-width: 200px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 245, 0.04);
  border: 2px solid transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.3s, border-color 0.3s, color 0.3s, transform 0.25s var(--ease-spring), box-shadow 0.3s;
  outline: none;
}

.quick-card:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.quick-card.focused {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--focus-ring);
  color: var(--text);
  transform: scale(1.04) translateY(-2px);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.3), 0 0 20px var(--accent-glow);
}

.quick-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  transition: background 0.3s, transform 0.3s var(--ease-spring);
}

.quick-card.focused .quick-icon {
  background: rgba(0, 112, 209, 0.35);
  transform: scale(1.08);
  color: var(--accent-bright);
}

/* ===== Control hints ===== */
.control-hints {
  position: relative;
  z-index: 10;
  display: flex;
  justify-content: center;
  gap: 28px;
  padding: 12px 40px 18px;
  color: var(--text-muted);
  font-size: 12px;
  animation: fadeIn 1s ease 0.6s both;
}

.hint {
  display: flex;
  align-items: center;
  gap: 6px;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-dim);
}

/* ===== Launch overlay ===== */
.launch-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s, visibility 0.5s;
}

.launch-overlay.active {
  opacity: 1;
  visibility: visible;
}

.launch-content {
  text-align: center;
}

.launch-spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto 20px;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--accent-bright);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.launch-text {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}

/* ===== Zone focus indicator (subtle) ===== */
.zone-active-carousel .carousel-section {
  /* reserved for future polish */
}

/* ===== Boot intro ===== */
body.booting .top-bar,
body.booting .main-content,
body.booting .control-hints {
  opacity: 0;
}

.boot-flash {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: bootOut 1.4s var(--ease-out) 0.6s forwards;
}

.boot-flash .boot-logo {
  width: 72px;
  height: 72px;
  color: #fff;
  opacity: 0;
  animation: bootLogo 1.2s var(--ease-out) 0.15s both;
}

@keyframes bootLogo {
  0% { opacity: 0; transform: scale(0.7); }
  40% { opacity: 1; transform: scale(1.05); }
  70% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.1); }
}

@keyframes bootOut {
  to { opacity: 0; visibility: hidden; pointer-events: none; }
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  :root {
    --card-w: 110px;
    --card-h: 148px;
    --card-focused-w: 140px;
    --card-focused-h: 188px;
  }

  .top-bar,
  .main-content {
    padding-left: 20px;
    padding-right: 20px;
  }

  .profile-name {
    display: none;
  }

  .control-hints {
    gap: 14px;
    flex-wrap: wrap;
  }

  .quick-card span {
    font-size: 11px;
  }
}

@media (max-height: 700px) {
  .hero {
    min-height: 100px;
  }

  .hero-title {
    font-size: 24px;
  }

  :root {
    --card-w: 100px;
    --card-h: 134px;
    --card-focused-w: 128px;
    --card-focused-h: 172px;
  }
}
