* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, "Microsoft YaHei", sans-serif;
  background: #f4f6fb;
  transition: background-color 0.5s ease;
}

body.my-turn {
  background: #e6f7e6; /* Greenish background when my turn */
}

.app {
  max-width: 980px;
  margin: 0 auto;
  padding: 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.view {
  width: 100%;
  max-width: 600px;
}

#gameView {
  max-width: 780px;
  text-align: center;
}

.hidden {
  display: none !important;
}

h1 {
  text-align: center;
  color: #333;
  margin-bottom: 24px;
}

.panel {
  background: #fff;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel label {
  font-weight: bold;
  color: #555;
}

.panel input {
  height: 40px;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 16px;
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

button {
  flex: 1;
  height: 40px;
  border: none;
  border-radius: 6px;
  background: #007bff;
  color: #fff;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.2s;
}

button:hover {
  background: #0056b3;
}

button.secondary-btn {
  background: #6c757d;
  max-width: 120px;
  margin: 0 auto;
}

button.secondary-btn:hover {
  background: #5a6268;
}

#lobbyStatus {
  text-align: center;
  min-height: 24px;
  margin: 0;
  font-weight: bold;
}

.timer {
  font-size: 24px;
  font-weight: bold;
  color: #007bff;
  text-align: center;
  margin: 0;
}

.skill-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 400px;
  overflow-y: auto;
}

.skill-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.skill-item:hover {
  background: #f9f9f9;
}

.skill-item.selected {
  border-color: #007bff;
  background: #eef6ff;
  box-shadow: 0 0 4px rgba(0, 123, 255, 0.2);
}

.skill-item input {
  margin-top: 4px;
  height: 16px;
  width: 16px;
  cursor: pointer;
}

.skill-info {
  flex: 1;
}

.skill-name {
  font-weight: bold;
  color: #333;
  margin-bottom: 4px;
  display: block;
}

.skill-desc {
  font-size: 13px;
  color: #666;
  line-height: 1.4;
}

button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* Game Header Layout */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  padding: 16px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
  margin-bottom: 20px;
  width: 100%;
  text-align: left;
}

.player-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border-radius: 8px;
  background: #f9f9f9;
  border: 2px solid transparent;
  transition: all 0.3s ease;
}

.player-card.active {
  border-color: #007bff;
  background: #eef6ff;
  box-shadow: 0 0 8px rgba(0, 123, 255, 0.2);
}

.p-name {
  font-weight: bold;
  font-size: 18px;
  color: #333;
}

.p-score, .p-skill, .p-target {
  font-size: 14px;
  color: #666;
}

.p-score span {
  font-weight: bold;
  color: #d14343;
}

.last-score {
  color: #2a7b2a;
  font-weight: bold;
  margin-left: 4px;
}

.p-skill-desc {
  font-size: 12px;
  color: #888;
  margin-bottom: 2px;
  line-height: 1.2;
}

.vs-info {
  flex: 0 0 140px;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

#gameStatus {
  font-weight: bold;
  color: #555;
  font-size: 14px;
}

#turnIndicator {
  font-size: 24px;
  font-weight: bold;
  color: #007bff;
}

/* Board */
.board {
  display: inline-grid;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.08) 0%, transparent 50%, rgba(0,0,0,0.04) 100%),
    #dcb468;
  padding: 16px;
  gap: 0;
  margin: 0 auto;
  border: 3px solid #b8860b;
  border-radius: 3px;
  box-shadow:
    inset 0 0 12px rgba(0, 0, 0, 0.06),
    0 0 0 5px #a0722a,
    0 0 0 7px #7a5520,
    4px 4px 20px rgba(0, 0, 0, 0.35);
}

.cell {
  width: var(--cell-size, 34px);
  height: var(--cell-size, 34px);
  background: transparent;
  position: relative;
  cursor: pointer;
}

.cell::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 0;
  width: 100%;
  height: 1px;
  background: rgba(60, 30, 0, 0.55);
  transform: translateY(-50%);
  pointer-events: none;
}

.cell::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 1px;
  height: 100%;
  background: rgba(60, 30, 0, 0.55);
  transform: translateX(-50%);
  pointer-events: none;
}

.cell:hover {
  background: radial-gradient(circle at 50% 50%, rgba(0, 0, 0, 0.08), transparent 70%);
}

/* Star points */
.star-dot {
  width: 7px;
  height: 7px;
  background: rgba(40, 20, 0, 0.7);
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1;
  pointer-events: none;
}

/* Last move indicator dot */
.last-move-dot {
  width: 8px;
  height: 8px;
  background: #e03030;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 3;
  pointer-events: none;
  box-shadow: 0 0 3px rgba(224, 48, 48, 0.6);
}

.stone {
  width: var(--stone-size, 30px);
  height: var(--stone-size, 30px);
  border-radius: 50%;
  position: absolute;
  top: var(--stone-offset, 2px);
  left: var(--stone-offset, 2px);
  z-index: 2;
  pointer-events: none;
}

.mine {
  background: radial-gradient(circle at 36% 36%, #555, #222 50%, #000 72%);
  box-shadow:
    1px 2px 3px rgba(0, 0, 0, 0.6),
    inset 0 -1px 2px rgba(255, 255, 255, 0.05);
}

.other {
  background: radial-gradient(circle at 36% 36%, #fff, #f0f0f0 35%, #d4d4d4 70%);
  box-shadow:
    1px 2px 3px rgba(0, 0, 0, 0.35),
    inset 0 1px 3px rgba(255, 255, 255, 0.8);
  border: 1px solid #bbb;
}

/* Footer */
.game-footer {
  margin-top: 20px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
}

.event-log {
  min-height: 24px;
  color: #555;
  font-style: italic;
  padding: 8px;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 6px;
}

/* Mobile Responsive */
@media (max-width: 600px) {
  .app {
    padding: 8px;
  }

  .game-header {
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    margin-bottom: 10px;
  }

  .player-card {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    padding: 8px 10px;
  }

  .p-name {
    font-size: 15px;
    width: 100%;
  }

  .p-score, .p-skill, .p-target {
    font-size: 12px;
  }

  .p-skill-desc {
    font-size: 11px;
    width: 100%;
  }

  .vs-info {
    flex: 0 0 auto;
    width: 100%;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 4px 0;
  }

  #gameStatus {
    font-size: 13px;
  }

  #turnIndicator {
    font-size: 18px;
  }

  .board {
    padding: 10px;
    border-width: 2px;
    box-shadow:
      inset 0 0 8px rgba(0, 0, 0, 0.06),
      0 0 0 3px #a0722a,
      0 0 0 5px #7a5520,
      2px 2px 10px rgba(0, 0, 0, 0.3);
  }

  .star-dot {
    width: 5px;
    height: 5px;
  }

  .last-move-dot {
    width: 6px;
    height: 6px;
  }

  .game-footer {
    margin-top: 10px;
  }

  h1 {
    font-size: 20px;
    margin-bottom: 16px;
  }
}
