
:root {
  --bg: #101426;
  --panel: #1b2340;
  --panel2: #29385f;
  --primary: #6379ff;
  --green: #20d58a;
  --text: #ffffff;
  --muted: #9daac9;
  --border: #354264;
  --danger: #ff7777;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, #263663, transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: Arial, sans-serif;
}

button, input {
  font: inherit;
}

button {
  border: none;
  cursor: pointer;
  color: white;
  background: var(--panel2);
  border-radius: 10px;
  padding: 14px;
  transition: .2s;
}

button:hover:not(:disabled) {
  filter: brightness(1.15);
  transform: translateY(-2px);
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
}

input {
  width: 100%;
  padding: 15px;
  margin: 9px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #111a30;
  color: white;
}

input:focus {
  outline: 2px solid var(--primary);
}

.topbar {
  min-height: 70px;
  padding: 12px 6%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #11182a;
  border-bottom: 1px solid var(--border);
}

.logo {
  color: white;
  text-decoration: none;
  font-size: 21px;
  font-weight: 900;
  letter-spacing: 2px;
}

#connection {
  color: var(--green);
  font-size: 13px;
}

.container {
  width: 100%;
  max-width: 1050px;
  padding: 30px 20px;
  margin: auto;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 17px;
  padding: 24px;
  margin-bottom: 20px;
  box-shadow: 0 12px 30px #0002;
}

.login-panel {
  max-width: 480px;
  margin: 55px auto;
}

.hero {
  text-align: center;
  padding: 15px 0 25px;
}

.hero-icon {
  font-size: 55px;
}

.hero h1 {
  font-size: 38px;
  letter-spacing: 5px;
}

.hero p, .muted, .section-title p {
  color: var(--muted);
}

label {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

#login button {
  width: 100%;
  margin: 8px 0;
}

.primary {
  background: linear-gradient(120deg, #536dfe, #885cff);
  font-weight: bold;
}

.separator {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin: 20px 0;
}

.hidden {
  display: none !important;
}

.room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
}

.room-header h2 {
  font-size: 28px;
  letter-spacing: 5px;
  color: #8ca3ff;
}

.small {
  font-size: 12px;
  padding: 10px 14px;
}

.section-title {
  margin: 30px 0 20px;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-bottom: 25px;
}

.game-card {
  min-height: 155px;
  padding: 20px 10px;
  background: linear-gradient(145deg, #263456, #1a2340);
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.game-card span {
  font-size: 36px;
}

.game-card strong {
  font-size: 15px;
  text-align: center;
}

.game-card small {
  color: var(--muted);
  text-align: center;
}

.game-card.selected {
  border: 2px solid var(--green);
  background: #183c38;
}

.new-game {
  background: linear-gradient(145deg, #37305f, #20264a);
  border-color: #7965e9;
}

.player, .score-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 13px;
  background: #111a30;
  border-radius: 9px;
  margin: 7px 0;
}

.game-panel {
  min-height: 280px;
}

.game-button {
  min-width: 60px;
  margin: 5px;
  background: #34446b;
  font-size: 17px;
}

.quiz-options {
  display: grid;
  gap: 10px;
}

.quiz-options button {
  width: 100%;
  text-align: left;
}

.word {
  font-size: 28px;
  letter-spacing: 8px;
  text-align: center;
  margin: 30px 0;
  color: var(--green);
  overflow-wrap: anywhere;
}

.letter-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}

.letter-grid button {
  padding: 12px 2px;
}

.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 340px;
  margin: 20px auto;
}

.ttt-cell {
  aspect-ratio: 1;
  font-size: 42px;
  background: #29385f;
}

.reaction-button {
  width: 100%;
  min-height: 210px;
  font-size: 30px;
  font-weight: 900;
  background: #d89c27;
  color: #18203b;
}

.reaction-button.go {
  background: var(--green);
  color: #092d1d;
}

.result {
  margin: 20px 0;
  padding: 20px;
  border-radius: 12px;
  text-align: center;
  background: #193b36;
  color: var(--green);
  font-size: 20px;
  font-weight: bold;
}

.error {
  color: var(--danger);
  text-align: center;
  min-height: 25px;
  padding: 5px;
}

footer {
  color: var(--muted);
  text-align: center;
  padding: 30px 0;
  font-size: 12px;
}

@media (max-width: 650px) {
  .games-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hero h1 {
    font-size: 29px;
  }

  .panel {
    padding: 17px;
  }

  .letter-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

@media (max-width: 360px) {
  .games-grid {
    grid-template-columns: 1fr;
  }
}
