:root {
  color-scheme: light;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  color: #17342f;
  --game-max-width: 680px;
  --panel: rgba(255, 255, 255, 0.92);
  --line: rgba(96, 144, 92, 0.28);
  --ink: #17342f;
  --leaf: #4e9b61;
  --leaf-dark: #276642;
  --sun: #f5a623;
  --berry: #d64b6b;
  --sky: #4b9bc8;
  --mint: #42c79b;
  --blue: #4ba3e3;
  --coral: #ff8f70;
  --purple: #9f86ff;
  --amber: #ffc857;
}

html {
  height: 100%;
  overflow: hidden;
}

* {
  box-sizing: border-box;
}

body {
  width: 100vw;
  height: 100dvh;
  min-height: 0;
  margin: 0;
  display: grid;
  align-items: start;
  justify-items: center;
  overflow: hidden;
  padding: clamp(6px, 1.3vmin, 14px);
  background-color: #b7e7ff;
  background-image: url("../../assets/seaside-girl-dog-right-bg.png");
  background-position: center bottom;
  background-size: cover;
  background-attachment: fixed;
}

.site-logo-link {
  position: fixed;
  top: clamp(10px, 2vmin, 22px);
  left: clamp(10px, 2vmin, 22px);
  z-index: 3;
  width: clamp(38px, 5vw, 64px);
  aspect-ratio: 1;
  background-color: rgba(255, 255, 255, 0.36);
  background-image: url("../../assets/shiguangdao-logo-transparent.png");
  background-position: center;
  background-size: 82% 82%;
  background-repeat: no-repeat;
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(22, 88, 119, 0.12);
  cursor: pointer;
  transition: transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.site-logo-link:hover,
.site-logo-link:focus-visible {
  transform: translateY(-2px) scale(1.06);
  background-color: rgba(255, 255, 255, 0.56);
  box-shadow: 0 14px 28px rgba(22, 88, 119, 0.2);
  outline: none;
}

button,
a {
  font: inherit;
}

.game-shell {
  position: relative;
  z-index: 1;
  --game-gap: clamp(4px, 0.8vmin, 8px);
  width: min(100%, var(--game-max-width));
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: var(--game-gap);
}

.game-shell:has(.huarong-board) {
  --game-max-width: 520px;
}

.game-shell:has(.gomoku-board),
.game-shell:has(.xiangqi-board) {
  --game-max-width: 780px;
}

.top-bar,
.game-area,
.controls,
.result-dialog {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 14px 34px rgba(57, 91, 65, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px) saturate(1.08);
}

.help-dialog {
  width: min(92vw, 430px);
}

.help-dialog ul {
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 9px;
  text-align: left;
}

.help-dialog li {
  position: relative;
  padding: 9px 10px 9px 30px;
  border: 1px solid rgba(78, 155, 97, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.64);
  color: #31594b;
  line-height: 1.45;
}

.help-dialog li::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 17px;
  width: 7px;
  aspect-ratio: 1;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--mint), var(--sun));
  box-shadow: 0 0 0 4px rgba(66, 199, 155, 0.12);
}

.help-button {
  min-width: 74px;
  background: linear-gradient(180deg, #ffffff, #e8fbff);
}

.top-bar {
  grid-column: 1;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 0;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.back-link,
.top-bar button,
.controls button,
.game-area button {
  min-height: 38px;
  border: 1px solid rgba(67, 119, 73, 0.36);
  border-radius: 8px;
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff, #f3fbea);
  box-shadow: 0 4px 10px rgba(48, 91, 56, 0.1);
  cursor: pointer;
  text-decoration: none;
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.back-link,
.top-bar button {
  padding: 9px 12px;
  white-space: nowrap;
}

.fullscreen-button {
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 20px;
  line-height: 1;
}

.fullscreen-button[aria-pressed="true"] {
  color: #114238;
  border-color: rgba(66, 199, 155, 0.58);
  background: linear-gradient(180deg, rgba(221, 255, 238, 0.98), rgba(190, 244, 218, 0.92));
}

.back-link:hover,
.top-bar button:hover,
.controls button:hover,
.game-area button:hover {
  transform: translateY(-1px);
  border-color: rgba(66, 199, 155, 0.68);
}

.title-block {
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: clamp(6px, 1.2vmin, 12px);
}

.title-block p {
  margin: 0;
  color: #31594b;
  font-size: clamp(11px, 1.8vmin, 14px);
  text-align: right;
  max-width: 24em;
  padding: clamp(5px, 1vmin, 7px) clamp(7px, 1.3vmin, 10px);
  border: 1px solid rgba(78, 155, 97, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 20px rgba(39, 102, 66, 0.08);
}

.title-block h1 {
  margin: 0;
  color: var(--leaf-dark);
  font-size: clamp(22px, 5vmin, 38px);
  line-height: 1.04;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.72);
}

.status-bar {
  grid-column: 1;
  grid-row: 2;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-content: start;
  gap: clamp(5px, 1vmin, 10px);
  padding: 0;
}

.status-bar div {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: clamp(6px, 1.1vmin, 10px) clamp(8px, 1.4vmin, 12px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 252, 240, 0.92)),
    var(--panel);
  box-shadow: 0 14px 34px rgba(57, 91, 65, 0.13), inset 0 1px 0 rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px) saturate(1.08);
  text-align: center;
}

.status-bar span {
  color: #5a7770;
  font-size: 12px;
}

.status-bar strong {
  color: #17342f;
  font-size: clamp(16px, 2.4vmin, 23px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-area {
  grid-column: 1;
  grid-row: 3;
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  padding: clamp(6px, 1vmin, 10px);
}

.game-area > .fullscreen-button {
  position: absolute;
  top: clamp(8px, 1.5vmin, 14px);
  right: clamp(8px, 1.5vmin, 14px);
  z-index: 20;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(10px) saturate(1.08);
}

.game-area:fullscreen {
  width: min(calc(100vw - 24px), var(--game-max-width));
  height: min(calc(100dvh - 24px), 900px);
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  margin: auto;
  overflow: hidden;
  border-radius: 10px;
  background-color: rgba(238, 248, 231, 0.96);
  background-image: url("../../assets/seaside-girl-dog-right-bg.png");
  background-position: center bottom;
  background-size: cover;
}

.game-area:fullscreen::backdrop {
  background-color: #b7e7ff;
  background-image: url("../../assets/seaside-girl-dog-right-bg.png");
  background-position: center bottom;
  background-size: cover;
}

@supports (width: 1cqw) {
  .game-area {
    container-type: size;
  }
}

.game-area:has(.gomoku-board),
.game-area:has(.xiangqi-board),
.game-area:has(.huarong-board) {
  padding: 0;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.game-area:has(.snake-board) {
  padding: 0;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.game-area:has(.breakout-stage) {
  padding: clamp(6px, 1vmin, 10px);
}

.game-area:has(.pinball-panel) {
  padding: 0;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.game-area:has(.billiards-panel) {
  padding: 0;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.game-area:has(.motorbike-panel) {
  padding: 0;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.game-area:has(.tank-war-panel) {
  padding: 0;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.game-area:has(.arrow-escape-board) {
  align-content: center;
  gap: clamp(6px, 1vmin, 10px);
}

.controls {
  grid-column: 1;
  justify-self: center;
  width: min(100%, var(--game-max-width));
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
  gap: 8px;
  padding: clamp(7px, 1.2vmin, 12px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 252, 242, 0.93)),
    var(--panel);
}

.controls:empty {
  display: none;
}

.controls button {
  padding: 8px 10px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.controls button.is-selected {
  color: #114238;
  border-color: rgba(66, 199, 155, 0.58);
  background: linear-gradient(180deg, rgba(221, 255, 238, 0.98), rgba(190, 244, 218, 0.92));
  box-shadow: 0 8px 16px rgba(38, 142, 104, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.result-dialog {
  position: fixed;
  left: 50vw;
  top: 50dvh;
  width: min(90vw, 340px);
  margin: 0;
  padding: 26px 24px 24px;
  text-align: center;
  border: 2px solid rgba(78, 155, 97, 0.45);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 255, 241, 0.96));
  transform: translate(-50%, -50%);
  animation: result-pop 280ms cubic-bezier(0.2, 1.2, 0.3, 1);
  overflow: hidden;
}

.result-dialog h2 {
  margin: 0 0 8px;
  color: var(--leaf-dark);
  font-size: clamp(24px, 5.2vmin, 34px);
}

.result-dialog p {
  margin: 0 0 18px;
  color: #456257;
  line-height: 1.6;
}

.result-dialog button {
  min-height: 38px;
  padding: 9px 16px;
  border: 1px solid rgba(67, 119, 73, 0.36);
  border-radius: 8px;
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff, #f3fbea);
  box-shadow: 0 4px 10px rgba(48, 91, 56, 0.1);
  cursor: pointer;
}

.result-dialog.result-success {
  border-color: rgba(78, 155, 97, 0.58);
  box-shadow: 0 20px 44px rgba(57, 91, 65, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.result-dialog.result-success::before,
.result-dialog.result-success::after,
.result-dialog.result-fail::before,
.result-dialog.result-fail::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.result-dialog.result-success::before {
  background:
    radial-gradient(circle at 18% 22%, #ff805c 0 4px, transparent 5px),
    radial-gradient(circle at 34% 12%, #ffd36a 0 5px, transparent 6px),
    radial-gradient(circle at 58% 18%, #42c79b 0 4px, transparent 5px),
    radial-gradient(circle at 78% 26%, #4b9bc8 0 5px, transparent 6px),
    radial-gradient(circle at 70% 72%, #d64b6b 0 4px, transparent 5px),
    radial-gradient(circle at 25% 78%, #f5a623 0 5px, transparent 6px);
  animation: confetti-burst 1180ms ease-out both;
}

.result-dialog.result-success::after {
  background:
    linear-gradient(135deg, transparent 0 43%, #ff805c 44% 58%, transparent 59%) 12% -28px / 24px 70px no-repeat,
    linear-gradient(45deg, transparent 0 42%, #ffd36a 43% 57%, transparent 58%) 34% -46px / 22px 78px no-repeat,
    linear-gradient(135deg, transparent 0 42%, #35c999 43% 57%, transparent 58%) 62% -38px / 24px 76px no-repeat,
    linear-gradient(45deg, transparent 0 43%, #1597d3 44% 58%, transparent 59%) 86% -30px / 22px 70px no-repeat;
  animation: result-ribbon-fall 1600ms ease-in-out both;
}

.result-dialog.result-fail {
  border-color: rgba(245, 166, 35, 0.58);
  background:
    radial-gradient(circle at 50% 118%, rgba(66, 199, 155, 0.2), transparent 52%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 253, 240, 0.96));
  box-shadow: 0 20px 44px rgba(96, 72, 36, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.result-dialog.result-fail::before {
  inset: auto -12% -28%;
  height: 58%;
  border-radius: 999px 999px 0 0;
  background:
    radial-gradient(circle at 22% 38%, rgba(255, 212, 112, 0.42) 0 10px, transparent 11px),
    radial-gradient(circle at 78% 42%, rgba(66, 199, 155, 0.34) 0 11px, transparent 12px),
    linear-gradient(180deg, rgba(255, 245, 204, 0.42), rgba(66, 199, 155, 0.16));
  animation: encourage-card-breathe 2200ms ease-in-out infinite;
}

.result-dialog.result-fail::after {
  inset: 12% 12% auto;
  height: 45%;
  background:
    radial-gradient(circle at 18% 88%, rgba(66, 199, 155, 0.7) 0 4px, transparent 5px),
    radial-gradient(circle at 38% 72%, rgba(245, 166, 35, 0.72) 0 5px, transparent 6px),
    radial-gradient(circle at 63% 86%, rgba(75, 155, 200, 0.62) 0 4px, transparent 5px),
    radial-gradient(circle at 82% 68%, rgba(255, 143, 112, 0.68) 0 5px, transparent 6px);
  animation: encourage-step-rise 1800ms ease-in-out infinite;
}

.result-dialog.result-fail h2::after {
  content: "继续加油";
  display: block;
  width: max-content;
  max-width: 100%;
  margin: 8px auto 0;
  padding: 4px 12px;
  border: 1px solid rgba(66, 199, 155, 0.3);
  border-radius: 999px;
  color: #276642;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(229, 255, 238, 0.82));
  box-shadow: 0 6px 14px rgba(66, 199, 155, 0.12);
  font-size: clamp(12px, 2.2vmin, 14px);
  line-height: 1.4;
  animation: encourage-card-breathe 2200ms ease-in-out infinite;
}

.result-dialog > * {
  position: relative;
  z-index: 1;
}

.result-dialog.result-neutral {
  border-color: rgba(75, 155, 200, 0.45);
}

.result-dialog::backdrop {
  background: rgba(31, 42, 36, 0.38);
  backdrop-filter: blur(3px);
}

.grid-board {
  display: grid;
  position: relative;
  gap: clamp(2px, 0.6vmin, 5px);
  width: min(100%, var(--board-size, 560px));
  max-height: 100%;
  aspect-ratio: var(--ratio, 1);
  padding: clamp(6px, 1.1vmin, 10px);
  border-radius: 8px;
  background: rgba(22, 55, 64, 0.18);
}

.cell {
  position: relative;
  z-index: 1;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.48);
  color: #15352e;
  font-weight: 800;
  line-height: 1;
  user-select: none;
}

.game-area .grid-board .cell {
  min-width: 0;
  min-height: 0;
  padding: 0;
}

.cell.is-dark {
  background: rgba(42, 57, 63, 0.76);
  color: white;
}

.cell.is-accent {
  background: var(--mint);
  color: #08352b;
}

.cell.is-warm {
  background: var(--coral);
  color: white;
}

.cell.is-blue {
  background: var(--blue);
  color: white;
}

.cell.is-purple {
  background: var(--purple);
  color: white;
}

.cell.is-goal {
  box-shadow: inset 0 0 0 3px rgba(255, 200, 87, 0.58);
}

.sokoban-board {
  --board-size: 680px;
  position: relative;
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 255, 255, 0.38), transparent 28%),
    linear-gradient(135deg, rgba(229, 250, 242, 0.92), rgba(242, 252, 255, 0.78));
  box-shadow: 0 16px 32px rgba(31, 77, 84, 0.12), inset 0 0 0 1px rgba(255, 255, 255, 0.72);
}

.sokoban-mission-panel {
  width: min(100%, 680px);
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
  padding: 9px 12px;
  border: 1px solid rgba(67, 139, 125, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: #17342f;
  font-size: clamp(12px, 1.8vmin, 15px);
  box-shadow: 0 10px 22px rgba(31, 77, 84, 0.1);
}

.sokoban-mission-panel span,
.sokoban-mission-panel i {
  color: rgba(23, 52, 47, 0.62);
  font-style: normal;
}

.sokoban-mission-panel strong {
  font-size: clamp(15px, 2.2vmin, 20px);
}

.sokoban-cell {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  font-size: clamp(15px, 2.6vmin, 25px);
}

.sokoban-floor-detail {
  position: absolute;
  inset: 18%;
  border-radius: 35% 65% 45% 55%;
  border: 1px solid rgba(73, 139, 126, 0.16);
  opacity: 0.44;
  transform: rotate(-16deg);
  pointer-events: none;
}

.sokoban-cell.is-goal {
  background:
    radial-gradient(circle, rgba(255, 214, 102, 0.86) 0 22%, transparent 24%),
    rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 0 0 3px rgba(255, 200, 87, 0.52);
}

.sokoban-cell.is-box-on-goal {
  background: linear-gradient(180deg, #68d9a5, #24ad7a);
  color: #063629;
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.58), 0 8px 14px rgba(31, 77, 84, 0.18);
}

.tic-tac-toe-cell.is-new-move {
  animation: tile-action-pop 260ms ease;
  box-shadow: 0 10px 18px rgba(45, 91, 78, 0.18), inset 0 0 0 2px rgba(255, 255, 255, 0.5);
}

.snake-board {
  --board-size: min(86vmin, calc(100dvh - 246px), 720px);
  --ratio: 1;
  gap: clamp(1px, 0.28vmin, 3px);
  padding: clamp(7px, 1.1vmin, 11px);
  border: 1px solid rgba(75, 155, 200, 0.28);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.74), rgba(229, 255, 238, 0.68)),
    radial-gradient(circle at 18% 18%, rgba(255, 209, 102, 0.18), transparent 34%),
    rgba(37, 103, 87, 0.16);
  box-shadow: 0 16px 34px rgba(31, 77, 84, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.76);
}

@supports (width: 1cqw) {
  .snake-board {
    --board-size: min(86vmin, 100cqw, calc(100cqh - 6px), 720px);
  }
}

.snake-cell {
  border-radius: 5px;
  border-color: rgba(102, 156, 111, 0.22);
  background: rgba(255, 255, 255, 0.5);
}

.snake-cell.snake-body,
.snake-cell.snake-tail,
.snake-cell.snake-head {
  border-color: rgba(255, 255, 255, 0.64);
  background: linear-gradient(145deg, #7bf0a4, #209d74);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72), 0 4px 9px rgba(20, 84, 65, 0.2);
}

.snake-cell.snake-head {
  border-radius: 42% 58% 58% 42%;
  background: linear-gradient(145deg, #a7ffc0, #22b487);
  transform: scale(1.06);
}

.snake-cell.snake-head::before {
  content: "";
  position: absolute;
  inset: 18% 17%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 33% 35%, #17342f 0 12%, transparent 13%),
    radial-gradient(circle at 68% 35%, #17342f 0 12%, transparent 13%),
    radial-gradient(circle at 50% 72%, rgba(255, 255, 255, 0.9) 0 10%, transparent 11%);
}

.snake-cell.snake-tail {
  border-radius: 55% 42% 42% 55%;
  opacity: 0.86;
  transform: scale(0.9);
}

.snake-cell.snake-food {
  background: radial-gradient(circle at 45% 42%, #fff6df 0 16%, #ff8f70 17% 56%, #d84d68 57%);
  border-color: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 0 3px rgba(255, 143, 112, 0.16), 0 4px 10px rgba(216, 77, 104, 0.18);
}

.snake-cell.snake-food::after {
  content: "";
  position: absolute;
  width: 28%;
  height: 28%;
  left: 54%;
  top: 14%;
  border-radius: 90% 20%;
  background: #4e9b61;
  transform: rotate(-28deg);
}

.memory-board {
  gap: clamp(5px, 1.1vmin, 10px);
  padding: clamp(8px, 1.5vmin, 14px);
}

.memory-card {
  font-size: clamp(34px, 8vmin, 68px);
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.7);
}

.board-wide {
  --board-size: 680px;
  --ratio: 1.25;
}

.gomoku-board {
  --board-size: min(78vmin, calc(100dvh - 170px), 780px);
  --ratio: 1;
  --board-padding: clamp(16px, 3.2vmin, 30px);
  --line-step: calc((100% - 2 * var(--board-padding)) / 14);
  display: block;
  gap: 0;
  padding: var(--board-padding);
  border: 2px solid rgba(120, 74, 31, 0.78);
  border-radius: 8px;
  background:
    radial-gradient(circle at 30% 22%, rgba(255, 246, 205, 0.5), transparent 28%),
    linear-gradient(135deg, #f1ca7b 0%, #e1a95b 48%, #c9853d 100%);
  box-shadow: inset 0 0 0 5px rgba(101, 59, 22, 0.1), 0 18px 34px rgba(74, 48, 21, 0.24);
}

.gomoku-board::before {
  content: "";
  position: absolute;
  inset: var(--board-padding);
  z-index: 0;
  border-top: 1px solid rgba(86, 50, 22, 0.92);
  border-right: 1px solid rgba(86, 50, 22, 0.92);
  background-image:
    repeating-linear-gradient(90deg, rgba(86, 50, 22, 0.92) 0 1px, transparent 1px calc(100% / 14)),
    repeating-linear-gradient(0deg, rgba(86, 50, 22, 0.92) 0 1px, transparent 1px calc(100% / 14));
  pointer-events: none;
}

.game-area .gomoku-point {
  position: absolute;
  left: calc(var(--board-padding) + var(--col) * var(--line-step));
  top: calc(var(--board-padding) + var(--row) * var(--line-step));
  width: clamp(26px, 5.4vmin, 42px);
  height: clamp(26px, 5.4vmin, 42px);
  min-height: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: transparent;
  font-size: 0;
  transform: translate(-50%, -50%);
}

.game-area .gomoku-point.is-dark,
.game-area .gomoku-point.is-accent {
  background: transparent;
  color: transparent;
}

.game-area .gomoku-point:hover {
  transform: translate(-50%, -50%) scale(1.05);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.32);
}

.gomoku-point.star::before {
  content: "";
  width: min(18%, 8px);
  aspect-ratio: 1;
  border-radius: 999px;
  background: rgba(73, 41, 18, 0.88);
}

.gomoku-point.is-dark::after,
.gomoku-point.is-accent::after {
  content: "";
  position: absolute;
  width: 74%;
  max-width: 34px;
  aspect-ratio: 1;
  border-radius: 999px;
  box-shadow: 0 7px 13px rgba(64, 38, 16, 0.28);
}

.gomoku-point.is-dark::after {
  background: radial-gradient(circle at 32% 26%, #748081 0 10%, #20272a 38%, #050607 100%);
}

.gomoku-point.is-accent::after {
  background: radial-gradient(circle at 30% 24%, #ffffff 0 18%, #f3efe4 52%, #cfc7b8 100%);
  border: 1px solid rgba(65, 50, 32, 0.28);
}

.gomoku-point.is-new-move::after {
  animation: ai-stone-pop 520ms cubic-bezier(0.2, 1.2, 0.28, 1);
}

@keyframes ai-stone-pop {
  0% {
    transform: scale(0.78);
    filter: brightness(1.08);
  }
  100% {
    transform: scale(1);
    filter: brightness(1);
  }
}

.board-tall {
  --board-size: 520px;
  --ratio: 0.8;
}

.huarong-board {
  width: auto;
  height: min(100%, calc(var(--board-size) / var(--ratio)));
  max-width: 100%;
  gap: clamp(5px, 1vmin, 8px);
  border: 1px solid rgba(75, 155, 200, 0.28);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.56), rgba(234, 247, 238, 0.42)),
    rgba(22, 55, 64, 0.18);
}

.huarong-empty {
  z-index: 1;
  border-style: dashed;
  background: rgba(255, 255, 255, 0.3);
}

.huarong-block {
  z-index: 2;
  min-height: 0;
  border-color: rgba(255, 255, 255, 0.64);
  font-size: clamp(22px, 5.2vmin, 42px);
  box-shadow: 0 10px 18px rgba(29, 87, 81, 0.16), inset 0 0 0 1px rgba(255, 255, 255, 0.32);
}

.huarong-cao {
  font-size: clamp(26px, 6vmin, 50px);
}

.xiangqi-board {
  --board-size: min(86vmin, 780px);
  --ratio: 0.9;
  --board-padding: clamp(36px, 5vmin, 54px);
  --line-step-x: calc((100% - 2 * var(--board-padding)) / 8);
  --line-step-y: calc((100% - 2 * var(--board-padding)) / 9);
  display: block;
  gap: 0;
  padding: var(--board-padding);
  border: 2px solid rgba(112, 59, 22, 0.82);
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(circle at 25% 18%, rgba(255, 245, 198, 0.52), transparent 30%),
    linear-gradient(135deg, #f3d085 0%, #e4ad62 52%, #c9833a 100%);
  box-shadow: inset 0 0 0 5px rgba(109, 62, 25, 0.12), 0 18px 34px rgba(72, 45, 22, 0.22);
}

.xiangqi-board::before {
  content: "";
  position: absolute;
  inset: var(--board-padding);
  z-index: 0;
  border: 1px solid rgba(92, 48, 20, 0.9);
  background-image:
    repeating-linear-gradient(90deg, rgba(92, 48, 20, 0.9) 0 1px, transparent 1px calc(100% / 8)),
    repeating-linear-gradient(0deg, rgba(92, 48, 20, 0.9) 0 1px, transparent 1px calc(100% / 9));
  pointer-events: none;
}

.xiangqi-board::after {
  content: "楚河        汉界";
  position: absolute;
  left: var(--board-padding);
  right: var(--board-padding);
  top: calc(var(--board-padding) + var(--line-step-y) * 4);
  z-index: 0;
  height: var(--line-step-y);
  display: flex;
  align-items: center;
  justify-content: center;
  border-block: 1px solid rgba(92, 48, 20, 0.9);
  background: linear-gradient(90deg, rgba(237, 188, 106, 0.96), rgba(247, 213, 145, 0.96), rgba(237, 188, 106, 0.96));
  color: rgba(91, 46, 19, 0.8);
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: clamp(18px, 4.1vmin, 32px);
  font-weight: 800;
  letter-spacing: 0;
  pointer-events: none;
}

.palace-line {
  position: absolute;
  z-index: 0;
  left: calc(var(--board-padding) + var(--line-step-x) * 3);
  width: calc(var(--line-step-x) * 2);
  height: calc(var(--line-step-y) * 2);
  pointer-events: none;
}

.palace-line.top-main,
.palace-line.top-cross {
  top: var(--board-padding);
}

.palace-line.bottom-main,
.palace-line.bottom-cross {
  top: calc(var(--board-padding) + var(--line-step-y) * 7);
}

.palace-line.top-main,
.palace-line.bottom-main {
  background: linear-gradient(to bottom right, transparent calc(50% - 0.5px), rgba(92, 48, 20, 0.84) calc(50% - 0.5px) calc(50% + 0.5px), transparent calc(50% + 0.5px));
}

.palace-line.top-cross,
.palace-line.bottom-cross {
  background: linear-gradient(to bottom left, transparent calc(50% - 0.5px), rgba(92, 48, 20, 0.84) calc(50% - 0.5px) calc(50% + 0.5px), transparent calc(50% + 0.5px));
}

.game-area .xiangqi-piece,
.game-area .xiangqi-point {
  position: absolute;
  left: calc(var(--board-padding) + var(--col) * var(--line-step-x));
  top: calc(var(--board-padding) + var(--row) * var(--line-step-y));
  width: clamp(34px, 6vmin, 54px);
  height: clamp(34px, 6vmin, 54px);
  min-height: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  transform: translate(-50%, -50%);
}

.xiangqi-piece {
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  color: #1f2d26;
  font-family: "KaiTi", "STKaiti", "Microsoft YaHei", serif;
  font-size: clamp(18px, 3.8vmin, 34px);
}

.piece-label {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 86%;
  height: 86%;
  transform: translate(-50%, -50%);
  transform-origin: center;
  line-height: 1;
  text-align: center;
}

.game-area .xiangqi-point:hover {
  transform: translate(-50%, -50%) scale(1.04);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.28);
}

.game-area .xiangqi-piece.occupied {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.xiangqi-piece.occupied::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 86%;
  max-width: 54px;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  z-index: 1;
  border-radius: 999px;
  background:
    radial-gradient(circle at 31% 25%, rgba(255, 255, 250, 0.95) 0 14%, transparent 15%),
    linear-gradient(145deg, #fff5df 0%, #ecd196 100%);
  border: 2px solid rgba(104, 57, 24, 0.76);
  box-shadow: inset 0 0 0 3px rgba(255, 252, 236, 0.72), 0 7px 12px rgba(66, 37, 16, 0.24);
}

.xiangqi-piece.occupied.is-new-ai-move {
  animation: xiangqi-move-bounce 780ms cubic-bezier(0.2, 1.24, 0.28, 1);
  will-change: transform;
}

.xiangqi-piece.occupied.is-new-ai-move::before {
  animation: xiangqi-piece-pop 620ms cubic-bezier(0.2, 1.16, 0.28, 1);
}

.xiangqi-piece.occupied.is-new-ai-move::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 0;
  width: 100%;
  max-width: 64px;
  aspect-ratio: 1;
  border: 2px solid rgba(255, 203, 92, 0.82);
  border-radius: 999px;
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: xiangqi-move-ring 920ms ease-out;
}

.xiangqi-piece.occupied.is-new-ai-move .piece-label {
  animation: xiangqi-label-pop 620ms cubic-bezier(0.2, 1.16, 0.28, 1);
}

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

.xiangqi-piece.is-goal {
  box-shadow: none;
}

.xiangqi-piece.occupied.is-goal::before {
  box-shadow: inset 0 0 0 3px rgba(255, 200, 87, 0.76), 0 7px 12px rgba(66, 37, 16, 0.24);
}

@keyframes xiangqi-piece-pop {
  0% {
    transform: translate(-50%, -50%) scale(0.76);
    filter: brightness(1.12);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
    filter: brightness(1);
  }
}

@keyframes xiangqi-move-bounce {
  0% {
    transform: translate(-50%, -50%) scale(0.86);
  }
  44% {
    transform: translate(-50%, -50%) scale(1.1);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes xiangqi-move-ring {
  0% {
    opacity: 0.95;
    transform: translate(-50%, -50%) scale(0.78);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.45);
  }
}

@keyframes xiangqi-label-pop {
  0% {
    transform: translate(-50%, -50%) scale(0.82);
  }
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
}

.canvas-game {
  width: min(100%, 700px);
  height: min(100%, 440px);
  border-radius: 8px;
  background: rgba(18, 55, 70, 0.22);
}

.breakout-stage {
  width: min(100%, 900px);
  height: min(100%, 680px);
  max-height: 100%;
  padding: clamp(7px, 1.2vmin, 12px);
  border: 1px solid rgba(75, 155, 200, 0.3);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(236, 253, 255, 0.72)),
    radial-gradient(circle at 16% 12%, rgba(255, 209, 102, 0.22), transparent 34%),
    radial-gradient(circle at 84% 20%, rgba(184, 156, 255, 0.22), transparent 32%);
  box-shadow: 0 18px 38px rgba(31, 77, 84, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.92);
}

.breakout-stage .canvas-game {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(78, 155, 97, 0.28);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.54);
}

.mini-grid {
  --board-size: min(100%, 620px);
  width: var(--board-size);
  height: var(--board-size);
  max-height: 100%;
  padding: clamp(7px, 1.2vmin, 12px);
  gap: clamp(4px, 0.8vmin, 8px);
  border: 1px solid rgba(78, 155, 97, 0.3);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(240, 252, 231, 0.74)),
    radial-gradient(circle at 18% 12%, rgba(255, 200, 87, 0.18), transparent 28%),
    radial-gradient(circle at 88% 22%, rgba(159, 134, 255, 0.16), transparent 30%);
  box-shadow: 0 18px 38px rgba(31, 77, 84, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

@supports (width: 1cqw) {
  .mini-grid {
    --board-size: min(100cqw, 100cqh, 620px);
  }
}

.mini-tile {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  border-radius: 8px;
  border-color: rgba(40, 79, 83, 0.18);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 255, 239, 0.86));
  color: var(--ink);
  font-weight: 900;
  font-size: clamp(16px, 4vmin, 34px);
  line-height: 1;
  box-shadow: 0 8px 16px rgba(35, 86, 70, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.mini-tile.is-selected {
  outline: 3px solid rgba(255, 143, 112, 0.75);
  outline-offset: -3px;
  transform: translateY(-1px) scale(1.02);
}

.tone-sky {
  color: #2b8cc8;
}

.tone-mint,
.tone-leaf {
  color: #2ba875;
}

.tone-berry {
  color: #d64b6b;
}

.tone-sun {
  color: #ef9f17;
}

.tone-purple {
  color: #7f62f0;
}

.mini-tile.tone-sky {
  color: #247fbb;
  background: linear-gradient(180deg, rgba(235, 249, 255, 0.98), rgba(205, 235, 255, 0.9));
}

.mini-tile.tone-mint,
.mini-tile.tone-leaf {
  color: #1e9b6a;
  background: linear-gradient(180deg, rgba(231, 255, 243, 0.98), rgba(200, 246, 223, 0.9));
}

.mini-tile.tone-berry {
  color: #c83f62;
  background: linear-gradient(180deg, rgba(255, 239, 245, 0.98), rgba(255, 215, 226, 0.9));
}

.mini-tile.tone-sun {
  color: #d78300;
  background: linear-gradient(180deg, rgba(255, 249, 222, 0.98), rgba(255, 229, 158, 0.9));
}

.mini-tile.tone-purple {
  color: #7357dc;
  background: linear-gradient(180deg, rgba(244, 240, 255, 0.98), rgba(224, 215, 255, 0.9));
}

.mini-tile:active {
  animation: tile-action-pop 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.bubble-cell,
.lines-cell {
  font-size: clamp(22px, 5vmin, 42px);
}

.coral-board {
  gap: clamp(5px, 1vmin, 9px);
  background:
    radial-gradient(circle at 18% 18%, rgba(125, 240, 191, 0.24), transparent 24%),
    radial-gradient(circle at 84% 76%, rgba(75, 155, 200, 0.18), transparent 28%),
    linear-gradient(180deg, rgba(232, 252, 255, 0.9), rgba(226, 248, 232, 0.78));
}

.coral-play-shell {
  width: min(100%, 680px);
  display: grid;
  gap: 10px;
}

.coral-tide-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border: 1px solid rgba(54, 154, 151, 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 10px 22px rgba(31, 77, 84, 0.09);
}

.coral-tide-chip,
.coral-tide-legend strong {
  min-height: 28px;
  display: inline-grid;
  place-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #17342f;
  font-size: 12px;
  font-weight: 900;
  box-shadow: inset 0 0 0 1px rgba(23, 52, 47, 0.1);
}

.coral-tide-chip.is-complete {
  box-shadow: inset 0 0 0 2px rgba(58, 197, 151, 0.55), 0 7px 14px rgba(31, 77, 84, 0.12);
}

.coral-cell {
  position: relative;
  overflow: hidden;
  font-size: clamp(18px, 4.8vmin, 38px);
  font-weight: 900;
  color: rgba(23, 52, 47, 0.48);
  transition: transform 150ms ease, border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

.coral-cell::after {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: 999px;
  opacity: 0;
  background: currentColor;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.48);
  transition: opacity 150ms ease, transform 150ms ease;
}

.coral-cell.is-path::after {
  opacity: 0.72;
  transform: scale(0.72);
}

.coral-cell.is-endpoint {
  color: currentColor;
  border-color: rgba(23, 52, 47, 0.18);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.74), 0 8px 18px rgba(31, 77, 84, 0.12);
}

.coral-cell.is-endpoint::after {
  opacity: 0.9;
  transform: scale(0.92);
}

.coral-cell.is-active {
  border-color: rgba(255, 185, 88, 0.86);
  box-shadow: 0 0 0 4px rgba(255, 185, 88, 0.24), inset 0 0 0 3px rgba(255, 255, 255, 0.78);
}

.coral-cell.is-complete {
  filter: saturate(1.12);
}

.coral-cell.is-rock {
  color: rgba(75, 93, 97, 0.54);
  cursor: not-allowed;
  background:
    radial-gradient(circle at 36% 28%, rgba(255, 255, 255, 0.35), transparent 20%),
    linear-gradient(145deg, rgba(176, 194, 188, 0.92), rgba(112, 139, 136, 0.86));
  border-color: rgba(78, 103, 103, 0.22);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.34);
}

.coral-cell.is-rock::after {
  opacity: 0;
}

.coral-cell.is-hinted {
  border-color: rgba(255, 185, 88, 0.92);
  box-shadow: 0 0 0 4px rgba(255, 185, 88, 0.28), 0 12px 24px rgba(31, 77, 84, 0.16);
  animation: coral-hint-pulse 0.9s ease-in-out infinite;
}

.coral-cell.is-underfilled {
  color: #ff8f68;
  border-color: rgba(255, 143, 104, 0.92);
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 223, 112, 0.38), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 244, 213, 0.86));
  box-shadow: 0 0 0 4px rgba(255, 143, 104, 0.22), 0 12px 24px rgba(31, 77, 84, 0.16);
  animation: coral-hint-pulse 0.9s ease-in-out infinite;
}

@keyframes coral-hint-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.045);
  }
}

.bubble-cell.is-aim {
  box-shadow: inset 0 0 0 3px rgba(255, 143, 112, 0.6), 0 0 0 2px rgba(255, 255, 255, 0.64);
  animation: bubble-aim-pulse 1.2s ease-in-out infinite;
}

.match-cell,
.star-cell,
.fruit-cell {
  font-size: clamp(20px, 4.8vmin, 38px);
}

.fruit-cell.is-drop-hint {
  color: rgba(23, 52, 47, 0.42);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(231, 255, 243, 0.62));
  animation: fruit-drop-bob 1.1s ease-in-out infinite;
}

.match-cell.is-clearing {
  position: relative;
  z-index: 2;
  pointer-events: none;
  animation: match-clear-pop 360ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.match-cell.is-clearing::after {
  content: "";
  position: absolute;
  inset: -18%;
  border-radius: inherit;
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 18px rgba(255, 214, 102, 0.78);
  animation: match-clear-ring 360ms ease-out forwards;
}

@keyframes match-clear-pop {
  0% {
    transform: scale(1);
    filter: saturate(1);
    opacity: 1;
  }

  45% {
    transform: scale(1.18) rotate(4deg);
    filter: saturate(1.55) brightness(1.18);
    opacity: 1;
  }

  100% {
    transform: scale(0.25) rotate(-8deg);
    filter: saturate(0.6) brightness(1.35);
    opacity: 0;
  }
}

@keyframes match-clear-ring {
  0% {
    transform: scale(0.72);
    opacity: 0.9;
  }

  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

@keyframes tile-action-pop {
  0% {
    transform: scale(1);
  }

  55% {
    transform: scale(1.07);
    filter: brightness(1.06);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes bubble-aim-pulse {
  0%,
  100% {
    box-shadow: inset 0 0 0 3px rgba(255, 143, 112, 0.48), 0 0 0 2px rgba(255, 255, 255, 0.58);
  }

  50% {
    box-shadow: inset 0 0 0 3px rgba(255, 143, 112, 0.82), 0 0 0 6px rgba(255, 255, 255, 0.36);
  }
}

@keyframes fruit-drop-bob {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(4px);
  }
}

.tank-cell.is-wall,
.maze-cell.is-wall {
  color: rgba(23, 52, 47, 0.48);
  background: linear-gradient(180deg, rgba(196, 218, 214, 0.82), rgba(155, 181, 170, 0.76));
}

.tank-cell.is-player,
.maze-cell.is-player,
.crossing-cell.is-player {
  color: #ff8f70;
}

.tank-cell.is-enemy,
.crossing-cell.is-hazard {
  color: #d64b6b;
}

.idiom-wrap {
  width: min(100%, 780px);
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: clamp(8px, 1.3vmin, 12px);
}

.idiom-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(8px, 1.4vmin, 14px);
  min-height: clamp(42px, 6vmin, 54px);
  padding: 8px clamp(10px, 1.8vmin, 16px);
  border: 1px solid rgba(78, 155, 97, 0.3);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(244, 255, 237, 0.88));
  box-shadow: 0 12px 24px rgba(31, 77, 84, 0.1);
}

.idiom-hint div {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.3vmin, 12px);
}

.idiom-hint strong {
  white-space: nowrap;
  color: var(--leaf-dark);
  font-size: clamp(16px, 2.4vmin, 22px);
}

.idiom-hint em {
  flex: 0 0 auto;
  font-style: normal;
  color: #6b7f74;
  font-weight: 900;
  font-size: clamp(12px, 1.8vmin, 15px);
}

.idiom-mask {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.idiom-mask span {
  display: grid;
  place-items: center;
  min-width: clamp(26px, 4vmin, 34px);
  height: clamp(26px, 4vmin, 34px);
  padding: 0 4px;
  border: 1px solid rgba(78, 155, 97, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.86);
  color: #17342f;
  font-size: clamp(17px, 2.8vmin, 24px);
  font-weight: 900;
}

.pipe-cell {
  color: #326d8b;
  font-size: clamp(22px, 5vmin, 44px);
}

.pipe-cell.is-flow {
  color: #1fae83;
  background: linear-gradient(180deg, rgba(229, 255, 245, 0.98), rgba(195, 247, 223, 0.92));
  box-shadow: 0 0 0 2px rgba(66, 199, 155, 0.32), 0 8px 16px rgba(35, 86, 70, 0.08);
}

.pipe-cell.is-source::after,
.pipe-cell.is-sink::after {
  position: absolute;
  right: 4px;
  bottom: 3px;
  color: rgba(23, 52, 47, 0.56);
  font-size: 11px;
  font-weight: 900;
}

.pipe-cell.is-source::after {
  content: "起";
}

.pipe-cell.is-sink::after {
  content: "终";
}

.slide-tile {
  font-size: clamp(20px, 5.2vmin, 42px);
}

.slide-tile.is-empty {
  opacity: 0.3;
  background: rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.54);
}

.crossing-cell,
.maze-cell {
  font-size: clamp(14px, 3.4vmin, 28px);
}

.maze-cell.is-exit {
  color: #2b8cc8;
}

.maze-shell {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 58%;
  height: 50%;
  transform: translate(-50%, -46%);
  border-radius: 54% 54% 44% 44% / 76% 76% 28% 28%;
  background:
    radial-gradient(circle at 50% 92%, #b87a54 0 8%, transparent 9%),
    repeating-conic-gradient(from -42deg at 50% 92%, rgba(255, 255, 255, 0.46) 0 8deg, rgba(216, 132, 112, 0.24) 8deg 16deg),
    linear-gradient(180deg, #fff0b9 0%, #f7b6a1 58%, #d46c75 100%);
  box-shadow:
    inset 0 4px 7px rgba(255, 255, 255, 0.58),
    inset 0 -5px 8px rgba(133, 67, 64, 0.24),
    0 5px 8px rgba(78, 45, 34, 0.18);
  clip-path: polygon(50% 0, 68% 13%, 84% 20%, 96% 42%, 91% 74%, 68% 96%, 32% 96%, 9% 74%, 4% 42%, 16% 20%, 32% 13%);
}

.maze-shell::before {
  content: "";
  position: absolute;
  left: 15%;
  right: 15%;
  bottom: 12%;
  height: 17%;
  border-radius: 50%;
  background: rgba(126, 65, 58, 0.22);
  box-shadow: 0 -9px 0 -7px rgba(255, 255, 255, 0.72);
}

.maze-shell::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 9%;
  width: 5px;
  height: 82%;
  border-radius: 999px;
  background: rgba(139, 76, 73, 0.18);
  box-shadow:
    -12px 5px 0 -1px rgba(139, 76, 73, 0.13),
    12px 5px 0 -1px rgba(139, 76, 73, 0.13),
    -23px 15px 0 -2px rgba(139, 76, 73, 0.1),
    23px 15px 0 -2px rgba(139, 76, 73, 0.1);
  transform: translateX(-50%);
}

.classic-canvas-stage {
  width: min(100%, 820px);
  height: min(100%, 620px);
  padding: clamp(7px, 1.2vmin, 12px);
  border: 1px solid rgba(75, 155, 200, 0.3);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(236, 253, 255, 0.74)),
    radial-gradient(circle at 14% 18%, rgba(255, 200, 87, 0.18), transparent 30%),
    radial-gradient(circle at 84% 18%, rgba(66, 199, 155, 0.2), transparent 30%);
  box-shadow: 0 18px 38px rgba(31, 77, 84, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.classic-canvas-stage .canvas-game {
  width: 100%;
  height: 100%;
  border: 1px solid rgba(78, 155, 97, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, 0.54);
}

.pinball-panel {
  width: min(100%, 740px);
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: clamp(7px, 1.2vmin, 12px);
}

.pinball-panel .classic-canvas-stage {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: clamp(8px, 1.2vmin, 12px);
  border-color: rgba(68, 147, 181, 0.36);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(225, 251, 255, 0.66)),
    radial-gradient(circle at 50% 12%, rgba(159, 134, 255, 0.2), transparent 30%),
    radial-gradient(circle at 12% 28%, rgba(75, 163, 227, 0.2), transparent 26%),
    radial-gradient(circle at 88% 40%, rgba(255, 143, 112, 0.18), transparent 28%);
  box-shadow:
    0 22px 42px rgba(31, 77, 84, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.pinball-stage .canvas-game {
  width: 100%;
  height: 100%;
  border-color: rgba(53, 111, 133, 0.28);
  background: rgba(217, 248, 255, 0.72);
  box-shadow:
    inset 0 0 0 4px rgba(255, 255, 255, 0.52),
    inset 0 -28px 54px rgba(75, 163, 227, 0.18);
}

.pinball-guide {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(34px, 5.5vmin, 46px);
  padding: 8px 12px;
  border: 1px solid rgba(78, 155, 97, 0.28);
  border-radius: 8px;
  color: #17342f;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 14px 28px rgba(31, 77, 84, 0.12);
  text-align: center;
  font-size: clamp(13px, 2vmin, 16px);
  font-weight: 900;
}

.billiards-panel {
  width: min(100%, 800px);
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: clamp(7px, 1.2vmin, 12px);
}

.billiards-panel .classic-canvas-stage {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: clamp(8px, 1.2vmin, 12px);
  border-color: rgba(113, 78, 39, 0.34);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(242, 250, 230, 0.62)),
    radial-gradient(circle at 16% 20%, rgba(255, 200, 87, 0.2), transparent 32%),
    radial-gradient(circle at 84% 18%, rgba(66, 199, 155, 0.2), transparent 30%);
  box-shadow:
    0 22px 42px rgba(31, 77, 84, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.billiards-stage .canvas-game {
  width: 100%;
  height: 100%;
  border-color: rgba(96, 65, 30, 0.34);
  background: rgba(36, 128, 94, 0.72);
  box-shadow:
    inset 0 0 0 4px rgba(255, 255, 255, 0.36),
    inset 0 0 56px rgba(23, 52, 47, 0.24);
}

.billiards-guide {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(34px, 5.5vmin, 46px);
  padding: 8px 12px;
  border: 1px solid rgba(78, 155, 97, 0.28);
  border-radius: 8px;
  color: #17342f;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 14px 28px rgba(31, 77, 84, 0.12);
  text-align: center;
  font-size: clamp(13px, 2vmin, 16px);
  font-weight: 900;
}

.tank-war-panel {
  width: min(100%, 800px);
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: clamp(7px, 1.2vmin, 12px);
}

.tank-war-panel .classic-canvas-stage {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: clamp(8px, 1.2vmin, 12px);
  border-color: rgba(45, 82, 65, 0.38);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(229, 246, 232, 0.62)),
    radial-gradient(circle at 16% 20%, rgba(157, 114, 65, 0.2), transparent 32%),
    radial-gradient(circle at 84% 18%, rgba(64, 122, 86, 0.18), transparent 30%);
  box-shadow:
    0 22px 42px rgba(31, 77, 84, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.tank-war-stage .canvas-game {
  width: 100%;
  height: 100%;
  border-color: rgba(34, 76, 58, 0.36);
  background: rgba(63, 78, 59, 0.78);
  box-shadow:
    inset 0 0 0 4px rgba(255, 255, 255, 0.28),
    inset 0 0 60px rgba(16, 32, 30, 0.32);
}

.tank-war-guide {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(34px, 5.5vmin, 46px);
  padding: 8px 12px;
  border: 1px solid rgba(78, 155, 97, 0.28);
  border-radius: 8px;
  color: #17342f;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 14px 28px rgba(31, 77, 84, 0.12);
  text-align: center;
  font-size: clamp(13px, 2vmin, 16px);
  font-weight: 900;
}

.motorbike-panel {
  width: min(100%, 800px);
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: clamp(7px, 1.2vmin, 12px);
}

.motorbike-panel .classic-canvas-stage {
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: clamp(8px, 1.2vmin, 12px);
  border-color: rgba(78, 135, 155, 0.35);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(226, 247, 255, 0.68)),
    radial-gradient(circle at 18% 16%, rgba(255, 200, 87, 0.2), transparent 32%),
    radial-gradient(circle at 82% 18%, rgba(255, 143, 112, 0.18), transparent 32%);
  box-shadow:
    0 22px 42px rgba(31, 77, 84, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.motorbike-stage .canvas-game {
  width: 100%;
  height: 100%;
  border-color: rgba(37, 89, 102, 0.32);
  background: rgba(190, 234, 248, 0.72);
  box-shadow:
    inset 0 0 0 4px rgba(255, 255, 255, 0.38),
    inset 0 -30px 56px rgba(23, 52, 47, 0.18);
}

.motorbike-guide {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(34px, 5.5vmin, 46px);
  padding: 8px 12px;
  border: 1px solid rgba(78, 155, 97, 0.28);
  border-radius: 8px;
  color: #17342f;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 14px 28px rgba(31, 77, 84, 0.12);
  text-align: center;
  font-size: clamp(13px, 2vmin, 16px);
  font-weight: 900;
}

.difference-board {
  width: min(100%, 880px);
  height: min(100%, 560px);
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: clamp(8px, 1.4vmin, 14px);
}

.difference-scenes {
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(8px, 1.4vmin, 14px);
}

.difference-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(78, 155, 97, 0.3);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(214, 242, 255, 0.88), rgba(255, 249, 226, 0.9)),
    radial-gradient(circle at 50% 78%, rgba(78, 155, 97, 0.22), transparent 24%);
  box-shadow: 0 18px 38px rgba(31, 77, 84, 0.12);
}

.difference-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, transparent 0 42%, rgba(65, 184, 221, 0.44) 42% 61%, rgba(255, 232, 170, 0.82) 61% 100%),
    radial-gradient(ellipse at 50% 58%, rgba(255, 255, 255, 0.58), transparent 34%);
}

.difference-scene-layer {
  position: absolute;
  inset: 0;
  cursor: crosshair;
}

.difference-scene-item {
  position: absolute;
  display: grid;
  place-items: center;
  width: clamp(24px, 4.5vmin, 44px);
  height: clamp(24px, 4.5vmin, 44px);
  font-size: clamp(20px, 4.4vmin, 38px);
  line-height: 1;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 8px 8px rgba(31, 77, 84, 0.14));
  user-select: none;
  pointer-events: none;
}

.scene-sun {
  width: clamp(28px, 5.4vmin, 48px);
  height: clamp(28px, 5.4vmin, 48px);
  border-radius: 999px;
  background: #ffd15c;
  box-shadow: 0 0 0 6px rgba(255, 209, 92, 0.28), 0 0 24px rgba(255, 184, 77, 0.45);
}

.scene-palm {
  width: clamp(34px, 7vmin, 62px);
  height: clamp(42px, 8vmin, 72px);
}

.scene-palm::before {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 18%;
  height: 58%;
  border-radius: 999px;
  background: linear-gradient(180deg, #a66a33, #704220);
  transform: translateX(-50%) rotate(2deg);
}

.scene-palm::after {
  content: "";
  position: absolute;
  top: 7%;
  left: 50%;
  width: 72%;
  height: 46%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 20% 50%, #37b66b 0 44%, transparent 46%),
    radial-gradient(ellipse at 80% 50%, #2ba85f 0 44%, transparent 46%),
    radial-gradient(ellipse at 50% 18%, #48c779 0 46%, transparent 48%);
  transform: translateX(-50%);
}

.scene-umbrella {
  width: clamp(34px, 6vmin, 56px);
  height: clamp(34px, 6vmin, 56px);
}

.scene-umbrella::before {
  content: "";
  position: absolute;
  top: 10%;
  left: 50%;
  width: 84%;
  height: 44%;
  border-radius: 999px 999px 8px 8px;
  background: repeating-linear-gradient(90deg, #ff8f70 0 18%, #fff3b0 18% 36%);
  transform: translateX(-50%);
}

.scene-umbrella::after {
  content: "";
  position: absolute;
  top: 42%;
  left: 50%;
  width: 4px;
  height: 48%;
  border-radius: 999px;
  background: #8b6b45;
  transform: translateX(-50%);
}

.scene-small-shell::before,
.scene-crab::before,
.difference-object-flower::before,
.difference-object-shell::before {
  font-weight: 900;
  font-family: Georgia, "Times New Roman", serif;
}

.scene-small-shell::before {
  content: "◖";
  color: #7f62f0;
}

.scene-crab::before {
  content: "≋";
  color: #ff6f61;
  font-size: 1.2em;
}

.difference-object {
  z-index: 2;
}

.difference-object-kite::before {
  content: "";
  width: 48%;
  height: 48%;
  border-radius: 4px;
  background: linear-gradient(135deg, #ff8f70 0 50%, #8b7cf6 50% 100%);
  transform: rotate(45deg);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.72);
}

.difference-object-kite::after {
  content: "";
  position: absolute;
  top: 58%;
  left: 50%;
  width: 2px;
  height: 34%;
  background: rgba(23, 52, 47, 0.45);
  transform: translateX(-50%) rotate(-18deg);
}

.difference-object-kite.is-right::before {
  border-radius: 999px;
  background: linear-gradient(135deg, #ffc857, #ff8f70);
}

.difference-object-boat::before {
  content: "";
  position: absolute;
  left: 42%;
  top: 18%;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 2px solid transparent;
  border-bottom: 28px solid #fff8d7;
}

.difference-object-boat::after {
  content: "";
  position: absolute;
  left: 16%;
  bottom: 20%;
  width: 70%;
  height: 20%;
  border-radius: 0 0 999px 999px;
  background: #17627d;
}

.difference-object-boat.is-right::before {
  border-bottom-color: #ffd15c;
}

.difference-object-boat.is-right::after {
  width: 84%;
  background: #ff8f70;
}

.difference-object-flower::before {
  content: "✿";
  color: #ff8f70;
}

.difference-object-flower.is-right::before {
  content: "✦";
  color: #8b7cf6;
}

.difference-object-shell::before {
  content: "◖";
  color: #7f62f0;
}

.difference-object-shell.is-right::before {
  content: "★";
  color: #ffc857;
}

.difference-object-starfish::before {
  content: "★";
  color: #ff8f70;
  font-size: 1.12em;
}

.difference-object-starfish.is-right::before {
  color: #ffc857;
  transform: rotate(18deg);
}

.difference-object-balloon::before {
  content: "";
  width: 54%;
  height: 66%;
  border-radius: 999px 999px 72% 72%;
  background: linear-gradient(135deg, #ff8f70, #d64b6b);
  box-shadow: inset -5px -7px 0 rgba(139, 38, 80, 0.16);
}

.difference-object-balloon::after {
  content: "";
  position: absolute;
  top: 72%;
  left: 50%;
  width: 2px;
  height: 30%;
  background: rgba(23, 52, 47, 0.42);
  transform: translateX(-50%);
}

.difference-object-balloon.is-right::before {
  background: linear-gradient(135deg, #7f62f0, #4b9bc8);
}

.difference-object-flag::before {
  content: "";
  position: absolute;
  left: 40%;
  top: 18%;
  width: 4px;
  height: 62%;
  border-radius: 999px;
  background: #7b5a35;
}

.difference-object-flag::after {
  content: "";
  position: absolute;
  left: 46%;
  top: 20%;
  width: 46%;
  height: 30%;
  border-radius: 4px 10px 10px 4px;
  background: linear-gradient(135deg, #42c79b, #4b9bc8);
}

.difference-object-flag.is-right::after {
  background: linear-gradient(135deg, #ffc857, #ff8f70);
  transform: translateY(8px);
}

.difference-object-bucket::before {
  content: "";
  width: 58%;
  height: 52%;
  border-radius: 6px 6px 10px 10px;
  background: linear-gradient(180deg, #ffc857, #ff8f70);
  box-shadow: inset 0 4px 0 rgba(255, 255, 255, 0.48);
}

.difference-object-bucket::after {
  content: "";
  position: absolute;
  top: 16%;
  left: 26%;
  width: 48%;
  height: 24%;
  border: 2px solid rgba(23, 52, 47, 0.38);
  border-bottom: 0;
  border-radius: 999px 999px 0 0;
}

.difference-object-bucket.is-right::before {
  background: linear-gradient(180deg, #7df0bf, #42c79b);
}

.difference-object-bird::before,
.difference-object-bird::after {
  content: "";
  position: absolute;
  top: 44%;
  width: 46%;
  height: 3px;
  border-radius: 999px;
  background: #17627d;
}

.difference-object-bird::before {
  left: 8%;
  transform: rotate(-24deg);
}

.difference-object-bird::after {
  right: 8%;
  transform: rotate(24deg);
}

.difference-object-bird.is-right::before,
.difference-object-bird.is-right::after {
  background: #ff8f70;
}

.difference-object-cloud {
  width: clamp(42px, 7vmin, 68px);
  height: clamp(24px, 4.2vmin, 40px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow:
    -12px 4px 0 rgba(255, 255, 255, 0.86),
    11px 3px 0 rgba(255, 255, 255, 0.82);
}

.game-area .difference-hotspot {
  appearance: none;
  -webkit-appearance: none;
  position: absolute;
  z-index: 4;
  width: clamp(42px, 8vmin, 72px);
  aspect-ratio: 1;
  padding: 0;
  border-radius: 999px;
  border: 2px solid transparent;
  background: transparent !important;
  box-shadow: none;
  color: transparent;
  transform: translate(-50%, -50%);
  cursor: pointer;
  min-height: 0;
  transition: none;
}

.game-area .difference-hotspot:hover {
  border-color: rgba(255, 255, 255, 0.72);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: none;
  transform: translate(-50%, -50%);
}

.difference-found-ring {
  position: absolute;
  z-index: 5;
  width: clamp(42px, 8vmin, 72px);
  aspect-ratio: 1;
  border: 3px solid rgba(255, 143, 112, 0.92);
  border-radius: 999px;
  box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.48), 0 8px 20px rgba(31, 77, 84, 0.18);
  transform: translate(-50%, -50%);
  pointer-events: none;
  animation: difference-ring-pop 320ms cubic-bezier(0.16, 1, 0.3, 1);
}

.difference-progress {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: clamp(8px, 1.4vmin, 12px);
  border: 1px solid rgba(78, 155, 97, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 14px 28px rgba(31, 77, 84, 0.12);
}

.difference-progress span {
  min-width: 74px;
  padding: 6px 10px;
  border-radius: 999px;
  color: rgba(23, 52, 47, 0.72);
  background: rgba(255, 255, 255, 0.82);
  text-align: center;
  font-weight: 800;
  font-size: clamp(12px, 1.8vmin, 15px);
}

.difference-progress span.is-found {
  color: #0d5b45;
  background: linear-gradient(180deg, rgba(199, 250, 226, 0.98), rgba(129, 228, 181, 0.9));
}

@keyframes difference-ring-pop {
  0% {
    transform: translate(-50%, -50%) scale(0.6);
    opacity: 0;
  }

  100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

.code-board {
  width: min(100%, 560px);
  display: grid;
  gap: 12px;
  padding: clamp(12px, 2vmin, 18px);
  border: 1px solid rgba(78, 155, 97, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 38px rgba(31, 77, 84, 0.13);
}

.code-display {
  min-height: 64px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(246, 252, 240, 0.96), rgba(230, 249, 239, 0.9));
  color: var(--leaf-dark);
  font-size: clamp(22px, 5vmin, 42px);
  font-weight: 900;
}

.code-guide {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid rgba(78, 155, 97, 0.26);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: #31594b;
}

.code-guide strong {
  color: var(--leaf-dark);
  font-size: clamp(15px, 2.2vmin, 18px);
}

.code-hint-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.code-hint-grid span {
  min-height: 42px;
  display: grid;
  place-items: center;
  padding: 6px 8px;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(246, 252, 240, 0.98), rgba(230, 249, 239, 0.9));
  color: rgba(23, 52, 47, 0.78);
  text-align: center;
  font-size: clamp(12px, 1.8vmin, 15px);
  font-weight: 800;
}

.code-log {
  min-height: 170px;
  display: grid;
  align-content: start;
  gap: 8px;
}

.code-log span {
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: #31594b;
  font-weight: 800;
}

.code-history-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 8px;
}

.code-history-row b {
  color: var(--leaf-dark);
  font-size: clamp(16px, 2.4vmin, 22px);
}

.code-history-row em {
  min-width: 48px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255, 235, 186, 0.9);
  color: #36564a;
  text-align: center;
  font-style: normal;
  font-weight: 900;
}

.code-empty {
  min-height: 56px;
  display: grid;
  place-items: center;
  text-align: center;
}

@media (max-width: 640px) {
  .code-hint-grid {
    grid-template-columns: 1fr;
  }
}

.idiom-cell,
.word-cell {
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: clamp(18px, 4.6vmin, 38px);
}

.word-grid-wrap {
  width: min(100%, 700px);
  height: min(100%, 620px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: clamp(8px, 1.4vmin, 12px);
}

.word-guide {
  padding: 8px 12px;
  border: 1px solid rgba(78, 155, 97, 0.28);
  border-radius: 8px;
  color: #31594b;
  background: rgba(255, 255, 255, 0.78);
  text-align: center;
  font-size: clamp(13px, 2vmin, 16px);
  font-weight: 800;
}

.word-board {
  --board-size: min(100%, 480px);
  width: var(--board-size);
  height: var(--board-size);
  justify-self: center;
}

.word-targets {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid rgba(78, 155, 97, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.word-targets span {
  min-width: 108px;
  padding: 7px 10px;
  border-radius: 999px;
  color: rgba(23, 52, 47, 0.72);
  background: rgba(255, 255, 255, 0.86);
  text-align: center;
  font-size: clamp(12px, 1.8vmin, 15px);
  font-weight: 900;
}

.word-targets span.is-found {
  color: #0d5b45;
  background: linear-gradient(180deg, rgba(199, 250, 226, 0.98), rgba(129, 228, 181, 0.9));
}

.word-cell.is-in-path {
  border-color: rgba(255, 143, 112, 0.82);
  background: linear-gradient(180deg, rgba(255, 246, 221, 0.98), rgba(255, 218, 168, 0.9));
  transform: scale(1.04);
}

.word-cell.is-found-word {
  border-color: rgba(66, 199, 155, 0.66);
  background: linear-gradient(180deg, rgba(224, 255, 238, 0.98), rgba(178, 239, 207, 0.9));
  color: #0d5b45;
}

.card-row,
.pile-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  width: min(100%, 760px);
}

.playing-card {
  width: clamp(48px, 8vmin, 70px);
  aspect-ratio: 0.72;
  border-radius: 8px;
  border: 1px solid rgba(40, 79, 83, 0.24);
  background: rgba(255, 255, 255, 0.9);
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #17342f;
  box-shadow: 0 8px 16px rgba(31, 77, 84, 0.1);
}

.playing-card.is-card-back {
  color: transparent;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.32) 0 12%, transparent 12% 24%, rgba(255, 255, 255, 0.28) 24% 36%, transparent 36%),
    linear-gradient(180deg, #2b8cc8, #22678f);
  box-shadow: 0 8px 16px rgba(31, 77, 84, 0.16), inset 0 0 0 4px rgba(255, 255, 255, 0.28);
}

.playing-card.is-selected {
  transform: translateY(-3px);
  border-color: rgba(255, 184, 77, 0.82);
  box-shadow: 0 0 0 3px rgba(255, 209, 92, 0.3), 0 12px 20px rgba(31, 77, 84, 0.16);
}

.playing-card.is-valid-target,
.pile.is-valid-target {
  border-color: rgba(58, 197, 151, 0.9);
  box-shadow: 0 0 0 3px rgba(111, 224, 183, 0.28), 0 12px 22px rgba(31, 77, 84, 0.14);
}

.playing-card.red {
  color: #c43f37;
}

.solitaire-layout {
  width: min(100%, 780px);
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(72, 139, 127, 0.18);
  border-radius: 8px;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.66), transparent 32%),
    linear-gradient(135deg, rgba(226, 249, 239, 0.82), rgba(235, 247, 255, 0.72));
}

.solitaire-theme-sunset {
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.66), transparent 32%),
    linear-gradient(135deg, rgba(255, 238, 214, 0.84), rgba(232, 249, 255, 0.72));
}

.solitaire-theme-moon-bay {
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.7), transparent 32%),
    linear-gradient(135deg, rgba(224, 239, 255, 0.86), rgba(231, 252, 242, 0.72));
}

.solitaire-coach-panel {
  display: grid;
  grid-template-columns: auto auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid rgba(23, 52, 47, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  color: #17342f;
  font-weight: 900;
}

.solitaire-coach-panel em {
  justify-self: end;
  color: rgba(23, 52, 47, 0.58);
  font-size: 12px;
  font-style: normal;
}

.solitaire-foundation-progress {
  grid-column: 1 / -1;
  height: 7px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--accent, #36c4a3) var(--progress, 0%), rgba(23, 52, 47, 0.1) 0);
  box-shadow: inset 0 0 0 1px rgba(23, 52, 47, 0.08);
}

.solitaire-message {
  width: min(100%, 760px);
  margin-inline: auto;
  padding: 8px 12px;
  border: 1px solid rgba(95, 148, 136, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  color: rgba(23, 52, 47, 0.78);
  text-align: center;
  font-size: clamp(13px, 2vmin, 16px);
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(31, 77, 84, 0.08);
}

.foundation-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.pile-row {
  align-items: start;
}

.pile {
  min-width: clamp(52px, 9vmin, 74px);
  min-height: clamp(72px, 12vmin, 100px);
  border: 1px dashed rgba(23, 52, 47, 0.28);
  border-radius: 8px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.34);
}

.pile .playing-card + .playing-card {
  margin-top: -56%;
}

.action-canvas-stage {
  width: min(100%, 760px);
  height: min(100%, 560px);
  aspect-ratio: 76 / 52;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(224, 249, 255, 0.64));
}

.action-canvas-stage .canvas-game {
  width: 100%;
  height: 100%;
  display: block;
}

.seaside-arcade-stage {
  box-shadow: 0 18px 38px rgba(28, 96, 122, 0.18), inset 0 0 0 1px rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(69, 152, 170, 0.28);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(221, 249, 255, 0.56));
}

.sequence-board {
  --board-size: min(100%, 560px);
  gap: clamp(8px, 1.5vmin, 14px);
  padding: clamp(10px, 1.8vmin, 16px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(242, 255, 235, 0.78)),
    radial-gradient(circle at 20% 20%, rgba(255, 205, 99, 0.18), transparent 28%),
    radial-gradient(circle at 84% 82%, rgba(94, 208, 190, 0.2), transparent 30%);
}

.sequence-shell {
  font-size: clamp(36px, 8vmin, 72px);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.sequence-shell.is-active {
  transform: translateY(-4px) scale(1.06);
  box-shadow: 0 0 0 4px rgba(255, 204, 92, 0.34), 0 18px 28px rgba(31, 77, 84, 0.18);
  filter: saturate(1.28);
}

.sequence-shell.tone-rose {
  background: linear-gradient(180deg, #fff6f4, #ffd5dc);
}

.sequence-shell.tone-sand {
  background: linear-gradient(180deg, #fff9e8, #ead09c);
}

.precision-board,
.puzzle-level-board {
  width: min(100%, var(--board-size));
  height: min(100%, var(--board-size));
  max-width: 580px;
  max-height: 580px;
  padding: clamp(8px, 1.5vmin, 14px);
  border-radius: 8px;
  background: rgba(245, 253, 241, 0.84);
  border: 1px solid rgba(78, 155, 97, 0.34);
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.42);
}

.mole-cell,
.color-maze-cell,
.arrow-cell {
  font-size: clamp(24px, 6vmin, 48px);
  font-weight: 900;
}

.mole-board {
  gap: clamp(8px, 1.8vmin, 14px);
  padding: clamp(10px, 2vmin, 18px);
  background: linear-gradient(180deg, rgba(219, 248, 207, 0.92), rgba(159, 218, 134, 0.86));
  border-color: rgba(74, 136, 72, 0.42);
  cursor: crosshair;
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='34' height='34' viewBox='0 0 34 34'%3E%3Cg transform='rotate(-35 17 17)'%3E%3Crect x='6' y='4' width='17' height='10' rx='3' fill='%23b7c4c9' stroke='%2317342f' stroke-width='2'/%3E%3Crect x='18' y='10' width='5' height='20' rx='2.5' fill='%23a66a35' stroke='%2317342f' stroke-width='1.8'/%3E%3C/g%3E%3C/svg%3E") 10 25, pointer;
}

.mole-cell {
  position: relative;
  overflow: hidden;
  border-color: rgba(74, 136, 72, 0.38);
  background:
    radial-gradient(circle at 20% 18%, rgba(255, 255, 255, 0.76), transparent 24%),
    linear-gradient(180deg, #eaffdc, #b9e28c);
}

.mole-hole {
  position: absolute;
  left: 14%;
  right: 14%;
  bottom: 12%;
  height: 30%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 48%, rgba(33, 24, 18, 0.88) 0 36%, rgba(82, 57, 33, 0.9) 52%, rgba(139, 95, 48, 0.64) 72%, transparent 73%);
  box-shadow: inset 0 8px 10px rgba(0, 0, 0, 0.22), 0 4px 0 rgba(80, 131, 70, 0.22);
}

.mole-cell.is-mole {
  color: #8d5524;
  background:
    radial-gradient(circle at 26% 16%, rgba(255, 255, 255, 0.82), transparent 22%),
    linear-gradient(180deg, #f5ffd9, #a9da74);
  animation: tile-action-pop 220ms ease;
}

.mole-face {
  position: absolute;
  left: 23%;
  bottom: 22%;
  width: 54%;
  height: 58%;
  border-radius: 52% 52% 45% 45% / 44% 44% 56% 56%;
  background:
    radial-gradient(ellipse at 50% 73%, #eed0a3 0 19%, transparent 20%),
    radial-gradient(ellipse at 50% 50%, #a9794d 0 48%, #735036 76%);
  box-shadow: inset 0 6px 9px rgba(255, 255, 255, 0.25), 0 7px 12px rgba(62, 38, 16, 0.22);
}

.mole-face::before {
  content: "";
  position: absolute;
  left: 35%;
  top: -9%;
  width: 30%;
  height: 20%;
  border-radius: 50% 50% 34% 34%;
  background: #7a5537;
  box-shadow: inset 0 3px 0 rgba(255, 255, 255, 0.16);
}

.mole-eye {
  position: absolute;
  top: 33%;
  width: 10%;
  height: 10%;
  border-radius: 50%;
  background: #17201d;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.18);
}

.mole-eye.left {
  left: 30%;
}

.mole-eye.right {
  right: 30%;
}

.mole-nose {
  position: absolute;
  left: 38%;
  top: 47%;
  width: 24%;
  height: 16%;
  border-radius: 50% 50% 62% 62%;
  background: #2f1d18;
  clip-path: polygon(50% 100%, 4% 10%, 96% 10%);
}

.mole-whisker {
  position: absolute;
  top: 55%;
  width: 24%;
  height: 2px;
  background: rgba(47, 29, 24, 0.72);
  transform-origin: center;
}

.mole-whisker.left {
  left: 8%;
}

.mole-whisker.right {
  right: 8%;
}

.mole-whisker.top.left {
  transform: rotate(12deg);
}

.mole-whisker.bottom.left {
  top: 63%;
  transform: rotate(-10deg);
}

.mole-whisker.top.right {
  transform: rotate(-12deg);
}

.mole-whisker.bottom.right {
  top: 63%;
  transform: rotate(10deg);
}

.mole-tooth {
  position: absolute;
  top: 66%;
  width: 8%;
  height: 14%;
  border-radius: 0 0 4px 4px;
  background: #fff7e8;
  border: 1px solid rgba(81, 48, 27, 0.28);
}

.mole-tooth.left {
  left: 42%;
}

.mole-tooth.right {
  right: 42%;
}

.mole-paw,
.mole-claw {
  position: absolute;
  z-index: 2;
}

.mole-paw {
  bottom: -3%;
  width: 23%;
  height: 18%;
  border-radius: 50%;
  background: #6f4b32;
}

.mole-paw.left {
  left: 13%;
}

.mole-paw.right {
  right: 13%;
}

.mole-claw {
  bottom: 2%;
  width: 14%;
  height: 9%;
  border-bottom: 2px solid rgba(255, 245, 210, 0.88);
  border-radius: 50%;
}

.mole-claw.left {
  left: 17%;
  transform: rotate(-12deg);
}

.mole-claw.right {
  right: 17%;
  transform: rotate(12deg);
}

.mole-cell.is-bomb,
.color-maze-cell.is-locked,
.arrow-cell.is-locked {
  color: #fff;
  background: linear-gradient(180deg, #495057, #1f2933);
}

.mole-bomb {
  position: absolute;
  left: 31%;
  bottom: 28%;
  width: 38%;
  height: 38%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.8), transparent 18%),
    linear-gradient(180deg, #5d6670, #111827);
  box-shadow: 0 8px 12px rgba(17, 24, 39, 0.28);
}

.mole-bomb span {
  position: absolute;
  left: 64%;
  top: -15%;
  width: 30%;
  height: 34%;
  border-top: 4px solid #ffcf5c;
  border-right: 4px solid #ffcf5c;
  border-radius: 50%;
  transform: rotate(-18deg);
}

.mole-cell.is-bomb-hit {
  animation: mole-bomb-hit 420ms ease both;
}

.mole-cell.is-bomb-hit .mole-bomb {
  background:
    radial-gradient(circle at 44% 42%, #fff7a8 0 13%, #ff8f3d 14% 34%, #f94144 35% 54%, transparent 55%),
    linear-gradient(180deg, #5d6670, #111827);
  box-shadow: 0 0 0 10px rgba(249, 65, 68, 0.16), 0 0 24px rgba(255, 143, 61, 0.68);
  transform: scale(1.12);
}

.mole-cell.is-bomb-hit::after {
  content: "-50";
  position: absolute;
  right: 10%;
  top: 10%;
  z-index: 3;
  color: #ffffff;
  font-size: clamp(15px, 3vmin, 24px);
  font-weight: 900;
  text-shadow: 0 2px 6px rgba(120, 20, 20, 0.45);
  animation: score-float 420ms ease both;
}

@keyframes mole-bomb-hit {
  0%,
  100% {
    transform: translate(0, 0);
    filter: none;
  }

  18% {
    transform: translate(-5px, 2px) rotate(-2deg);
    filter: saturate(1.4);
  }

  38% {
    transform: translate(5px, -2px) rotate(2deg);
  }

  58% {
    transform: translate(-3px, 1px) rotate(-1deg);
  }
}

.color-maze-cell.tone-mint,
.color-maze-cell.tone-sky,
.color-maze-cell.tone-berry,
.color-maze-cell.tone-sun,
.color-maze-cell.tone-purple,
.color-maze-cell.tone-leaf {
  animation: tile-action-pop 180ms ease;
}

.color-maze-guide {
  width: min(100%, 580px);
  display: grid;
  gap: 8px;
  padding: clamp(8px, 1.5vmin, 12px);
  border-radius: 8px;
  border: 1px solid rgba(78, 155, 97, 0.3);
  background: rgba(255, 255, 255, 0.78);
  color: #17342f;
  box-shadow: 0 12px 24px rgba(24, 83, 89, 0.1);
}

.color-maze-goal {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: clamp(14px, 2vmin, 17px);
  font-weight: 900;
}

.color-maze-goal strong {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: #0d6f66;
}

.color-maze-rule {
  font-size: clamp(12px, 1.6vmin, 14px);
  font-weight: 700;
  line-height: 1.45;
  text-align: center;
  color: rgba(23, 52, 47, 0.72);
}

.color-maze-swatch {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 3px 8px rgba(23, 52, 47, 0.18);
}

.color-maze-cell.is-player {
  box-shadow: inset 0 0 0 4px rgba(255, 255, 255, 0.7), 0 0 0 3px rgba(23, 52, 47, 0.24);
}

.arrow-cell {
  position: relative;
  color: #17342f;
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.arrow-escape-board {
  --board-size: min(100%, 540px);
  gap: clamp(6px, 1.1vmin, 10px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(240, 253, 230, 0.8)),
    radial-gradient(circle at 14% 15%, rgba(87, 197, 182, 0.18), transparent 31%),
    radial-gradient(circle at 88% 84%, rgba(255, 185, 88, 0.16), transparent 34%);
}

@supports (width: 1cqw) {
  .arrow-escape-board {
    --board-size: min(100cqw, calc(100cqh - 74px), 540px);
  }
}

.arrow-escape-board .arrow-cell {
  font-size: clamp(30px, 7vmin, 58px);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(247, 255, 236, 0.88));
}

.arrow-guide {
  width: min(100%, 720px);
  padding: 8px 12px;
  border: 1px solid rgba(78, 155, 97, 0.28);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  color: #31594b;
  text-align: center;
  font-size: clamp(12px, 1.9vmin, 15px);
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(31, 77, 84, 0.1);
}

.arrow-escape-board .arrow-cell:empty {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.62), rgba(245, 253, 236, 0.42));
  box-shadow: inset 0 0 0 1px rgba(75, 136, 91, 0.1);
}

.arrow-escape-board .arrow-cell.is-locked {
  color: #fff;
  background:
    radial-gradient(circle at 36% 28%, rgba(255, 255, 255, 0.24), transparent 18%),
    linear-gradient(145deg, #40515b, #17242c);
  border-color: rgba(13, 28, 36, 0.34);
}

.arrow-escape-board .arrow-cell.is-danger {
  color: rgba(23, 52, 47, 0.62);
  background: linear-gradient(180deg, rgba(246, 251, 244, 0.96), rgba(226, 237, 231, 0.78));
  border-color: rgba(78, 117, 105, 0.22);
}

.arrow-escape-board .arrow-cell.is-rotator {
  color: #6d3f09;
  background:
    radial-gradient(circle at 36% 28%, rgba(255, 255, 255, 0.78), transparent 20%),
    linear-gradient(180deg, rgba(255, 237, 180, 0.98), rgba(255, 190, 91, 0.88));
  border-color: rgba(220, 145, 44, 0.46);
  box-shadow: 0 12px 22px rgba(166, 103, 32, 0.14), inset 0 0 0 2px rgba(255, 255, 255, 0.55);
}

.arrow-escape-board .arrow-cell.is-escape-ready {
  color: #0d5567;
  border-color: rgba(22, 151, 164, 0.42);
  box-shadow: 0 10px 20px rgba(24, 119, 123, 0.13), inset 0 0 0 2px rgba(255, 255, 255, 0.74);
  animation: arrow-ready-pulse 1.6s ease-in-out infinite;
}

.arrow-escape-board .arrow-cell.is-hinted {
  color: #104f5f;
  border-color: rgba(255, 168, 60, 0.8);
  box-shadow: 0 0 0 4px rgba(255, 188, 84, 0.24), 0 14px 26px rgba(31, 77, 84, 0.18);
  animation: arrow-hint-pop 0.72s ease-in-out 2;
}

@keyframes arrow-ready-pulse {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-2px);
  }
}

@keyframes arrow-hint-pop {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.06);
  }
}

@keyframes result-pop {
  from {
    opacity: 0;
    transform: translate(-50%, calc(-50% + 10px)) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes confetti-burst {
  0% {
    opacity: 0;
    transform: scale(0.72) translateY(18px);
  }
  35% {
    opacity: 1;
  }
  100% {
    opacity: 0.72;
    transform: scale(1.08) translateY(-12px);
  }
}

@keyframes result-ribbon-fall {
  0% {
    opacity: 0;
    transform: translateY(-28px) rotate(-3deg);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0.9;
    transform: translateY(78px) rotate(4deg);
  }
}

@keyframes encourage-card-breathe {
  0%,
  100% {
    opacity: 0.72;
    filter: saturate(1);
  }
  50% {
    opacity: 1;
    filter: saturate(1.12);
  }
}

@keyframes encourage-step-rise {
  0% {
    opacity: 0.16;
    transform: translateY(16px);
  }
  45% {
    opacity: 0.74;
  }
  100% {
    opacity: 0.1;
    transform: translateY(-18px);
  }
}

@media (max-width: 760px) {
  body {
    padding: 6px;
  }

  .title-block h1 {
    padding-left: clamp(44px, 9vw, 68px);
  }

  .game-shell {
    width: min(100%, 860px);
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
  }

  .top-bar {
    grid-column: 1;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .status-bar {
    grid-column: 1;
    grid-row: 2;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .game-area {
    grid-column: 1;
    grid-row: 3;
  }

  .controls {
    grid-column: 1;
  }

  .title-block {
    align-items: end;
  }

  .status-bar strong {
    font-size: 15px;
  }

  .cell {
    border-radius: 4px;
  }
}
