body {
  background: #111;
  color: #fff;
  font-family: Arial, sans-serif;
  text-align: center;
  margin: 0;
  padding: 10px;
  touch-action: manipulation;
}

h1 {
  margin: 10px 0;
  font-size: 24px;
}

#board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 8px;
  max-width: 400px;
  margin: 15px auto;
  position: relative;
  aspect-ratio: 1;
}

.cell {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 52px;
  font-weight: bold;
  background: #222;
  cursor: pointer;
  transition: background 0.2s;
  user-select: none;
  border-radius: 8px;
  min-height: 80px;
}
.cell:active { background: #333; }
.cell.X { color: #00d8ff; }
.cell.O { color: #ff6666; }

.controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: 400px;
  margin: 0 auto;
}

.controls button {
  padding: 16px 20px;
  background: #333;
  color: #fff;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 18px;
  min-height: 55px;
}
.controls button:active {
  background: #555;
}

.room-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 15px 0;
}

.room-item {
  padding: 15px;
  background: #222;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
  text-align: left;
}
.room-item:active {
  background: #333;
}

.room-creator {
  font-size: 14px;
  color: #ccc;
  margin-top: 5px;
}

#status {
  font-size: 18px;
  margin: 15px 0;
  min-height: 25px;
}

.room-name {
  margin: 10px 0;
  font-size: 16px;
  color: #ccc;
}

.win-line {
  position: absolute;
  height: 8px;
  background: #ff3b3b;
  transform-origin: left center;
  border-radius: 4px;
  z-index: 10;
  box-shadow: 0 0 15px rgba(255, 0, 0, 0.8);
}

.error {
  color: #ff4444;
  background: #332222;
  padding: 15px;
  border-radius: 10px;
  margin: 10px 0;
}

.loading {
  opacity: 0.7;
  pointer-events: none;
}

@media (max-width: 400px) {
  h1 { font-size: 20px; }
  .cell { font-size: 48px; min-height: 70px; }
  .controls button { padding: 14px 18px; font-size: 16px; }
}
#board {
  position: relative;
}

.winner-line {
  position: absolute;
  height: 4px;
  background: #ff3b30;
  border-radius: 2px;
  transform-origin: 0 50%;
  z-index: 10;
}
