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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background: #ffffff;
  min-height: 100vh;
  color: #333333;
}

.portal-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.portal-header {
  margin-bottom: 3rem;
  animation: fadeInDown 0.6s ease-out;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
}

.header-content > div:first-child {
  text-align: center;
  flex: 1;
}

.auth-status {
  display: flex;
  align-items: center;
  gap: 1rem;
  position: relative;
}

.auth-header-button {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #ffffff;
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
}

.auth-header-button:hover {
  background: linear-gradient(135deg, #7c8df8, #8d63b8);
  transform: translateY(-2px);
}

.user-menu {
  position: relative;
}

.user-menu-button {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #ffffff;
  padding: 0.625rem 1.25rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.875rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-menu-button:hover {
  background: linear-gradient(135deg, #7c8df8, #8d63b8);
  transform: translateY(-2px);
}

#username-display {
  font-weight: 600;
}

.menu-arrow {
  font-size: 0.7rem;
  transition: transform 0.3s ease;
}

.user-menu-button.open .menu-arrow {
  transform: rotate(180deg);
}

.user-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: #ffffff;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  min-width: 180px;
  overflow: hidden;
  z-index: 1000;
}

.dropdown-item {
  width: 100%;
  padding: 0.75rem 1rem;
  border: none;
  background: #ffffff;
  color: #333333;
  font-weight: 600;
  font-size: 0.875rem;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s ease;
}

.dropdown-item:hover {
  background: #f5f5f5;
  color: #764ba2;
}

.portal-title {
  font-size: 3rem;
  font-weight: 800;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #667eea, #764ba2);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.portal-subtitle {
  font-size: 1.2rem;
  color: #666666;
  font-weight: 300;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 2rem;
  flex: 1;
  align-content: start;
  animation: fadeIn 0.8s ease-out 0.2s both;
}

.loading,
.no-games,
.error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem;
  font-size: 1.2rem;
  opacity: 0.8;
}

.error {
  background: rgba(255, 68, 68, 0.2);
  border-radius: 12px;
  border: 2px solid rgba(255, 68, 68, 0.4);
}

.game-card {
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  transition: all 0.3s ease;
  cursor: pointer;
  text-decoration: none;
  color: #333333;
  border: 2px solid #e0e0e0;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.game-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
  border-color: #667eea;
}

.game-thumbnail {
  width: 100%;
  height: 200px;
  background: linear-gradient(135deg, rgba(102, 126, 234, 0.4), rgba(118, 75, 162, 0.4));
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.partner-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.95);
  color: #667eea;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 2px solid #667eea;
  z-index: 10;
}

.game-icon {
  font-size: 4rem;
  opacity: 0.3;
}

.game-content {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex: 1;
}

.game-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.game-author {
  font-size: 0.875rem;
  color: #667eea;
  font-weight: 600;
  font-style: italic;
  margin-bottom: 0.5rem;
}

.game-description {
  font-size: 0.95rem;
  opacity: 0.85;
  line-height: 1.5;
  flex: 1;
}

.game-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.game-tag {
  background: #e8ebf9;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #4a5fc1;
  border: 1px solid #d0d8f0;
}

.play-button {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: #ffffff;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-weight: 600;
  text-align: center;
  margin-top: 0.5rem;
  transition: all 0.3s ease;
  border: none;
}

.game-card:hover .play-button {
  background: linear-gradient(135deg, #7c8df8, #8d63b8);
  transform: scale(1.05);
}

.portal-footer {
  text-align: center;
  margin-top: 3rem;
  padding: 2rem 0;
  opacity: 0.7;
  font-size: 0.9rem;
}

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

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

@media (max-width: 768px) {
  .portal-container {
    padding: 1rem;
  }

  .header-content {
    flex-direction: column;
    gap: 1.5rem;
    align-items: stretch;
  }

  .header-content > div:first-child {
    text-align: center;
  }

  .auth-status {
    justify-content: center;
  }

  .portal-title {
    font-size: 2rem;
  }

  .portal-subtitle {
    font-size: 1rem;
  }

  .games-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }

  .game-thumbnail {
    height: 180px;
  }

  .game-title {
    font-size: 1.35rem;
  }

  .game-content {
    padding: 1.25rem;
  }
}

@media (max-width: 480px) {
  .portal-container {
    padding: 0.75rem;
  }

  .portal-header {
    margin-bottom: 2rem;
  }

  .portal-title {
    font-size: 1.75rem;
  }

  .portal-subtitle {
    font-size: 0.9rem;
  }

  .auth-header-button,
  .user-menu-button {
    padding: 0.625rem 1rem;
    font-size: 0.8rem;
  }

  .game-thumbnail {
    height: 150px;
  }

  .game-icon {
    font-size: 3rem;
  }

  .game-title {
    font-size: 1.25rem;
  }

  .game-description {
    font-size: 0.875rem;
  }

  .game-tag {
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
  }
}
