:root {
  font-family: ui-rounded, "Segoe UI", system-ui, sans-serif;
  color: #263b49;
  background: #f8f5ee;
  font-synthesis: none;
  --red: #d84e43;
  --blue: #167e92;
  --ink: #263b49;
  --line: #dce1df;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background-image: radial-gradient(#9da9a520 0.8px, transparent 0.8px);
  background-size: 18px 18px;
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
}
button:focus-visible,
input:focus-visible,
a:focus-visible {
  outline: 3px solid #daa529;
  outline-offset: 4px;
}
button {
  color: inherit;
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
main {
  max-width: 1200px;
  margin: auto;
  padding: 34px 36px 26px;
}
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 42px;
}
.logo {
  font-size: 36px;
  font-weight: 850;
  letter-spacing: -2px;
  display: flex;
  align-items: center;
  gap: 11px;
}
.logo-mark {
  display: grid;
  grid-template-columns: repeat(2, 8px);
  gap: 4px;
  transform: rotate(-12deg);
}
.logo-mark i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
}
.logo-mark i:nth-child(even) {
  background: var(--blue);
}
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 11px;
  font-weight: 800;
  color: #75827e;
}
.text-button {
  border: 0;
  background: transparent;
  padding: 12px 4px;
  font-weight: 650;
}
.welcome {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
  align-items: center;
  max-width: 1000px;
  margin: 54px auto;
}
.hero h1 {
  font-size: clamp(48px, 6vw, 76px);
  line-height: 1.04;
  letter-spacing: -3.5px;
  margin: 16px 0 24px;
  max-width: 490px;
}
.hero p {
  font-size: 18px;
  line-height: 1.7;
  color: #627271;
  max-width: 360px;
}
.sketch {
  margin-top: 32px;
  width: 260px;
  height: 155px;
  transform: rotate(-5deg);
}
.setup {
  background: #fffdf8;
  border: 1px solid #e4e3d9;
  border-radius: 24px;
  padding: 30px;
  box-shadow: 0 12px 40px #263b4907;
}
.setup h2 {
  font-size: 26px;
  letter-spacing: -0.7px;
  margin: 0 0 23px;
}
.choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.choice {
  background: transparent;
  border: 1.5px solid #e1e3db;
  border-radius: 15px;
  padding: 19px 14px;
  text-align: left;
  min-height: 140px;
}
.choice.active {
  border-color: var(--ink);
  background: #f1f5ed;
  box-shadow: 0 0 0 1px var(--ink);
}
.choice .icon {
  font-size: 27px;
  display: block;
  margin-bottom: 10px;
}
.choice strong {
  display: block;
  font-size: 15px;
}
.choice small {
  display: block;
  font-size: 12px;
  line-height: 1.5;
  color: #73817c;
  margin-top: 6px;
}
fieldset {
  padding: 0;
  margin: 24px 0;
  border: 0;
}
legend,
label {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
  display: block;
}
.segments {
  display: flex;
  gap: 8px;
}
.segments button {
  flex: 1;
  background: transparent;
  border: 1px solid #dfe2d8;
  border-radius: 10px;
  padding: 11px 8px;
  font-size: 13px;
  font-weight: 650;
}
.segments button.active {
  background: var(--ink);
  color: white;
  border-color: var(--ink);
}
.primary {
  border: 0;
  border-radius: 12px;
  background: var(--ink);
  color: white;
  padding: 15px 22px;
  font-weight: 700;
  min-height: 48px;
}
.full {
  width: 100%;
}
.secondary {
  border: 1px solid #d8ded6;
  background: #fffdf8;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 650;
  min-height: 44px;
}
.join-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.join-row input {
  min-width: 0;
  width: 100%;
  border: 1px solid #d8ded6;
  border-radius: 10px;
  padding: 12px;
  background: white;
}
footer {
  text-align: center;
  font-size: 12px;
  color: #85908a;
  margin-top: 50px;
}
.game-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 22px;
}
.game-top h1 {
  font-size: 30px;
  letter-spacing: -1px;
  margin: 0 0 6px;
}
.muted {
  font-size: 13px;
  color: #71817c;
}
.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 230px;
  gap: 26px;
  align-items: start;
}
.board-card {
  min-width: 0;
  background: #fffdf9;
  border: 1px solid #e0e2d9;
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 8px 26px #253c4705;
}
.board-scroll {
  overflow: auto;
  max-height: 70vh;
  overscroll-behavior: contain;
  scrollbar-color: #b4c0b7 transparent;
  border-radius: 10px;
}
.board {
  position: relative;
  width: var(--board-size);
  height: var(--board-size);
  isolation: isolate;
}
.grid-svg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  width: 100%;
  height: 100%;
  z-index: 0;
}
.cells {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(var(--size), 44px);
  grid-template-rows: repeat(var(--size), 44px);
}
.cell {
  position: relative;
  border: 0;
  padding: 0;
  background: transparent;
  border-radius: 8px;
  width: 44px;
  height: 44px;
}
.cell::before {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #b9c8c6;
}
.cell:hover {
  background: #263b4909;
}
.cell.p1::before,
.cell.p2::before {
  width: 15px;
  height: 15px;
  background: var(--red);
  box-shadow: 0 2px 2px #263b4920;
}
.cell.p2::before {
  background: var(--blue);
  border: 3px solid #fffdf9;
  outline: 3px solid var(--blue);
  width: 11px;
  height: 11px;
}
.cell.captured::before {
  opacity: 0.4;
}
.board-note {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
  color: #7c8b83;
  margin-top: 15px;
}
.score-card {
  border: 1px solid #e0e2d9;
  border-radius: 16px;
  background: #fffdf8;
  padding: 19px;
  margin-bottom: 12px;
}
.score-card.current {
  border-color: var(--ink);
  box-shadow: 0 0 0 1px var(--ink);
}
.player-label {
  font-size: 13px;
  font-weight: 750;
  display: flex;
  gap: 8px;
  align-items: center;
}
.dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--red);
}
.dot.blue {
  background: var(--blue);
  box-shadow: inset 0 0 0 3px #fffdf8;
  border: 2px solid var(--blue);
}
.score {
  font-size: 46px;
  line-height: 1.2;
  font-weight: 750;
  letter-spacing: -2px;
  margin-top: 10px;
}
.score-card small {
  font-size: 11px;
  color: #7c8b83;
}
.aside-actions {
  display: grid;
  gap: 9px;
  margin-top: 22px;
}
.help-note {
  font-size: 12px;
  line-height: 1.7;
  color: #7a8982;
  margin: 20px 3px;
}
.status-pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  background: #eaf0e5;
  padding: 9px 13px;
  border-radius: 30px;
  font-size: 12px;
  font-weight: 650;
}
.status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  background: #738d5a;
  border-radius: 50%;
}
.invite {
  background: #edf1e8;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 20px;
}
.invite p {
  font-size: 12px;
  line-height: 1.6;
  word-break: break-all;
}
.invite input {
  width: 100%;
  padding: 9px;
  border: 1px solid #d8ded6;
  border-radius: 8px;
  font-size: 11px;
  margin-bottom: 9px;
}
.invite-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.notice {
  color: #a04632;
  font-size: 13px;
  line-height: 1.5;
  min-height: 18px;
  margin-top: 12px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
dialog {
  border: 1px solid #dce1d7;
  border-radius: 22px;
  max-width: 460px;
  padding: 30px;
  color: var(--ink);
  background: #fffdf8;
}
dialog::backdrop {
  background: #1f344a55;
  backdrop-filter: blur(3px);
}
dialog p {
  line-height: 1.8;
  color: #65756e;
}
dialog h2 {
  font-size: 27px;
  letter-spacing: -0.8px;
}
.join-screen {
  max-width: 460px;
  margin: 90px auto;
}
.end-banner {
  background: #eaf0e5;
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-weight: 750;
}
@media (max-width: 800px) {
  main {
    padding: 22px 20px;
  }
  .welcome {
    gap: 28px;
    margin: 25px auto;
    grid-template-columns: 1fr;
  }
  .hero {
    text-align: center;
  }
  .hero h1 {
    font-size: 50px;
    max-width: none;
    margin: 16px 0;
  }
  .hero p {
    max-width: 480px;
    margin: auto;
    font-size: 16px;
  }
  .sketch {
    display: none;
  }
  .setup {
    max-width: 500px;
    width: 100%;
    margin: auto;
  }
  .masthead {
    margin-bottom: 24px;
  }
  .game-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .sidebar {
    min-width: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
    grid-row: 1;
  }
  .score-card {
    margin: 0;
    padding: 12px 16px;
  }
  .score {
    font-size: 30px;
  }
  .aside-actions,
  .help-note {
    grid-column: 1/-1;
    margin: 0;
  }
  .aside-actions {
    display: flex;
  }
  .aside-actions button {
    flex: 1;
  }
  .help-note {
    display: none;
  }
  .board-card {
    padding: 12px;
  }
  .game-top {
    align-items: start;
  }
  .game-top h1 {
    font-size: 25px;
  }
  .status-pill {
    font-size: 11px;
    max-width: 180px;
  }
  .board-scroll {
    max-height: 63vh;
  }
  .board-note span:last-child {
    display: none;
  }
  footer {
    margin-top: 26px;
  }
}
@media (prefers-reduced-motion: no-preference) {
  button {
    transition:
      background 0.15s,
      transform 0.15s;
  }
  .primary:hover {
    background: #39596a;
    transform: translateY(-1px);
  }
}

.cell.captured {
  background: repeating-linear-gradient(
    135deg,
    #607b7310 0 2px,
    transparent 2px 8px
  );
}
.cell.captured::after {
  content: "";
  position: absolute;
  left: 15px;
  top: 21px;
  width: 14px;
  height: 2px;
  background: #7d8d85;
  transform: rotate(-45deg);
  pointer-events: none;
}
.cell.captured:not(.p1):not(.p2)::before {
  width: 14px;
  height: 2px;
  border-radius: 0;
  background: #7d8d85;
  transform: translate(-50%, -50%) rotate(45deg);
  opacity: 0.6;
}

.practice-banner {
  padding: 18px 22px;
  margin-bottom: 20px;
  border: 1px solid #c6d6bd;
  border-radius: 16px;
  background: #eef3e9;
}
.practice-banner p {
  margin: 0 0 12px;
  font-weight: 650;
}
.practice-banner label {
  display: flex;
  align-items: center;
  gap: 8px;
}
.practice-banner small {
  display: block;
  color: #63776c;
  font-size: 12px;
}
.practice-banner input {
  width: 20px;
  height: 20px;
  accent-color: #263b49;
}
