/* Global reset and base styles */
* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, #101820, #05070a 55%, #020305 100%);
  background-attachment: fixed; /* Keep gradient fixed to viewport */
  background-size: cover; /* Ensure it covers the entire area */
  color: #e5f0ff;
}

/* Game hub layout */
body.theme-game-hub {
  cursor: none; /* hide default cursor so trail is visible */
}

.hub-shell {
  min-height: 100vh;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px 40px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Header with title + animated text + Buy Me a Coffee button */
.hub-header {
  text-align: left;
}

.hub-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hub-header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hub-header-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.hub-title {
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: -0.02em;
}

.hub-subtitle {
  font-size: 14px;
  color: #8a9bb5;
  min-height: 1.4em;
}

#typed-text {
  white-space: nowrap;
}

.caret {
  display: inline-block;
  width: 1ch;
  color: #4fe3a1;
}

.caret-hidden {
  opacity: 0;
}

/* Make the BMC button feel integrated */
.hub-header-right iframe,
.hub-header-right .bmc-button,
.hub-header-right [data-name="bmc-button"] {
  filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6));
}

/* Main two-column layout: ~65% cards, ~35% viewer */
.hub-main {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 24px;
  align-items: flex-start;
}

/* Search bar spanning full width */
.hub-search {
  grid-column: 1 / -1;
  margin-bottom: 8px;
}

.game-search-input {
  width: 100%;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid #283446;
  background: rgba(5, 9, 14, 0.95);
  color: #e5f0ff;
  font-size: 14px;
}

.game-search-input::placeholder {
  color: #6b7a93;
}

.game-search-input:focus-visible {
  outline: none;
  border-color: #4fe3a1;
}

.frame-hint {
  margin-top: 6px;
  font-size: 12px;
  color: #6b7a93;
}

/* Game cards grid */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

/* Glassy, neon game cards */
.game-card {
  position: relative;
  padding: 16px 16px 14px;
  border-radius: 16px;
  background: rgba(10, 18, 28, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.06);
  backdrop-filter: blur(14px) saturate(130%);
  -webkit-backdrop-filter: blur(14px) saturate(130%);
  overflow: hidden;
  transition:
    transform 0.18s ease-out,
    border-color 0.18s ease-out,
    box-shadow 0.18s ease-out,
    background 0.18s ease-out;
}

.game-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 0% 0%, rgba(79, 227, 161, 0.18), transparent 55%);
  opacity: 0.6;
  pointer-events: none;
}

.game-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.18),
    transparent 40%,
    transparent 60%,
    rgba(255, 255, 255, 0.08)
  );
  mix-blend-mode: soft-light;
  opacity: 0.35;
  pointer-events: none;
}

.game-card > * {
  position: relative;
  z-index: 1;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: rgba(79, 227, 161, 0.6);
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.7);
  background: rgba(12, 22, 34, 0.95);
}

.game-title {
  margin: 0 0 6px;
  font-size: 18px;
}

.game-desc {
  margin: 0 0 12px;
  font-size: 13px;
  color: #9aa7c0;
}

/* Neon buttons on cards */
.game-launch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(79, 227, 161, 0.7);
  background: radial-gradient(circle at 0% 0%, #4fe3a1, #1a8b5b);
  color: #02140a;
  font-size: 14px;
  cursor: pointer;
  min-height: 40px;
  transition:
    transform 0.16s ease-out,
    box-shadow 0.16s ease-out,
    background 0.16s ease-out,
    border-color 0.16s ease-out;
}

.game-launch:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.7);
  border-color: rgba(79, 227, 161, 0.9);
}

.game-launch:active {
  transform: translateY(0);
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.7) inset;
}

/* Game viewer panel: minimal, no glow/box */
.game-frame-section {
  padding: 0;
  margin: 0;
  border: none;
  background: none;
  box-shadow: none;
}

.frame-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.frame-title {
  margin: 0;
  font-size: 16px;
  color: #9aa7c0;
}

.frame-fullscreen-btn {
  padding: 6px 12px;
  font-size: 13px;
  border-radius: 999px;
  border: 1px solid #283446;
  background: rgba(6, 11, 18, 0.95);
  color: #e5f0ff;
  cursor: pointer;
  min-height: 32px;
  transition:
    background 0.16s ease-out,
    transform 0.16s ease-out,
    border-color 0.16s ease-out;
}

.frame-fullscreen-btn:hover {
  background: #1a8b5b;
  border-color: #4fe3a1;
}

.frame-fullscreen-btn:active {
  transform: translateY(1px);
}

/* Iframe itself: no box, just content */
#game-frame,
iframe#game-frame {
  width: 100%;
  height: 420px;
  border: none;
  outline: none;
  background: transparent;
  box-shadow: none;
}

/* Cursor trail canvas above content */
#trail-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

/* Responsive tweaks */
@media (max-width: 900px) {
  .hub-main {
    grid-template-columns: 1fr;
  }

  #game-frame,
  iframe#game-frame {
    height: 320px;
  }

  .hub-header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .hub-header-right {
    align-self: stretch;
    justify-content: flex-start;
  }
}
