*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --page-bg: linear-gradient(180deg, #f3efe4 0%, #eef4ff 55%, #f8fafc 100%);
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: #ffffff;
  --ink: #1f2937;
  --muted: #5f6b7a;
  --line: rgba(148, 163, 184, 0.24);
  --shadow-soft: 0 18px 40px rgba(15, 23, 42, 0.08);
  --shadow-card: 0 14px 28px rgba(15, 23, 42, 0.08);
  --button-bg: #ffffff;
  --button-bg-hover: #f0f4f8;
  --button-ink: #1f2937;
  --field-bg: #ffffff;
  --field-border: #cbd5e1;
  --field-ink: #1f2937;
  --surface-border: rgba(255, 255, 255, 0.76);
}

:root[data-theme="dark"] {
  --page-bg: linear-gradient(180deg, #020617 0%, #0f172a 48%, #111827 100%);
  --surface: rgba(15, 23, 42, 0.9);
  --surface-strong: #0f172a;
  --ink: #e2e8f0;
  --muted: #94a3b8;
  --line: rgba(148, 163, 184, 0.18);
  --shadow-soft: 0 18px 40px rgba(2, 6, 23, 0.38);
  --shadow-card: 0 16px 30px rgba(2, 6, 23, 0.36);
  --button-bg: #111827;
  --button-bg-hover: #1f2937;
  --button-ink: #e2e8f0;
  --field-bg: #0b1220;
  --field-border: #334155;
  --field-ink: #e2e8f0;
  --surface-border: rgba(51, 65, 85, 0.9);
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI", "Microsoft JhengHei", sans-serif;
  background: var(--page-bg);
  color: var(--ink);
  user-select: none;
  transition: background 180ms ease, color 180ms ease;
}

body.modal-open {
  overflow: hidden;
}

html,
body,
body :not(input):not(textarea):not([contenteditable="true"]) {
  caret-color: transparent;
}

.container {
  width: min(100%, 900px);
  max-width: 900px;
  margin: 24px auto;
  background: var(--surface);
  padding: 24px;
  border-radius: 24px;
  border: 1px solid var(--surface-border);
  box-shadow: var(--shadow-soft);
}

h1, h2, h3 {
  margin-top: 0;
}

.app-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
}

.app-settings {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

.toolbar-action {
  min-height: 44px;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
}

.settings-field,
.theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--ink);
}

.settings-field select {
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  outline: none;
}

:root[data-theme="dark"] .settings-field,
:root[data-theme="dark"] .theme-switch {
  background: rgba(15, 23, 42, 0.74);
}

:root[data-theme="dark"] .menu-search--toolbar .menu-search__label {
  color: #cbd5e1;
}

.theme-switch {
  cursor: pointer;
}

.theme-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.theme-switch__slider {
  position: relative;
  width: 48px;
  height: 28px;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 160ms ease;
}

.theme-switch__slider::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.2);
  transition: transform 160ms ease;
}

.theme-switch input:checked + .theme-switch__slider {
  background: #38bdf8;
}

.theme-switch input:checked + .theme-switch__slider::before {
  transform: translateX(20px);
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.hidden {
  display: none;
}

.menu-hero {
  display: grid;
  gap: 16px;
  padding: 24px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top left, rgba(250, 204, 21, 0.26), transparent 30%),
    radial-gradient(circle at bottom right, rgba(56, 189, 248, 0.24), transparent 32%),
    linear-gradient(135deg, #0f172a 0%, #1d3557 48%, #1f6f78 100%);
  color: #f8fafc;
}

.menu-eyebrow {
  margin: 0 0 8px;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.8);
}

.menu-description {
  max-width: 620px;
  margin: 12px 0 0;
  line-height: 1.7;
  color: rgba(226, 232, 240, 0.86);
}

.menu-tools {
  display: grid;
  gap: 12px;
}

.menu-search {
  display: grid;
  gap: 8px;
}

.menu-search--toolbar {
  flex: 1 1 320px;
  max-width: 420px;
  min-width: 220px;
}

.menu-search__label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: rgba(226, 232, 240, 0.92);
}

.menu-search input {
  width: min(100%, 380px);
  padding: 10px 12px;
  border: 1px solid rgba(186, 230, 253, 0.32);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.32);
  color: #f8fafc;
}

.menu-search input::placeholder {
  color: rgba(226, 232, 240, 0.72);
}

.menu-search--toolbar .menu-search__label {
  color: var(--muted);
}

.menu-search--toolbar input {
  width: 100%;
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--field-ink);
}

.menu-search--toolbar input::placeholder {
  color: var(--muted);
}

.leaderboard-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.leaderboard-modal.hidden {
  display: none !important;
}

.leaderboard-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.52);
  backdrop-filter: blur(6px);
}

.leaderboard-modal__dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 860px);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--surface-border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  color: var(--ink);
}

.leaderboard-modal__header {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.leaderboard-screen {
  display: grid;
  gap: 14px;
}

.leaderboard-subtitle {
  margin: -4px 0 0;
  color: var(--muted);
}

.leaderboard-context {
  margin: 10px 0 14px;
  font-weight: 700;
  color: var(--ink);
}

.leaderboard-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.leaderboard-page-info {
  margin: 0;
  font-weight: 700;
  color: var(--muted);
}

.leaderboard-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.leaderboard-difficulty-tabs {
  margin-top: -4px;
}

.leaderboard-tab.is-active {
  background: #222;
  border-color: #222;
  color: #fff;
}

:root[data-theme="dark"] .leaderboard-tab.is-active {
  background: #e2e8f0;
  border-color: #e2e8f0;
  color: #0f172a;
}

.leaderboard-status {
  margin: 0;
  min-height: 1.5em;
  color: var(--muted);
}

.leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leaderboard-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-strong);
}

.leaderboard-rank {
  width: 2.5em;
  font-weight: 700;
}

.leaderboard-name {
  overflow-wrap: anywhere;
}

.leaderboard-score {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.menu-legend {
  display: flex;
  width: 100%;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.menu-legend__chip,
.menu-card__difficulty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.04em;
}

.menu-level-chip {
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.menu-level-chip:hover {
  transform: translateY(-1px);
}

.menu-level-chip.is-active {
  border-color: rgba(241, 245, 249, 0.82);
  box-shadow: 0 0 0 2px rgba(241, 245, 249, 0.26);
  transform: translateY(-1px);
}

.menu-legend__action {
  margin-left: auto;
}

.level-1 {
  background: rgba(196, 181, 253, 0.26);
  color: #5b21b6;
}

.level-2 {
  background: rgba(125, 211, 252, 0.26);
  color: #0f766e;
}

.level-3 {
  background: rgba(250, 204, 21, 0.24);
  color: #92400e;
}

.level-4 {
  background: rgba(251, 146, 60, 0.24);
  color: #9a3412;
}

.level-5 {
  background: rgba(248, 113, 113, 0.22);
  color: #991b1b;
}

.menu-buttons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.menu-buttons > button.hidden,
.menu-buttons > button[hidden] {
  display: none !important;
}

button {
  padding: 10px 16px;
  border: 1px solid var(--field-border);
  background: var(--button-bg);
  color: var(--button-ink);
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  line-height: 1.3;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

select {
  padding: 10px 12px;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  font-size: 16px;
  background: var(--field-bg);
  color: var(--field-ink);
  appearance: none;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

input,
select {
  max-width: 100%;
}

button:hover:enabled {
  background: var(--button-bg-hover);
}

.menu-level-chip {
  min-height: 30px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.2;
}

.menu-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  min-height: 230px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0%, var(--surface-strong) 100%);
  box-shadow: var(--shadow-card);
  text-align: left;
  overflow: hidden;
  transition: transform 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.menu-card::after {
  content: "";
  position: absolute;
  inset: auto -32px -52px auto;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.08), transparent 68%);
}

.menu-card:hover:enabled {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, #ffffff 100%);
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 18px 34px rgba(15, 23, 42, 0.14);
  transform: translateY(-4px);
}

.menu-card__top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.menu-card__rank {
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.14em;
  color: var(--muted);
}

.menu-card__thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 10;
  border-radius: 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.menu-card__thumb::before,
.menu-card__thumb::after {
  content: "";
  position: absolute;
}

.menu-card__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.menu-card__meta {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
}

.thumb--1a2b {
  background:
    linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}

.thumb--1a2b::before {
  content: "1 2 3 4";
  inset: 18px auto auto 18px;
  padding: 8px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.2em;
}

.thumb--1a2b::after {
  content: "1A2B";
  right: 18px;
  bottom: 16px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #facc15;
  color: #0f172a;
  font-size: 16px;
  font-weight: 700;
}

.thumb--cashforge {
  background: linear-gradient(180deg, #f1f5f9 0%, #e2e8f0 100%);
}

.thumb--cashforge::before {
  content: "NT$";
  left: 18px;
  top: 18px;
  padding: 8px 12px;
  border-radius: 10px;
  background: #0f172a;
  color: #f8fafc;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.thumb--cashforge::after {
  content: "+13";
  right: 16px;
  bottom: 14px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid rgba(245, 158, 11, 0.4);
  background: #fef3c7;
  color: #92400e;
  font-size: 20px;
  font-weight: 800;
}

.thumb--tictactoe {
  background:
    linear-gradient(#0f172a55, #0f172a55),
    linear-gradient(90deg, transparent 31%, #1f2937 31%, #1f2937 35%, transparent 35%, transparent 65%, #1f2937 65%, #1f2937 69%, transparent 69%),
    linear-gradient(transparent 31%, #1f2937 31%, #1f2937 35%, transparent 35%, transparent 65%, #1f2937 65%, #1f2937 69%, transparent 69%),
    #f8fafc;
}

.thumb--tictactoe::before {
  content: "O";
  left: 26px;
  top: 18px;
  color: #2563eb;
  font-size: 42px;
  font-weight: 800;
}

.thumb--tictactoe::after {
  content: "X";
  right: 24px;
  bottom: 12px;
  color: #ef4444;
  font-size: 38px;
  font-weight: 800;
}

.thumb--connectfour {
  background:
    linear-gradient(180deg, #dbeafe 0%, #bfdbfe 100%);
}

.thumb--connectfour::before {
  inset: 14px 18px 18px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 16% 24%, rgba(255, 255, 255, 0.95) 0 8px, transparent 9px),
    radial-gradient(circle at 40% 24%, rgba(255, 255, 255, 0.95) 0 8px, transparent 9px),
    radial-gradient(circle at 64% 24%, rgba(255, 255, 255, 0.95) 0 8px, transparent 9px),
    radial-gradient(circle at 88% 24%, rgba(255, 255, 255, 0.95) 0 8px, transparent 9px),
    radial-gradient(circle at 28% 48%, rgba(255, 255, 255, 0.95) 0 8px, transparent 9px),
    radial-gradient(circle at 52% 48%, rgba(255, 255, 255, 0.95) 0 8px, transparent 9px),
    radial-gradient(circle at 76% 48%, rgba(255, 255, 255, 0.95) 0 8px, transparent 9px),
    radial-gradient(circle at 16% 72%, rgba(255, 255, 255, 0.95) 0 8px, transparent 9px),
    radial-gradient(circle at 40% 72%, rgba(255, 255, 255, 0.95) 0 8px, transparent 9px),
    radial-gradient(circle at 64% 72%, rgba(255, 255, 255, 0.95) 0 8px, transparent 9px),
    radial-gradient(circle at 88% 72%, rgba(255, 255, 255, 0.95) 0 8px, transparent 9px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.06)),
    #2563eb;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.22);
}

.thumb--connectfour::after {
  left: 32px;
  top: 34px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow:
    24px 0 0 #facc15,
    48px 0 0 #ef4444,
    12px 24px 0 #facc15,
    36px 24px 0 #ef4444,
    60px 24px 0 #facc15,
    24px 48px 0 #ef4444,
    48px 48px 0 #facc15;
}

.thumb--snake {
  background:
    linear-gradient(180deg, #eff6ff 0%, #dbeafe 100%);
}

.thumb--snake::before {
  left: 18px;
  top: 22px;
  width: 90px;
  height: 14px;
  border-radius: 999px;
  background: #16a34a;
  box-shadow:
    18px 18px 0 #22c55e,
    36px 18px 0 #16a34a,
    54px 18px 0 #22c55e,
    54px 36px 0 #16a34a;
}

.thumb--snake::after {
  right: 20px;
  top: 28px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ef4444;
  box-shadow: 4px -6px 0 -4px #15803d;
}

.thumb--2048 {
  background: #bbada0;
}

.thumb--2048::before {
  inset: 14px;
  border-radius: 14px;
  background:
    linear-gradient(90deg, transparent 0, transparent calc(50% - 4px), #cdc1b4 calc(50% - 4px), #cdc1b4 calc(50% + 4px), transparent calc(50% + 4px)),
    linear-gradient(transparent 0, transparent calc(50% - 4px), #cdc1b4 calc(50% - 4px), #cdc1b4 calc(50% + 4px), transparent calc(50% + 4px)),
    #d6cabd;
}

.thumb--2048::after {
  content: "2048";
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 10px 14px;
  border-radius: 12px;
  background: #edc22e;
  color: #1f2937;
  font-size: 20px;
  font-weight: 800;
}

.thumb--breakout {
  background:
    linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
}

.thumb--breakout::before {
  left: 16px;
  top: 16px;
  width: calc(100% - 32px);
  height: 40px;
  background:
    repeating-linear-gradient(90deg, #ef4444 0 24px, transparent 24px 28px),
    repeating-linear-gradient(90deg, #f59e0b 0 24px, transparent 24px 28px),
    repeating-linear-gradient(90deg, #38bdf8 0 24px, transparent 24px 28px);
  background-size: 100% 12px;
  background-position: 0 0, 0 14px, 0 28px;
  background-repeat: no-repeat;
}

.thumb--breakout::after {
  right: 20px;
  bottom: 16px;
  width: 54px;
  height: 8px;
  border-radius: 999px;
  background: #f8fafc;
  box-shadow: -32px -22px 0 2px #38bdf8;
}

.thumb--raiden {
  background:
    linear-gradient(180deg, #020617 0%, #0f172a 100%);
}

.thumb--raiden::before {
  inset: 0;
  background:
    radial-gradient(circle at 15% 22%, rgba(186, 230, 253, 0.9) 0 2px, transparent 2.5px),
    radial-gradient(circle at 36% 46%, rgba(186, 230, 253, 0.8) 0 1.8px, transparent 2.2px),
    radial-gradient(circle at 62% 28%, rgba(186, 230, 253, 0.85) 0 2px, transparent 2.4px),
    radial-gradient(circle at 82% 62%, rgba(186, 230, 253, 0.72) 0 1.8px, transparent 2.1px);
}

.thumb--raiden::after {
  left: 50%;
  bottom: 16px;
  width: 30px;
  height: 56px;
  transform: translateX(-50%);
  background:
    linear-gradient(135deg, transparent 50%, #38bdf8 50%) left,
    linear-gradient(-135deg, transparent 50%, #38bdf8 50%) right;
  background-size: 50% 100%;
  background-repeat: no-repeat;
  clip-path: polygon(50% 0, 100% 88%, 72% 88%, 72% 100%, 28% 100%, 28% 88%, 0 88%);
  box-shadow:
    0 8px 0 -4px #f97316,
    -18px -34px 0 -14px #ef4444,
    18px -28px 0 -14px #ef4444;
}

.thumb--dino {
  background:
    linear-gradient(180deg, #f8fafc 0%, #e2e8f0 72%, #cbd5e1 72%, #cbd5e1 100%);
}

.thumb--dino::before {
  left: 26px;
  bottom: 18px;
  width: 28px;
  height: 24px;
  background: #111827;
  box-shadow:
    12px -10px 0 0 #111827,
    22px -16px 0 -2px #111827,
    26px 0 0 -8px #111827,
    8px 20px 0 -8px #111827,
    22px 20px 0 -8px #111827;
}

.thumb--dino::after {
  right: 24px;
  bottom: 18px;
  width: 12px;
  height: 34px;
  background: #166534;
  box-shadow:
    -8px 12px 0 -2px #166534,
    8px 8px 0 -2px #166534;
}

.thumb--minesweeper {
  background:
    linear-gradient(180deg, #e2e8f0 0%, #cbd5e1 100%);
}

.thumb--minesweeper::before {
  inset: 14px;
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(100, 116, 139, 0.18) 1px, transparent 1px),
    linear-gradient(rgba(100, 116, 139, 0.18) 1px, transparent 1px);
  background-size: 24px 24px;
}

.thumb--minesweeper::after {
  content: "1";
  left: 30px;
  top: 26px;
  color: #2563eb;
  font-size: 30px;
  font-weight: 800;
  box-shadow:
    54px 10px 0 0 rgba(239, 68, 68, 0.88),
    82px 36px 0 0 rgba(250, 204, 21, 0.9);
}

.thumb--sudoku {
  background:
    linear-gradient(180deg, #fefce8 0%, #fef3c7 100%);
}

.thumb--sudoku::before {
  inset: 12px;
  border-radius: 12px;
  background:
    linear-gradient(90deg, transparent 31%, #92400e 31%, #92400e 33%, transparent 33%, transparent 65%, #92400e 65%, #92400e 67%, transparent 67%),
    linear-gradient(transparent 31%, #92400e 31%, #92400e 33%, transparent 33%, transparent 65%, #92400e 65%, #92400e 67%, transparent 67%),
    linear-gradient(90deg, rgba(120, 53, 15, 0.18) 1px, transparent 1px),
    linear-gradient(rgba(120, 53, 15, 0.18) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 16px 16px, 16px 16px;
}

.thumb--sudoku::after {
  content: "5 8 3";
  left: 26px;
  bottom: 18px;
  color: #92400e;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.22em;
}

.thumb--memory {
  background:
    linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
}

.thumb--memory::before {
  left: 20px;
  top: 22px;
  width: 44px;
  height: 58px;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
  box-shadow:
    36px 10px 0 0 rgba(248, 250, 252, 0.96),
    18px 26px 0 0 rgba(251, 191, 36, 0.96);
}

.thumb--memory::after {
  content: "";
  left: 32px;
  top: 34px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #2563eb;
  box-shadow:
    36px 10px 0 0 #ec4899,
    18px 26px 0 0 #f97316;
}

.thumb--whack {
  background:
    linear-gradient(180deg, #dcfce7 0%, #bbf7d0 100%);
}

.thumb--whack::before {
  inset: 16px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 25% 28%, #166534 0 16px, transparent 17px),
    radial-gradient(circle at 75% 28%, #166534 0 16px, transparent 17px),
    radial-gradient(circle at 25% 72%, #166534 0 16px, transparent 17px),
    radial-gradient(circle at 75% 72%, #166534 0 16px, transparent 17px),
    radial-gradient(circle at 50% 50%, #166534 0 16px, transparent 17px),
    #65a30d;
}

.thumb--whack::after {
  left: 46px;
  top: 42px;
  width: 28px;
  height: 22px;
  border-radius: 50% 50% 42% 42%;
  background: #7c2d12;
  box-shadow:
    0 -10px 0 -6px #fef3c7,
    -10px -4px 0 -7px #111827,
    10px -4px 0 -7px #111827;
}

.thumb--slide {
  background:
    linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
}

.thumb--slide::before {
  inset: 18px;
  border-radius: 16px;
  background:
    linear-gradient(90deg, rgba(148, 163, 184, 0.28) 1px, transparent 1px),
    linear-gradient(rgba(148, 163, 184, 0.28) 1px, transparent 1px);
  background-size: 28px 28px;
}

.thumb--slide::after {
  content: "15";
  left: 38px;
  top: 34px;
  padding: 8px 12px;
  border-radius: 12px;
  background: #2563eb;
  color: #ffffff;
  font-size: 22px;
  font-weight: 800;
  box-shadow:
    30px 0 0 0 #3b82f6,
    0 30px 0 0 #1d4ed8;
}

.thumb--sokoban {
  background:
    linear-gradient(180deg, #fef3c7 0%, #fcd34d 100%);
}

.thumb--sokoban::before {
  inset: 16px;
  border-radius: 16px;
  background:
    linear-gradient(90deg, rgba(146, 64, 14, 0.24) 1px, transparent 1px),
    linear-gradient(rgba(146, 64, 14, 0.24) 1px, transparent 1px);
  background-size: 24px 24px;
}

.thumb--sokoban::after {
  left: 34px;
  top: 34px;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #b45309;
  box-shadow:
    28px 0 0 #fbbf24,
    56px 0 0 #b45309,
    28px 28px 0 #fef3c7;
}

.thumb--huarongdao {
  background:
    linear-gradient(180deg, #f5d0a2 0%, #e9b67b 100%);
}

.thumb--huarongdao::before {
  inset: 14px;
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(120, 53, 15, 0.25) 1px, transparent 1px),
    linear-gradient(rgba(120, 53, 15, 0.25) 1px, transparent 1px);
  background-size: 24px 24px;
}

.thumb--huarongdao::after {
  left: 40px;
  top: 26px;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(180deg, #b91c1c 0%, #7f1d1d 100%);
  box-shadow:
    -24px 0 0 -4px #1d4ed8,
    52px 0 0 -4px #1d4ed8,
    -24px 44px 0 -4px #1d4ed8,
    52px 44px 0 -4px #1d4ed8,
    12px 52px 0 -12px #4b5563,
    36px 52px 0 -12px #4b5563;
}

.thumb--water-sort {
  background: linear-gradient(180deg, #e0f2fe 0%, #bae6fd 100%);
}

.thumb--water-sort::before {
  left: 22px;
  top: 18px;
  width: 20px;
  height: 72px;
  border: 3px solid #0f172a;
  border-top: 0;
  border-radius: 0 0 14px 14px;
  background:
    linear-gradient(to top,
      #60a5fa 0 25%,
      #fbbf24 25% 50%,
      #f87171 50% 75%,
      transparent 75% 100%);
}

.thumb--water-sort::after {
  left: 56px;
  top: 24px;
  width: 20px;
  height: 60px;
  border: 3px solid #0f172a;
  border-top: 0;
  border-radius: 0 0 14px 14px;
  background:
    linear-gradient(to top,
      #34d399 0 33%,
      #a78bfa 33% 66%,
      transparent 66% 100%);
}

.thumb--gomoku {
  background:
    linear-gradient(180deg, #fbbf24 0%, #f59e0b 100%);
}

.thumb--gomoku::before {
  inset: 12px;
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(120, 53, 15, 0.28) 1px, transparent 1px),
    linear-gradient(rgba(120, 53, 15, 0.28) 1px, transparent 1px);
  background-size: 18px 18px;
}

.thumb--gomoku::after {
  left: 30px;
  top: 26px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #111827;
  box-shadow:
    18px 18px 0 #f8fafc,
    36px 36px 0 #111827,
    54px 54px 0 #f8fafc;
}

.thumb--reversi {
  background:
    linear-gradient(180deg, #166534 0%, #14532d 100%);
}

.thumb--reversi::before {
  left: 34px;
  top: 26px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #111827;
  box-shadow: 34px 22px 0 #f8fafc;
}

.thumb--reversi::after {
  right: 32px;
  bottom: 26px;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(90deg, #111827 50%, #f8fafc 50%);
}

.thumb--tetris {
  background:
    linear-gradient(180deg, #111827 0%, #1f2937 100%);
}

.thumb--tetris::before {
  left: 18px;
  bottom: 18px;
  width: 22px;
  height: 22px;
  background: #38bdf8;
  box-shadow:
    22px 0 0 #38bdf8,
    44px 0 0 #38bdf8,
    66px 0 0 #38bdf8,
    88px -22px 0 #f97316,
    110px -22px 0 #f97316,
    110px 0 0 #f97316,
    66px -22px 0 #a855f7,
    88px -44px 0 #a855f7,
    88px -22px 0 #a855f7;
}

.thumb--tetris::after {
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 22px 22px;
}

.thumb--pinball {
  background:
    radial-gradient(circle at 20% 18%, rgba(250, 204, 21, 0.3), transparent 18%),
    linear-gradient(180deg, #0f172a 0%, #1d3557 100%);
}

.thumb--pinball::before {
  inset: 12px;
  border-radius: 16px;
  border: 2px solid rgba(248, 250, 252, 0.44);
  border-bottom-left-radius: 26px;
  border-bottom-right-radius: 26px;
}

.thumb--pinball::after {
  right: 24px;
  bottom: 16px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #f8fafc;
  box-shadow:
    -78px -42px 0 7px #fb7185,
    -24px -58px 0 6px #facc15,
    -48px -10px 0 0 #38bdf8;
}

.thumb--pacman {
  background:
    linear-gradient(180deg, #020617 0%, #111827 100%);
}

.thumb--pacman::before {
  inset: 0;
  background:
    radial-gradient(circle at 22% 50%, #fde68a 0 6px, transparent 7px),
    radial-gradient(circle at 40% 50%, rgba(253, 230, 138, 0.9) 0 2px, transparent 3px),
    radial-gradient(circle at 53% 50%, rgba(253, 230, 138, 0.9) 0 2px, transparent 3px),
    radial-gradient(circle at 66% 50%, rgba(253, 230, 138, 0.9) 0 2px, transparent 3px),
    linear-gradient(90deg, transparent 16%, #1d4ed8 16%, #1d4ed8 20%, transparent 20%, transparent 80%, #1d4ed8 80%, #1d4ed8 84%, transparent 84%);
}

.thumb--pacman::after {
  content: "";
  right: 22px;
  top: 26px;
  width: 28px;
  height: 28px;
  border-radius: 14px 14px 6px 6px;
  background: #ef4444;
  box-shadow:
    0 12px 0 -10px #ef4444,
    -4px 12px 0 -10px #ef4444,
    4px 12px 0 -10px #ef4444;
}

.thumb--chess {
  background:
    linear-gradient(135deg, #f1e4c9 25%, #8b5e34 25%, #8b5e34 50%, #f1e4c9 50%, #f1e4c9 75%, #8b5e34 75%);
  background-size: 46px 46px;
}

.thumb--chess::before {
  content: "♞";
  left: 24px;
  top: 18px;
  color: #111827;
  font-size: 48px;
  line-height: 1;
}

.thumb--chess::after {
  content: "♔";
  right: 20px;
  bottom: 14px;
  color: #f8fafc;
  font-size: 48px;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(15, 23, 42, 0.3);
}

.thumb--xiangqi {
  background:
    linear-gradient(180deg, #f6d4a4 0%, #e4b77d 100%);
}

.thumb--xiangqi::before {
  inset: 12px;
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(120, 53, 15, 0.25) 2px, transparent 2px),
    linear-gradient(rgba(120, 53, 15, 0.25) 2px, transparent 2px);
  background-size: 24px 24px;
}

.thumb--xiangqi::after {
  content: "帥  將";
  left: 22px;
  bottom: 18px;
  color: #7f1d1d;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 0.34em;
}

.thumb--go {
  background:
    linear-gradient(180deg, #efc17a 0%, #d8a763 100%);
}

.thumb--go::before {
  inset: 12px;
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(120, 53, 15, 0.25) 1px, transparent 1px),
    linear-gradient(rgba(120, 53, 15, 0.25) 1px, transparent 1px);
  background-size: 18px 18px;
}

.thumb--go::after {
  left: 28px;
  top: 24px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #111827;
  box-shadow:
    24px 0 0 #f8fafc,
    48px 24px 0 #111827,
    72px 48px 0 #f8fafc,
    96px 24px 0 #111827;
}

.thumb--shogi {
  background:
    linear-gradient(180deg, #f6d4a4 0%, #e4b77d 100%);
}

.thumb--shogi::before {
  inset: 12px;
  border-radius: 12px;
  background:
    linear-gradient(90deg, rgba(120, 53, 15, 0.24) 1px, transparent 1px),
    linear-gradient(rgba(120, 53, 15, 0.24) 1px, transparent 1px);
  background-size: 20px 20px;
}

.thumb--shogi::after {
  content: "SHOGI";
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(127, 29, 29, 0.9);
  color: #fff7ed;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.thumb--checkers {
  background:
    linear-gradient(180deg, #f5d8ac 0%, #d8a767 100%);
}

.thumb--checkers::before {
  inset: 14px;
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 0%, rgba(17, 24, 39, 0.82) 0 8px, transparent 9px),
    radial-gradient(circle at 100% 25%, rgba(17, 24, 39, 0.82) 0 8px, transparent 9px),
    radial-gradient(circle at 100% 75%, rgba(17, 24, 39, 0.82) 0 8px, transparent 9px),
    radial-gradient(circle at 50% 100%, rgba(17, 24, 39, 0.82) 0 8px, transparent 9px),
    radial-gradient(circle at 0% 75%, rgba(17, 24, 39, 0.82) 0 8px, transparent 9px),
    radial-gradient(circle at 0% 25%, rgba(17, 24, 39, 0.82) 0 8px, transparent 9px);
}

.thumb--checkers::after {
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: #ef4444;
  box-shadow:
    -34px -18px 0 #22c55e,
    34px -18px 0 #8b5cf6,
    -34px 18px 0 #f97316,
    34px 18px 0 #facc15,
    0 36px 0 #2563eb;
}

.thumb--maze {
  background: linear-gradient(180deg, #dbeafe 0%, #f8fafc 100%);
}

.thumb--maze::before {
  inset: 14px;
  border-radius: 16px;
  background:
    linear-gradient(90deg, transparent 16%, #1e293b 16% 20%, transparent 20% 38%, #1e293b 38% 42%, transparent 42% 58%, #1e293b 58% 62%, transparent 62% 80%, #1e293b 80% 84%, transparent 84%),
    linear-gradient(transparent 16%, #1e293b 16% 20%, transparent 20% 38%, #1e293b 38% 42%, transparent 42% 58%, #1e293b 58% 62%, transparent 62% 80%, #1e293b 80% 84%, transparent 84%),
    #e2e8f0;
}

.thumb--maze::after {
  left: 20px;
  top: 18px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow:
    38px 16px 0 #f59e0b,
    80px 56px 0 #2563eb;
}

.thumb--flappy {
  background: linear-gradient(180deg, #bfdbfe 0%, #eff6ff 100%);
}

.thumb--flappy::before {
  left: 20px;
  top: 22px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #facc15;
  box-shadow: 14px -6px 0 -8px #0f172a;
}

.thumb--flappy::after {
  right: 16px;
  top: 12px;
  width: 26px;
  height: 72px;
  border-radius: 10px;
  background:
    linear-gradient(180deg, #22c55e 0%, #15803d 100%);
  box-shadow:
    -58px 22px 0 0 #16a34a;
}

.thumb--rhythm {
  background: linear-gradient(180deg, #111827 0%, #1f2937 100%);
}

.thumb--rhythm::before {
  inset: 14px 16px 14px;
  border-radius: 16px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 0 24%, rgba(255, 255, 255, 0.14) 24% 26%, rgba(255, 255, 255, 0.04) 26% 49%, rgba(255, 255, 255, 0.14) 49% 51%, rgba(255, 255, 255, 0.04) 51% 74%, rgba(255, 255, 255, 0.14) 74% 76%, rgba(255, 255, 255, 0.04) 76%),
    linear-gradient(transparent 72%, rgba(248, 250, 252, 0.45) 72% 74%, transparent 74%),
    #0f172a;
}

.thumb--rhythm::after {
  left: 24px;
  top: 20px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #f472b6;
  box-shadow:
    34px 24px 0 #60a5fa,
    68px 8px 0 #facc15;
}

.thumb--roguelike {
  background: linear-gradient(180deg, #1f2937 0%, #334155 100%);
}

.thumb--roguelike::before {
  inset: 14px;
  border-radius: 16px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px) 0 0 / 18px 18px,
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px) 0 0 / 18px 18px,
    linear-gradient(180deg, rgba(15, 23, 42, 0.16), rgba(15, 23, 42, 0.32)),
    #0f172a;
}

.thumb--roguelike::after {
  left: 22px;
  top: 24px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #60a5fa;
  box-shadow:
    42px 18px 0 #facc15,
    72px 52px 0 #ef4444;
}

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

.top-bar {
  margin-bottom: 20px;
}

.input-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 16px 0;
}

input {
  padding: 10px;
  font-size: 16px;
  width: 180px;
  border: 1px solid var(--field-border);
  background: var(--field-bg);
  color: var(--field-ink);
  border-radius: 8px;
  caret-color: auto;
  user-select: text;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}

.history {
  margin-top: 20px;
}

#history-list {
  padding-left: 20px;
}

#message,
#maze-message,
#flappy-message,
#rhythm-message,
#roguelike-message,
#snake-message,
#minesweeper-message,
#message-2048,
#breakout-message,
#pinball-message,
#dino-message,
#pacman-message,
#chess-message,
#tictactoe-message,
#tetris-message,
#gomoku-message,
#reversi-message,
#sudoku-message,
#memory-message,
#water-sort-message,
#raiden-message,
#cashforge-message,
#checkers-message,
#xiangqi-message,
#go-message {
  font-weight: bold;
}

.game-panel {
  margin-top: 10px;
}

.cashforge-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.cashforge-view {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.55);
  padding: 14px;
}

.cashforge-view h3 {
  margin-bottom: 10px;
}

.cashforge-shop-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cashforge-shop-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-strong);
}

.cashforge-toggle-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0;
}

.cashforge-toggle-row label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cashforge-equipment-status-list {
  margin: 10px 0 0;
  padding-left: 20px;
}

.cashforge-equipment-status-item {
  margin: 4px 0;
}

.cashforge-equipment-status-item.is-destroyed {
  color: #b91c1c;
}

.game-stats {
  margin: 10px 0 0;
}

.stats-separator {
  margin: 0 8px;
}

.mode-button.active {
  background: #222;
  border-color: #222;
  color: #fff;
}

:root[data-theme="dark"] .menu-card {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96) 0%, #0f172a 100%);
  color: var(--ink);
}

:root[data-theme="dark"] .menu-card:hover:enabled {
  background: linear-gradient(180deg, rgba(17, 24, 39, 0.98) 0%, #111827 100%);
}

:root[data-theme="dark"] .menu-card__title {
  color: #f8fafc;
}

:root[data-theme="dark"] .menu-card__rank,
:root[data-theme="dark"] .menu-card__meta {
  color: #93a4bb;
}

:root[data-theme="dark"] .menu-card__difficulty {
  border: 1px solid rgba(255, 255, 255, 0.06);
}

:root[data-theme="dark"] .menu-level-chip.is-active {
  border-color: rgba(186, 230, 253, 0.68);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.28);
}

:root[data-theme="dark"] .level-1 {
  background: rgba(167, 139, 250, 0.22);
  color: #ddd6fe;
}

:root[data-theme="dark"] .level-2 {
  background: rgba(34, 211, 238, 0.2);
  color: #a5f3fc;
}

:root[data-theme="dark"] .level-3 {
  background: rgba(251, 191, 36, 0.2);
  color: #fde68a;
}

:root[data-theme="dark"] .level-4 {
  background: rgba(251, 146, 60, 0.2);
  color: #fdba74;
}

:root[data-theme="dark"] .level-5 {
  background: rgba(248, 113, 113, 0.2);
  color: #fecaca;
}

:root[data-theme="dark"] .mode-button.active {
  background: #e2e8f0;
  border-color: #e2e8f0;
  color: #0f172a;
}

:root[data-theme="dark"] .cashforge-view {
  background: rgba(15, 23, 42, 0.48);
}

#snake-canvas {
  border: 2px solid #333;
  background: #fafafa;
  display: block;
  width: 100%;
  max-width: 560px;
  height: auto;
}

#maze-canvas,
#flappy-canvas,
#rhythm-canvas,
#roguelike-canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 2px solid var(--line);
  background: var(--surface);
}

#maze-canvas {
  max-width: 620px;
  background: #f8fafc;
}

#flappy-canvas {
  max-width: 480px;
  background: linear-gradient(180deg, #bfdbfe 0%, #eff6ff 100%);
}

#rhythm-canvas {
  max-width: 520px;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
}

#roguelike-canvas {
  max-width: 600px;
  background: #f8fafc;
}

.snake-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  width: min(100%, 560px);
}

.snake-leaderboard {
  width: min(100%, 560px);
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-strong);
}

.snake-leaderboard h3 {
  margin: 0 0 8px;
}

.snake-leaderboard-status {
  margin: 0 0 10px;
  min-height: 1.5em;
  color: var(--muted);
}

.snake-leaderboard-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.snake-leaderboard-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.snake-leaderboard-rank {
  font-weight: 700;
  width: 2.5em;
}

.snake-leaderboard-name {
  overflow-wrap: anywhere;
}

.snake-leaderboard-score {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.snake-touch-controls {
  display: none;
  width: min(100%, 240px);
  gap: 10px;
}

.snake-touch-controls > button,
.snake-touch-middle button {
  min-height: 56px;
  touch-action: manipulation;
}

.snake-touch-controls > button {
  width: 72px;
  justify-self: center;
}

.snake-touch-middle {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.board-scroll {
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 6px;
  -webkit-overflow-scrolling: touch;
}

.minesweeper-board {
  display: grid;
  grid-template-columns: repeat(var(--ms-cols, 16), var(--ms-cell-size, 28px));
  grid-auto-rows: var(--ms-cell-size, 28px);
  gap: 4px;
  margin-top: 16px;
  width: max-content;
}

.cell {
  width: var(--ms-cell-size, 28px);
  height: var(--ms-cell-size, 28px);
  border: 1px solid #bbb;
  background: #dfe6e9;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  cursor: pointer;
  font-size: calc(var(--ms-cell-size, 28px) * 0.46);
}

.cell.revealed {
  background: #f5f5f5;
  color: #1f2937;
  cursor: default;
}

.cell.revealed.empty {
  background: #f5f5f5;
}

.cell.flagged {
  background: #ffeaa7;
  color: #b91c1c;
}

.cell.mine {
  background: #ff7675;
  color: #1f2937;
}

.cell.count-1 {
  color: #2563eb;
}

.cell.count-2 {
  color: #15803d;
}

.cell.count-3 {
  color: #dc2626;
}

.cell.count-4 {
  color: #1d4ed8;
}

.cell.count-5 {
  color: #7c2d12;
}

.cell.count-6 {
  color: #0f766e;
}

.cell.count-7 {
  color: #111827;
}

.cell.count-8 {
  color: #475569;
}

.board-2048 {
  width: min(100%, 340px);
  aspect-ratio: 1 / 1;
  position: relative;
  background: #bbada0;
  padding: 8px;
  border-radius: 12px;
  margin-top: 16px;
  margin-inline: auto;
  overflow: hidden;
}

.board-2048-background {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  height: 100%;
}

.board-2048-bg-cell {
  width: auto;
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  background: #cdc1b4;
}

.board-2048-tiles-layer,
.board-2048-animation-layer {
  position: absolute;
  inset: 8px;
}

.tile-2048-cell {
  width: calc((100% - 24px) / 4);
  height: auto;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1;
  font-size: clamp(18px, 7vw, 28px);
  font-weight: bold;
  background: #cdc1b4;
  color: #776e65;
}

.board-2048-tile {
  position: absolute;
  top: 0;
  left: 0;
}

.board-2048-moving-tile {
  transition: transform 150ms ease-in-out;
  box-shadow: 0 12px 18px rgba(15, 23, 42, 0.14);
}

.tile-2048-cell.new-tile {
  animation: tile-2048-pop-in 160ms ease-out;
}

.tile-2048-cell.merged-tile {
  animation: tile-2048-merge-pop 180ms ease-out;
}

@keyframes tile-2048-pop-in {
  0% {
    opacity: 0.35;
    filter: brightness(1.28);
  }
  100% {
    opacity: 1;
    filter: brightness(1);
  }
}

@keyframes tile-2048-merge-pop {
  0% {
    filter: brightness(1);
  }
  55% {
    filter: brightness(1.34);
  }
  100% {
    filter: brightness(1);
  }
}

.tile-0 {
  background: #cdc1b4;
  color: transparent;
}

.tile-2 {
  background: #eee4da;
}

.tile-4 {
  background: #ede0c8;
}

.tile-8 {
  background: #f2b179;
  color: #f9f6f2;
}

.tile-16 {
  background: #f59563;
  color: #f9f6f2;
}

.tile-32 {
  background: #f67c5f;
  color: #f9f6f2;
}

.tile-64 {
  background: #f65e3b;
  color: #f9f6f2;
}

.tile-128 {
  background: #edcf72;
  color: #222;
  font-size: 24px;
}

.tile-256 {
  background: #edcc61;
  color: #222;
  font-size: 24px;
}

.tile-512 {
  background: #edc850;
  color: #222;
  font-size: 24px;
}

.tile-1024 {
  background: #edc53f;
  color: #222;
  font-size: 22px;
}

.tile-2048 {
  background: #edc22e;
  color: #222;
  font-size: 22px;
}

.tile-super {
  background: #3c3a32;
  color: #f9f6f2;
  font-size: 18px;
}

#breakout-canvas {
  border: 2px solid #333;
  background: linear-gradient(180deg, #f9fbff 0%, #eef2f7 100%);
  display: block;
  max-width: 100%;
  width: min(100%, 640px);
  height: auto;
}

#raiden-canvas {
  border: 2px solid #0f172a;
  border-radius: 12px;
  background: #020617;
  display: block;
  max-width: 100%;
  width: min(100%, 480px);
  height: auto;
}

.pinball-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}

#pinball-canvas {
  border: 2px solid #0f172a;
  border-radius: 18px;
  background: #0f172a;
  display: block;
  max-width: 100%;
  width: min(100%, 520px);
  height: auto;
}

.pinball-side-panel {
  flex: 1 1 220px;
  min-width: min(100%, 220px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pinball-touch-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.pinball-touch-controls button {
  min-height: 54px;
  touch-action: manipulation;
}

.pinball-hint {
  margin: 0;
  line-height: 1.6;
  color: #475569;
}

.dino-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}

#dino-canvas {
  border: 2px solid #475569;
  border-radius: 14px;
  background: linear-gradient(180deg, #f8fafc 0%, #e2e8f0 100%);
  display: block;
  max-width: 100%;
  width: min(100%, 800px);
  height: auto;
}

.dino-side-panel {
  flex: 1 1 220px;
  min-width: min(100%, 220px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dino-touch-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.dino-touch-controls button {
  min-height: 54px;
  touch-action: manipulation;
}

.dino-hint {
  margin: 0;
  line-height: 1.6;
  color: #475569;
}

.pacman-layout {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  flex-wrap: wrap;
}

#pacman-canvas {
  border: 2px solid #0f172a;
  border-radius: 14px;
  background: #020617;
  display: block;
  max-width: 100%;
  width: min(100%, 504px);
  height: auto;
}

.pacman-side-panel {
  flex: 1 1 220px;
  min-width: min(100%, 220px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.pacman-touch-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pacman-touch-controls > button {
  width: min(100%, 120px);
  align-self: center;
}

.pacman-touch-middle {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.pacman-touch-middle button {
  min-height: 54px;
  touch-action: manipulation;
}

.pacman-hint {
  margin: 0;
  line-height: 1.6;
  color: #475569;
}

.chess-board {
  display: grid;
  grid-template-columns: repeat(8, 64px);
  grid-auto-rows: 64px;
  width: max-content;
  margin-top: 16px;
  border: 4px solid #6b4226;
  border-radius: 12px;
  overflow: hidden;
  background: #6b4226;
}

.chess-cell {
  width: 64px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
}

.chess-cell.light {
  background: #f0d9b5;
}

.chess-cell.dark {
  background: #b58863;
}

.chess-cell.selected {
  box-shadow: inset 0 0 0 4px #2563eb;
}

.chess-cell.valid.capture {
  box-shadow: inset 0 0 0 4px rgba(185, 28, 28, 0.85);
}

.chess-cell.last-from,
.chess-cell.last-to {
  background-image: linear-gradient(rgba(250, 204, 21, 0.3), rgba(250, 204, 21, 0.3));
}

.chess-cell.checked {
  box-shadow: inset 0 0 0 4px rgba(220, 38, 38, 0.92);
}

.chess-piece {
  font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", sans-serif;
  font-size: 42px;
  line-height: 1;
  user-select: none;
}

.chess-piece.white {
  color: #f8fafc;
  text-shadow: 0 1px 0 #111827, 0 0 2px rgba(0, 0, 0, 0.45);
}

.chess-piece.black {
  color: #111827;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);
}

.chess-move-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(17, 24, 39, 0.22);
}

.tictactoe-board {
  display: grid;
  grid-template-columns: repeat(3, 88px);
  grid-auto-rows: 88px;
  gap: 10px;
  width: max-content;
  margin-top: 16px;
}

.tictactoe-cell {
  width: 88px;
  height: 88px;
  border: 2px solid #cbd5e1;
  border-radius: 16px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 54px;
  font-weight: 700;
  line-height: 1;
  padding: 0;
}

.tictactoe-cell:hover:enabled {
  background: #f8fafc;
}

.tictactoe-cell:disabled {
  cursor: default;
}

.tictactoe-cell.circle {
  color: #2563eb;
}

.tictactoe-cell.cross {
  color: #dc2626;
}

.tictactoe-cell.winner {
  background: #fef3c7;
  border-color: #f59e0b;
}

.connectfour-board {
  --connectfour-cell-size: 70px;
  --connectfour-gap: 8px;
  display: grid;
  grid-template-columns: repeat(7, var(--connectfour-cell-size));
  grid-auto-rows: var(--connectfour-cell-size);
  gap: var(--connectfour-gap);
  width: max-content;
  margin-top: 16px;
  padding: 14px;
  border-radius: 28px;
  border: 3px solid #1e40af;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0.05)),
    #2563eb;
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.22),
    0 16px 30px rgba(37, 99, 235, 0.18);
  overflow: hidden;
}

.connectfour-cell {
  width: var(--connectfour-cell-size);
  height: var(--connectfour-cell-size);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.connectfour-cell::before {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 34%, rgba(255, 255, 255, 0.26), rgba(30, 64, 175, 0.9) 78%);
  box-shadow:
    inset 0 6px 10px rgba(0, 0, 0, 0.28),
    inset 0 -2px 4px rgba(255, 255, 255, 0.14);
}

.connectfour-cell.drop-target::after {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  opacity: 0.28;
}

.connectfour-board[data-player="red"] .connectfour-cell.drop-target::after {
  background: #ef4444;
}

.connectfour-board[data-player="yellow"] .connectfour-cell.drop-target::after {
  background: #facc15;
}

.connectfour-cell:hover:enabled {
  transform: translateY(-1px);
}

.connectfour-disc {
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  box-shadow:
    inset 0 2px 5px rgba(255, 255, 255, 0.28),
    inset 0 -3px 6px rgba(0, 0, 0, 0.22),
    0 4px 8px rgba(15, 23, 42, 0.26);
  z-index: 1;
}

.connectfour-disc.is-dropping {
  animation: connectfour-drop 360ms cubic-bezier(0.18, 0.78, 0.24, 1) both;
}

.connectfour-disc.red {
  background: radial-gradient(circle at 32% 30%, #fecaca, #ef4444 62%, #b91c1c 100%);
}

.connectfour-disc.yellow {
  background: radial-gradient(circle at 32% 30%, #fef3c7, #facc15 62%, #ca8a04 100%);
}

@keyframes connectfour-drop {
  0% {
    transform: translateY(calc(-1 * var(--drop-distance, 0px)));
  }

  72% {
    transform: translateY(3px);
  }

  100% {
    transform: translateY(0);
  }
}

.tetris-layout {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: flex-start;
  margin-top: 16px;
}

#tetris-canvas {
  border: 2px solid #0f172a;
  background: #111827;
  display: block;
  max-width: 100%;
  width: min(100%, 320px);
  height: auto;
}

.tetris-side-panel {
  min-width: 160px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tetris-preview-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

#tetris-hold-canvas,
#tetris-next-canvas {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  display: block;
}

.tetris-side-panel h3 {
  margin: 0;
}


.gomoku-board {
  --gomoku-gap: 32px;
  --gomoku-padding: 16px;
  --gomoku-stone-size: 24px;
  position: relative;
  display: block;
  width: max-content;
  margin-top: 16px;
  border: 3px solid #3f2a16;
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(120, 72, 22, 0.08)),
    #d6a35f;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  overflow: visible;
}

.gomoku-grid-line {
  position: absolute;
  background: rgba(44, 28, 14, 0.9);
  pointer-events: none;
  z-index: 0;
}

.gomoku-grid-line--horizontal {
  height: 1px;
  transform: translateY(-0.5px);
}

.gomoku-grid-line--vertical {
  width: 1px;
  transform: translateX(-0.5px);
}

.gomoku-point {
  position: absolute;
  width: var(--gomoku-gap);
  height: var(--gomoku-gap);
  transform: translate(-50%, -50%);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  z-index: 1;
}

.gomoku-point:hover:enabled {
  background: transparent;
}

.gomoku-point.clickable {
  cursor: pointer;
}

.gomoku-point.star-point::before {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(44, 28, 14, 0.9);
}

.gomoku-stone {
  width: var(--gomoku-stone-size);
  height: var(--gomoku-stone-size);
  border-radius: 50%;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.3), 0 2px 5px rgba(0, 0, 0, 0.25);
}

.gomoku-stone.black {
  background: radial-gradient(circle at 30% 30%, #666, #111 70%);
}

.gomoku-stone.white {
  background: radial-gradient(circle at 30% 30%, #fff, #d8d8d8 70%);
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.reversi-board {
  display: grid;
  grid-template-columns: repeat(8, 50px);
  grid-auto-rows: 50px;
  width: max-content;
  background: #0a6b37;
  border: 2px solid #084f2a;
  margin-top: 16px;
}

.reversi-cell {
  width: 50px;
  height: 50px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  perspective: 700px;
}

.reversi-cell.valid::after {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.45);
}

.reversi-disc {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.25), 0 2px 5px rgba(0, 0, 0, 0.25);
  position: absolute;
  transform-style: preserve-3d;
}

.reversi-disc.black {
  background: radial-gradient(circle at 30% 30%, #666, #111 70%);
}

.reversi-disc.white {
  background: radial-gradient(circle at 30% 30%, #fff, #dcdcdc 70%);
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.reversi-disc.flipping {
  animation: reversi-flip 280ms ease-in-out;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.reversi-disc-face {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  backface-visibility: hidden;
  box-shadow: inset 0 2px 4px rgba(255, 255, 255, 0.25), 0 2px 5px rgba(0, 0, 0, 0.25);
}

.reversi-disc-face.black {
  background: radial-gradient(circle at 30% 30%, #666, #111 70%);
}

.reversi-disc-face.white {
  background: radial-gradient(circle at 30% 30%, #fff, #dcdcdc 70%);
  border: 1px solid rgba(0, 0, 0, 0.15);
}

.reversi-disc-face.back {
  transform: rotateY(180deg);
}

@keyframes reversi-flip {
  0% {
    transform: rotateY(0deg);
  }
  100% {
    transform: rotateY(180deg);
  }
}

.sudoku-board {
  display: grid;
  grid-template-columns: repeat(9, 44px);
  grid-auto-rows: 44px;
  width: max-content;
  background: #1f2937;
  gap: 1px;
  padding: 1px;
  border: 2px solid #1f2937;
  border-radius: 0;
  overflow: hidden;
  margin-top: 16px;
}

.sudoku-cell {
  width: 44px;
  height: 44px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  position: relative;
}

.sudoku-cell.fixed {
  background: #eef2f7;
  color: #111827;
}

.sudoku-cell.user-entry {
  color: #2563eb;
}

.sudoku-cell.confirmed {
  color: #374151;
}

.sudoku-cell.selected {
  background: #dbeafe;
}

.sudoku-cell.wrong {
  background: #fee2e2;
  color: #b91c1c;
}

.sudoku-cell.subgrid-right {
  box-shadow: inset -2px 0 0 #1f2937;
}

.sudoku-cell.subgrid-bottom {
  box-shadow: inset 0 -2px 0 #1f2937;
}

.sudoku-cell.subgrid-right.subgrid-bottom {
  box-shadow: inset -2px 0 0 #1f2937, inset 0 -2px 0 #1f2937;
}

.sudoku-number-pad {
  display: grid;
  grid-template-columns: repeat(5, minmax(56px, 1fr));
  gap: 8px;
  max-width: 360px;
  margin-top: 16px;
}

.sudoku-number-button {
  padding: 12px 0;
  font-size: 18px;
}

.sudoku-action-button {
  min-height: 50px;
  padding: 8px 6px;
  font-size: 13px;
  line-height: 1.2;
  white-space: normal;
}

.sudoku-number-button.clear {
  grid-column: span 2;
}

.sudoku-cell.has-notes {
  align-items: stretch;
  justify-content: stretch;
  padding: 4px;
}

.sudoku-notes {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(0, 1fr));
  align-items: center;
  justify-items: center;
  font-size: 10px;
  font-weight: 600;
  color: transparent;
}

.sudoku-note {
  line-height: 1;
}

.sudoku-note.active {
  color: #64748b;
}

.memory-board {
  --memory-columns: 4;
  display: grid;
  grid-template-columns: repeat(var(--memory-columns), 92px);
  gap: 12px;
  width: max-content;
  margin-top: 16px;
}

.memory-card {
  width: 92px;
  height: 122px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  perspective: 1000px;
}

.memory-card:disabled {
  cursor: default;
}

.memory-card__inner {
  display: block;
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 16px;
  transform-style: preserve-3d;
  transition: transform 320ms ease, opacity 220ms ease, filter 220ms ease;
}

.memory-card.is-flipped .memory-card__inner {
  transform: rotateY(180deg);
}

.memory-card.is-matched .memory-card__inner {
  transform: rotateY(180deg) scale(0.92);
  opacity: 0.18;
  filter: saturate(0.55);
}

.memory-card__face {
  position: absolute;
  inset: 0;
  border-radius: 16px;
  backface-visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.18);
}

.memory-card__face--front {
  background: linear-gradient(180deg, #ffffff 0%, #eef2ff 100%);
  border: 2px solid rgba(148, 163, 184, 0.35);
  transform: rotateY(180deg);
}

.memory-card__face--back {
  overflow: hidden;
  background: linear-gradient(180deg, #0f172a 0%, #1e293b 100%);
  border: 2px solid rgba(148, 163, 184, 0.2);
}

.memory-card__back-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: rgba(191, 219, 254, 0.18);
  box-shadow:
    -24px -24px 0 -12px rgba(56, 189, 248, 0.28),
    24px 24px 0 -12px rgba(244, 114, 182, 0.24);
}

.memory-board[data-theme="playing"] .memory-card__face--back {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08) 0 25%, transparent 25% 50%, rgba(255, 255, 255, 0.08) 50% 75%, transparent 75% 100%),
    linear-gradient(180deg, #0f172a 0%, #1d3557 100%);
  background-size: 24px 24px, auto;
}

.memory-board[data-theme="tarot"] .memory-card__face--back {
  background:
    radial-gradient(circle at center, rgba(250, 204, 21, 0.3) 0 18%, transparent 18% 100%),
    linear-gradient(180deg, #1f1537 0%, #3b0764 100%);
}

.memory-board[data-theme="tarot"] .memory-card__face--front {
  background:
    linear-gradient(180deg, #fff7ed 0%, #f5d0fe 100%);
  border-color: rgba(147, 51, 234, 0.25);
}

.memory-board[data-theme="fruit"] .memory-card__face--back {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.12) 0 16%, transparent 16% 50%, rgba(255, 255, 255, 0.12) 50% 66%, transparent 66% 100%),
    linear-gradient(180deg, #14532d 0%, #166534 100%);
  background-size: 22px 22px, auto;
}

.memory-board[data-theme="fruit"] .memory-card__face--front {
  background:
    linear-gradient(180deg, #fefce8 0%, #ecfccb 100%);
  border-color: rgba(22, 163, 74, 0.25);
}

.memory-card__label {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--memory-accent, #2563eb);
}

.memory-board[data-theme="tarot"] .memory-card__label {
  font-size: 18px;
  letter-spacing: 0.12em;
}

.memory-board[data-theme="fruit"] .memory-card__label {
  font-size: 18px;
}

.memory-card__sublabel {
  margin-top: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: #475569;
}

.whack-board {
  --whack-columns: 3;
  --whack-hole-size: 96px;
  display: grid;
  grid-template-columns: repeat(var(--whack-columns), var(--whack-hole-size));
  grid-auto-rows: var(--whack-hole-size);
  gap: 14px;
  width: max-content;
  margin-top: 16px;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Crect x='5' y='4' width='17' height='8' rx='2' fill='%234b5563'/%3E%3Crect x='14' y='10' width='4' height='18' rx='2' transform='rotate(-28 16 19)' fill='%23b45309'/%3E%3Crect x='13' y='14' width='6' height='14' rx='2' transform='rotate(-28 16 21)' fill='%23d97706'/%3E%3C/svg%3E") 4 4, pointer;
}

.whack-hole {
  width: var(--whack-hole-size);
  height: var(--whack-hole-size);
  padding: 0;
  border: 0;
  border-radius: 28px;
  background: linear-gradient(180deg, #86efac 0%, #22c55e 100%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  overflow: hidden;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Crect x='5' y='4' width='17' height='8' rx='2' fill='%234b5563'/%3E%3Crect x='14' y='10' width='4' height='18' rx='2' transform='rotate(-28 16 19)' fill='%23b45309'/%3E%3Crect x='13' y='14' width='6' height='14' rx='2' transform='rotate(-28 16 21)' fill='%23d97706'/%3E%3C/svg%3E") 4 4, pointer;
}

.whack-hole:disabled {
  opacity: 1;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Crect x='5' y='4' width='17' height='8' rx='2' fill='%234b5563'/%3E%3Crect x='14' y='10' width='4' height='18' rx='2' transform='rotate(-28 16 19)' fill='%23b45309'/%3E%3Crect x='13' y='14' width='6' height='14' rx='2' transform='rotate(-28 16 21)' fill='%23d97706'/%3E%3C/svg%3E") 4 4, pointer;
}

.whack-hole__tunnel {
  position: relative;
  width: 74px;
  height: 58px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, #1f2937 0 42%, #111827 60%, #0f172a 100%);
  margin-bottom: 10px;
}

.whack-mole {
  position: absolute;
  left: 50%;
  bottom: 12px;
  width: 38px;
  height: 38px;
  transform: translateX(-50%);
  border-radius: 50% 50% 44% 44%;
  background: #92400e;
  box-shadow:
    0 -12px 0 -7px #fef3c7,
    -12px -4px 0 -8px #111827,
    12px -4px 0 -8px #111827;
}

.whack-mole--spawn {
  animation: whack-pop 180ms ease-out;
}

.whack-mole--miss {
  animation: whack-miss 220ms ease-in forwards;
}

.whack-mole--hit {
  animation: whack-hit 220ms ease-out forwards;
}

.whack-bomb {
  position: absolute;
  left: 50%;
  bottom: 12px;
  width: 34px;
  height: 34px;
  transform: translateX(-50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 30%, #9ca3af 0 10%, #4b5563 10% 20%, #111827 20% 100%);
  box-shadow:
    0 -9px 0 -7px #fb923c,
    0 -15px 0 -13px #1f2937;
}

.whack-bomb--spawn {
  animation: whack-pop 180ms ease-out;
}

.whack-bomb--miss {
  animation: whack-miss 220ms ease-in forwards;
}

.whack-bomb::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  width: 10px;
  height: 8px;
  border: 2px solid #1f2937;
  border-bottom: 0;
  border-radius: 999px 999px 0 0;
  transform: translateX(-50%) rotate(-12deg);
}

.whack-bomb::after {
  content: "";
  position: absolute;
  top: -12px;
  left: 62%;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #f97316;
  box-shadow: 0 0 10px rgba(249, 115, 22, 0.65);
}

.whack-bomb--hit {
  animation: whack-bomb-hit 240ms ease-out forwards;
}

.whack-burst {
  position: absolute;
  left: 50%;
  bottom: 42px;
  transform: translateX(-50%);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fef3c7;
  text-shadow:
    0 2px 0 rgba(15, 23, 42, 0.3),
    0 0 12px rgba(250, 204, 21, 0.45);
  pointer-events: none;
  animation: whack-burst-float 240ms ease-out forwards;
}

.whack-burst--bomb {
  color: #fecaca;
  text-shadow:
    0 2px 0 rgba(15, 23, 42, 0.35),
    0 0 12px rgba(239, 68, 68, 0.45);
}

@keyframes whack-pop {
  0% {
    transform: translateX(-50%) translateY(16px) scale(0.82);
    opacity: 0;
  }

  100% {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 1;
  }
}

@keyframes whack-hit {
  0% {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 1;
  }

  100% {
    transform: translateX(-50%) translateY(18px) scale(0.72);
    opacity: 0.2;
  }
}

@keyframes whack-miss {
  0% {
    transform: translateX(-50%) translateY(0) scale(1);
    opacity: 1;
  }

  100% {
    transform: translateX(-50%) translateY(20px) scale(0.7);
    opacity: 0;
  }
}

@keyframes whack-bomb-hit {
  0% {
    transform: translateX(-50%) scale(1);
    opacity: 1;
    filter: brightness(1);
  }

  100% {
    transform: translateX(-50%) scale(1.18);
    opacity: 0;
    filter: brightness(1.55);
  }
}

@keyframes whack-burst-float {
  0% {
    transform: translateX(-50%) translateY(8px) scale(0.85);
    opacity: 0;
  }

  100% {
    transform: translateX(-50%) translateY(-12px) scale(1);
    opacity: 1;
  }
}

.sokoban-board {
  --sokoban-columns: 7;
  --sokoban-rows: 7;
  --sokoban-cell: 46px;
  display: grid;
  grid-template-columns: repeat(var(--sokoban-columns), var(--sokoban-cell));
  grid-auto-rows: var(--sokoban-cell);
  gap: 2px;
  width: max-content;
  margin-top: 16px;
  padding: 10px;
  border-radius: 14px;
  background: #854d0e;
}

.sokoban-cell {
  width: var(--sokoban-cell);
  height: var(--sokoban-cell);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sokoban-cell.wall {
  background:
    linear-gradient(135deg, #334155 0%, #1e293b 100%);
}

.sokoban-cell.floor {
  background: #f5deb3;
}

.sokoban-cell.target::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #ef4444;
  opacity: 0.5;
}

.sokoban-entity {
  position: relative;
  z-index: 1;
}

.sokoban-player {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #2563eb;
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.28),
    0 2px 6px rgba(37, 99, 235, 0.24);
}

.sokoban-box {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background:
    linear-gradient(135deg, #d97706 0%, #92400e 100%);
  box-shadow: inset 0 2px 3px rgba(255, 255, 255, 0.2);
}

.sokoban-box.on-target {
  outline: 2px solid #facc15;
}

.slide-board {
  --slide-size: 4;
  --slide-cell: 74px;
  display: grid;
  grid-template-columns: repeat(var(--slide-size), var(--slide-cell));
  grid-auto-rows: var(--slide-cell);
  gap: 8px;
  width: max-content;
  margin-top: 16px;
  padding: 12px;
  border-radius: 18px;
  background: #dbeafe;
}

.slide-tile {
  width: var(--slide-cell);
  height: var(--slide-cell);
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff 0%, #eff6ff 100%);
  color: #0f172a;
  font-size: 28px;
  font-weight: 800;
  transition:
    background 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
  will-change: transform;
  box-shadow:
    0 8px 18px rgba(37, 99, 235, 0.16),
    inset 0 2px 3px rgba(255, 255, 255, 0.3);
}

.slide-tile:disabled {
  opacity: 1;
}

.slide-tile.is-movable {
  background: linear-gradient(180deg, #bfdbfe 0%, #60a5fa 100%);
}

.slide-tile.is-empty {
  background: rgba(148, 163, 184, 0.25);
  box-shadow: none;
  cursor: default;
}

.slide-tile.is-final {
  background: linear-gradient(180deg, #bfdbfe 0%, #60a5fa 100%);
}

.water-sort-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(84px, 1fr));
  gap: 20px;
  width: min(100%, 640px);
  margin-top: 16px;
}

.water-sort-tube {
  position: relative;
  width: 84px;
  height: 198px;
  padding: 0;
  border: 0;
  background: transparent;
  justify-self: center;
  transition: transform 150ms ease;
}

.water-sort-tube::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 4px;
  width: 56px;
  height: 14px;
  transform: translateX(-50%);
  border: 3px solid #64748b;
  border-radius: 6px;
  background: linear-gradient(180deg, rgba(241, 245, 249, 0.9), rgba(203, 213, 225, 0.7));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
  pointer-events: none;
}

.water-sort-tube::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 18px;
  width: 34px;
  height: 12px;
  transform: translateX(-50%);
  border: 3px solid #64748b;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: rgba(241, 245, 249, 0.65);
  pointer-events: none;
}

.water-sort-tube__inner {
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 48px;
  height: 162px;
  transform: translateX(-50%);
  border: 3px solid #475569;
  border-top: 0;
  border-radius: 0 0 22px 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0.18)),
    rgba(255, 255, 255, 0.24);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.3);
  overflow: hidden;
}

.water-sort-tube.selected {
  transform: translateY(-8px);
}

.water-sort-tube.completed .water-sort-tube__inner {
  border-color: #16a34a;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.18);
}

.water-sort-segment {
  position: absolute;
  left: 4px;
  width: calc(100% - 8px);
  height: 30px;
  border-radius: 10px 10px 6px 6px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.color-red { background: #f87171; }
.color-blue { background: #60a5fa; }
.color-yellow { background: #fbbf24; }
.color-green { background: #34d399; }
.color-purple { background: #a78bfa; }

.huarongdao-board {
  --huarongdao-cell: 72px;
  --huarongdao-padding: 12px;
  position: relative;
  width: calc(var(--huarongdao-padding) * 2 + var(--huarongdao-cell) * 4);
  height: calc(var(--huarongdao-padding) * 2 + var(--huarongdao-cell) * 5);
  margin-top: 16px;
  border-radius: 14px;
  background: linear-gradient(180deg, #f6d4a4 0%, #e4b77d 100%);
  border: 2px solid #8b4513;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, 0.2);
  overflow: hidden;
}

.huarongdao-board::before {
  content: "";
  position: absolute;
  inset: var(--huarongdao-padding);
  background:
    repeating-linear-gradient(
      to right,
      #7c3f12 0 1px,
      transparent 1px var(--huarongdao-cell)
    ),
    repeating-linear-gradient(
      to bottom,
      #7c3f12 0 1px,
      transparent 1px var(--huarongdao-cell)
    );
  pointer-events: none;
}

.huarongdao-board::after {
  content: "";
  position: absolute;
  left: calc(var(--huarongdao-padding) + var(--huarongdao-cell) * 1);
  bottom: 0;
  width: calc(var(--huarongdao-cell) * 2);
  height: 8px;
  border-radius: 6px 6px 0 0;
  background: rgba(127, 29, 29, 0.78);
  pointer-events: none;
}

.huarongdao-piece {
  position: absolute;
  z-index: 2;
  border: 0;
  border-radius: 10px;
  color: #f8fafc;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: center;
  text-shadow: 0 1px 0 rgba(15, 23, 42, 0.35);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, 0.2),
    0 4px 8px rgba(15, 23, 42, 0.22);
}

.huarongdao-piece--cao {
  background: linear-gradient(180deg, #dc2626 0%, #7f1d1d 100%);
}

.huarongdao-piece--general {
  background: linear-gradient(180deg, #2563eb 0%, #1e3a8a 100%);
}

.huarongdao-piece--soldier {
  background: linear-gradient(180deg, #6b7280 0%, #374151 100%);
  font-size: 13px;
}

.huarongdao-piece.is-selected {
  outline: 3px solid #fde68a;
  outline-offset: -2px;
}

.huarongdao-move-mark {
  position: absolute;
  z-index: 3;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(250, 204, 21, 0.95);
  color: #1f2937;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.25);
}

.checkers-board {
  --checkers-gap-x: 40px;
  --checkers-gap-y: 34px;
  --checkers-padding: 30px;
  --checkers-cell: 32px;
  position: relative;
  width: max-content;
  margin-top: 16px;
  border: 2px solid #8a5b2f;
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(120, 72, 22, 0.08)),
    #d8ab6c;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.checkers-link {
  position: absolute;
  height: 1.5px;
  transform-origin: left center;
  background: rgba(68, 45, 19, 0.55);
  pointer-events: none;
  z-index: 0;
}

.checkers-cell {
  position: absolute;
  width: var(--checkers-cell);
  height: var(--checkers-cell);
  padding: 0;
  border: 2px solid rgba(86, 56, 26, 0.6);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(250, 236, 207, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.checkers-cell:hover:enabled {
  background: rgba(255, 243, 218, 0.92);
}

.checkers-cell.selected {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}

.checkers-cell.valid-step {
  box-shadow: inset 0 0 0 3px rgba(14, 165, 233, 0.28);
}

.checkers-cell.valid-jump {
  box-shadow: inset 0 0 0 3px rgba(249, 115, 22, 0.35);
}

.checkers-move-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.35);
}

.checkers-piece {
  width: calc(var(--checkers-cell) - 10px);
  height: calc(var(--checkers-cell) - 10px);
  border-radius: 50%;
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.32),
    0 2px 4px rgba(15, 23, 42, 0.25);
}

.checkers-piece.red {
  background: radial-gradient(circle at 30% 30%, #fda4af, #dc2626 72%);
}

.checkers-piece.blue {
  background: radial-gradient(circle at 30% 30%, #93c5fd, #2563eb 72%);
}

.checkers-piece.green {
  background: radial-gradient(circle at 30% 30%, #86efac, #16a34a 72%);
}

.checkers-piece.yellow {
  background: radial-gradient(circle at 30% 30%, #fde68a, #eab308 72%);
}

.checkers-piece.purple {
  background: radial-gradient(circle at 30% 30%, #d8b4fe, #8b5cf6 72%);
}

.checkers-piece.orange {
  background: radial-gradient(circle at 30% 30%, #fdba74, #f97316 72%);
}

.checkers-player-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 3px 10px;
  margin-right: 6px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid rgba(15, 23, 42, 0.12);
  background: #f8fafc;
  color: #0f172a;
}

.checkers-player-tag.active {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.22);
}

.checkers-player-tag.red {
  background: #fee2e2;
  color: #991b1b;
}

.checkers-player-tag.blue {
  background: #dbeafe;
  color: #1e3a8a;
}

.checkers-player-tag.green {
  background: #dcfce7;
  color: #166534;
}

.checkers-player-tag.yellow {
  background: #fef9c3;
  color: #854d0e;
}

.checkers-player-tag.purple {
  background: #f3e8ff;
  color: #6b21a8;
}

.checkers-player-tag.orange {
  background: #ffedd5;
  color: #9a3412;
}

.xiangqi-board {
  display: grid;
  grid-template-columns: repeat(9, 58px);
  grid-auto-rows: 58px;
  gap: 2px;
  width: max-content;
  margin-top: 16px;
  padding: 8px;
  border: 2px solid #8a5b2f;
  border-radius: 12px;
  background: linear-gradient(180deg, #d9b27a 0%, #c89557 100%);
}

.xiangqi-cell {
  width: 58px;
  height: 58px;
  background: rgba(255, 247, 232, 0.9);
  border: 1px solid rgba(117, 74, 34, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
}

.xiangqi-cell.river {
  background: linear-gradient(180deg, rgba(255, 247, 232, 0.9) 0%, rgba(227, 240, 255, 0.95) 100%);
}

.xiangqi-cell.selected {
  background: #fde68a;
  box-shadow: inset 0 0 0 3px #2563eb;
}

.xiangqi-cell.valid {
  background: #fef3c7;
}

.xiangqi-piece {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff9ec, #ead5b2 72%);
  border: 2px solid #b8844d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.xiangqi-piece.red {
  color: #b91c1c;
}

.xiangqi-piece.black {
  color: #111827;
}

.xiangqi-move-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(17, 24, 39, 0.22);
}

.shogi-hands {
  display: grid;
  gap: 8px;
  margin: 10px 0 8px;
}

.shogi-hand-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.shogi-hand-row__label {
  color: var(--muted);
  font-size: 14px;
}

.shogi-hand {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-height: 36px;
}

.shogi-hand-piece {
  min-width: 52px;
  min-height: 34px;
  padding: 4px 8px;
  border-radius: 9px;
  border: 1px solid #a16207;
  background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
  color: #7c2d12;
  font-size: 16px;
  font-weight: 700;
}

.shogi-hand-piece.readonly {
  opacity: 0.76;
}

.shogi-hand-piece.selected {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.22);
}

.shogi-hand-empty {
  color: var(--muted);
  font-size: 14px;
}

.shogi-promote-prompt {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 10px 0 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(248, 250, 252, 0.84);
}

:root[data-theme="dark"] .shogi-promote-prompt {
  background: rgba(15, 23, 42, 0.76);
}

.shogi-board {
  display: grid;
  grid-template-columns: repeat(9, 58px);
  grid-auto-rows: 58px;
  gap: 1px;
  width: max-content;
  margin-top: 16px;
  padding: 8px;
  border: 2px solid #8a5b2f;
  border-radius: 12px;
  background: linear-gradient(180deg, #d9b27a 0%, #c89557 100%);
}

.shogi-cell {
  width: 58px;
  height: 58px;
  padding: 0;
  border: 1px solid rgba(117, 74, 34, 0.52);
  border-radius: 0;
  background: rgba(255, 247, 232, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.shogi-cell:hover:enabled {
  background: #fff4dd;
}

.shogi-cell.selected {
  background: #fde68a;
  box-shadow: inset 0 0 0 3px #2563eb;
}

.shogi-cell.valid {
  background: #fef3c7;
}

.shogi-cell.capture {
  box-shadow: inset 0 0 0 3px rgba(220, 38, 38, 0.45);
}

.shogi-piece {
  width: 40px;
  height: 46px;
  border: 1px solid #a16207;
  border-radius: 5px;
  background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
  color: #111827;
  clip-path: polygon(50% 0, 94% 22%, 84% 100%, 16% 100%, 6% 22%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.shogi-piece.white {
  transform: rotate(180deg);
}

.shogi-piece.promoted {
  color: #b91c1c;
}

.shogi-move-dot {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: rgba(17, 24, 39, 0.26);
}

.go-board {
  --go-gap: 30px;
  --go-padding: 15px;
  --go-stone-size: 24px;
  position: relative;
  display: block;
  width: max-content;
  margin-top: 16px;
  border: 3px solid #3f2a16;
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(120, 72, 22, 0.08)),
    #d6a35f;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  overflow: visible;
}

.go-grid-line {
  position: absolute;
  background: rgba(44, 28, 14, 0.9);
  pointer-events: none;
  z-index: 0;
}

.go-grid-line--horizontal {
  height: 1px;
  transform: translateY(-0.5px);
}

.go-grid-line--vertical {
  width: 1px;
  transform: translateX(-0.5px);
}

.go-point {
  position: absolute;
  width: var(--go-gap);
  height: var(--go-gap);
  transform: translate(-50%, -50%);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 1;
}

.go-point:hover:enabled {
  background: transparent;
}

.go-point.star-point::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(51, 31, 11, 0.72);
  position: absolute;
}

.go-point.last-move .go-stone::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  position: absolute;
  border: 2px solid rgba(37, 99, 235, 0.95);
}

.go-stone {
  width: var(--go-stone-size);
  height: var(--go-stone-size);
  border-radius: 50%;
  position: relative;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.go-stone.black {
  background: radial-gradient(circle at 30% 30%, #5f5f5f, #111 70%);
}

.go-stone.white {
  background: radial-gradient(circle at 30% 30%, #fff, #dcdcdc 72%);
  border: 1px solid rgba(0, 0, 0, 0.18);
}

@media (max-width: 768px) {
  body {
    padding: 12px;
  }

  .container {
    margin: 0 auto;
    padding: 18px;
    border-radius: 16px;
  }

  .app-toolbar,
  .app-settings {
    justify-content: stretch;
  }

  .app-settings {
    width: 100%;
    flex-direction: column;
  }

  .menu-search--toolbar {
    width: 100%;
    max-width: none;
    min-width: 0;
  }

  .toolbar-action {
    width: 100%;
  }

  .settings-field,
  .theme-switch {
    width: 100%;
    justify-content: space-between;
  }

  .menu-hero {
    padding: 20px;
  }

  .menu-description {
    max-width: 100%;
  }

  .menu-search input {
    width: 100%;
  }

  .menu-buttons {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .menu-buttons > button {
    width: 100%;
  }

  .menu-card {
    min-height: 214px;
  }

  .top-bar button {
    width: 100%;
  }

  .input-row {
    flex-direction: column;
    align-items: stretch;
  }

  .input-row > button,
  .input-row > select,
  .input-row > input {
    width: 100%;
  }

  .cashforge-shop-item {
    flex-direction: column;
    align-items: stretch;
  }

  .game-stats {
    line-height: 1.75;
  }

  .stats-separator {
    display: none;
  }

  .board-scroll {
    padding-bottom: 10px;
  }

  .pinball-layout {
    flex-direction: column;
  }

  .pinball-side-panel {
    width: 100%;
    min-width: 0;
  }

  .dino-layout {
    flex-direction: column;
  }

  .dino-side-panel {
    width: 100%;
    min-width: 0;
  }

  .pacman-layout {
    flex-direction: column;
  }

  .pacman-side-panel {
    width: 100%;
    min-width: 0;
  }

  .leaderboard-nav button {
    width: 100%;
  }

  .leaderboard-nav {
    flex-direction: column;
    align-items: stretch;
  }

  .leaderboard-page-info {
    text-align: center;
  }

  .snake-touch-controls {
    display: grid;
  }

  .chess-board {
    grid-template-columns: repeat(8, 48px);
    grid-auto-rows: 48px;
  }

  .chess-cell {
    width: 48px;
    height: 48px;
  }

  .chess-piece {
    font-size: 32px;
  }

  .tictactoe-board {
    grid-template-columns: repeat(3, 76px);
    grid-auto-rows: 76px;
    gap: 8px;
  }

  .tictactoe-cell {
    width: 76px;
    height: 76px;
    font-size: 46px;
  }

  .connectfour-board {
    --connectfour-cell-size: 58px;
    --connectfour-gap: 7px;
    padding: 12px;
  }

  .connectfour-cell {
    width: var(--connectfour-cell-size);
    height: var(--connectfour-cell-size);
  }

  .whack-board {
    --whack-hole-size: 84px;
    gap: 12px;
  }

  .whack-hole {
    width: var(--whack-hole-size);
    height: var(--whack-hole-size);
  }

  .sokoban-board {
    --sokoban-cell: 38px;
  }

  .slide-board {
    --slide-cell: 64px;
  }

  .huarongdao-board {
    --huarongdao-cell: 60px;
  }

  .huarongdao-piece {
    font-size: 14px;
  }

  .water-sort-board {
    grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
    gap: 14px;
    width: min(100%, 100%);
  }

  .water-sort-tube {
    width: 72px;
    height: 176px;
  }

  .water-sort-tube::before {
    width: 48px;
    height: 12px;
    border-width: 2px;
  }

  .water-sort-tube::after {
    top: 15px;
    width: 30px;
    height: 10px;
    border-width: 2px;
  }

  .water-sort-tube__inner {
    width: 42px;
    height: 142px;
  }

  .tetris-layout {
    flex-direction: column;
    align-items: stretch;
  }

  .tetris-side-panel {
    width: min(100%, 320px);
  }

  #tetris-hold-canvas,
  #tetris-next-canvas {
    width: 112px;
    height: 112px;
    margin-inline: auto;
  }

  .gomoku-board {
    --gomoku-gap: 26px;
    --gomoku-padding: 13px;
    --gomoku-stone-size: 18px;
  }

  .reversi-board {
    grid-template-columns: repeat(8, 42px);
    grid-auto-rows: 42px;
  }

  .reversi-cell {
    width: 42px;
    height: 42px;
  }

  .reversi-disc {
    width: 32px;
    height: 32px;
  }

  .sudoku-board {
    grid-template-columns: repeat(9, 36px);
    grid-auto-rows: 36px;
  }

  .sudoku-cell {
    width: 36px;
    height: 36px;
    font-size: 18px;
  }

  .sudoku-number-pad {
    max-width: 100%;
  }

  .xiangqi-board {
    grid-template-columns: repeat(9, 44px);
    grid-auto-rows: 44px;
    padding: 6px;
  }

  .xiangqi-cell {
    width: 44px;
    height: 44px;
  }

  .xiangqi-piece {
    width: 32px;
    height: 32px;
    font-size: 20px;
  }

  .shogi-board {
    grid-template-columns: repeat(9, 46px);
    grid-auto-rows: 46px;
    padding: 6px;
  }

  .shogi-cell {
    width: 46px;
    height: 46px;
  }

  .shogi-piece {
    width: 31px;
    height: 35px;
    font-size: 18px;
  }

  .checkers-board {
    --checkers-gap-x: 33px;
    --checkers-gap-y: 28px;
    --checkers-padding: 24px;
    --checkers-cell: 28px;
  }

  .go-board {
    --go-gap: 22px;
    --go-padding: 11px;
    --go-stone-size: 18px;
  }

  .go-point.star-point::before {
    width: 4px;
    height: 4px;
  }

  .gomoku-point.star-point::before {
    width: 5px;
    height: 5px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 14px;
  }

  .app-toolbar {
    margin-bottom: 14px;
  }

  .menu-hero {
    padding: 18px;
    border-radius: 20px;
  }

  .menu-legend {
    gap: 8px;
  }

  .menu-buttons {
    grid-template-columns: 1fr;
  }

  .menu-card {
    min-height: auto;
    padding: 13px;
  }

  .menu-card__title {
    font-size: 17px;
  }

  .menu-card__meta {
    font-size: 12px;
  }

  h1 {
    font-size: 28px;
  }

  h2 {
    font-size: 22px;
  }

  .pinball-touch-controls {
    grid-template-columns: 1fr;
  }

  .dino-touch-controls {
    grid-template-columns: 1fr;
  }

  .snake-touch-middle {
    grid-template-columns: 1fr;
  }

  .pacman-touch-middle {
    grid-template-columns: 1fr;
  }

  .chess-board {
    grid-template-columns: repeat(8, 40px);
    grid-auto-rows: 40px;
  }

  .chess-cell {
    width: 40px;
    height: 40px;
  }

  .chess-piece {
    font-size: 28px;
  }

  .tictactoe-board {
    grid-template-columns: repeat(3, 68px);
    grid-auto-rows: 68px;
  }

  .tictactoe-cell {
    width: 68px;
    height: 68px;
    font-size: 40px;
  }

  .connectfour-board {
    --connectfour-cell-size: 48px;
    --connectfour-gap: 6px;
    padding: 10px;
  }

  .connectfour-cell {
    width: var(--connectfour-cell-size);
    height: var(--connectfour-cell-size);
  }

  .whack-board {
    --whack-hole-size: 72px;
    gap: 10px;
  }

  .whack-hole {
    width: var(--whack-hole-size);
    height: var(--whack-hole-size);
    border-radius: 22px;
  }

  .whack-hole__tunnel {
    width: 58px;
    height: 44px;
  }

  .whack-mole {
    width: 30px;
    height: 30px;
  }

  .sokoban-board {
    --sokoban-cell: 32px;
  }

  .slide-board {
    --slide-cell: 52px;
    gap: 6px;
    padding: 10px;
  }

  .slide-tile {
    font-size: 22px;
    border-radius: 14px;
  }

  .huarongdao-board {
    --huarongdao-cell: 48px;
    --huarongdao-padding: 10px;
  }

  .huarongdao-piece {
    font-size: 12px;
    border-radius: 8px;
  }

  .huarongdao-move-mark {
    width: 20px;
    height: 20px;
    font-size: 16px;
  }

  .water-sort-board {
    grid-template-columns: repeat(auto-fit, minmax(62px, 1fr));
    gap: 14px;
    width: min(100%, 100%);
  }

  .water-sort-tube {
    width: 66px;
    height: 164px;
  }

  .water-sort-tube::before {
    top: 3px;
    width: 44px;
    height: 11px;
    border-width: 2px;
  }

  .water-sort-tube::after {
    top: 14px;
    width: 26px;
    height: 9px;
    border-width: 2px;
  }

  .water-sort-tube__inner {
    width: 38px;
    height: 132px;
    bottom: 7px;
  }

  .gomoku-board {
    --gomoku-gap: 22px;
    --gomoku-padding: 11px;
    --gomoku-stone-size: 16px;
  }

  .reversi-board {
    grid-template-columns: repeat(8, 36px);
    grid-auto-rows: 36px;
  }

  .reversi-cell {
    width: 36px;
    height: 36px;
  }

  .reversi-disc {
    width: 26px;
    height: 26px;
  }

  .sudoku-board {
    grid-template-columns: repeat(9, 32px);
    grid-auto-rows: 32px;
  }

  .sudoku-cell {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  .xiangqi-board {
    grid-template-columns: repeat(9, 38px);
    grid-auto-rows: 38px;
    padding: 5px;
  }

  .xiangqi-cell {
    width: 38px;
    height: 38px;
  }

  .xiangqi-piece {
    width: 28px;
    height: 28px;
    font-size: 18px;
  }

  .shogi-board {
    grid-template-columns: repeat(9, 40px);
    grid-auto-rows: 40px;
    padding: 5px;
  }

  .shogi-cell {
    width: 40px;
    height: 40px;
  }

  .shogi-piece {
    width: 27px;
    height: 30px;
    font-size: 16px;
  }

  .checkers-board {
    --checkers-gap-x: 28px;
    --checkers-gap-y: 24px;
    --checkers-padding: 18px;
    --checkers-cell: 24px;
  }

  .go-board {
    --go-gap: 18px;
    --go-padding: 9px;
    --go-stone-size: 14px;
  }

  .gomoku-point.star-point::before {
    width: 4px;
    height: 4px;
  }
}

:root[data-theme="dark"] .cell,
:root[data-theme="dark"] .cell.revealed,
:root[data-theme="dark"] .cell.revealed.empty,
:root[data-theme="dark"] .cell.mine {
  color: #1f2937;
}
