@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600;800&display=swap');

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

html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  width: 100%;
  min-height: 100vh;
  font-family: 'Inter', system-ui, sans-serif;
  background: #0f0f1a;
  background-image:
    radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(59, 130, 246, 0.1) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(139, 92, 246, 0.08) 0%, transparent 50%);
  color: #e2e8f0;
  -webkit-font-smoothing: antialiased;
  --nav-height: 48px;
}

/* ── Navigation Bar ── */

.nav-bar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  padding: 0.4rem 1rem;
  background: rgba(15, 15, 26, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(99, 102, 241, 0.15);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  max-width: 600px;
}

.nav-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.nav-logo {
  height: 22px;
  width: auto;
  flex-shrink: 0;
}

.nav-subtitle {
  font-size: 0.65rem;
  font-weight: 500;
  color: #94a3b8;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

.back-button {
  position: absolute;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: #c7d2fe;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}

.back-button:hover {
  background: rgba(99, 102, 241, 0.25);
  border-color: rgba(99, 102, 241, 0.5);
}

.back-button svg {
  width: 18px;
  height: 18px;
}

/* ── Game Selector Grid ── */

.game-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  padding: 1.25rem 1rem;
  max-width: 600px;
  margin: 0 auto;
}

/* ── Game Card ── */

.game-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem 0.75rem;
  background: rgba(30, 30, 60, 0.6);
  border: 1px solid rgba(99, 102, 241, 0.12);
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  text-align: center;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: rgba(99, 102, 241, 0.4);
  box-shadow:
    0 8px 24px rgba(99, 102, 241, 0.15),
    0 0 0 1px rgba(99, 102, 241, 0.1);
}

.game-card:active {
  transform: translateY(-1px);
}

.card-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
}

.card-name {
  font-size: 1rem;
  font-weight: 700;
  color: #f1f5f9;
}

.card-description {
  font-size: 0.8rem;
  line-height: 1.4;
  color: #94a3b8;
}

/* ── Game Frame (iframe) ── */

.game-frame {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  width: 100%;
  height: calc(100vh - var(--nav-height));
  border: none;
}

/* ── Empty State ── */

.empty-state {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - var(--nav-height));
  color: #64748b;
  font-size: 1rem;
}

/* ── Error Overlay ── */

.error-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 15, 26, 0.9);
  backdrop-filter: blur(6px);
}

.error-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem;
  text-align: center;
  color: #f87171;
  font-weight: 600;
}

.error-back-button {
  padding: 0.5rem 1.25rem;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: #e2e8f0;
  background: linear-gradient(135deg, #6366f1, #3b82f6);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.error-back-button:hover {
  opacity: 0.85;
}

/* ── Utility ── */

.hidden {
  display: none !important;
}
