/* Fonts */
@import url('https://fonts.googleapis.com/css2?family=Tilt+Warp&family=Roboto:wght@400;500;600;700&display=swap');

/* CSS Variables - Warm Charcoal Theme */
:root {
  --bg-primary: #1C1917;
  --bg-surface: #292524;
  --bg-elevated: #3a3633;
  --border: #44403C;
  --accent: #F97316;
  --accent-hover: #ea580c;
  --text-primary: #E7E5E4;
  --text-secondary: #A8A29E;
  --text-muted: #78716C;
  --radius: 8px;
  --radius-lg: 12px;
}

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

/* Base */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-left {
  display: flex;
  align-items: center;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0px;
  font-family: 'Tilt Warp', cursive;
  font-size: 1.5rem;
  color: var(--text-primary);
  text-decoration: none;
  letter-spacing: -0.02em;
  transition: color 0.2s;
}

.logo:hover {
  color: var(--accent);
}

.logo-icon {
  width: 60px;
  height: 60px;
  object-fit: contain;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Navigation */
.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--radius);
  transition: color 0.2s, background 0.2s;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-surface);
}

/* Auth UI */
.login-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.login-btn:hover {
  background: var(--accent-hover);
}

.login-btn:active {
  transform: scale(0.98);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-name {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-primary);
}

.settings-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  background: var(--bg-surface);
  border-radius: 50%;
  color: var(--text-secondary);
  text-decoration: none;
  transition: background 0.2s, color 0.2s;
}

.settings-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.logout-btn {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.logout-btn:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* Main Content */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px;
}

/* Hero Section */
.hero {
  text-align: center;
  margin-bottom: 64px;
}

.hero h1 {
  font-family: 'Tilt Warp', cursive;
  font-size: 3rem;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 16px;
  letter-spacing: -0.02em;
}

.hero p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto;
}

/* Section */
.section-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 24px;
}

/* Game Grid */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 24px;
}

.game-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid transparent;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: var(--border);
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.4);
}

.game-card .thumbnail {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: var(--bg-elevated);
  position: relative;
  overflow: hidden;
}

.game-card .thumbnail img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.game-card:hover .thumbnail img {
  transform: scale(1.05);
}

.game-card .play-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

.game-card:hover .play-overlay {
  opacity: 1;
}

.play-btn {
  background: var(--accent);
  color: white;
  border: none;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.play-btn:hover {
  background: var(--accent-hover);
}

.play-btn:active {
  transform: scale(0.96);
}

.game-card .info {
  padding: 16px;
}

.game-card .name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.game-card .description {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* App Page (Streaming) */
.app-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-primary);
  padding: 24px;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 400px;
  margin-bottom: 16px;
}

.app-header h1 {
  color: var(--text-primary);
  font-size: 1.125rem;
  font-weight: 600;
}

.back-btn {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.back-btn:hover {
  background: var(--bg-elevated);
}

.status-bar {
  margin-bottom: 12px;
  padding: 10px 16px;
  background: var(--bg-surface);
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.status-bar.connected {
  background: rgba(34, 197, 94, 0.1);
  border-color: rgba(34, 197, 94, 0.3);
  color: #22c55e;
}

.status-bar.error {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.stream-container {
  position: relative;
  overflow: hidden;
  background: #000;
}

.stream-canvas {
  display: block;
  touch-action: none;
  max-width: 100%;
  height: auto;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28, 25, 23, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.loading-overlay.hidden {
  display: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.loading-overlay p {
  color: var(--text-secondary);
  margin-top: 16px;
  font-size: 0.9375rem;
}

/* Login Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(4px);
}

.modal-overlay.show {
  display: flex;
}

.modal-content {
  background: var(--bg-surface);
  padding: 32px;
  border-radius: var(--radius-lg);
  text-align: center;
  max-width: 360px;
  width: 90%;
  border: 1px solid var(--border);
}

.modal-content h2 {
  margin-bottom: 8px;
  color: var(--text-primary);
  font-size: 1.25rem;
}

.modal-content p {
  color: var(--text-secondary);
  margin-bottom: 24px;
  font-size: 0.9375rem;
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  padding: 12px 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.google-btn:hover {
  background: var(--bg-primary);
  border-color: var(--text-muted);
}

.cancel-btn {
  margin-top: 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  transition: color 0.2s;
}

.cancel-btn:hover {
  color: var(--text-secondary);
}

/* Pricing Page */
.pricing-page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 64px 24px;
}

.pricing-header {
  text-align: center;
  margin-bottom: 48px;
}

.pricing-header h1 {
  font-family: 'Tilt Warp', cursive;
  font-size: 2.5rem;
  font-weight: 400;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.pricing-header p {
  font-size: 1.125rem;
  color: var(--text-secondary);
}

.pricing-container {
  min-height: 400px;
}

.login-prompt {
  text-align: center;
  padding: 64px 24px;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  max-width: 400px;
  margin: 0 auto;
}

.login-prompt h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.login-prompt p {
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.login-prompt .login-btn {
  padding: 12px 32px;
  font-size: 1rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}

.empty-state svg {
  width: 48px;
  height: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* Responsive */
@media (max-width: 768px) {
  .header {
    padding: 0 16px;
    height: 56px;
  }

  .logo {
    font-size: 1.25rem;
  }

  .main-content {
    padding: 32px 16px;
  }

  .hero h1 {
    font-size: 2rem;
  }

  .hero p {
    font-size: 1rem;
  }

  .game-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
  }

  .game-card .info {
    padding: 12px;
  }

  .game-card .name {
    font-size: 0.875rem;
  }
}

@media (max-width: 480px) {
  .header-right {
    gap: 8px;
  }

  .nav-link {
    padding: 6px 10px;
    font-size: 0.8125rem;
  }

  .login-btn {
    padding: 8px 14px;
    font-size: 0.8125rem;
  }
}
