/* ============================================================
   Gomoku - Game Styles
   ============================================================ */

:root {
  --black-color: #171717;
  --white-color: #f6edda;
  --board-bg: #d1a164;
  --board-border: #5b371d;
  --overlay-bg: rgba(22, 25, 23, 0.8);
  --surface: #f5f1e8;
  --surface-border: #d7c8ae;
  --ink-muted: #6f675c;
}

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

body {
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  background-color: #26302c;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(255, 255, 255, 0.018) 0,
    rgba(255, 255, 255, 0.018) 1px,
    transparent 1px,
    transparent 5px
  );
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: #333;
}

/* ---- Common Buttons ---- */
.btn {
  padding: 12px 32px;
  font-size: 18px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition:
    transform 0.15s,
    box-shadow 0.15s;
  font-family: inherit;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn:active {
  transform: translateY(0);
}

/* ---- Overlay ---- */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--overlay-bg);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.overlay-content {
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 8px;
  padding: 40px 48px;
  text-align: center;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* ---- Mode Selection ---- */
.game-title {
  font-size: 42px;
  margin-bottom: 4px;
  color: #2e2a25;
  font-family: "STKaiti", "KaiTi", "楷体", serif;
}

.subtitle {
  font-size: 16px;
  color: var(--ink-muted);
  margin-bottom: 32px;
}

.mode-buttons {
  display: flex;
  gap: 12px;
  flex-wrap: nowrap;
  justify-content: center;
}

.mode-buttons .btn {
  padding: 10px 20px;
  font-size: 16px;
}

.btn-pvp {
  background: #302b25;
  color: #fff;
}

.btn-pve {
  background: #fffdf8;
  color: #302b25;
  border: 2px solid #55473a;
}

.btn-online {
  background: #315f52;
  color: #fff;
}

/* ---- Rock Paper Scissors ---- */
#rps-section h2 {
  margin-bottom: 24px;
  color: #333;
}

.rps-player {
  margin-bottom: 20px;
}

.rps-player h3 {
  margin-bottom: 10px;
  font-size: 16px;
  color: #555;
}

.rps-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn-rps {
  background: #fff;
  border: 2px solid #ccc;
  padding: 10px 18px;
  font-size: 16px;
  border-radius: 8px;
}

@media (hover: hover) {
  .btn-rps:hover {
    border-color: #333;
    background: #f5f5f5;
  }
}

.btn-rps.selected {
  border-color: #ffd600;
  background: #fff9c4;
}

.rps-status {
  margin-top: 8px;
  font-size: 14px;
  color: #888;
}

.rps-result {
  margin-top: 16px;
  font-size: 18px;
  font-weight: bold;
  min-height: 28px;
}

/* ---- Game Area ---- */
#game-area {
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 820px;
}

#game-main {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  justify-content: center;
}

/* ---- Status Bar ---- */
#status-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 24px;
  justify-content: center;
  margin-bottom: 16px;
  padding: 12px 20px;
  background: rgba(248, 245, 237, 0.96);
  border: 1px solid rgba(215, 200, 174, 0.9);
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(12, 18, 15, 0.2);
  width: 100%;
}

.status-item {
  font-size: 15px;
}

.label {
  color: var(--ink-muted);
}

.team-indicator {
  font-weight: bold;
}

.text-black {
  color: #0a0a0a;
}

.text-white-stone {
  color: #999;
}

/* ---- Board ---- */
#board-canvas {
  display: block;
  border: 1px solid rgba(75, 45, 24, 0.8);
  border-radius: 4px;
  box-shadow:
    0 2px 0 rgba(255, 233, 190, 0.18) inset,
    0 14px 30px rgba(8, 13, 11, 0.38);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  user-select: none;
  max-width: 100%;
  height: auto;
}

/* ---- Rules Panel ---- */
#rules-panel {
  background: rgba(248, 245, 237, 0.96);
  border: 1px solid rgba(215, 200, 174, 0.9);
  border-radius: 6px;
  padding: 16px;
  box-shadow: 0 8px 22px rgba(12, 18, 15, 0.22);
  width: 220px;
  font-size: 13px;
  line-height: 1.6;
}

#rules-panel h3 {
  font-size: 16px;
  margin-bottom: 12px;
  color: #333;
  border-bottom: 2px solid #8b6137;
  padding-bottom: 8px;
}

.rule-section {
  margin-bottom: 12px;
}

.rule-section h4 {
  font-size: 13px;
  color: #4d4439;
  margin-bottom: 4px;
}

.rule-section ul {
  list-style: none;
  padding-left: 4px;
}

.rule-section li {
  color: #6c6256;
  padding: 1px 0;
}

/* ---- Message Area ---- */
#message {
  margin-top: 12px;
  padding: 10px 20px;
  font-size: 15px;
  color: #514a41;
  text-align: center;
  min-height: 40px;
  background: rgba(248, 245, 237, 0.96);
  border: 1px solid rgba(215, 200, 174, 0.9);
  border-radius: 6px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  width: 100%;
  max-width: 480px;
}

#message.error {
  color: #e53935;
  background: rgba(229, 57, 53, 0.1);
}

#message.info {
  color: #245844;
  background: rgba(224, 239, 230, 0.96);
}

/* ---- Game Over ---- */
#game-over .overlay-content h2 {
  font-size: 28px;
  margin-bottom: 24px;
}

.btn-restart {
  background: #302b25;
  color: #fff;
  font-size: 18px;
}

/* ---- Responsive ---- */
@media (max-width: 700px) {
  .overlay-content {
    padding: 24px 16px;
  }

  .game-title {
    font-size: 32px;
  }

  .btn {
    padding: 10px 22px;
    font-size: 16px;
  }

  .mode-buttons {
    flex-direction: column;
    gap: 12px;
  }

  .rps-buttons {
    flex-direction: column;
    align-items: center;
  }

  #game-area {
    padding: 10px;
  }

  #game-main {
    flex-direction: column;
    align-items: center;
  }

  #rules-panel {
    width: 100%;
    max-width: 480px;
  }

  #status-bar {
    gap: 8px 16px;
    padding: 10px 12px;
  }

  .status-item {
    font-size: 13px;
  }
}
