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

:root {
  --primary: #6c5ce7;
  --primary-dark: #5b4cdb;
  --secondary: #00cec9;
  --accent: #fd79a8;
  --bg: #0a0a1a;
  --bg-card: #141428;
  --bg-input: #1e1e3a;
  --text: #ffffff;
  --text-muted: #a0a0c0;
  --success: #00b894;
  --danger: #e17055;
  --warning: #fdcb6e;
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Background animation */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 40%, rgba(108, 92, 231, 0.08) 0%, transparent 50%),
              radial-gradient(circle at 70% 60%, rgba(0, 206, 201, 0.06) 0%, transparent 50%);
  animation: bgMove 20s ease-in-out infinite;
  z-index: -1;
}

@keyframes bgMove {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-5%, -5%); }
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.container-wide {
  max-width: 900px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin-bottom: 16px;
}

/* Logo */
.logo {
  text-align: center;
  margin-bottom: 32px;
}

.logo h1 {
  font-size: 3rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: -1px;
}

.logo p {
  color: var(--text-muted);
  margin-top: 8px;
  font-size: 1.1rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  width: 100%;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
}

.btn-primary:hover {
  box-shadow: 0 6px 20px rgba(108, 92, 231, 0.6);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: rgba(108, 92, 231, 0.2);
  border-color: var(--primary);
}

.btn-success {
  background: linear-gradient(135deg, var(--success), #00a381);
  color: white;
  box-shadow: 0 4px 15px rgba(0, 184, 148, 0.4);
}

.btn-danger {
  background: linear-gradient(135deg, var(--danger), #d63031);
  color: white;
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.85rem;
  width: auto;
}

.btn-group {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.btn-group .btn { flex: 1; }

/* Inputs */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-input);
  border: 2px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1rem;
  transition: border-color 0.2s;
  outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
}

.form-group select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23a0a0c0' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

.form-group select option {
  background: var(--bg-card);
  color: var(--text);
}

/* Links */
.link {
  color: var(--secondary);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s;
}

.link:hover { color: var(--primary); }

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mt-2 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }

/* Error/Success messages */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.alert-error {
  background: rgba(225, 112, 85, 0.15);
  border: 1px solid rgba(225, 112, 85, 0.3);
  color: #ff7675;
}

.alert-success {
  background: rgba(0, 184, 148, 0.15);
  border: 1px solid rgba(0, 184, 148, 0.3);
  color: #55efc4;
}

/* Room Code Display */
.room-code {
  text-align: center;
  padding: 24px;
  background: var(--bg-input);
  border-radius: var(--radius);
  margin: 20px 0;
}

.room-code .code {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: 8px;
  color: var(--secondary);
  font-family: 'Courier New', monospace;
}

.room-code .label {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 8px;
}

/* Players List */
.players-list {
  list-style: none;
}

.player-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-input);
  border-radius: var(--radius);
  margin-bottom: 8px;
  border: 1px solid rgba(255, 255, 255, 0.03);
}

.player-item .name {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.player-item .role {
  font-size: 0.75rem;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(108, 92, 231, 0.2);
  color: var(--primary);
}

.player-item .score {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--warning);
}

/* Game Screens */
.game-screen {
  text-align: center;
}

.game-screen .big-word {
  font-size: 3rem;
  font-weight: 800;
  padding: 40px 20px;
  margin: 20px 0;
  background: linear-gradient(135deg, rgba(108, 92, 231, 0.15), rgba(0, 206, 201, 0.15));
  border-radius: var(--radius);
  border: 2px solid rgba(108, 92, 231, 0.3);
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  word-break: break-word;
}

.game-screen .word-counter {
  color: var(--text-muted);
  margin-bottom: 16px;
  font-size: 0.9rem;
}

.game-screen .timer-display {
  font-size: 4rem;
  font-weight: 800;
  color: var(--secondary);
  margin: 20px 0;
}

.game-screen .timer-display.warning {
  color: var(--warning);
}

.game-screen .timer-display.danger {
  color: var(--danger);
  animation: pulse 0.5s ease infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

.guess-input-area {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.guess-input-area input {
  flex: 1;
  padding: 16px;
  background: var(--bg-input);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 1.1rem;
  outline: none;
}

.guess-input-area input:focus {
  border-color: var(--primary);
}

/* Scoreboard */
.scoreboard {
  margin-top: 24px;
}

.scoreboard .score-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: var(--bg-input);
  border-radius: var(--radius);
  margin-bottom: 8px;
}

.scoreboard .score-item.winner {
  border: 2px solid var(--warning);
  background: rgba(253, 203, 110, 0.1);
}

.scoreboard .rank {
  font-size: 1.5rem;
  font-weight: 800;
  width: 40px;
}

.scoreboard .player-name {
  flex: 1;
  text-align: left;
  margin-left: 12px;
  font-weight: 600;
}

.scoreboard .player-score {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--warning);
}

/* Topic Selection */
.topic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 20px 0;
}

.topic-option {
  padding: 20px;
  background: var(--bg-input);
  border: 2px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.topic-option:hover {
  border-color: var(--primary);
  background: rgba(108, 92, 231, 0.1);
}

.topic-option.selected {
  border-color: var(--primary);
  background: rgba(108, 92, 231, 0.2);
  box-shadow: 0 0 20px rgba(108, 92, 231, 0.2);
}

.topic-option .icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.topic-option .name {
  font-weight: 600;
  font-size: 0.95rem;
}

/* Word Count Selector */
.word-count-selector {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 16px 0;
}

.word-count-btn {
  padding: 12px 24px;
  background: var(--bg-input);
  border: 2px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  transition: all 0.2s;
}

.word-count-btn:hover {
  border-color: var(--primary);
}

.word-count-btn.selected {
  border-color: var(--primary);
  background: rgba(108, 92, 231, 0.2);
}

/* Game Mode Cards */
.game-mode-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin: 20px 0;
}

.game-mode-card {
  padding: 20px;
  background: var(--bg-input);
  border: 2px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.game-mode-card:hover {
  border-color: var(--primary);
}

.game-mode-card.selected {
  border-color: var(--primary);
  background: rgba(108, 92, 231, 0.15);
}

.game-mode-card h3 {
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.game-mode-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Navigation */
.nav-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-bar .logo-sm {
  font-size: 1.3rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

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

.nav-bar .user-info .username {
  font-weight: 600;
  color: var(--text-muted);
}

/* Tabs */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-input);
  padding: 4px;
  border-radius: var(--radius);
  margin-bottom: 20px;
}

.tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: all 0.2s;
  border: none;
  background: none;
  color: var(--text);
}

.tab:hover { color: var(--text); }

.tab.active {
  background: var(--primary);
  color: white;
}

/* Tables */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table th, table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

table th {
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

table td {
  font-size: 0.95rem;
}

/* Status badges */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-pending {
  background: rgba(253, 203, 110, 0.2);
  color: var(--warning);
}

.badge-approved {
  background: rgba(0, 184, 148, 0.2);
  color: var(--success);
}

.badge-rejected {
  background: rgba(225, 112, 85, 0.2);
  color: var(--danger);
}

/* Word list manager */
.word-list-manager {
  margin: 20px 0;
}

.word-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.word-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(108, 92, 231, 0.15);
  border: 1px solid rgba(108, 92, 231, 0.3);
  border-radius: 20px;
  font-size: 0.9rem;
}

.word-tag .remove {
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
}

.word-tag .remove:hover { color: var(--danger); }

.add-word-row {
  display: flex;
  gap: 8px;
}

.add-word-row input {
  flex: 1;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.4s ease;
}

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

.slide-in {
  animation: slideIn 0.3s ease;
}

/* Responsive */
@media (max-width: 600px) {
  .container { padding: 16px; }
  .card { padding: 20px; }
  .logo h1 { font-size: 2.2rem; }
  .game-screen .big-word { font-size: 2rem; padding: 24px 16px; }
  .topic-grid { grid-template-columns: 1fr; }
  .guess-input-area { flex-direction: column; }
}
