:root {
  --bg: #fff7ef;
  --paper: #fffdf8;
  --ink: #1d2433;
  --muted: #697083;
  --panel: rgba(255, 253, 248, 0.9);
  --line: #243044;
  --dark-square: #2f6f73;
  --light-square: #ffd89a;
  --red: #ff5a67;
  --black: #232635;
  --gold: #ffd34f;
  --green: #16a39b;
  --blue: #3767d6;
  --pink: #ff8db3;
  --shadow: 8px 8px 0 rgba(29, 36, 51, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Trebuchet MS", "Segoe UI", Verdana, sans-serif;
  background:
    linear-gradient(rgba(29, 36, 51, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 36, 51, 0.035) 1px, transparent 1px),
    linear-gradient(135deg, #fffaf5 0%, var(--bg) 52%, #f1fff9 100%);
  background-size:
    24px 24px,
    24px 24px,
    auto;
}

button,
textarea,
select {
  font: inherit;
}

button {
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 0.72rem 1rem;
  color: var(--ink);
  background: #fff1b8;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

button:hover:not(:disabled) {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 rgba(29, 36, 51, 0.18);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.primary {
  color: #ffffff;
  background: var(--green);
}

textarea,
select {
  width: 100%;
  border: 2px solid rgba(36, 48, 68, 0.22);
  border-radius: 8px;
  padding: 0.8rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0;
}

.home-shell {
  min-height: 100vh;
  display: grid;
  align-content: center;
  gap: 22px;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 20px;
  align-items: end;
  animation: rise 600ms ease both;
}

.home-hero h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.2rem, 5.6vw, 4.2rem);
  line-height: 0.9;
  letter-spacing: 0;
  text-wrap: balance;
  white-space: nowrap;
}

.home-hero p:not(.eyebrow) {
  max-width: 620px;
  color: var(--muted);
  font-size: 1.12rem;
}

.coffee-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin-top: 10px;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 0.78rem 1.08rem;
  color: var(--ink);
  background: var(--gold);
  box-shadow: 4px 4px 0 rgba(29, 36, 51, 0.14);
  font-size: 0.92rem;
  font-weight: 900;
  text-decoration: none;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.coffee-link:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 rgba(29, 36, 51, 0.18);
}

.coffee-link.compact {
  margin-top: 0;
}

.home-game-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.home-game-nav a {
  border: 2px solid rgba(36, 48, 68, 0.2);
  border-radius: 8px;
  padding: 0.56rem 0.82rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.74);
  font-size: 0.86rem;
  font-weight: 900;
  text-decoration: none;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.home-game-nav a:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 rgba(29, 36, 51, 0.12);
}

.home-badge {
  width: 148px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 3px solid var(--line);
  border-radius: 14px;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(255, 211, 79, 0.22) 0 25%, transparent 25% 50%, rgba(255, 141, 179, 0.24) 50% 75%, transparent 75%),
    var(--blue);
  background-size: 24px 24px;
  box-shadow: var(--shadow);
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.home-badge span {
  display: block;
  width: 100%;
  font-size: 4.3rem;
  line-height: 0.82;
  letter-spacing: 0;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.game-tile {
  min-height: 420px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 20px;
  padding: 24px;
  overflow: hidden;
  position: relative;
  isolation: isolate;
}

.game-tile::before {
  content: "";
  position: absolute;
  inset: auto -1px -1px auto;
  width: 128px;
  height: 128px;
  background:
    linear-gradient(135deg, rgba(255, 211, 79, 0.64) 25%, transparent 25%) 0 0 / 24px 24px,
    linear-gradient(135deg, transparent 75%, rgba(255, 141, 179, 0.52) 75%) 0 0 / 24px 24px;
  z-index: -1;
}

.checkers-tile::before {
  background:
    linear-gradient(135deg, rgba(255, 90, 103, 0.5) 25%, transparent 25%) 0 0 / 24px 24px,
    linear-gradient(135deg, transparent 75%, rgba(255, 211, 79, 0.58) 75%) 0 0 / 24px 24px;
}

.reversi-tile::before {
  background:
    linear-gradient(135deg, rgba(22, 163, 155, 0.46) 25%, transparent 25%) 0 0 / 24px 24px,
    linear-gradient(135deg, transparent 75%, rgba(255, 141, 179, 0.5) 75%) 0 0 / 24px 24px;
}

.connect-four-tile::before {
  background:
    linear-gradient(135deg, rgba(55, 103, 214, 0.42) 25%, transparent 25%) 0 0 / 24px 24px,
    linear-gradient(135deg, transparent 75%, rgba(255, 211, 79, 0.64) 75%) 0 0 / 24px 24px;
}

.pool-tile::before {
  background:
    linear-gradient(135deg, rgba(47, 111, 115, 0.46) 25%, transparent 25%) 0 0 / 24px 24px,
    linear-gradient(135deg, transparent 75%, rgba(255, 90, 103, 0.42) 75%) 0 0 / 24px 24px;
}

.game-tile h2 {
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 4.8rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.game-tile p:not(.eyebrow) {
  max-width: 460px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.45;
}

.game-preview {
  width: min(300px, 64vw);
  aspect-ratio: 1;
  align-self: center;
  justify-self: center;
  transform: rotate(-1deg);
}

.checkers-scene,
.reversi-scene,
.connect-four-scene {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 8px solid var(--line);
  border-radius: 12px;
  box-shadow: 8px 8px 0 rgba(29, 36, 51, 0.14);
}

.checkers-scene {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.14), transparent),
    conic-gradient(var(--light-square) 25%, var(--dark-square) 0 50%, var(--light-square) 0 75%, var(--dark-square) 0);
  background-size: 100% 100%, 25% 25%;
}

.checker-piece,
.reversi-preview .disc,
.move-hint {
  --row: 1;
  --col: 1;
  position: absolute;
  left: calc((var(--col) - 1) * 12.5% + 1.5%);
  top: calc((var(--row) - 1) * 12.5% + 1.5%);
  width: 9.5%;
  aspect-ratio: 1;
  border-radius: 999px;
}

.checker-piece,
.reversi-preview .disc {
  box-shadow:
    inset 0 7px 10px rgba(255, 255, 255, 0.2),
    inset 0 -9px 12px rgba(0, 0, 0, 0.25),
    0 8px 13px rgba(24, 17, 12, 0.24);
}

.checker-piece.red {
  background: var(--red);
}

.checker-piece.black {
  background: var(--black);
}

.checker-piece.king::after {
  content: "K";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.86);
  font-size: clamp(0.6rem, 2.5vw, 1.05rem);
  font-weight: 900;
}

.checker-piece.pos-1 {
  --row: 2;
  --col: 4;
}

.checker-piece.pos-2 {
  --row: 3;
  --col: 7;
}

.checker-piece.pos-3 {
  --row: 4;
  --col: 4;
}

.checker-piece.pos-4 {
  --row: 5;
  --col: 3;
}

.checker-piece.pos-5 {
  --row: 6;
  --col: 6;
}

.checker-piece.pos-6 {
  --row: 7;
  --col: 1;
}

.checker-piece.pos-7 {
  --row: 7;
  --col: 5;
}

.jump-target {
  --row: 3;
  --col: 5;
  position: absolute;
  left: calc((var(--col) - 1) * 12.5% + 2.3%);
  top: calc((var(--row) - 1) * 12.5% + 2.3%);
  width: 8%;
  aspect-ratio: 1;
  border: 3px solid var(--gold);
  border-radius: 999px;
  background: rgba(255, 211, 79, 0.24);
}

.checkers-scene::after {
  content: "";
  position: absolute;
  left: 38%;
  top: 43%;
  width: 22%;
  height: 22%;
  border-top: 4px solid rgba(255, 211, 79, 0.82);
  border-right: 4px solid rgba(255, 211, 79, 0.82);
  transform: rotate(-45deg);
}

.reversi-scene {
  background:
    linear-gradient(rgba(29, 36, 51, 0.24) 1px, transparent 1px),
    linear-gradient(90deg, rgba(29, 36, 51, 0.24) 1px, transparent 1px),
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent),
    #3f785f;
  background-size: 12.5% 12.5%, 12.5% 12.5%, 100% 100%, 100% 100%;
}

.reversi-preview .disc.black {
  background: #101b20;
}

.reversi-preview .disc.white {
  background: #f5ead7;
}

.reversi-preview .disc.pos-1 {
  --row: 3;
  --col: 4;
}

.reversi-preview .disc.pos-2 {
  --row: 3;
  --col: 5;
}

.reversi-preview .disc.pos-3 {
  --row: 4;
  --col: 3;
}

.reversi-preview .disc.pos-4 {
  --row: 4;
  --col: 4;
}

.reversi-preview .disc.pos-5 {
  --row: 4;
  --col: 5;
}

.reversi-preview .disc.pos-6 {
  --row: 5;
  --col: 4;
}

.reversi-preview .disc.pos-7 {
  --row: 5;
  --col: 5;
}

.reversi-preview .disc.pos-8 {
  --row: 5;
  --col: 6;
}

.reversi-preview .disc.pos-9 {
  --row: 6;
  --col: 4;
}

.reversi-preview .disc.pos-10 {
  --row: 6;
  --col: 5;
}

.move-hint {
  width: 4.2%;
  left: calc((var(--col) - 1) * 12.5% + 4.15%);
  top: calc((var(--row) - 1) * 12.5% + 4.15%);
  background: rgba(255, 211, 79, 0.82);
  box-shadow: 0 0 0 7px rgba(255, 211, 79, 0.18);
}

.move-hint.pos-11 {
  --row: 3;
  --col: 3;
}

.move-hint.pos-12 {
  --row: 4;
  --col: 6;
}

.move-hint.pos-13 {
  --row: 6;
  --col: 6;
}

.connect-four-preview {
  aspect-ratio: 7 / 6;
}

.connect-four-scene {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: clamp(5px, 1.1vw, 9px);
  padding: clamp(10px, 2vw, 16px);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.18), transparent),
    var(--blue);
}

.connect-four-scene span {
  border-radius: 999px;
  background: #fff7ef;
  box-shadow:
    inset 0 8px 12px rgba(0, 0, 0, 0.26),
    0 3px 7px rgba(255, 255, 255, 0.14);
}

.connect-four-scene span.red,
.connect-four-scene span.yellow {
  box-shadow:
    inset 0 8px 11px rgba(255, 255, 255, 0.2),
    inset 0 -10px 13px rgba(0, 0, 0, 0.24),
    0 5px 9px rgba(24, 17, 12, 0.2);
}

.connect-four-scene span.red {
  background: var(--red);
}

.connect-four-scene span.yellow {
  background: var(--gold);
}

.connect-four-scene .drop-preview {
  position: absolute;
  left: calc(3 * ((100% - clamp(20px, 4vw, 32px)) / 7) + clamp(10px, 2vw, 16px) + 1.2%);
  top: 4%;
  width: 11%;
  aspect-ratio: 1;
  border-radius: 999px;
  background: var(--red);
  box-shadow:
    inset 0 8px 11px rgba(255, 255, 255, 0.2),
    inset 0 -10px 13px rgba(0, 0, 0, 0.24),
    0 7px 14px rgba(24, 17, 12, 0.22);
}

.play-link {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 48px;
  border: 2px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem 1.1rem;
  color: #ffffff;
  background: var(--green);
  font-weight: 800;
  text-decoration: none;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease;
}

.play-link:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 rgba(29, 36, 51, 0.18);
}

.checkers-tile .play-link {
  background: var(--red);
}

.connect-four-tile .play-link {
  background: var(--blue);
}

.pool-tile .play-link {
  background: var(--dark-square);
}

.pool-preview {
  width: min(330px, 70vw);
  aspect-ratio: 9 / 5;
}

.pool-scene {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 11px solid #6f4729;
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.1), transparent 46%),
    #257568;
  box-shadow:
    inset 0 0 0 10px #123f3a,
    8px 8px 0 rgba(29, 36, 51, 0.14);
}

.pool-pocket {
  position: absolute;
  width: 13%;
  aspect-ratio: 1;
  border-radius: 999px;
  background: #121722;
  box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.8);
}

.pool-pocket.corner-1 {
  left: -5%;
  top: -9%;
}

.pool-pocket.corner-2 {
  right: -5%;
  top: -9%;
}

.pool-pocket.corner-3 {
  left: -5%;
  bottom: -9%;
}

.pool-pocket.corner-4 {
  right: -5%;
  bottom: -9%;
}

.pool-pocket.side-1 {
  left: 43.5%;
  top: -9%;
}

.pool-pocket.side-2 {
  left: 43.5%;
  bottom: -9%;
}

.pool-ball {
  position: absolute;
  width: 7.2%;
  aspect-ratio: 1;
  border: 2px solid rgba(29, 36, 51, 0.28);
  border-radius: 999px;
  background: #faf6e7;
  box-shadow:
    inset 0 6px 8px rgba(255, 255, 255, 0.28),
    inset 0 -8px 11px rgba(0, 0, 0, 0.23),
    0 6px 10px rgba(21, 29, 24, 0.24);
}

.pool-ball.cue {
  left: 24%;
  top: 46%;
}

.pool-ball.solid {
  background: var(--gold);
}

.pool-ball.stripe {
  background:
    linear-gradient(#faf6e7 0 28%, var(--red) 28% 72%, #faf6e7 72%);
}

.pool-ball.one {
  left: 62%;
  top: 46%;
}

.pool-ball.two {
  left: 69%;
  top: 42%;
  background: var(--blue);
}

.pool-ball.three {
  left: 69%;
  top: 50%;
  background: var(--black);
}

.pool-ball.four {
  left: 76%;
  top: 38%;
}

.pool-ball.five {
  left: 76%;
  top: 54%;
  background:
    linear-gradient(#faf6e7 0 28%, var(--green) 28% 72%, #faf6e7 72%);
}

.pool-aim {
  position: absolute;
  left: 31%;
  top: 51%;
  width: 30%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 211, 79, 0.86);
  transform: rotate(-9deg);
  transform-origin: left center;
  box-shadow: 0 0 0 5px rgba(255, 211, 79, 0.14);
}

.home-note,
.support-note {
  padding: 20px;
}

.home-note p:last-child,
.support-note p:last-child {
  max-width: 820px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.support-note code {
  color: var(--ink);
}

.hero {
  max-width: 980px;
  margin-bottom: 24px;
  animation: rise 600ms ease both;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.4rem, 6.2vw, 5.4rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.hero p {
  max-width: 620px;
  color: var(--muted);
  font-size: 1.08rem;
}

.game-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.game-nav a {
  border: 2px solid rgba(36, 48, 68, 0.2);
  border-radius: 8px;
  padding: 0.62rem 0.92rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.game-nav a:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 rgba(29, 36, 51, 0.12);
}

.game-nav a.active {
  color: #ffffff;
  background: var(--ink);
}

.eyebrow,
.label {
  margin: 0 0 0.4rem;
  color: var(--green);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.panel {
  border: 2px solid rgba(36, 48, 68, 0.16);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.mode-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding: 12px;
  margin-bottom: 18px;
}

.mode-card {
  min-height: 92px;
  border-radius: 8px;
  padding: 1rem;
  text-align: left;
  background: rgba(255, 255, 255, 0.78);
}

.mode-card span {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 800;
}

.mode-card.active {
  color: #ffffff;
  background: var(--blue);
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(240px, 310px) minmax(320px, 1fr) minmax(180px, 240px);
  gap: 18px;
  align-items: start;
}

.sidebar,
.move-log {
  padding: 20px;
}

.sidebar {
  display: grid;
  gap: 18px;
}

.sidebar h2 {
  margin: 0 0 0.5rem;
  font-size: 1.55rem;
}

.sidebar p {
  margin-top: 0;
  color: var(--muted);
}

.status-card {
  border: 2px dashed rgba(36, 48, 68, 0.22);
  border-radius: 8px;
  padding: 1rem;
  background: rgba(255, 211, 79, 0.24);
}

.status-card p:last-child {
  margin-bottom: 0;
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 700;
}

.board-view-panel {
  display: grid;
  gap: 10px;
}

.board-view-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.board-view-heading .label {
  margin-bottom: 0;
}

.board-view-heading span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.segmented-control {
  display: grid;
  grid-template-columns: 0.72fr 1fr;
  gap: 6px;
  padding: 5px;
  border: 2px solid rgba(36, 48, 68, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.68);
}

.segmented-control button {
  min-width: 0;
  border: 0;
  padding: 0.58rem 0.68rem;
  background: transparent;
  box-shadow: none;
  font-size: 0.88rem;
  font-weight: 800;
}

.segmented-control button:hover:not(:disabled) {
  transform: none;
  box-shadow: none;
  background: rgba(55, 103, 214, 0.1);
}

.segmented-control button.active {
  color: #ffffff;
  background: var(--blue);
}

.score-card {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.score-card span {
  border: 2px solid rgba(36, 48, 68, 0.12);
  border-radius: 8px;
  padding: 0.82rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.78);
}

.score-card strong {
  display: block;
  color: var(--ink);
  font-size: 1.7rem;
  line-height: 1;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.online-panel,
.bot-panel {
  display: grid;
  gap: 10px;
}

.hidden {
  display: none;
}

.hint {
  font-size: 0.88rem;
  line-height: 1.4;
}

.board-wrap {
  display: grid;
  justify-items: center;
  gap: 12px;
}

.board-turn {
  width: min(72vh, 100%);
  max-width: 670px;
  display: flex;
  align-items: center;
  gap: 10px;
  border: 2px solid rgba(36, 48, 68, 0.16);
  border-radius: 8px;
  padding: 0.72rem 0.9rem;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 6px 6px 0 rgba(29, 36, 51, 0.1);
  font-size: 1rem;
  font-weight: 900;
}

.turn-dot {
  width: 16px;
  aspect-ratio: 1;
  flex: 0 0 auto;
  border: 2px solid rgba(36, 48, 68, 0.24);
  border-radius: 999px;
  background: var(--red);
  box-shadow: inset 0 3px 5px rgba(255, 255, 255, 0.28);
}

.board-turn[data-turn="black"] .turn-dot {
  background: var(--black);
}

.board-stage {
  width: min(72vh, 100%);
  max-width: 670px;
  display: grid;
  place-items: center;
  perspective: 1200px;
  perspective-origin: 50% 62%;
}

.board {
  width: min(72vh, 100%);
  max-width: 670px;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  overflow: hidden;
  border: 12px solid var(--line);
  border-radius: 12px;
  box-shadow: 10px 10px 0 rgba(29, 36, 51, 0.16);
  animation: settle 700ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.board-stage .board {
  width: 100%;
  max-width: none;
}

.checkers-board {
  transform-origin: center;
  transform-style: preserve-3d;
  transition:
    transform 420ms cubic-bezier(0.16, 1, 0.3, 1),
    box-shadow 420ms ease;
}

.checkers-board.board-view-3d {
  overflow: visible;
  box-shadow:
    0 34px 42px rgba(29, 36, 51, 0.26),
    10px 10px 0 rgba(29, 36, 51, 0.14);
}

.checkers-board.board-view-3d[data-facing="red"] {
  transform: rotateX(42deg) rotateZ(0deg);
}

.checkers-board.board-view-3d[data-facing="black"] {
  transform: rotateX(42deg) rotateZ(180deg);
}

.checkers-board.board-view-3d .square {
  transform-style: preserve-3d;
}

.checkers-board.board-view-3d .square.move::after,
.checkers-board.board-view-3d .square.capture::after {
  transform: translateZ(14px);
}

.checkers-board.board-view-3d .piece {
  --piece-z: 22px;
  transform: translateZ(22px) rotateZ(var(--piece-rotation));
  box-shadow:
    inset 0 12px 14px rgba(255, 255, 255, 0.24),
    inset 0 -11px 16px rgba(0, 0, 0, 0.28),
    0 8px 0 rgba(23, 27, 39, 0.34),
    0 18px 22px rgba(18, 22, 31, 0.32);
}

.checkers-board.board-view-3d[data-facing="black"] .piece {
  --piece-rotation: 180deg;
}

.square {
  min-width: 0;
  min-height: 0;
  position: relative;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: var(--light-square);
}

.square.dark {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.07), transparent),
    var(--dark-square);
}

.square.selected {
  outline: 5px solid var(--gold);
  outline-offset: -6px;
  z-index: 2;
}

.square.move::after,
.square.capture::after {
  content: "";
  width: 28%;
  aspect-ratio: 1;
  border-radius: 999px;
  background: rgba(246, 180, 67, 0.8);
  box-shadow: 0 0 0 8px rgba(246, 180, 67, 0.18);
}

.square.capture::after {
  background: rgba(199, 56, 47, 0.82);
  box-shadow: 0 0 0 8px rgba(199, 56, 47, 0.18);
}

.piece {
  --piece-z: 0px;
  --piece-rotation: 0deg;
  width: 70%;
  aspect-ratio: 1;
  position: relative;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.88);
  font-size: clamp(1rem, 3vw, 1.8rem);
  font-weight: 900;
  box-shadow:
    inset 0 10px 16px rgba(255, 255, 255, 0.2),
    inset 0 -12px 20px rgba(0, 0, 0, 0.22),
    0 12px 22px rgba(24, 17, 12, 0.28);
  will-change: transform;
}

.piece::after {
  content: "";
  position: absolute;
  inset: 14%;
  border-radius: inherit;
  border: 2px solid rgba(255, 255, 255, 0.2);
  opacity: 0;
  pointer-events: none;
}

.piece.red {
  background: var(--red);
}

.piece.black {
  background: var(--black);
}

.piece.king::before {
  content: "K";
  position: relative;
  z-index: 1;
}

.checkers-board.board-view-3d .piece::after {
  opacity: 1;
  box-shadow:
    inset 0 5px 7px rgba(255, 255, 255, 0.2),
    inset 0 -5px 7px rgba(0, 0, 0, 0.16);
}

.checkers-board.board-view-3d .piece.red {
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.36), transparent 0 24%),
    linear-gradient(145deg, #ff7780, var(--red) 48%, #c9323d);
  box-shadow:
    inset 0 12px 14px rgba(255, 255, 255, 0.24),
    inset 0 -11px 16px rgba(0, 0, 0, 0.28),
    0 8px 0 #aa2d37,
    0 18px 22px rgba(18, 22, 31, 0.32);
}

.checkers-board.board-view-3d .piece.black {
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.18), transparent 0 24%),
    linear-gradient(145deg, #3a3f55, var(--black) 48%, #10131e);
  box-shadow:
    inset 0 12px 14px rgba(255, 255, 255, 0.18),
    inset 0 -11px 16px rgba(0, 0, 0, 0.34),
    0 8px 0 #111522,
    0 18px 22px rgba(18, 22, 31, 0.32);
}

.piece.just-moved {
  animation: snapMove 240ms cubic-bezier(0.18, 0.89, 0.24, 1.18);
}

.reversi-board {
  background: #315f4e;
}

.reversi-board .square {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.06), transparent),
    #3f785f;
  border: 1px solid rgba(29, 55, 43, 0.34);
}

.reversi-board .square.dark {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent),
    #356a55;
}

.reversi-board .square.move::after {
  width: 24%;
  background: rgba(246, 180, 67, 0.86);
  box-shadow: 0 0 0 8px rgba(246, 180, 67, 0.18);
}

.disc {
  width: 72%;
  aspect-ratio: 1;
  border-radius: 999px;
  box-shadow:
    inset 0 9px 14px rgba(255, 255, 255, 0.16),
    inset 0 -14px 18px rgba(0, 0, 0, 0.22),
    0 12px 20px rgba(21, 29, 24, 0.25);
  will-change: transform;
}

.disc.black {
  background: #101b20;
}

.disc.white {
  background: #f5ead7;
}

.disc.just-flipped {
  animation: flipDisc 260ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.connect-board {
  width: min(76vh, 100%);
  max-width: 720px;
  aspect-ratio: 7 / 6;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: clamp(5px, 1vw, 10px);
  padding: clamp(10px, 2vw, 18px);
  border: 12px solid var(--line);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.16), transparent),
    var(--blue);
  box-shadow: 10px 10px 0 rgba(29, 36, 51, 0.16);
  animation: settle 700ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.pool-layout {
  grid-template-columns: minmax(240px, 310px) minmax(360px, 1fr) minmax(180px, 240px);
}

.pool-wrap {
  width: 100%;
}

.pool-canvas {
  width: 100%;
  max-width: 900px;
  aspect-ratio: 9 / 5;
  display: block;
  border: 12px solid var(--line);
  border-radius: 14px;
  background: #236b60;
  box-shadow: 10px 10px 0 rgba(29, 36, 51, 0.16);
  touch-action: none;
  user-select: none;
  animation: settle 700ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.pool-power {
  display: grid;
  gap: 8px;
}

.pool-power > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.pool-power .label {
  margin: 0;
}

.pool-power span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 900;
}

.pool-power meter {
  width: 100%;
  height: 18px;
  overflow: hidden;
  border: 2px solid rgba(36, 48, 68, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.pool-power meter::-webkit-meter-bar {
  background: rgba(255, 255, 255, 0.72);
}

.pool-power meter::-webkit-meter-optimum-value {
  background: var(--gold);
}

.pool-power meter::-moz-meter-bar {
  background: var(--gold);
}

.connect-slot {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  padding: 0;
  background: #fff7ef;
  box-shadow:
    inset 0 9px 16px rgba(0, 0, 0, 0.24),
    0 4px 8px rgba(255, 255, 255, 0.12);
}

.connect-slot.playable:hover {
  outline: 5px solid rgba(246, 180, 67, 0.62);
  outline-offset: -4px;
}

.connect-slot.winner {
  background: var(--gold);
}

.connect-disc {
  width: 84%;
  aspect-ratio: 1;
  border-radius: 999px;
  box-shadow:
    inset 0 9px 14px rgba(255, 255, 255, 0.2),
    inset 0 -14px 18px rgba(0, 0, 0, 0.22),
    0 12px 20px rgba(21, 29, 24, 0.22);
  will-change: transform;
}

.connect-disc.red {
  background: var(--red);
}

.connect-disc.yellow {
  background: #f6c74a;
}

.connect-disc.just-dropped {
  animation: dropDisc 260ms cubic-bezier(0.15, 0.8, 0.28, 1.18);
}

.move-log {
  max-height: 720px;
  overflow: auto;
}

.move-log ol {
  margin: 0;
  padding-left: 1.35rem;
}

.move-log li {
  margin: 0.45rem 0;
  color: var(--muted);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

@keyframes settle {
  from {
    opacity: 0;
    transform: rotate(-1.5deg) translateY(18px);
  }
}

@keyframes snapMove {
  0% {
    transform: translate3d(var(--move-x), var(--move-y), var(--piece-z)) rotateZ(var(--piece-rotation)) scale(0.9);
    filter: brightness(1.18);
    box-shadow:
      inset 0 10px 16px rgba(255, 255, 255, 0.24),
      inset 0 -12px 20px rgba(0, 0, 0, 0.22),
      0 20px 30px rgba(24, 17, 12, 0.34),
      0 0 0 8px rgba(246, 180, 67, 0.32);
  }

  72% {
    transform: translate3d(0, 0, var(--piece-z)) rotateZ(var(--piece-rotation)) scale(1.12);
  }

  100% {
    transform: translate3d(0, 0, var(--piece-z)) rotateZ(var(--piece-rotation)) scale(1);
    filter: brightness(1);
  }
}

@keyframes flipDisc {
  0% {
    transform: rotateY(90deg) scale(0.86);
    filter: brightness(1.18);
  }

  72% {
    transform: rotateY(0) scale(1.08);
  }

  100% {
    transform: rotateY(0) scale(1);
    filter: brightness(1);
  }
}

@keyframes dropDisc {
  0% {
    transform: translateY(calc(-1 * var(--drop-distance))) scale(0.94);
    filter: brightness(1.15);
  }

  72% {
    transform: translateY(0) scale(1.08);
  }

  100% {
    transform: translateY(0) scale(1);
    filter: brightness(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  button,
  .checkers-board {
    transition: none;
  }

  .board,
  .piece.just-moved,
  .disc.just-flipped,
  .connect-disc.just-dropped {
    animation: none;
  }
}

@media (max-width: 920px) {
  .home-shell {
    align-content: start;
  }

  .home-hero,
  .game-grid {
    grid-template-columns: 1fr;
  }

  .home-badge {
    width: 112px;
    border-radius: 10px;
  }

  .home-badge span {
    font-size: 3.2rem;
  }

  .game-tile {
    min-height: auto;
  }

  .mode-panel,
  .game-layout {
    grid-template-columns: 1fr;
  }

  .board-stage {
    width: 100%;
  }

  .move-log {
    max-height: 220px;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 20px, 1180px);
    padding: 18px 0;
  }

  .home-hero h1 {
    font-size: clamp(1.45rem, 7.4vw, 2.85rem);
  }

  .home-hero p:not(.eyebrow),
  .hero p {
    font-size: 1rem;
  }

  .home-badge {
    display: none;
  }

  .game-grid {
    gap: 12px;
  }

  .game-tile {
    padding: 18px;
    border-radius: 8px;
  }

  .game-preview {
    width: min(220px, 70vw);
  }

  .play-link {
    width: 100%;
  }

  .game-nav a {
    flex: 1 1 auto;
    text-align: center;
  }

  .coffee-link {
    width: 100%;
  }

  .hero h1 {
    font-size: clamp(2.45rem, 14vw, 4rem);
  }
}
