/* 오목 웹보드 — 먹과 나무결 톤 */
:root {
  --ink: #1a1c19;
  --ink-soft: #2e322c;
  --jade: #2f6b5a;
  --jade-light: #3d8a74;
  --wood-deep: #8b5a2b;
  --wood: #c4a06a;
  --wood-light: #e2c48a;
  --wood-line: #5c3d1e;
  --cream: #f3e6c8;
  --mist: rgba(246, 240, 228, 0.92);
  --shadow: rgba(20, 18, 12, 0.35);
  --black-stone: #1c1c1c;
  --white-stone: #f5f0e6;
  --radius: 18px;
  --font-display: "Noto Serif KR", "Batang", serif;
  --font-ui: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font-ui);
  color: var(--ink);
  background: #14201c;
  overflow-x: hidden;
}

/* 배경 분위기 */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse 80% 60% at 20% 10%, rgba(61, 138, 116, 0.35), transparent 55%),
    radial-gradient(ellipse 70% 50% at 85% 80%, rgba(139, 90, 43, 0.28), transparent 50%),
    linear-gradient(160deg, #0f1a16 0%, #1a2a24 45%, #1c1812 100%);
  animation: ambient-shift 18s ease-in-out infinite alternate;
}

@keyframes ambient-shift {
  from { filter: hue-rotate(0deg) brightness(1); }
  to { filter: hue-rotate(8deg) brightness(1.05); }
}

.app {
  width: min(960px, 100% - 2rem);
  margin: 0 auto;
  padding: 2.5rem 0 3rem;
  display: grid;
  gap: 1.75rem;
  justify-items: center;
}

/* 히어로 — 브랜드 중심 */
.hero {
  text-align: center;
  animation: rise-in 0.7s ease both;
}

.brand {
  margin: 0 0 0.35rem;
  font-size: 0.75rem;
  letter-spacing: 0.35em;
  color: rgba(226, 196, 138, 0.75);
  font-weight: 600;
}

.title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 8vw, 4.2rem);
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--cream);
  text-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
}

.subtitle {
  margin: 0.65rem 0 0;
  max-width: 28rem;
  font-size: 0.95rem;
  line-height: 1.55;
  color: rgba(243, 230, 200, 0.72);
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 설정 패널 */
.panel {
  width: min(420px, 100%);
  display: grid;
  gap: 0.9rem;
  animation: rise-in 0.7s ease 0.1s both;
}

.mode-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  padding: 0.35rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(226, 196, 138, 0.18);
  border-radius: 999px;
}

.mode-btn {
  border: 0;
  background: transparent;
  color: rgba(243, 230, 200, 0.7);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.65rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, transform 0.2s ease;
}

.mode-btn:hover {
  color: var(--cream);
}

.mode-btn.is-active {
  background: linear-gradient(135deg, var(--jade), var(--jade-light));
  color: #fff;
  box-shadow: 0 6px 18px rgba(47, 107, 90, 0.4);
}

.status-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.85rem;
  padding: 0.95rem 1.15rem;
  background: var(--mist);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px var(--shadow);
}

.turn-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  box-shadow:
    inset -3px -3px 6px rgba(255, 255, 255, 0.15),
    inset 3px 3px 8px rgba(0, 0, 0, 0.45),
    0 2px 6px rgba(0, 0, 0, 0.25);
  transition: background 0.3s ease, transform 0.3s ease;
}

.turn-dot[data-player="black"] {
  background: radial-gradient(circle at 35% 30%, #4a4a4a, var(--black-stone) 70%);
}

.turn-dot[data-player="white"] {
  background: radial-gradient(circle at 35% 30%, #fff, var(--white-stone) 70%);
  border: 1px solid rgba(0, 0, 0, 0.12);
}

.turn-dot.is-pulse {
  animation: pulse-dot 0.45s ease;
}

@keyframes pulse-dot {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.18); }
}

.status-label {
  margin: 0;
  font-size: 0.75rem;
  color: rgba(26, 28, 25, 0.55);
  font-weight: 500;
}

.status-value {
  margin: 0.1rem 0 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.move-count {
  text-align: right;
  line-height: 1.1;
}

.move-num {
  display: block;
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--jade);
}

.move-unit {
  font-size: 0.75rem;
  color: rgba(26, 28, 25, 0.5);
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.btn {
  border: 0;
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0.8rem 1rem;
  border-radius: 12px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease, opacity 0.2s ease;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.08);
  color: var(--cream);
  border: 1px solid rgba(226, 196, 138, 0.28);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
}

.btn-primary {
  background: linear-gradient(135deg, #d4a84b, #b8862e);
  color: #1a1408;
  box-shadow: 0 8px 20px rgba(184, 134, 46, 0.35);
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 10px 26px rgba(184, 134, 46, 0.48);
}

/* 오목판 */
.board-wrap {
  width: min(640px, 100%);
  animation: rise-in 0.75s ease 0.18s both;
}

.board-frame {
  position: relative;
  padding: clamp(0.6rem, 2vw, 1rem);
  background:
    linear-gradient(145deg, #d9b57a 0%, #b8894a 40%, #9a6d35 100%);
  border-radius: 22px;
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -2px 8px rgba(80, 45, 10, 0.25);
}

#board {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  cursor: pointer;
  touch-action: none;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.12), transparent 45%),
    linear-gradient(180deg, #e8c88a, #c9a05e);
  box-shadow: inset 0 0 40px rgba(90, 55, 20, 0.15);
}

.win-banner {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 0.35rem;
  text-align: center;
  background: rgba(15, 22, 18, 0.72);
  backdrop-filter: blur(6px);
  border-radius: 22px;
  animation: fade-banner 0.4s ease both;
  padding: 1.5rem;
}

.win-banner[hidden] {
  display: none;
}

@keyframes fade-banner {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.win-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  color: var(--cream);
  letter-spacing: 0.1em;
}

.win-desc {
  margin: 0 0 1rem;
  color: rgba(243, 230, 200, 0.75);
  font-size: 0.95rem;
}

.hint {
  text-align: center;
  animation: rise-in 0.7s ease 0.25s both;
}

.hint p {
  margin: 0;
  font-size: 0.82rem;
  color: rgba(243, 230, 200, 0.45);
}

@media (max-width: 520px) {
  .app {
    width: min(100% - 1.2rem, 960px);
    padding-top: 1.5rem;
    gap: 1.25rem;
  }

  .subtitle {
    font-size: 0.85rem;
  }

  .status-card {
    padding: 0.8rem 1rem;
  }
}
