.game-screen {
  width: 100%;
  align-self: stretch;
}

.game-header {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 12px !important;
  border-bottom: 1px solid var(--line);
}

.brand--compact .brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
}

.game-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: color-mix(in srgb, var(--paper) 86%, transparent);
  transition: color 150ms ease, border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.icon-button:hover {
  color: var(--blue);
  border-color: var(--blue);
  background: var(--color-secondary-soft);
  transform: translateY(-1px);
}

.icon-button svg {
  width: 20px;
  height: 20px;
}

.match-bar {
  width: min(780px, 100%);
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(150px, auto) minmax(170px, 1fr);
  align-items: stretch;
  gap: 10px;
  margin: 14px auto 10px;
}

.player-card,
.turn-status {
  min-height: 62px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
}

.player-card {
  gap: 10px;
  padding: 8px 11px;
  opacity: 0.64;
  transition: opacity 160ms ease, border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.player-card--two {
  justify-content: flex-end;
  text-align: right;
}

.player-card.is-active {
  opacity: 1;
  border-color: color-mix(in srgb, var(--player-color) 54%, transparent);
  background: color-mix(in srgb, var(--player-color) 9%, var(--paper));
  transform: translateY(-1px);
}

.player-card--one { --player-color: var(--coral); }
.player-card--two { --player-color: var(--blue); }

.player-swatch {
  width: 12px;
  height: 28px;
  flex: none;
  border-radius: 999px;
  background: var(--player-color);
}

.player-card span,
.player-card small,
.player-card strong {
  display: block;
}

.player-card small {
  color: var(--ink-muted);
  font-size: 0.56rem;
  font-weight: 850;
  letter-spacing: 0.11em;
}

.player-card strong {
  margin-top: 1px;
  font-size: 0.75rem;
}

.player-card b {
  margin-left: auto;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
  font-weight: 500;
}

.player-card--two b {
  margin-right: auto;
  margin-left: 0;
}

.turn-status {
  min-width: 150px;
  flex-direction: column;
  justify-content: center;
  position: relative;
  padding: 8px 16px;
  text-align: center;
}

.turn-status__dot {
  position: absolute;
  top: 8px;
  left: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--coral);
}

.turn-status.is-player-two .turn-status__dot {
  background: var(--blue);
}

.turn-status.is-thinking .turn-status__dot {
  animation: pulse 900ms ease-in-out infinite;
}

.turn-status strong {
  font-size: 0.75rem;
}

.turn-status small {
  margin-top: 3px;
  color: var(--ink-muted);
  font-size: 0.58rem;
}

.board-stage {
  width: min(610px, 100%);
  margin: 0 auto;
  padding: clamp(9px, 1.7vw, 14px);
  border: 1px solid var(--line);
  border-radius: clamp(20px, 3vw, 28px);
  background: color-mix(in srgb, var(--paper-raised) 87%, transparent);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(8px);
}

.game-screen[data-size="3"] .board-stage { width: min(430px, 100%); }
.game-screen[data-size="5"] .board-stage { width: min(520px, 100%); }
.game-screen[data-size="7"] .board-stage { width: min(590px, 100%); }

.dots-board {
  --boxes: 3;
  --dot-size: 14px;
  display: grid;
  grid-template-columns: repeat(var(--boxes), var(--dot-size) minmax(0, 1fr)) var(--dot-size);
  grid-template-rows: repeat(var(--boxes), var(--dot-size) minmax(0, 1fr)) var(--dot-size);
  width: 100%;
  aspect-ratio: 1;
  padding: 5px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--color-canvas) 76%, white);
  touch-action: manipulation;
}

.dots-board[data-size="5"] {
  --dot-size: 12px;
}

.dots-board[data-size="7"] {
  --dot-size: 10px;
}

.board-dot {
  position: relative;
  z-index: 4;
  width: var(--dot-size);
  height: var(--dot-size);
  align-self: center;
  justify-self: center;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-canvas) 76%, white);
  pointer-events: none;
}

.board-box {
  position: relative;
  z-index: 0;
  display: grid;
  place-items: center;
  margin: 3px;
  border-radius: clamp(6px, 1.5vw, 13px);
  color: transparent;
  background: color-mix(in srgb, var(--ink) 2.8%, transparent);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(0.72rem, 4vw, 1.55rem);
  font-weight: 600;
  transition: color 180ms ease, background 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.board-box.is-player-one {
  color: color-mix(in srgb, var(--coral) 82%, var(--ink));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--coral) 23%, white), color-mix(in srgb, var(--coral) 10%, white));
}

.board-box.is-player-two {
  color: var(--blue);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--blue) 20%, white), color-mix(in srgb, var(--blue) 8%, white));
}

.board-box.is-new {
  animation: claim-box 360ms cubic-bezier(0.2, 0.85, 0.25, 1.2) both;
}

.edge {
  position: relative;
  z-index: 2;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
}

.edge::before {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ink) 13%, transparent);
  transition: background 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.edge--horizontal::before {
  top: 50%;
  right: 2px;
  left: 2px;
  height: clamp(4px, 0.9vw, 7px);
  transform: translateY(-50%) scaleX(0.78);
}

.edge--vertical::before {
  top: 2px;
  bottom: 2px;
  left: 50%;
  width: clamp(4px, 0.9vw, 7px);
  transform: translateX(-50%) scaleY(0.78);
}

.edge:hover:not(:disabled)::before {
  background: color-mix(in srgb, var(--current-player-color, var(--coral)) 62%, transparent);
}

.edge--horizontal:hover:not(:disabled)::before {
  transform: translateY(-50%) scaleX(0.96);
}

.edge--vertical:hover:not(:disabled)::before {
  transform: translateX(-50%) scaleY(0.96);
}

.edge:focus-visible {
  z-index: 6;
  outline: 3px solid var(--blue);
  outline-offset: 1px;
}

.edge.is-player-one::before,
.edge.is-player-two::before {
  box-shadow: 0 2px 8px color-mix(in srgb, currentColor 22%, transparent);
}

.edge.is-player-one {
  color: var(--coral);
}

.edge.is-player-two {
  color: var(--blue);
}

.edge.is-player-one::before {
  background: var(--coral);
}

.edge.is-player-two::before {
  background: var(--blue);
}

.edge--horizontal.is-player-one::before,
.edge--horizontal.is-player-two::before {
  transform: translateY(-50%) scaleX(1);
}

.edge--vertical.is-player-one::before,
.edge--vertical.is-player-two::before {
  transform: translateX(-50%) scaleY(1);
}

.edge.is-last::before {
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent);
}

.edge:disabled {
  cursor: default;
}

.dots-board.is-locked .edge:not(:disabled) {
  cursor: wait;
}

.game-footer {
  width: min(610px, 100%);
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 7px auto 0;
}

.game-footer p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.68rem;
}

.text-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 8px;
  color: var(--ink-muted);
  background: transparent;
  font-size: 0.7rem;
  font-weight: 800;
}

.text-button:hover {
  color: var(--coral);
}

.text-button svg {
  width: 17px;
  height: 17px;
}

@keyframes claim-box {
  0% { opacity: 0.3; transform: scale(0.72); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes pulse {
  0%, 100% { opacity: 0.35; transform: scale(0.75); }
  50% { opacity: 1; transform: scale(1.15); }
}
