:root {
  --paper: #F6F1E6;
  --paper-deep: #FBF7EE;
  --card-border: #E2D5B8;
  --ink: #2A2420;
  --ink-soft: #4A4038;
  --muted: #6B5F53;
  --red: #AC3B2A;
  --red-deep: #8B2E21;
  --teal: #2F6E6A;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Work Sans', sans-serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--red);
  text-decoration: none;
}

a:hover {
  color: var(--red-deep);
}

.serif {
  font-family: 'Noto Serif KR', serif;
}

.tag {
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.btn,
.btn-primary {
  padding: 10px 18px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 14px;
  border: 1px solid var(--ink);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
}

.btn:hover {
  background: var(--ink);
  color: var(--paper);
}

.btn-primary {
  border-color: var(--red);
  background: var(--red);
  color: var(--paper);
}

.btn-primary:hover {
  background: var(--red-deep);
}

.btn:disabled,
.btn-primary:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.pill {
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  background: var(--paper-deep);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.card {
  background: var(--paper-deep);
  border: 1px solid var(--card-border);
  border-radius: 6px;
}

.site-header {
  width: 100%;
  border-bottom: 1px solid var(--card-border);
  background: var(--paper);
}

.variant-tab {
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  color: var(--ink);
  background: transparent;
}

.variant-tab:hover {
  background: var(--paper-deep);
  color: var(--ink);
}

.variant-tab.is-active,
.variant-tab.is-active:hover {
  background: var(--ink);
  color: var(--paper);
}

.site-header__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.toolbar {
  width: 100%;
  border-bottom: 1px solid var(--card-border);
  background: var(--paper-deep);
}

.toolbar__inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.turn-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.turn-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.main-layout {
  max-width: 1280px;
  margin: 0 auto;
  padding: 48px 40px;
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  align-items: flex-start;
  width: 100%;
}

.board-column {
  flex: 2 1 480px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.theme-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-swatch {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(42, 36, 32, .25);
  border: 2px solid transparent;
}

.theme-swatch[aria-pressed="true"] {
  border-color: var(--ink);
}

.sound-toggle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  padding: 0;
  margin-left: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--ink);
  background: var(--paper-deep);
  border: 1px solid var(--card-border);
}

.sound-toggle[aria-pressed="true"] {
  color: var(--muted);
}

.board-frame {
  border-radius: 10px;
  padding: 34px;
  box-shadow: 0 22px 44px -22px rgba(42, 36, 32, .4);
  box-sizing: border-box;
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
}

.board-frame svg {
  display: block;
  width: 100%;
  height: auto;
}

.board-point {
  cursor: pointer;
}

.rules-panel {
  flex: 1 1 300px;
  min-width: 280px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.rules-panel ul {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink-soft);
}

.win-banner {
  position: fixed;
  inset: 0;
  background: rgba(42, 36, 32, .55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.win-banner.is-visible {
  display: flex;
}

.win-banner__card {
  background: var(--paper);
  border-radius: 10px;
  padding: 40px 48px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 320px;
}

/* Reserved for a future ad unit (AdSense, per the monetization plan). Keep
   this placeholder's footprint close to a real banner's so the layout
   doesn't jump when a real ad slots in later. */
.ad-slot {
  max-width: 1280px;
  margin: 32px auto 0;
  padding: 0 40px;
  box-sizing: border-box;
}

.ad-slot__box {
  border: 1px dashed var(--card-border);
  border-radius: 6px;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--muted);
}

@media (max-width: 640px) {
  .site-header__inner,
  .toolbar__inner,
  .main-layout {
    padding-left: 16px;
    padding-right: 16px;
  }

  .main-layout {
    padding-top: 24px;
    padding-bottom: 24px;
    gap: 24px;
  }

  .board-frame {
    /* Break out of .main-layout's side padding so the board goes edge to
       edge on phones — on a dense board (Gomoku's 15x15) every extra pixel
       of width matters for how comfortably it can be tapped. */
    max-width: none;
    width: calc(100% + 32px);
    margin-left: -16px;
    margin-right: -16px;
    padding: 6px;
    border-radius: 0;
    box-shadow: none;
  }

  .ad-slot {
    padding: 0 16px;
  }
}
