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

body {
  background: #000;
  color: #eee;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  justify-content: center;
  height: 100vh;
  padding: 10px 20px 0 20px;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: 100%;
  max-width: 540px;
  height: 100%;
}

.hidden { display: none !important; }

#game-view {
  width: 100%;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

#bottom-space {
  margin-top: 25px;
  display: flex;
  justify-content: center;
}

#info-box {
  width: 320px;
  height: 270px;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#info-img {
  width: 300px;
  height: 250px;
  border-radius: 8px;
  filter: grayscale(100%);
  object-fit: cover;
}

#top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 40px;
}

#player-name {
  font-size: 0.9rem;
  color: #4a9d5b;
  cursor: pointer;
}

#player-name:hover {
  text-decoration: underline;
}

#meta-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 5px;
  width: 100%;
  aspect-ratio: 1;
  background: transparent;
  border-radius: 8px;
  padding: 1px;
}

.small-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 2px;
  background: #000;
  border-radius: 4px;
  padding: 2px;
  position: relative;
  transition: box-shadow 0.15s;
  border: 1px solid #333;
  outline: 1px solid #333;
}

.small-board.active {
  border: 1px solid transparent;
  outline: 1px solid #e89830;
}

/* Win-line markers */
.cell.win-blue::before,
.cell.win-red::before,
.cell.draw-marker::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 15%;
  height: 15%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: white;
  pointer-events: none;
  z-index: 1;
}

.cell {
  background: #333;
  border-radius: 3px;
  position: relative;
  cursor: default;
  transition: background 0.1s;
}

.cell.blue {
  background: #4a9d5b;
  border-radius: 8px;
}

.cell.red {
  background: #d94a4a;
  border-radius: 8px;
}

.cell.legal {
  cursor: pointer;
}

.cell.legal:hover {
  border: 1px solid #e89830;
}

/* Last-move marker */
.cell.last-move::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30%;
  height: 30%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 2px solid white;
  pointer-events: none;
}

#level {
  font-size: 0.9rem;
  color: #666;
}

#new-game {
  padding: 6px 20px;
  font-size: 0.9rem;
  border: none;
  border-radius: 6px;
  background: #4a9d5b;
  color: white;
  cursor: pointer;
  transition: background 0.15s;
}

#new-game:hover {
  background: #3d8a4d;
}

#new-game.btn-hidden {
  visibility: hidden;
}

/* Players view */
#players-view {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding-top: 40px;
}

#players-header {
  font-size: 1.2rem;
  color: #888;
}

#players-list {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.player-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #1a1a1a;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.player-row:hover {
  background: #2a2a2a;
}

.player-row-name {
  color: #4a9d5b;
  font-size: 1rem;
}

.player-row-info {
  color: #666;
  font-size: 0.8rem;
}

#new-player-btn {
  padding: 10px 28px;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  background: #4a9d5b;
  color: white;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 8px;
}

#new-player-btn:hover {
  background: #3d8a4d;
}
