:root {
  color-scheme: light;
  --ink: #1b2433;
  --paper: #f8f1e1;
  --panel: rgba(255, 251, 243, 0.76);
  --panel-border: rgba(27, 36, 51, 0.09);
  --sky: #8bcde8;
  --sun: #e7bf59;
  --melon: #c96345;
  --leaf: #5f8b67;
  --berry: #4f6aa2;
  --shadow: 0 24px 60px rgba(42, 56, 79, 0.18);
  --wood-dark: #6a4a33;
  --wood-light: #d8b690;
  --ember: #d76445;
  --frost: #6f90c7;
  --rune: #e8d7b4;
  --board-shell-start: rgba(76, 52, 38, 0.98);
  --board-shell-end: rgba(132, 94, 62, 0.98);
  --square-light-start: #ddc2a0;
  --square-light-end: #caa57e;
  --square-dark-start: #8b5f43;
  --square-dark-end: #6b452f;
  --red-piece-highlight: #f0a18a;
  --red-piece-base: #d76445;
  --red-piece-shadow: #9d402c;
  --blue-piece-highlight: #d7e2f8;
  --blue-piece-base: #6f90c7;
  --blue-piece-shadow: #415a89;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 255, 255, 0.72) 0, transparent 20%),
    radial-gradient(circle at 82% 18%, rgba(232, 215, 180, 0.58) 0, transparent 16%),
    radial-gradient(circle at 74% 70%, rgba(111, 144, 199, 0.2) 0, transparent 20%),
    linear-gradient(180deg, #c7dcef 0%, #e7edf5 35%, #efe3c5 100%);
}

body {
  margin: 0;
  min-height: 100vh;
}

@media (pointer: coarse) {
  body {
    -webkit-user-select: none;
    user-select: none;
  }
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.page-shell {
  width: min(1100px, calc(100% - 24px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.hero,
.game-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 32px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.hero {
  min-height: 46vh;
  padding: 24px;
  display: grid;
  gap: 18px;
  grid-template-columns: 1.35fr 1fr;
  align-items: stretch;
}

.hero-compact {
  min-height: 0;
  padding: 18px 20px;
  gap: 14px;
  align-items: start;
}

.hero-copy,
.hero-card,
.game-head {
  display: grid;
  gap: 8px;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  font-weight: 800;
  color: rgba(25, 50, 74, 0.58);
}

.hero h1,
.hero h2,
.game-card h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: -0.05em;
  line-height: 0.95;
}

.hero h1 {
  font-size: clamp(3.4rem, 12vw, 7rem);
}

.hero h2,
.game-card h2 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.hero-text,
.hero-card p,
.game-copy,
.coming-soon,
.game-status,
.score-label {
  margin: 0;
  line-height: 1.45;
}

.hero-card {
  align-content: start;
  padding: 20px;
  border-radius: 26px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(232, 215, 180, 0.82)),
    repeating-linear-gradient(90deg, rgba(106, 74, 51, 0.06) 0 12px, transparent 12px 24px);
}

.hero-card-compact {
  padding: 16px 18px;
  gap: 6px;
}

.hero-card-label {
  margin: 0;
  font-size: 0.86rem;
  font-weight: 800;
  color: rgba(25, 50, 74, 0.62);
}

.hero-link,
.secondary-button {
  min-height: 52px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 800;
  text-decoration: none;
}

.hero-link {
  justify-self: start;
  background: linear-gradient(135deg, #9f503b, #d49c4a);
  color: white;
  box-shadow: 0 18px 28px rgba(159, 80, 59, 0.28);
}

.launcher-link {
  margin-top: auto;
}

.back-link {
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
}

.game-grid {
  margin-top: 16px;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.game-grid-single {
  grid-template-columns: 1fr;
}

.game-card {
  padding: 20px;
  display: grid;
  gap: 18px;
  align-content: start;
}

.game-card-featured {
  grid-column: span 2;
}

.game-card-full {
  grid-column: 1 / -1;
}

.score-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

.customizer-field {
  display: grid;
  gap: 6px;
}

.customizer-label {
  font-size: 0.84rem;
  font-weight: 800;
  color: rgba(27, 36, 51, 0.72);
}

.customizer-select {
  min-height: 46px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1px solid rgba(27, 36, 51, 0.12);
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  font: inherit;
}

.rules-panel {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.68);
  border: 1px solid rgba(27, 36, 51, 0.08);
}

.rule-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  color: rgba(27, 36, 51, 0.86);
}

.rule-toggle input {
  width: 18px;
  height: 18px;
  accent-color: #5b7fae;
}

.mode-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mode-button {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid rgba(27, 36, 51, 0.12);
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

.mode-button-active {
  background: linear-gradient(135deg, rgba(101, 124, 88, 0.98), rgba(91, 127, 174, 0.98));
  color: white;
  border-color: transparent;
  box-shadow: 0 12px 20px rgba(91, 127, 174, 0.18);
}

.mode-row[hidden] {
  display: none;
}

.score-pill {
  min-width: 110px;
  padding: 10px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(25, 50, 74, 0.08);
}

.score-pill strong {
  display: block;
  margin-top: 2px;
  font-size: 1.5rem;
}

.star-button {
  width: min(100%, 340px);
  aspect-ratio: 1;
  justify-self: center;
  border: 0;
  border-radius: 28px;
  cursor: pointer;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.95) 0, rgba(255, 255, 255, 0.3) 26%, transparent 27%),
    linear-gradient(180deg, #6cd8ff 0%, #779dff 100%);
  box-shadow: 0 26px 40px rgba(86, 114, 255, 0.22);
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.star-button.is-popping {
  transform: scale(0.94) rotate(-6deg);
  box-shadow: 0 16px 24px rgba(86, 114, 255, 0.2);
}

.star-shape {
  display: inline-block;
  font-size: clamp(5rem, 14vw, 8rem);
  color: var(--sun);
  text-shadow: 0 8px 0 rgba(233, 170, 24, 0.24);
}

.action-row {
  display: flex;
  gap: 12px;
}

.secondary-button {
  background: linear-gradient(135deg, #657c58, #5b7fae);
  color: white;
  box-shadow: 0 18px 28px rgba(79, 184, 162, 0.24);
}

.coming-soon {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px dashed rgba(25, 50, 74, 0.16);
}

.checkers-shell {
  display: grid;
  justify-items: center;
}

.chess-shell {
  display: grid;
  justify-items: center;
}

.chess-board {
  width: min(100%, 520px);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, minmax(0, 1fr));
  padding: 14px;
  border-radius: 32px;
  background: linear-gradient(135deg, #40583d, #789064);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.18), inset 0 -3px 0 rgba(38, 58, 35, 0.3), 0 28px 36px rgba(44, 63, 39, 0.22);
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.chess-square {
  border: 0;
  padding: 0;
  margin: 0;
  position: relative;
  display: grid;
  place-items: center;
  cursor: pointer;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
  transition: box-shadow 120ms ease, filter 120ms ease;
}

.chess-square-light { background: linear-gradient(135deg, #f0ddb9, #d8ba8e); }
.chess-square-dark { background: linear-gradient(135deg, #78935d, #506f49); }

.chess-board-pokemon {
  background: linear-gradient(135deg, #102b60, #2457a5);
}

.chess-board-pokemon .chess-square-light { background: #ffe333; }
.chess-board-pokemon .chess-square-dark { background: #153e85; }

.chess-board-pokemon .chess-square-selected {
  box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 6px #e63570;
}

.chess-board-pokemon .chess-square-playable::after {
  background: #e63570;
  box-shadow: 0 0 0 3px #fff;
}

.chess-board-pokemon .chess-square:focus-visible {
  outline: 3px solid #fff;
  box-shadow: inset 0 0 0 6px #e63570;
}

.chess-square-selected {
  box-shadow: inset 0 0 0 5px rgba(255, 249, 225, 0.96);
  z-index: 1;
}

.chess-square-playable::after {
  position: absolute;
  z-index: 2;
  pointer-events: none;
  content: "";
  width: 22%;
  aspect-ratio: 1;
  border-radius: 999px;
  background: rgba(255, 248, 220, 0.94);
  box-shadow: 0 0 0 7px rgba(255, 248, 220, 0.28);
}

.chess-piece {
  position: relative;
  z-index: 1;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 7vw, 3.7rem);
  line-height: 1;
  filter: drop-shadow(0 3px 2px rgba(32, 44, 28, 0.28));
}

.chess-piece-white { color: #fff8e5; text-shadow: 0 1px 0 #826b4b, 0 0 3px rgba(75, 57, 36, 0.68); }
.chess-piece-black { color: #263429; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2); }

.chess-style-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
  font-weight: 700;
}

.chess-style-controls select {
  min-height: 44px;
  padding: 8px 14px;
  border: 2px solid #506f49;
  border-radius: 12px;
  color: #263429;
  background: #fff8e5;
  font: inherit;
}

.chess-piece-guide {
  margin: 0 0 16px;
  line-height: 1.6;
  font-size: 0.9rem;
}

.chess-piece-pokemon {
  width: 88%;
  height: 92%;
  box-sizing: border-box;
  border: 3px solid;
  border-bottom-width: 5px;
  border-radius: 20%;
  background: transparent;
  overflow: hidden;
  text-shadow: none;
  pointer-events: none;
}

.chess-piece-pokemon.chess-piece-white { border-color: #fff8e5; box-shadow: 0 0 0 1px #826b4b; }
.chess-piece-pokemon.chess-piece-black { border-color: #263429; box-shadow: 0 0 0 1px #fff8e5; }

.chess-piece-pokemon img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.chess-piece-role {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 38%;
  border-radius: 5px 0 0 0;
  font-size: clamp(10px, 2.6vw, 17px);
  line-height: 1.15;
  text-align: center;
}

.chess-piece-white .chess-piece-role { color: #263429; background: #fff8e5; }
.chess-piece-black .chess-piece-role { color: #fff8e5; background: #263429; }

.chess-square:focus-visible {
  outline: 3px solid rgba(25, 50, 74, 0.6);
  outline-offset: -3px;
  z-index: 2;
}

.muehle-shell {
  display: grid;
  justify-items: center;
}

.muehle-board {
  width: min(100%, 560px);
  aspect-ratio: 1;
  position: relative;
  border-radius: 30px;
  background:
    linear-gradient(135deg, rgba(76, 52, 38, 0.98), rgba(132, 94, 62, 0.98));
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.18),
    inset 0 -3px 0 rgba(67, 44, 30, 0.28),
    0 28px 36px rgba(64, 43, 28, 0.2);
  overflow: hidden;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.muehle-svg,
.muehle-node-layer {
  position: absolute;
  inset: 0;
}

.muehle-svg {
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.muehle-node-layer {
  pointer-events: none;
}

.muehle-track {
  fill: none;
  stroke: rgba(244, 234, 207, 0.92);
  stroke-linecap: round;
  stroke-width: 1.35;
}

.muehle-node {
  position: absolute;
  width: 11%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 0;
  border-radius: 999px;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  pointer-events: auto;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.muehle-node::before {
  content: "";
  width: 26%;
  aspect-ratio: 1;
  border-radius: 999px;
  background: rgba(245, 233, 205, 0.88);
  box-shadow: 0 0 0 6px rgba(245, 233, 205, 0.15);
}

.muehle-node-selectable::before {
  background: rgba(245, 233, 205, 0.98);
  box-shadow: 0 0 0 8px rgba(245, 233, 205, 0.18);
}

.muehle-node-selected {
  box-shadow: 0 0 0 5px rgba(247, 238, 214, 0.8);
}

.muehle-node-removable {
  box-shadow: 0 0 0 5px rgba(224, 104, 77, 0.75);
}

.muehle-piece {
  width: 82%;
  aspect-ratio: 1;
  border-radius: 999px;
  position: relative;
  box-shadow:
    inset 0 6px 10px rgba(255, 255, 255, 0.16),
    inset 0 -8px 14px rgba(0, 0, 0, 0.18),
    0 6px 10px rgba(0, 0, 0, 0.16);
}

.muehle-piece-red {
  background: radial-gradient(circle at 34% 28%, var(--red-piece-highlight) 0, var(--red-piece-base) 42%, var(--red-piece-shadow) 100%);
}

.muehle-piece-blue {
  background: radial-gradient(circle at 34% 28%, var(--blue-piece-highlight) 0, var(--blue-piece-base) 42%, var(--blue-piece-shadow) 100%);
}

.checkers-board {
  width: min(100%, 520px);
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, minmax(0, 1fr));
  gap: 0;
  padding: 14px;
  border-radius: 32px;
  background:
    linear-gradient(135deg, var(--board-shell-start), var(--board-shell-end));
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.18),
    inset 0 -3px 0 rgba(67, 44, 30, 0.28),
    0 28px 36px rgba(64, 43, 28, 0.2);
  overflow: hidden;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.checkers-square {
  border: 0;
  padding: 0;
  margin: 0;
  position: relative;
  display: grid;
  place-items: center;
  cursor: pointer;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

.checkers-square-light {
  background:
    linear-gradient(135deg, var(--square-light-start), var(--square-light-end));
}

.checkers-square-dark {
  background:
    linear-gradient(135deg, var(--square-dark-start), var(--square-dark-end));
}

.checkers-square-playable::after {
  content: "";
  width: 22%;
  aspect-ratio: 1;
  border-radius: 999px;
  background: rgba(245, 233, 205, 0.9);
  box-shadow: 0 0 0 7px rgba(245, 233, 205, 0.18);
}

.checkers-square-selected {
  box-shadow: inset 0 0 0 5px rgba(247, 238, 214, 0.9);
  z-index: 1;
}

.checkers-piece {
  width: 72%;
  aspect-ratio: 1;
  border-radius: 999px;
  border: 0;
  position: relative;
  box-shadow:
    inset 0 6px 10px rgba(255, 255, 255, 0.16),
    inset 0 -8px 14px rgba(0, 0, 0, 0.18),
    0 6px 10px rgba(0, 0, 0, 0.16);
}

.checkers-piece-red {
  background: radial-gradient(circle at 34% 28%, var(--red-piece-highlight) 0, var(--red-piece-base) 42%, var(--red-piece-shadow) 100%);
}

.checkers-piece-blue {
  background: radial-gradient(circle at 34% 28%, var(--blue-piece-highlight) 0, var(--blue-piece-base) 42%, var(--blue-piece-shadow) 100%);
}

.checkers-piece-king::after {
  content: "ᚠ";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--rune);
  font-size: clamp(1.2rem, 3vw, 1.5rem);
  font-weight: 800;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.22);
}

.checkers-piece-pokemon {
  display: grid;
  place-items: center;
}

.checkers-piece-pokemon img {
  width: 78%;
  height: 78%;
  object-fit: contain;
  pointer-events: none;
}

.checkers-piece-pokemon.checkers-piece-king::after {
  inset: -8% -8% auto auto;
  width: 44%;
  height: 44%;
  border-radius: 50%;
  background: #fff8e5;
  color: #263429;
  box-shadow: 0 0 0 2px #263429;
  font-size: clamp(0.7rem, 2vw, 1.2rem);
  text-shadow: none;
}

.checkers-square:hover .checkers-piece,
.checkers-square:focus-visible .checkers-piece {
  filter: brightness(1.05);
}

.checkers-square:focus-visible {
  outline: 3px solid rgba(25, 50, 74, 0.26);
  outline-offset: -3px;
}

.hero-link:focus-visible,
.back-link:focus-visible,
.secondary-button:focus-visible,
.mode-button:focus-visible,
.customizer-select:focus-visible,
.star-button:focus-visible,
.muehle-node:focus-visible {
  outline: 3px solid rgba(25, 50, 74, 0.24);
  outline-offset: 3px;
}

.board-theme-midnight {
  --board-shell-start: #2f354e;
  --board-shell-end: #55627d;
}

.board-theme-aurora {
  --board-shell-start: #355965;
  --board-shell-end: #67846f;
}

.board-theme-stone {
  --board-shell-start: #75706a;
  --board-shell-end: #9b948c;
}

.square-theme-snow {
  --square-light-start: #eef3fb;
  --square-light-end: #d7e2f0;
  --square-dark-start: #6a7688;
  --square-dark-end: #4a5567;
}

.square-theme-moss {
  --square-light-start: #d9d2b3;
  --square-light-end: #c4b78f;
  --square-dark-start: #69815f;
  --square-dark-end: #465741;
}

.square-theme-twilight {
  --square-light-start: #d6c7dc;
  --square-light-end: #c3b0cb;
  --square-dark-start: #5b506e;
  --square-dark-end: #403852;
}

.red-piece-berry {
  --red-piece-highlight: #efb0c7;
  --red-piece-base: #c65b89;
  --red-piece-shadow: #7b2f50;
}

.red-piece-gold {
  --red-piece-highlight: #f8e5a8;
  --red-piece-base: #d2ac43;
  --red-piece-shadow: #8d6c1f;
}

.red-piece-plum {
  --red-piece-highlight: #d9b2e6;
  --red-piece-base: #9360b2;
  --red-piece-shadow: #58366e;
}

.blue-piece-ocean {
  --blue-piece-highlight: #b4e3ef;
  --blue-piece-base: #43a9c4;
  --blue-piece-shadow: #24657a;
}

.blue-piece-mint {
  --blue-piece-highlight: #d8f6e7;
  --blue-piece-base: #66c89b;
  --blue-piece-shadow: #2e7f5b;
}

.blue-piece-slate {
  --blue-piece-highlight: #d9dde5;
  --blue-piece-base: #8691a6;
  --blue-piece-shadow: #4a5263;
}

@media (max-width: 860px) {
  .hero,
  .game-grid {
    grid-template-columns: 1fr;
  }

  .game-card-featured {
    grid-column: auto;
  }
}

@media (max-width: 640px) {
  .page-shell {
    width: min(100%, calc(100% - 16px));
    padding-top: 10px;
  }

  .hero,
  .game-card {
    padding: 16px;
    border-radius: 24px;
  }

  .hero-compact {
    padding: 14px 16px;
    gap: 10px;
  }

  .hero-link,
  .secondary-button {
    width: 100%;
  }

  .customizer-grid {
    grid-template-columns: 1fr;
  }

  .action-row {
    display: block;
  }

  .checkers-board {
    padding: 10px;
    border-radius: 22px;
  }

  .muehle-board {
    border-radius: 22px;
  }

  .muehle-node {
    width: 12.5%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
