* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  color: var(--text);
  background: var(--bg);
  font-family: "Noto Sans SC", "Microsoft YaHei", "PingFang SC", sans-serif;
  user-select: none;
}

button,
select,
textarea,
input {
  color: inherit;
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
select:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid var(--text-bright);
  outline-offset: 3px;
  box-shadow: 0 0 0 6px rgba(202, 165, 106, 0.42);
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  isolation: isolate;
  background: var(--bg);
}

.ambient,
.grain-lines {
  position: fixed;
  pointer-events: none;
  z-index: -2;
}

.ambient {
  border-radius: 50%;
  filter: blur(1px);
}

.ambient-jade {
  width: min(55vw, 680px);
  aspect-ratio: 1;
  top: -34%;
  left: 0;
  clip-path: ellipse(52% 50% at 0 50%);
  background: rgba(44, 69, 63, 0.22);
}

.ambient-cinnabar {
  width: min(58vw, 740px);
  aspect-ratio: 1;
  right: 0;
  bottom: -45%;
  clip-path: ellipse(52% 50% at 100% 50%);
  background: rgba(97, 56, 31, 0.15);
}

.grain-lines {
  inset: 0;
  z-index: -1;
  opacity: 0.72;
  background:
    repeating-linear-gradient(176deg, transparent 0 78px, rgba(202, 165, 106, 0.035) 79px 80px, transparent 81px 112px),
    radial-gradient(circle at 50% 48%, rgba(255, 255, 255, 0.018), transparent 48%);
}

.outline-btn {
  min-height: var(--control-h);
  padding: 0 18px;
  border: 1px solid var(--accent-dark);
  border-radius: 7px;
  color: var(--text);
  background: rgba(27, 36, 35, 0.72);
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

.outline-btn:hover {
  border-color: var(--accent);
  color: var(--text-bright);
  background: var(--panel-light);
}

.outline-btn:active {
  transform: translateY(1px);
}

.outline-btn:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.primary-btn {
  color: #151a19;
  border-color: var(--accent);
  background: var(--accent);
}

.primary-btn:hover {
  color: #0f1312;
  background: #d8b778;
}

/* 棋室首页 */
.lobby-view {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding:
    max(clamp(28px, 5vh, 60px), var(--safe-top))
    max(clamp(24px, 7vw, 90px), var(--safe-right))
    max(clamp(28px, 5vh, 60px), var(--safe-bottom))
    max(clamp(24px, 7vw, 90px), var(--safe-left));
  overflow: auto;
  background: #0b100f;
}

.lobby-view::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  background: rgba(7, 12, 11, 0.52);
  box-shadow: inset 0 0 220px rgba(0, 0, 0, 0.62);
}

.lobby-scene {
  --scene-shift-x: 0px;
  --scene-shift-y: 0px;
  --scene-tilt: 0deg;
  position: absolute;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background: #0b100f;
}

.lobby-scene-stage {
  position: absolute;
  inset: -18%;
  display: grid;
  place-items: center;
  will-change: transform;
  animation: lobby-camera-drift 18s ease-in-out infinite alternate;
}

.lobby-scene-canvas {
  width: min(940px, 76vw);
  max-width: none;
  height: auto;
  opacity: 0.86;
  filter: saturate(0.82) contrast(1.12) brightness(0.5);
  transform: perspective(1150px) rotateX(53deg) rotateZ(-8deg) scale(1.34);
  transform-origin: center 54%;
  box-shadow: 0 36px 110px rgba(0, 0, 0, 0.58);
  transition: opacity 450ms ease, filter 450ms ease;
  will-change: opacity, transform;
}

.lobby-scene::after {
  content: "";
  position: absolute;
  inset: -35%;
  opacity: 0;
  pointer-events: none;
  background: linear-gradient(
    108deg,
    transparent 40%,
    rgba(239, 211, 154, 0.16) 49%,
    rgba(198, 75, 64, 0.08) 53%,
    transparent 62%
  );
  mix-blend-mode: screen;
  animation: lobby-light-sweep 12s ease-in-out infinite;
}

.lobby-scene.is-resetting .lobby-scene-canvas {
  opacity: 0;
  filter: saturate(0.7) contrast(1.08) brightness(0.36);
}

.lobby-content {
  position: relative;
  z-index: 2;
  width: min(950px, 100%);
  text-align: center;
  animation: lobby-enter 560ms cubic-bezier(0.2, 0.75, 0.2, 1) both;
}

.eyebrow,
.dialog-kicker {
  color: var(--accent);
  font-family: "KaiTi", "STKaiti", serif;
  font-size: clamp(15px, 1.4vw, 18px);
  letter-spacing: 0.42em;
}

.lobby-content h1 {
  margin-top: 20px;
  color: var(--text);
  font-family: "FangSong", "STFangsong", "KaiTi", serif;
  font-size: clamp(42px, 5vw, 62px);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-shadow: 0 5px 18px rgba(0, 0, 0, 0.35);
}

.lobby-subtitle {
  margin-top: 16px;
  color: var(--text-dim);
  font-size: clamp(15px, 1.6vw, 20px);
  letter-spacing: 0.08em;
}

.lobby-divider {
  width: 100%;
  height: 1px;
  margin: 27px 0 22px;
  background: linear-gradient(90deg, transparent, rgba(202, 165, 106, 0.6) 12%, rgba(202, 165, 106, 0.6) 88%, transparent);
}

.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  width: min(750px, 100%);
  margin: 0 auto;
}

.mode-card {
  position: relative;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 100px;
  padding: 15px 16px;
  border: 1px solid var(--accent-dark);
  border-radius: 10px;
  background: rgba(27, 36, 35, 0.88);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.02);
  text-align: left;
  overflow: hidden;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
  animation: card-enter 420ms ease both;
}

.mode-card:nth-child(2) { animation-delay: 45ms; }
.mode-card:nth-child(3) { animation-delay: 90ms; }
.mode-card:nth-child(4) { animation-delay: 135ms; }
.mode-card:nth-child(5) { animation-delay: 180ms; }
.mode-card:nth-child(6) { animation-delay: 225ms; }

.mode-card:hover {
  z-index: 1;
  transform: translateY(-3px);
  border-color: var(--accent);
  background: var(--panel-light);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.24), inset 0 0 28px rgba(202, 165, 106, 0.055);
}

.mode-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: var(--panel-light);
}

.mode-glyph {
  display: grid;
  place-items: center;
  width: 46px;
  aspect-ratio: 1;
  border: 1px solid rgba(202, 165, 106, 0.66);
  border-radius: 50%;
  color: var(--accent);
  background: rgba(202, 165, 106, 0.08);
  font-family: "KaiTi", "STKaiti", serif;
  font-size: 22px;
  transition: color 180ms ease, background 180ms ease, transform 180ms ease;
}

.mode-card:hover .mode-glyph,
.mode-card:focus-visible .mode-glyph {
  color: #141918;
  background: var(--accent);
  transform: rotate(-4deg);
}

.mode-copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 6px;
}

.mode-head {
  position: relative;
  padding-right: 58px;
  min-width: 0;
}

.mode-name {
  display: block;
  min-width: 0;
  color: var(--text);
  font-family: "FangSong", "STFangsong", serif;
  font-size: 18px;
  line-height: 1.3;
  letter-spacing: 0.04em;
}

.mode-desc {
  color: #d3d0c6;
  font-size: 15px;
  line-height: 1.45;
}

.mode-tag {
  position: absolute;
  top: 0;
  right: 0;
  padding: 3px 7px;
  border: 1px solid rgba(128, 102, 63, 0.62);
  border-radius: 999px;
  color: var(--text-dim);
  background: rgba(12, 17, 16, 0.42);
  font-size: 13px;
  line-height: 1.25;
  white-space: nowrap;
}

:lang(en) .mode-head {
  padding-right: 72px;
}

:lang(en) .mode-name {
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  letter-spacing: 0;
}

:lang(en) .mode-desc {
  font-size: 13px;
}

:lang(en) .mode-tag {
  font-size: 11px;
  padding: 2px 6px;
}

.mode-card-more {
  border-color: rgba(202, 165, 106, 0.52);
  background:
    linear-gradient(135deg, rgba(202, 165, 106, 0.07) 0%, transparent 42%),
    rgba(30, 38, 36, 0.9);
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.03), 0 0 0 1px rgba(202, 165, 106, 0.08);
}

.mode-card-more .mode-tag {
  color: var(--accent);
  border-color: rgba(202, 165, 106, 0.55);
  background: rgba(202, 165, 106, 0.1);
}

.mode-card-more:hover,
.mode-card-more:focus-visible {
  box-shadow:
    0 14px 34px rgba(0, 0, 0, 0.24),
    inset 0 0 32px rgba(202, 165, 106, 0.08),
    0 0 18px rgba(202, 165, 106, 0.12);
}

.lobby-options {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 15px;
}

.difficulty-control {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-dim);
  font-size: 14px;
}

.difficulty-control select {
  min-height: var(--control-h);
  padding: 0 32px 0 12px;
  border: 0;
  border-bottom: 1px solid var(--accent-dark);
  border-radius: 3px;
  background: var(--panel);
}

.shortcut-tip {
  margin-top: 16px;
  color: var(--text-dim);
  font-size: 14px;
}

.shortcut-tip kbd {
  display: inline-grid;
  place-items: center;
  min-width: 27px;
  min-height: 26px;
  margin: 0 3px 0 8px;
  padding: 0 6px;
  border: 1px solid #59645f;
  border-bottom-color: var(--accent-dark);
  border-radius: 5px;
  color: var(--text);
  background: #18201f;
  box-shadow: inset 0 -2px rgba(0, 0, 0, 0.3);
  font-family: "Consolas", "Cascadia Mono", monospace;
  font-size: 14px;
}

.touch-help {
  display: none;
}

/* 对局页 */
.game-view {
  display: grid;
  grid-template-rows: var(--header-h) minmax(0, 1fr);
  width: 100%;
  height: 100%;
  animation: game-enter 320ms ease both;
}

.game-header {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  padding: max(12px, var(--safe-top)) max(19px, var(--safe-right)) 12px max(19px, var(--safe-left));
  border-bottom: 1px solid rgba(128, 102, 63, 0.42);
  background: rgba(16, 21, 21, 0.72);
  backdrop-filter: blur(7px);
}

.game-header h2 {
  flex: 1;
  min-width: 0;
  color: var(--text);
  font-family: "FangSong", "STFangsong", serif;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.06em;
}

.game-header-main {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 0;
}

.game-header-main h2 {
  flex: 0 1 auto;
  margin: 0;
}

.rules-guide-btn {
  flex-shrink: 0;
  height: 32px;
  padding: 0 12px 0 10px;
  border: 1px solid rgba(202, 165, 106, 0.34);
  border-radius: 999px;
  color: var(--accent);
  background:
    linear-gradient(145deg, rgba(202, 165, 106, 0.12), rgba(202, 165, 106, 0.04));
  font-family: "FangSong", "STFangsong", serif;
  font-size: 13px;
  letter-spacing: 0.12em;
  white-space: nowrap;
  transition:
    border-color 160ms ease,
    color 160ms ease,
    background 160ms ease,
    transform 160ms ease;
}

.rules-guide-btn::before {
  content: var(--rules-prefix, "则");
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-right: 6px;
  border-radius: 50%;
  color: var(--text-bright);
  background: rgba(202, 165, 106, 0.22);
  font-size: 11px;
  line-height: 1;
}

.rules-guide-btn:hover {
  border-color: var(--accent);
  color: var(--text-bright);
  background: var(--accent-soft);
  transform: translateY(-1px);
}

.rules-guide-btn:active {
  transform: translateY(0);
}

.thinking-text {
  max-width: min(36vw, 460px);
  overflow: hidden;
  color: var(--accent);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thinking-text:not(:empty)::after {
  content: "";
  display: inline-block;
  width: 5px;
  height: 5px;
  margin-left: 7px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse-dot 900ms ease-in-out infinite;
}

.header-back { min-width: 100px; }
.compact-btn { min-width: 66px; }

.sound-control {
  position: relative;
  z-index: 5;
}

.locale-control {
  flex-shrink: 0;
}
.locale-select {
  min-height: 30px;
  padding: 0 24px 0 8px;
  border: 1px solid rgba(202, 165, 106, 0.34);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  font-size: 13px;
  cursor: pointer;
}
.locale-select:hover {
  border-color: var(--accent);
  color: var(--text);
}

.sound-btn {
  min-width: 112px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.sound-btn[aria-pressed="true"] {
  color: var(--text-bright);
  border-color: rgba(202, 165, 106, 0.62);
  background: rgba(202, 165, 106, 0.1);
}

.sound-btn[aria-pressed="false"] {
  color: var(--text-dim);
  border-color: rgba(212, 94, 84, 0.45);
}

.sound-btn[aria-expanded="true"] {
  border-color: var(--accent);
  color: var(--text-bright);
  background: var(--panel-light);
  box-shadow: 0 0 0 1px rgba(202, 165, 106, 0.28);
}

.sound-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: min(272px, calc(100vw - 28px));
  padding: 14px 16px 12px;
  border: 1.5px solid rgba(202, 165, 106, 0.68);
  border-radius: 12px;
  background:
    linear-gradient(180deg, rgba(48, 58, 54, 0.99), rgba(22, 30, 29, 0.99));
  box-shadow:
    0 14px 32px rgba(0, 0, 0, 0.48),
    0 0 0 1px rgba(238, 229, 211, 0.05),
    inset 0 1px 0 rgba(238, 229, 211, 0.1);
  animation: sound-pop 140ms ease-out;
}

.sound-popover[hidden] {
  display: none;
}

@keyframes sound-pop {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.sound-popover-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.sound-popover-heading {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sound-popover-title {
  color: var(--text-bright);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.sound-mute-btn {
  flex-shrink: 0;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(128, 102, 63, 0.85);
  border-radius: 8px;
  color: var(--text-bright);
  background: rgba(16, 21, 21, 0.72);
  font-size: 13px;
  font-weight: 600;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}

.sound-mute-btn:hover {
  border-color: var(--accent);
  color: var(--text-bright);
}

.sound-mute-btn[aria-pressed="true"] {
  border-color: rgba(212, 94, 84, 0.7);
  color: #f0c2c0;
}

.sound-slider-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 4px 2px 0;
}

.sound-glyph {
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  user-select: none;
}

.sound-slider {
  --volume-pct: 70%;
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 36px;
  margin: 0;
  background: transparent;
  cursor: pointer;
}

.sound-slider:focus-visible {
  outline: 2px solid rgba(202, 165, 106, 0.55);
  outline-offset: 2px;
  border-radius: 8px;
}

.sound-slider::-webkit-slider-runnable-track {
  height: 10px;
  border: 1px solid rgba(202, 165, 106, 0.55);
  border-radius: 999px;
  background:
    linear-gradient(
      90deg,
      var(--wood-light) 0%,
      var(--accent) var(--volume-pct),
      rgba(255, 250, 240, 0.16) var(--volume-pct),
      rgba(255, 250, 240, 0.16) 100%
    );
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.38);
}

.sound-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: -7px;
  border: 2px solid #fff6df;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fffaf0, #efd39a 58%, #aa7945);
  box-shadow:
    0 0 0 2px rgba(202, 165, 106, 0.35),
    0 2px 8px rgba(0, 0, 0, 0.45);
}

.sound-slider::-moz-range-track {
  height: 10px;
  border: 1px solid rgba(202, 165, 106, 0.55);
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.16);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.38);
}

.sound-slider::-moz-range-progress {
  height: 10px;
  border-radius: 999px 0 0 999px;
  background: linear-gradient(90deg, var(--wood-light), var(--accent));
}

.sound-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 2px solid #fff6df;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fffaf0, #efd39a 58%, #aa7945);
  box-shadow:
    0 0 0 2px rgba(202, 165, 106, 0.35),
    0 2px 8px rgba(0, 0, 0, 0.45);
}

.sound-volume-readout {
  color: var(--wood-light);
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: 0.01em;
}

.sound-volume-readout::after {
  content: '%';
  margin-left: 1px;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
}

.sound-popover.is-muted .sound-volume-readout {
  color: var(--text-dim);
}

.sound-popover.is-muted .sound-volume-readout::after {
  color: var(--text-faint);
}

.game-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--sidebar-w);
  gap: 16px;
  min-height: 0;
  flex: 1;
  padding: 0 max(19px, var(--safe-right)) max(14px, var(--safe-bottom)) max(19px, var(--safe-left));
}

.board-area {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  overflow: visible;
  padding: 4px;
  border: 1px solid rgba(128, 102, 63, 0.72);
  border-radius: 14px;
  background: rgba(18, 25, 24, 0.8);
  box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.12);
}

.board-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  perspective: 1100px;
  perspective-origin: 50% 42%;
}

#boardCanvas {
  display: block;
  border: 1px solid #3f2819;
  border-radius: 9px;
  background: #5b351f;
  box-shadow:
    0 22px 38px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(30, 17, 10, 0.72);
  cursor: pointer;
  touch-action: manipulation;
  transform: rotateX(2.6deg);
  transform-origin: 50% 54%;
  transform-style: preserve-3d;
}

#boardCanvas:focus-visible {
  outline: 3px solid var(--text-bright);
  outline-offset: 5px;
  box-shadow: 0 0 0 8px rgba(202, 165, 106, 0.35), 0 12px 30px rgba(0, 0, 0, 0.34);
}

.sr-status {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* 弹窗与浮层 */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding:
    max(24px, var(--safe-top))
    max(24px, var(--safe-right))
    max(24px, var(--safe-bottom))
    max(24px, var(--safe-left));
  background: rgba(5, 8, 8, 0.76);
  backdrop-filter: blur(8px);
}

.modal-content {
  width: min(460px, 100%);
  max-height: calc(100dvh - 48px);
  overflow: auto;
  padding: 32px;
  border: 1px solid var(--accent-dark);
  border-radius: 14px;
  color: var(--text);
  background: linear-gradient(145deg, #202a28, #151d1c);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.48);
  text-align: center;
  animation: modal-enter 220ms ease both;
}

.modal-content h2 {
  margin: 12px 0 10px;
  color: var(--text);
  font-family: "FangSong", "STFangsong", serif;
  font-size: 30px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.dialog-desc,
.modal-content > p {
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.8;
  white-space: pre-line;
}

.dialog-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 22px;
}

.dialog-close {
  margin-top: 22px;
}

.endgame-dialog {
  width: min(760px, 100%);
}

.mode-setup-dialog {
  width: min(720px, 100%);
}

.difficulty-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
  text-align: left;
}

.difficulty-card {
  min-height: 68px;
  padding: 10px 14px;
  border: 1px solid rgba(202, 165, 106, 0.4);
  border-radius: 8px;
  color: var(--text);
  background: rgba(18, 27, 25, 0.86);
  cursor: pointer;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}

.difficulty-card:hover,
.difficulty-card:focus-visible {
  border-color: var(--accent);
  background: rgba(37, 48, 44, 0.96);
  transform: translateY(-1px);
}

.difficulty-card.is-active {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(202, 165, 106, 0.18), rgba(39, 61, 53, 0.86));
  box-shadow: inset 0 0 0 1px rgba(202, 165, 106, 0.18);
}

.difficulty-card span,
.difficulty-card small {
  display: block;
}

.difficulty-card span {
  color: var(--accent-light);
  font-size: 18px;
}

.difficulty-card small {
  margin-top: 3px;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.45;
}

.setup-side {
  width: min(320px, 100%);
  margin: 18px auto 0;
  padding: 10px;
  border: 1px solid rgba(128, 102, 63, 0.5);
  border-radius: 9px;
  background: rgba(27, 36, 35, 0.72);
  text-align: left;
}

.setup-side .panel-label {
  margin-bottom: 8px;
}

.setup-side + .setup-side {
  margin-top: 10px;
}

.color-choice-group .segmented-btn {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  text-align: left;
}

.color-choice-piece {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  padding: 7px;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-family: var(--font-serif);
  font-size: 20px;
  line-height: 1;
}

.color-choice-piece.red {
  color: #9f3029;
  background: #efd9c4;
}

.color-choice-piece.black {
  color: #e4ddd0;
  background: #202927;
}

.color-choice-piece.white {
  color: #2a2a2a;
  background: #f3ede1;
}

.color-choice-copy strong,
.color-choice-copy small {
  display: block;
}

.color-choice-copy strong {
  font-size: 16px;
}

.color-choice-copy small {
  margin-top: 2px;
  font-size: 14px;
  font-weight: 400;
  opacity: 0.78;
}

@media (max-width: 560px) {
  .mode-setup-dialog {
    padding: 24px 18px;
  }

  .difficulty-card-grid {
    grid-template-columns: 1fr;
  }
}

.rules-dialog {
  width: min(520px, 100%);
  text-align: left;
}

.rules-body {
  margin-top: 6px;
}

.rules-lead {
  margin: 0 0 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(128, 102, 63, 0.28);
  color: var(--accent);
  font-family: "FangSong", "STFangsong", serif;
  font-size: 13px;
  letter-spacing: 0.28em;
  text-align: center;
}

.rules-sections {
  display: grid;
  gap: 18px;
}

.rules-section {
  padding: 14px 16px;
  border: 1px solid rgba(128, 102, 63, 0.24);
  border-radius: 10px;
  background: rgba(8, 12, 11, 0.34);
}

.rules-section-title {
  margin: 0 0 10px;
  color: var(--text-bright);
  font-family: "FangSong", "STFangsong", serif;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.08em;
}

.rules-list {
  margin: 0;
  padding-left: 1.1em;
  list-style: disc;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.85;
}

.rules-list li + li {
  margin-top: 6px;
}

.rules-shortcuts {
  display: grid;
  gap: 8px;
}

.rules-shortcut-row {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.6;
}

.rules-shortcut-row kbd {
  min-width: 72px;
  padding: 4px 8px;
  border: 1px solid rgba(202, 165, 106, 0.28);
  border-radius: 6px;
  background: rgba(202, 165, 106, 0.08);
  color: var(--accent);
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-align: center;
}

.endgame-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 20px;
  text-align: left;
}

.endgame-card {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--accent-dark);
  border-radius: 9px;
  background: var(--panel);
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.endgame-card:hover,
.endgame-card.active {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: var(--panel-light);
}

.endgame-name {
  color: var(--accent);
  font-family: "FangSong", "STFangsong", serif;
  font-size: 18px;
}

.endgame-desc {
  margin-top: 5px;
  color: var(--text-dim);
  font-size: 14px;
  line-height: 1.55;
}

.endgame-meta {
  display: flex;
  gap: 8px;
  margin-top: 9px;
  color: var(--text-faint);
  font-size: 14px;
}

.endgame-diff {
  color: var(--success);
}

.diff-hard { color: var(--red-light); }
.diff-medium { color: var(--accent); }

.feedback-dialog {
  width: min(680px, 100%);
}

.feedback-dialog textarea,
.feedback-dialog input {
  width: 100%;
  margin-top: 14px;
  border: 1px solid #53605c;
  border-radius: 8px;
  color: var(--text);
  background: #111817;
  user-select: text;
}

.feedback-dialog textarea {
  min-height: 180px;
  padding: 14px;
  resize: vertical;
}

.feedback-dialog input {
  height: 44px;
  padding: 0 14px;
}

.feedback-dialog textarea::placeholder,
.feedback-dialog input::placeholder {
  color: #66716d;
}

.form-status {
  min-height: 24px;
  padding-top: 8px;
  color: var(--red-light);
  font-size: 14px;
}

.coming-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin: 20px 0;
}

.coming-grid div {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 18px 8px;
  border: 1px solid var(--accent-dark);
  border-radius: 8px;
  background: var(--panel);
}

.coming-grid strong {
  color: var(--accent);
  font-family: "FangSong", "STFangsong", serif;
  font-size: 17px;
}

.coming-grid span {
  color: var(--text-dim);
  font-size: 14px;
}

/* —— 更多游戏枢纽 / 对局 —— */
.extra-hub {
  position: relative;
  z-index: 2;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(28px + var(--safe-top))
    calc(24px + var(--safe-right))
    calc(28px + var(--safe-bottom))
    calc(24px + var(--safe-left));
}

.extra-hub-content {
  width: min(920px, 100%);
  text-align: center;
}

.extra-hub-content h1 {
  margin: 8px 0 10px;
  font-family: "FangSong", "STFangsong", "Songti SC", serif;
  font-size: clamp(40px, 7vw, 52px);
  font-weight: 400;
  color: var(--text);
  letter-spacing: 0.12em;
}

.extra-game-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px 16px;
  margin: 8px 0 22px;
  justify-items: stretch;
}

.extra-game-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-height: 138px;
  padding: 22px 20px 18px;
  text-align: left;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--accent-dark);
  border-radius: 14px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.extra-game-card:hover,
.extra-game-card:focus-visible {
  outline: none;
  border-color: var(--accent);
  border-width: 2px;
  background: var(--panel-light);
  transform: translateY(-2px);
}

.extra-game-card:focus-visible {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.extra-game-card strong {
  font-family: "FangSong", "STFangsong", serif;
  font-size: 20px;
  font-weight: 400;
  color: var(--text-bright);
}

.extra-game-card span {
  color: var(--text-dim);
  font-size: 15px;
  line-height: 1.45;
  flex: 1;
}

:lang(en) .extra-game-card strong {
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.25;
}

:lang(en) .extra-game-card span {
  font-size: 13px;
}

:lang(en) .extra-game-card em {
  font-size: 12px;
}

.extra-game-view .extra-board-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 320px;
}

.promo-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.toast {
  position: fixed;
  z-index: 160;
  left: 50%;
  bottom: max(28px, calc(var(--safe-bottom) + 12px));
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 18px;
  border: 1px solid var(--accent-dark);
  border-radius: 999px;
  color: var(--text);
  background: rgba(25, 34, 32, 0.96);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.34);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

::-webkit-scrollbar {
  width: 7px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #53605c;
}

@keyframes lobby-enter {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes card-enter {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes game-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modal-enter {
  from { opacity: 0; transform: scale(0.97) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.25; transform: scale(0.7); }
  50% { opacity: 1; transform: scale(1); }
}

@media (max-width: 900px) {
  :root {
    --sidebar-w: 238px;
  }

  .game-content {
    gap: 10px;
    padding-inline: 10px;
  }

  .game-header {
    padding-inline: 10px;
  }

  .game-header h2 {
    font-size: 19px;
  }

  .rules-guide-btn {
    height: 30px;
    padding-inline: 10px;
    font-size: 12px;
    letter-spacing: 0.08em;
  }

  .thinking-text {
    display: none;
  }
}

@media (max-width: 720px) {
  html,
  body {
    overflow-x: hidden;
    overflow-y: auto;
  }

  #app {
    overflow-x: hidden;
    overflow-y: auto;
  }

  .lobby-view {
    min-height: 100dvh;
    height: auto;
    padding:
      max(36px, var(--safe-top))
      max(18px, var(--safe-right))
      max(36px, var(--safe-bottom))
      max(18px, var(--safe-left));
  }

  .lobby-view::after {
    background: rgba(7, 12, 11, 0.62);
    box-shadow: inset 0 0 120px rgba(0, 0, 0, 0.56);
  }

  .lobby-scene-stage {
    inset: -12% -55%;
  }

  .lobby-scene-canvas {
    width: 118vw;
    transform: perspective(1000px) rotateX(28deg) rotateZ(-5deg) scale(1.85);
  }

  .lobby-scene::after {
    opacity: 0;
    animation: none;
  }

  .lobby-content h1 {
    margin-top: 12px;
  }

  .lobby-divider {
    margin: 20px 0 16px;
  }

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

  .mode-card {
    min-height: 94px;
    padding-inline: 13px;
  }

  .mode-name { font-size: 17px; }
  .mode-desc { font-size: 14px; }

  .lobby-options {
    flex-wrap: wrap;
  }

  .shortcut-tip {
    line-height: 1.7;
  }

  .keyboard-help {
    display: none;
  }

  .touch-help {
    display: inline;
  }

  .game-view {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    height: 100dvh;
    max-height: 100dvh;
    overflow: hidden;
  }

  .game-header {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 64px;
    height: auto;
    gap: 8px;
  }

  .game-header h2 {
    font-size: 17px;
  }

  .header-back,
  .sound-btn {
    min-width: 0;
    padding: 0 12px;
  }

  .compact-btn {
    display: none;
  }

  .game-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 10px;
    padding: 6px max(6px, var(--safe-right)) max(10px, var(--safe-bottom)) max(6px, var(--safe-left));
    overflow: hidden;
  }

  .board-area {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    padding: 2px;
  }

  .sidebar {
    flex: 0 1 auto;
    width: 100%;
    min-height: 0;
    max-height: min(42vh, 360px);
    overflow-y: auto;
  }

  .notation-box {
    min-height: 180px;
  }

  .modal {
    padding: 14px;
  }

  .modal-content {
    padding: 24px 18px;
  }

  .endgame-list,
  .coming-grid,
  .extra-game-grid {
    grid-template-columns: 1fr;
  }

  .extra-game-card {
    min-height: 110px;
  }

  .promo-actions {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 900px) and (min-width: 641px) {
  .extra-game-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 410px) {
  .mode-grid {
    grid-template-columns: 1fr;
  }

  .mode-card {
    min-height: 82px;
  }
}

@media (hover: none) and (pointer: coarse) {
  .outline-btn:hover,
  .mode-card:hover,
  .endgame-card:hover {
    transform: none;
  }
}

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

  .lobby-scene-stage {
    animation: none !important;
    transform: none;
  }

  .lobby-scene::after {
    display: none;
  }

  .decor-lattice,
  .decor-haze,
  .decor-char {
    animation: none !important;
  }

  .decor-sweep {
    display: none;
  }

  .decor-motes span {
    animation: none !important;
    opacity: 0;
  }
}

/* —— UI 增强（与 Tailwind 4 浏览器版协同；离线时装饰层自动隐藏，基础样式不受影响） —— */
.lobby-decor {
  display: none;
}

/* —— 对局子页面动态微背景（纯 CSS；不拦截指针、棋盘画布之上零遮挡） —— */
.game-view {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 12% 18%, rgba(40, 74, 65, 0.18), transparent 34%),
    radial-gradient(ellipse at 88% 82%, rgba(99, 65, 34, 0.12), transparent 38%),
    linear-gradient(145deg, #101716 0%, #0f1514 48%, #111716 100%);
}

.game-view > .game-header,
.game-view > .game-content,
.extra-hub-content {
  position: relative;
  z-index: 1;
}

.extra-hub {
  isolation: isolate;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 12% 20%, rgba(40, 84, 70, 0.2), transparent 36%),
    radial-gradient(ellipse at 90% 78%, rgba(101, 67, 35, 0.1), transparent 38%),
    linear-gradient(145deg, #0f1715 0%, #0d1413 52%, #101614 100%);
}

.game-decor {
  --decor-primary: 202, 165, 106;
  --decor-secondary: 131, 185, 154;
  --decor-grid-size: 58px;
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  contain: paint;
}

.extra-game-view .game-decor,
.game-decor-hub {
  --decor-primary: 131, 185, 154;
  --decor-secondary: 202, 165, 106;
  --decor-grid-size: 46px;
}

.game-decor::before,
.game-decor::after {
  content: '';
  position: absolute;
  inset: 0;
}

.game-decor::before {
  background:
    linear-gradient(90deg, rgba(var(--decor-primary), 0.15), transparent 20%, transparent 80%, rgba(var(--decor-secondary), 0.11)),
    linear-gradient(180deg, rgba(var(--decor-primary), 0.07), transparent 22%, transparent 76%, rgba(0, 0, 0, 0.14));
}

.game-decor::after {
  box-shadow:
    inset 0 0 150px rgba(0, 0, 0, 0.32),
    inset 0 0 0 1px rgba(var(--decor-primary), 0.035);
}

/* 幻影棋枰：极淡格线缓慢平移，中心蒙版留白避免干扰棋盘区 */
.decor-lattice {
  position: absolute;
  inset: calc(var(--decor-grid-size) * -2);
  background:
    radial-gradient(circle, rgba(var(--decor-primary), 0.42) 0 1px, transparent 1.5px) 0 0 / var(--decor-grid-size) var(--decor-grid-size),
    repeating-linear-gradient(90deg, rgba(var(--decor-primary), 0.27) 0 1px, transparent 1px var(--decor-grid-size)),
    repeating-linear-gradient(0deg, rgba(var(--decor-primary), 0.27) 0 1px, transparent 1px var(--decor-grid-size));
  opacity: 0.48;
  -webkit-mask-image: radial-gradient(ellipse 70% 68% at 50% 48%, transparent 24%, rgba(0, 0, 0, 0.12) 43%, rgba(0, 0, 0, 0.82) 76%, #000 100%);
  mask-image: radial-gradient(ellipse 70% 68% at 50% 48%, transparent 24%, rgba(0, 0, 0, 0.12) 43%, rgba(0, 0, 0, 0.82) 76%, #000 100%);
  will-change: transform;
  animation: lattice-pan 92s linear infinite;
}

.extra-game-view .decor-lattice {
  animation-duration: 112s;
  animation-direction: reverse;
}

.game-decor-hub .decor-lattice {
  opacity: 0.4;
  animation-duration: 126s;
  animation-direction: reverse;
}

/* 墨晕：预模糊径向渐变，不使用 filter，避免重排开销 */
.decor-haze {
  position: absolute;
  width: min(70vmax, 980px);
  aspect-ratio: 1;
  border-radius: 50%;
  opacity: 0.86;
  will-change: transform, opacity;
}

.decor-haze-jade {
  left: -30%;
  top: -16%;
  background:
    radial-gradient(circle at 46% 48%, rgba(var(--decor-secondary), 0.24) 0 7%, rgba(var(--decor-secondary), 0.12) 19%, transparent 54%),
    radial-gradient(circle at 50% 50%, transparent 0 31%, rgba(var(--decor-secondary), 0.07) 42%, transparent 68%);
  animation: haze-drift 38s ease-in-out infinite alternate;
}

.decor-haze-gold {
  right: -28%;
  bottom: -28%;
  background:
    radial-gradient(circle at 48% 48%, rgba(var(--decor-primary), 0.22) 0 8%, rgba(var(--decor-primary), 0.11) 22%, transparent 56%),
    radial-gradient(circle at 50% 50%, transparent 0 34%, rgba(var(--decor-primary), 0.065) 46%, transparent 70%);
  animation: haze-drift 47s ease-in-out infinite alternate-reverse;
}

/* 灯下浮尘：负延迟使首屏即有分布 */
.decor-motes {
  position: absolute;
  z-index: 2;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  mix-blend-mode: screen;
}

.decor-motes span {
  position: absolute;
  bottom: -6%;
  width: 5px;
  height: 5px;
  border: 1px solid rgba(255, 250, 224, 0.72);
  border-radius: 50%;
  background: rgba(var(--decor-primary), 1);
  box-shadow:
    0 0 6px 2px rgba(var(--decor-primary), 0.92),
    0 0 16px 6px rgba(var(--decor-primary), 0.5),
    0 0 34px 12px rgba(var(--decor-primary), 0.2);
  opacity: 0;
  will-change: transform, opacity;
  animation: mote-rise 24s linear infinite;
}

.decor-motes span:nth-child(1) { left: 7%;  animation-duration: 25s; animation-delay: -4s; }
.decor-motes span:nth-child(2) { left: 19%; width: 3px; height: 3px; animation-duration: 20s; animation-delay: -12s; }
.decor-motes span:nth-child(3) { left: 33%; width: 4px; height: 4px; background: rgba(var(--decor-secondary), 1); box-shadow: 0 0 6px 2px rgba(var(--decor-secondary), 0.9), 0 0 16px 6px rgba(var(--decor-secondary), 0.48), 0 0 32px 11px rgba(var(--decor-secondary), 0.19); animation-duration: 28s; animation-delay: -19s; }
.decor-motes span:nth-child(4) { left: 48%; width: 7px; height: 7px; animation-duration: 31s; animation-delay: -8s; }
.decor-motes span:nth-child(5) { left: 64%; width: 3px; height: 3px; background: rgba(var(--decor-secondary), 1); box-shadow: 0 0 6px 2px rgba(var(--decor-secondary), 0.88), 0 0 15px 5px rgba(var(--decor-secondary), 0.46), 0 0 30px 10px rgba(var(--decor-secondary), 0.18); animation-duration: 22s; animation-delay: -16s; }
.decor-motes span:nth-child(6) { left: 79%; animation-duration: 27s; animation-delay: -2s; }
.decor-motes span:nth-child(7) { left: 92%; width: 4px; height: 4px; animation-duration: 23s; animation-delay: -20s; }

/* 定期斜扫的极淡光带 */
.decor-sweep {
  position: absolute;
  inset: -28%;
  background: linear-gradient(
    112deg,
    transparent 43%,
    rgba(var(--decor-primary), 0.015) 46%,
    rgba(255, 250, 240, 0.065) 49%,
    rgba(var(--decor-secondary), 0.035) 51%,
    transparent 55%
  );
  opacity: 0;
  mix-blend-mode: screen;
  will-change: transform, opacity;
  animation: decor-sweep 21s ease-in-out infinite;
}

.game-decor-hub .decor-sweep {
  animation-delay: -11s;
}

/* 字魂水印：呼吸式明暗， alpha 极低不抢视线 */
.decor-char {
  position: absolute;
  left: -3%;
  bottom: -6%;
  font-family: "FangSong", "STFangsong", "Songti SC", serif;
  font-size: clamp(230px, 42vmin, 430px);
  font-weight: 700;
  line-height: 1;
  color: transparent;
  background: linear-gradient(145deg, rgba(var(--decor-primary), 0.19), rgba(var(--decor-primary), 0.035) 68%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-stroke: 1px rgba(var(--decor-primary), 0.15);
  filter: drop-shadow(0 0 24px rgba(var(--decor-primary), 0.08));
  opacity: 0.86;
  will-change: transform, opacity;
  animation: char-breathe 15s ease-in-out infinite;
}

.extra-game-view .decor-char,
.game-decor-hub .decor-char {
  right: -3%;
  left: auto;
  background: linear-gradient(215deg, rgba(var(--decor-primary), 0.19), rgba(var(--decor-primary), 0.035) 68%);
  -webkit-background-clip: text;
  background-clip: text;
}

.game-decor-hub .decor-char {
  bottom: -9%;
  opacity: 0.72;
}

/* 首页：微动层位于暗幕之上、主内容之下，浮尘清晰而棋枰主动退让 */
.game-decor-lobby {
  --decor-grid-size: 72px;
  z-index: 2;
}

.lobby-content {
  z-index: 3;
}

.game-decor-lobby::after {
  box-shadow:
    inset 0 0 150px rgba(0, 0, 0, 0.14),
    inset 0 0 0 1px rgba(var(--decor-primary), 0.028);
}

.game-decor-lobby .decor-lattice {
  opacity: 0.2;
  animation-duration: 118s;
}

.game-decor-lobby .decor-haze {
  opacity: 0.58;
}

.game-decor-lobby .decor-sweep {
  animation-duration: 26s;
  animation-delay: -14s;
}

.game-decor-lobby .decor-char {
  bottom: -12%;
  opacity: 0.58;
}

@keyframes lattice-pan {
  from { transform: translate3d(0, 0, 0); }
  to { transform: translate3d(var(--decor-grid-size), var(--decor-grid-size), 0); }
}

@keyframes haze-drift {
  from { transform: translate3d(-2%, -1%, 0) scale(0.96); opacity: 0.66; }
  to { transform: translate3d(4%, 3%, 0) scale(1.1); opacity: 0.96; }
}

@keyframes mote-rise {
  0%   { transform: translate3d(0, 0, 0); opacity: 0; }
  8%   { opacity: 0.68; }
  20%  { opacity: 1; }
  42%  { transform: translate3d(1.5vw, -42vh, 0); }
  72%  { opacity: 0.9; }
  88%  { opacity: 0.54; }
  100% { transform: translate3d(-1vw, -108vh, 0); opacity: 0; }
}

@keyframes decor-sweep {
  0%, 68% { opacity: 0; transform: translate3d(-30%, 0, 0); }
  75%     { opacity: 0.82; }
  86%, 100% { opacity: 0; transform: translate3d(30%, 0, 0); }
}

@keyframes char-breathe {
  0%, 100% { opacity: 0.64; transform: scale(0.99); }
  50%      { opacity: 0.94; transform: scale(1.018); }
}

@media (max-width: 720px) {
  .game-decor {
    --decor-grid-size: 44px;
  }

  .extra-game-view .game-decor,
  .game-decor-hub {
    --decor-grid-size: 38px;
  }

  .decor-lattice {
    opacity: 0.34;
    -webkit-mask-image: radial-gradient(ellipse 82% 64% at 50% 42%, transparent 32%, rgba(0, 0, 0, 0.75) 76%, #000 100%);
    mask-image: radial-gradient(ellipse 82% 64% at 50% 42%, transparent 32%, rgba(0, 0, 0, 0.75) 76%, #000 100%);
  }

  .decor-char {
    bottom: -3%;
    font-size: clamp(150px, 46vw, 230px);
    opacity: 0.48;
  }

  .decor-haze {
    width: 88vmax;
  }
}

.ambient-jade {
  animation: ambient-drift 36s ease-in-out infinite alternate;
}

.ambient-cinnabar {
  animation: ambient-drift 44s ease-in-out infinite alternate-reverse;
}

.mode-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    105deg,
    transparent 34%,
    rgba(255, 250, 240, 0.055) 46%,
    rgba(202, 165, 106, 0.13) 50%,
    rgba(255, 250, 240, 0.055) 54%,
    transparent 66%
  );
  transform: translateX(-130%);
  transition: transform 640ms cubic-bezier(0.22, 0.61, 0.36, 1);
}

.mode-card:hover::after,
.mode-card:focus-visible::after {
  transform: translateX(130%);
}

.game-header-main h2 {
  position: relative;
  padding-bottom: 8px;
}

.game-header-main h2::after {
  content: "";
  position: absolute;
  left: 1px;
  bottom: 0;
  width: 46px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), rgba(202, 165, 106, 0));
}

.primary-btn:hover {
  box-shadow: 0 8px 24px rgba(202, 165, 106, 0.3);
}

@keyframes ambient-drift {
  from { transform: translate3d(-3%, -2%, 0) scale(1); }
  to { transform: translate3d(4%, 3%, 0) scale(1.14); }
}

@keyframes lobby-camera-drift {
  from {
    transform: translate3d(
      calc(var(--scene-shift-x) - 9px),
      calc(var(--scene-shift-y) - 5px),
      0
    ) rotate(calc(var(--scene-tilt) - 0.7deg));
  }
  to {
    transform: translate3d(
      calc(var(--scene-shift-x) + 9px),
      calc(var(--scene-shift-y) + 5px),
      0
    ) rotate(calc(var(--scene-tilt) + 0.7deg));
  }
}

@keyframes lobby-light-sweep {
  0%, 58% { opacity: 0; transform: translate3d(-28%, 0, 0); }
  68% { opacity: 0.72; }
  82%, 100% { opacity: 0; transform: translate3d(28%, 0, 0); }
}
