/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  padding-top: calc(12px + var(--safe-top));
  background: rgba(26,16,53,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.logo {
  font-size: 26px;
  font-weight: 800;
  background: linear-gradient(135deg, #7c4dff, #448aff, #00e5ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nickname-area {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* Join Bar */
.join-bar {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
}

.join-bar input {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-family: monospace;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-align: center;
  outline: none;
  background: rgba(255,255,255,0.06);
  color: var(--text);
}
.join-bar input:focus {
  border-color: var(--accent);
  background: rgba(124,77,255,0.08);
}
.join-bar input::placeholder {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, sans-serif;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-secondary);
}

/* Category Tabs */
.category-tabs {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.category-tab {
  padding: 8px 16px;
  border-radius: 20px;
  border: none;
  background: rgba(255,255,255,0.06);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.category-tab:hover {
  background: rgba(255,255,255,0.1);
}
.category-tab.active {
  background: var(--accent);
  color: white;
}

/* Game Grid */
.game-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 8px 16px 100px;
  overflow-y: auto;
  flex: 1;
}

@media (min-width: 480px) {
  .game-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
@media (min-width: 768px) {
  .game-grid {
    grid-template-columns: repeat(5, 1fr);
    max-width: 640px;
    margin: 0 auto;
  }
}

.game-card {
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.1);
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  overflow: hidden;
}
.game-card:active {
  transform: scale(0.95);
}
.game-card:hover {
  border-color: rgba(255,255,255,0.25);
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.game-card .game-icon {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.game-card .game-icon svg {
  width: 100%;
  height: 100%;
  border-radius: 8px;
}
.game-card .game-name {
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  color: white;
  padding: 0 4px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.game-card .game-players {
  font-size: 9px;
  color: rgba(255,255,255,0.7);
}
.game-card.unavailable {
  opacity: 0.4;
}
.game-card.unavailable::after {
  content: 'Soon';
  position: absolute;
  top: 6px;
  right: 6px;
  font-size: 8px;
  font-weight: 700;
  background: var(--orange);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
}

/* Room View */
.game-header {
  display: flex;
  align-items: center;
  padding: 12px 16px;
  padding-top: calc(12px + var(--safe-top));
  background: rgba(26,16,53,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  gap: 12px;
}
.game-header span {
  font-weight: 600;
  color: var(--text);
}
#room-code-display {
  margin-left: auto;
  font-family: monospace;
  font-size: 14px;
  color: var(--text-secondary);
}

.room-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px;
}

.room-code-big {
  font-size: 48px;
  font-weight: 800;
  font-family: monospace;
  letter-spacing: 6px;
  color: white;
  text-shadow: 0 0 30px rgba(124,77,255,0.5), 0 0 60px rgba(124,77,255,0.2);
}

.player-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 300px;
}
.player-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-sm);
}
.player-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #7c4dff, #448aff);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 700;
  font-size: 14px;
}
.player-item .host-badge {
  margin-left: auto;
  font-size: 10px;
  color: var(--orange);
  font-weight: 600;
}

.waiting-msg {
  color: var(--text-secondary);
  font-size: 14px;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}
