:root {
  /* PRIMARY BRAND COLORS */
  --color-primary: #c12675; /* Main brand color - primary buttons, links, highlights */
  --color-primary-light: #d84a95; /* Hover states for primary elements, lighter accents */
  --color-primary-dark: #9a1c5b; /* Active states, pressed buttons, darker emphasis */
  --color-primary-subtle: #f4e6ee; /* Background tints, very light overlays, subtle highlights */

  /* SECONDARY ACCENT COLORS */
  --color-secondary: #8b4a9c; /* Secondary buttons, alternative CTAs, complementary actions */
  --color-secondary-light: #a866b8; /* Hover states for secondary elements */
  --color-secondary-dark: #6d3b7a; /* Active states for secondary elements */

  /* NEUTRAL GRAYS */
  --color-neutral-50: #fafafa; /* Page backgrounds, card backgrounds */
  --color-neutral-100: #f5f5f5; /* Subtle backgrounds, disabled states */
  --color-neutral-200: #e5e5e5; /* Borders, dividers, subtle separators */
  --color-neutral-300: #d4d4d4; /* Input borders, inactive elements */
  --color-neutral-400: #a3a3a3; /* Placeholder text, muted elements */
  --color-neutral-500: #737373; /* Body text, secondary information */
  --color-neutral-600: #525252; /* Headings, important text */
  --color-neutral-700: #404040; /* Primary text, main content */
  --color-neutral-800: #262626; /* High contrast text, emphasis */
  --color-neutral-900: #171717; /* Maximum contrast, headers, navigation */

  /* STATUS & FEEDBACK COLORS */
  --color-success: #059669; /* Success messages, confirmations, positive states */
  --color-success-light: #10b981; /* Success backgrounds, subtle positive indicators */
  --color-warning: #d97706; /* Warning messages, caution states */
  --color-warning-light: #f59e0b; /* Warning backgrounds, attention grabbers */
  --color-error: #dc2626; /* Error messages, destructive actions */
  --color-error-light: #ef4444; /* Error backgrounds, validation errors */
  --color-info: #2563eb; /* Info messages, helpful tips */
  --color-info-light: #3b82f6; /* Info backgrounds, informational highlights */

  /* SPECIAL PURPOSE COLORS */
  --color-gradient-start: #c12675; /* Start of brand gradients */
  --color-gradient-end: #8b4a9c; /* End of brand gradients, creates depth */
  --color-shadow: rgba(193, 38, 117, 0.15); /* Drop shadows with brand tint */
  --color-overlay: rgba(
    193,
    38,
    117,
    0.08
  ); /* Modal overlays, background tints */

  /* TEXT ON COLORED BACKGROUNDS */
  --color-on-primary: #ffffff; /* Text/icons on primary color backgrounds */
  --color-on-secondary: #ffffff; /* Text/icons on secondary color backgrounds */
  --color-on-dark: #ffffff; /* Text/icons on dark backgrounds */
  --color-on-light: #171717; /* Text/icons on light backgrounds */

  /* INTERACTIVE STATES */
  --color-hover-overlay: rgba(
    255,
    255,
    255,
    0.1
  ); /* Light overlay for hover states */
  --color-active-overlay: rgba(
    0,
    0,
    0,
    0.1
  ); /* Dark overlay for active/pressed states */
  --color-focus-ring: rgba(
    193,
    38,
    117,
    0.3
  ); /* Focus rings for accessibility */

  /* BACKGROUND VARIATIONS */
  --color-bg-primary: #ffffff; /* Main page background */
  --color-bg-secondary: #fafafa; /* Secondary sections, cards */
  --color-bg-tertiary: #f5f5f5; /* Sidebar backgrounds, less prominent areas */
  --color-bg-accent: #fdf2f8; /* Very subtle pink background for special sections */
}

body {
  font-family: Arial, sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  margin: 0;
  background-color: var(--color-bg-accent);
  color: var(--color-on-light);
}

#game-container {
  background-color: var(--color-bg-primary);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 0 20px var(--color-shadow);
  text-align: center;
}

#title-box {
  font-size: 1.25em;
  padding-top: 0.25em;
  padding-bottom: 0.25em;
}

#game-board {
  position: relative;
  width: 82svw;
  max-width: 480px;
  aspect-ratio: 1/1;
  background-color: var(--color-bg-tertiary);
  border: 2px solid var(--color-neutral-700);
}

#game-board::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image:
    linear-gradient(to right, var(--color-neutral-400) 1px, transparent 1px),
    linear-gradient(to bottom, var(--color-neutral-400) 1px, transparent 1px);
  background-size: 7.142857142857142% 7.142857142857142%;
  background-position: -1px -1px;
  pointer-events: none;
}

.intersection {
  position: absolute;
  width: 6.6666666666%;
  height: 6.6666666666%;
  margin-left: -3.3333333333%;
  margin-top: -3.3333333333%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 1;
}

.intersection:hover {
  background-color: var(--color-hover-overlay);
}

.stone-black-heart,
.stone-white-heart {
  position: relative;
  width: 24px;
  height: 24px;
  margin: auto;
  overflow: hidden;
}

.stone-black-heart::before,
.stone-black-heart::after,
.stone-white-heart::before,
.stone-white-heart::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 20px;
  border-radius: 50% 50% 0 0;
  border: 1px solid var(--color-neutral-900);
  box-sizing: border-box;
  transform: rotate(-45deg);
  transform-origin: 0 100%;
  top: 0;
  left: 12px;
}

.last-move.stone-white-heart::after,
.last-move.stone-black-heart::after,
.last-move.stone-white-heart::before,
.last-move.stone-black-heart::before {
  border: 2px solid var(--color-info) !important;
}

.stone-black-heart::after,
.stone-white-heart::after {
  left: 0;
  transform: rotate(45deg);
  transform-origin: 100% 100%;
}

.stone-black-heart::before,
.stone-black-heart::after {
  background-color: var(--color-primary-light);
}

.stone-white-heart::before,
.stone-white-heart::after {
  background-color: var(--color-on-primary);
}

.player-name {
  font-weight: bold;
}

.player-name.player-black {
  color: var(--color-primary-light);
}

.player-name.player-white {
  color: var(--color-on-primary);
  text-shadow:
    -1px -1px 0 var(--color-neutral-900),
    1px -1px 0 var(--color-neutral-900),
    -1px 1px 0 var(--color-neutral-900),
    1px 1px 0 var(--color-neutral-900);
}

.player-name.player-to-play {
  border: 2px solid var(--color-focus-ring);
  border-radius: 10px;
  padding: 2px;
}

#game-link-container {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 40px;
  margin-top: 20px;
}

.icon {
  width: 1.4em;
  height: 1.4em;
  vertical-align: middle;
}

#button-box button {
  display: flex;
  justify-content: center;
  align-items: center;
  transition: opacity 0.3s ease;
  padding: 8px 15px;
  border-radius: 5px;
  white-space: nowrap;
  border: none;
  cursor: pointer;
  font-size: 1em;
  flex-grow: 1;
  flex-basis: 0;
}

#button-box {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

#resign-button {
  background-color: var(--color-primary);
  color: var(--color-on-primary);
}

#resign-button:hover {
  background-color: var(--color-primary-light);
}

#copy-link-button {
  background-color: var(--color-primary);
  color: var(--color-on-primary);
}

#copy-link-button.copied-state {
  background-color: var(--color-success);
}

#takeback-button {
  background-color: var(--color-info);
  color: var(--color-on-primary);
}

#takeback-button:hover {
  background-color: var(--color-info-light);
}

#draw-button {
  background-color: var(--color-secondary);
  color: var(--color-on-secondary);
}

#draw-button:hover {
  background-color: var(--color-secondary-light);
}

.accept-button {
  background-color: var(--color-success);
  color: var(--color-on-primary);
}

.accept-button:hover {
  background-color: var(--color-success-light);
}

.decline-button {
  background-color: var(--color-error);
  color: var(--color-on-primary);
}

.decline-button:hover {
  background-color: var(--color-error-light);
}

.player-profile-box {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  background-color: var(--color-neutral-100);
  color: var(--color-on-light);
  padding: 8px 12px;
  border-radius: 20px;
  box-shadow: 0 2px 4px var(--color-shadow);
}

.player-profile-box .edit-icon {
  cursor: pointer;
  width: 1.4em;
  height: 1.4em;
  opacity: 0.6;
  transition: opacity 0.3s ease;
}

.player-profile-box .edit-icon:hover {
  opacity: 1;
}

.player-profile-box #display-name-edit-controls {
  display: flex;
  gap: 5px;
  align-items: center;
}

.player-profile-box #display-name-input {
  border: 1px solid var(--color-neutral-300);
  border-radius: 5px;
  padding: 5px 8px;
  font-size: 1em;
  width: 120px;
}

.player-profile-box button {
  background-color: var(--color-success);
  color: var(--color-on-primary);
  border: none;
  border-radius: 5px;
  padding: 5px 10px;
  cursor: pointer;
  font-size: 0.9em;
  transition: background-color 0.3s ease;
}

.player-profile-box button:hover {
  background-color: var(--color-success-light);
}

.player-profile-box button#cancel-display-name-button {
  background-color: var(--color-error);
}

.player-profile-box button#cancel-display-name-button:hover {
  background-color: var(--color-error-light);
}
