/* =========================================================
   狼 · 羊 · 菜 过河大冒险
   ========================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --ink: #1f3b57;
  --muted: #6a879b;
  --green: #22a06b;
  --green-deep: #168256;
  --orange: #ff9d2e;
  --orange-deep: #d97a12;
  --blue: #2f8fd6;
  --blue-deep: #2374b0;
  --line: #e6f2f9;
  --card: #ffffff;
  --radius-lg: 28px;
  --radius-md: 22px;
  --shadow-card: 0 24px 50px -30px rgba(23, 78, 112, 0.55);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Segoe UI", system-ui, -apple-system, sans-serif;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 520px at 8% -8%, #d6f2ff 0%, rgba(214, 242, 255, 0) 62%),
    radial-gradient(760px 440px at 96% -4%, #fff2d2 0%, rgba(255, 242, 210, 0) 58%),
    radial-gradient(700px 500px at 50% 110%, #e7fbf1 0%, rgba(231, 251, 241, 0) 60%),
    linear-gradient(180deg, #f2fbff 0%, #eef9ff 45%, #f8fdff 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
}

h1,
h2,
p {
  margin: 0;
}

ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

img {
  max-width: 100%;
}

.page {
  max-width: 1320px;
  margin: 0 auto;
}

/* =========================================================
   顶部栏
   ========================================================= */
.topbar {
  padding: 26px 26px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  flex: none;
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  font-size: 30px;
  border-radius: 20px;
  background: linear-gradient(145deg, #ffe8a8, #ffbd63);
  box-shadow:
    0 10px 22px -10px rgba(240, 150, 40, 0.85),
    inset 0 -3px 0 rgba(160, 90, 0, 0.14),
    inset 0 2px 0 rgba(255, 255, 255, 0.65);
  transform: rotate(-4deg);
  animation: markFloat 5s ease-in-out infinite;
}

@keyframes markFloat {
  0%, 100% { transform: rotate(-4deg) translateY(0); }
  50% { transform: rotate(2deg) translateY(-4px); }
}

.brand-text h1 {
  font-size: clamp(20px, 2.3vw, 28px);
  font-weight: 900;
  letter-spacing: 0.5px;
  line-height: 1.15;
  color: var(--ink);
}

.brand-text h1 span {
  color: var(--green);
  position: relative;
}

.brand-text h1 span::after {
  content: "";
  position: absolute;
  left: 2%;
  right: 2%;
  bottom: -4px;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffd166, #7bd6a4);
  opacity: 0.75;
}

.brand-text p {
  margin-top: 7px;
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.2px;
}

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* =========================================================
   按钮
   ========================================================= */
.btn {
  position: relative;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  padding: 12px 21px;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.3px;
  color: #fff;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.16s ease, box-shadow 0.16s ease, filter 0.2s ease, opacity 0.2s ease;
  will-change: transform;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
  filter: saturate(0.5);
}

.btn:focus-visible {
  outline: 3px solid rgba(47, 143, 214, 0.45);
  outline-offset: 3px;
}

.btn--start {
  background: linear-gradient(180deg, #3ac889 0%, #22a06b 100%);
  box-shadow: 0 5px 0 #157a50, 0 12px 20px -12px rgba(21, 122, 80, 0.9);
}

.btn--start:hover {
  filter: brightness(1.05);
}

.btn--start:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #157a50, 0 4px 8px -6px rgba(21, 122, 80, 0.9);
}

.btn--auto {
  background: linear-gradient(180deg, #ffb95e 0%, #ff9d2e 100%);
  box-shadow: 0 5px 0 #d97a12, 0 12px 20px -12px rgba(217, 122, 18, 0.9);
}

.btn--auto:hover {
  filter: brightness(1.04);
}

.btn--auto:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #d97a12, 0 4px 8px -6px rgba(217, 122, 18, 0.9);
}

.btn--step {
  background: linear-gradient(180deg, #64b6ec 0%, #2f8fd6 100%);
  box-shadow: 0 5px 0 #2374b0, 0 12px 20px -12px rgba(35, 116, 176, 0.9);
}

.btn--step:hover {
  filter: brightness(1.04);
}

.btn--step:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #2374b0, 0 4px 8px -6px rgba(35, 116, 176, 0.9);
}

.btn--reset {
  color: #3c6076;
  background: linear-gradient(180deg, #ffffff, #f2faff);
  border: 2px solid #dceef8;
  box-shadow: 0 4px 0 #d5e9f4, 0 10px 18px -14px rgba(30, 100, 130, 0.7);
}

.btn--reset:hover {
  filter: brightness(1.02);
  color: #1f6e96;
}

.btn--reset:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 #d5e9f4;
}

.btn--lg {
  padding: 14px 34px;
  font-size: 15.5px;
}

/* 点击水波纹 */
.btn .ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  transform: scale(0);
  pointer-events: none;
  animation: rippleOut 0.62s ease-out forwards;
}

.btn--reset .ripple {
  background: rgba(47, 143, 214, 0.18);
}

@keyframes rippleOut {
  to {
    transform: scale(2.4);
    opacity: 0;
  }
}

/* =========================================================
   主布局
   ========================================================= */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  align-items: start;
  padding: 0 26px 22px;
}

.stage-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-card), inset 0 1px 0 #fff;
}

/* =========================================================
   HUD
   ========================================================= */
.hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 4px 6px 14px;
}

.hud-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.3px;
  border: 1px solid transparent;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.75;
}

.chip--steps {
  background: #f2faff;
  color: #62849a;
  border-color: #e2f1fa;
}

.chip--steps::before {
  display: none;
}

.chip--steps b {
  font-size: 16px;
  color: var(--ink);
  line-height: 1;
}

.chip--steps i {
  font-style: normal;
  font-size: 11.5px;
  color: #8fa8b9;
}

.chip--idle {
  background: #f1f9fd;
  color: #5f8196;
  border-color: #e1f1fa;
}

.chip--manual {
  background: #e8f9f0;
  color: #17875a;
  border-color: #c8efdb;
}

.chip--auto {
  background: #fff3e2;
  color: #bf7614;
  border-color: #ffe3bd;
}

.chip--guided {
  background: #eef0ff;
  color: #5b63c8;
  border-color: #dfe2ff;
}

.chip--failed {
  background: #ffecec;
  color: #cf4646;
  border-color: #ffd6d6;
}

.chip--won {
  background: #fff9da;
  color: #b08300;
  border-color: #ffedaa;
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: auto;
}

.progress-label {
  font-size: 11.5px;
  font-weight: 700;
  color: #93acbc;
}

.progress {
  display: flex;
  align-items: center;
  gap: 5px;
}

.progress span {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  font-size: 16px;
  background: #f2f9fd;
  filter: grayscale(1);
  opacity: 0.42;
  transition: transform 0.3s ease, background 0.3s ease, opacity 0.3s ease, filter 0.3s ease, box-shadow 0.3s ease;
}

.progress span.done {
  filter: none;
  opacity: 1;
  background: #e9fbf2;
  box-shadow: 0 0 0 2px #b9eed5, 0 6px 10px -8px rgba(22, 130, 86, 0.8);
  transform: translateY(-2px);
}

/* =========================================================
   舞台场景
   ========================================================= */
.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 24px;
  overflow: hidden;
  isolation: isolate;
  container-type: inline-size;
  background: linear-gradient(180deg, #b9e8ff 0%, #ddf5ff 46%, #effcff 58%, #eafaf2 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.6);
  user-select: none;
}

/* 天空装饰 */
.sky {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.sun {
  position: absolute;
  top: 7%;
  right: 8%;
  width: clamp(56px, 10cqw, 104px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 36% 34%, #fffbe0, #ffd866 58%, #ffb52e 100%);
  box-shadow:
    0 0 32px rgba(255, 205, 80, 0.8),
    0 0 80px rgba(255, 205, 80, 0.35);
  animation: sunPulse 6s ease-in-out infinite;
}

.sun::after {
  content: "";
  position: absolute;
  inset: -18%;
  border-radius: 50%;
  border: 2px dashed rgba(255, 210, 100, 0.5);
}

@keyframes sunPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

.cloud {
  position: absolute;
  height: clamp(14px, 2.6cqw, 28px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  filter: drop-shadow(0 8px 12px rgba(80, 150, 190, 0.16));
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 50%;
}

.cloud::before {
  width: 52%;
  height: 190%;
  left: 10%;
  top: -100%;
}

.cloud::after {
  width: 36%;
  height: 150%;
  right: 12%;
  top: -72%;
}

.cloud--1 {
  width: 15%;
  left: 9%;
  top: 13%;
  animation: cloudDrift 26s ease-in-out infinite alternate;
}

.cloud--2 {
  width: 11%;
  left: 44%;
  top: 8%;
  opacity: 0.85;
  animation: cloudDrift 34s ease-in-out infinite alternate-reverse;
}

.cloud--3 {
  width: 13%;
  right: 24%;
  top: 22%;
  opacity: 0.75;
  animation: cloudDrift 30s ease-in-out infinite alternate;
}

@keyframes cloudDrift {
  from { transform: translateX(0); }
  to { transform: translateX(46px); }
}

/* 远山 */
.hills {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 42%;
  height: 24%;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(42% 130% at 12% 100%, #b6e8ad 0 62%, transparent 63%),
    radial-gradient(38% 110% at 33% 100%, #9de09d 0 60%, transparent 61%),
    radial-gradient(46% 125% at 64% 100%, #b0e5a9 0 60%, transparent 61%),
    radial-gradient(40% 115% at 90% 100%, #95db93 0 62%, transparent 63%);
  opacity: 0.9;
}

/* 河流 */
.river {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 48%;
  z-index: 2;
  overflow: hidden;
  background: linear-gradient(180deg, #93e0f8 0%, #55beea 38%, #3499d4 72%, #247fba 100%);
}

.river::before {
  content: "";
  position: absolute;
  inset: -20% -10%;
  background: repeating-linear-gradient(
    112deg,
    rgba(255, 255, 255, 0) 0 26px,
    rgba(255, 255, 255, 0.2) 26px 34px,
    rgba(255, 255, 255, 0) 34px 68px
  );
  animation: waterFlow 11s linear infinite;
  opacity: 0.55;
}

.river::after {
  content: "";
  position: absolute;
  left: -5%;
  right: -5%;
  top: -2px;
  height: 10px;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.65), transparent 70%);
  filter: blur(2px);
}

@keyframes waterFlow {
  from { transform: translateX(0); }
  to { transform: translateX(136px); }
}

.wave {
  position: absolute;
  left: -15%;
  width: 130%;
  height: clamp(5px, 1.1cqw, 11px);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.34);
  filter: blur(1px);
  animation: waveMove 7.5s ease-in-out infinite alternate;
}

.wave--1 {
  top: 9%;
  animation-delay: -2s;
}

.wave--2 {
  top: 34%;
  left: -25%;
  width: 150%;
  opacity: 0.55;
  animation-delay: -4s;
}

.wave--3 {
  top: 66%;
  opacity: 0.35;
  left: -8%;
  animation-delay: -1s;
}

@keyframes waveMove {
  from { transform: translateX(-5%); }
  to { transform: translateX(5%); }
}

/* =========================================================
   河岸
   ========================================================= */
.bank {
  position: absolute;
  bottom: -4%;
  width: 33%;
  height: 60%;
  z-index: 3;
  filter: drop-shadow(0 14px 18px rgba(30, 90, 55, 0.2));
  background: linear-gradient(180deg, #b2ec8a 0%, #92db6c 34%, #70c153 72%, #519f3d 100%);
}

.bank--left {
  left: -3%;
  border-radius: 0 48% 28% 0 / 0 42% 24% 0;
}

.bank--right {
  right: -3%;
  border-radius: 48% 0 0 28% / 42% 0 0 24%;
}

.bank::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.4) 1.4px, transparent 1.8px),
    radial-gradient(rgba(55, 110, 45, 0.22) 1.6px, transparent 2px);
  background-size: 22px 22px, 35px 35px;
  background-position: 0 0, 12px 17px;
  opacity: 0.55;
  pointer-events: none;
}

.bank::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 30%;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(80, 145, 55, 0), rgba(52, 108, 38, 0.32));
  pointer-events: none;
}

.bank-label {
  position: absolute;
  top: 8%;
  left: 9%;
  z-index: 2;
  padding: 5px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #2f6b47;
  font-size: clamp(9px, 1.15cqw, 12px);
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: 0 5px 12px -6px rgba(40, 100, 60, 0.45);
  white-space: nowrap;
}

.bank--right .bank-label {
  left: auto;
  right: 9%;
}

.bank-deco {
  position: absolute;
  font-size: clamp(18px, 2.8cqw, 30px);
  opacity: 0.92;
  pointer-events: none;
  filter: drop-shadow(0 4px 6px rgba(30, 80, 40, 0.2));
}

.bank--left .bank-deco {
  left: 10%;
  top: 34%;
}

.bank--right .bank-deco {
  right: 9%;
  top: 32%;
}

/* 角色区域 */
.characters {
  position: absolute;
  bottom: 8%;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(2, auto);
  justify-content: center;
  align-items: end;
  gap: clamp(6px, 1.4cqw, 15px) clamp(7px, 1.9cqw, 20px);
}

.bank--left .characters {
  left: 5%;
  right: 16%;
}

.bank--right .characters {
  right: 5%;
  left: 16%;
}

/* =========================================================
   角色卡片
   ========================================================= */
.char {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  cursor: default;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.18s ease;
  filter: drop-shadow(0 10px 12px rgba(20, 60, 40, 0.2));
}

.char.is-active {
  cursor: pointer;
}

.char.is-active:hover {
  transform: translateY(-5px) scale(1.04);
}

.char.is-active:active {
  transform: translateY(-1px) scale(0.98);
}

.char:focus-visible {
  outline: 3px solid rgba(255, 196, 77, 0.85);
  outline-offset: 4px;
  border-radius: 16px;
}

.char-img {
  position: relative;
  display: grid;
  place-items: center;
  width: clamp(46px, 9cqw, 86px);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  background: #fffdf2;
  border: 3px solid #ffffff;
  box-shadow:
    0 0 0 2px rgba(80, 150, 110, 0.16),
    inset 0 -5px 10px rgba(0, 0, 0, 0.05);
  animation: charFloat 3.8s ease-in-out infinite;
}

.char:nth-child(2n) .char-img {
  animation-delay: -1.3s;
}

.char:nth-child(3n) .char-img {
  animation-delay: -2.4s;
}

@keyframes charFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.char-img::before {
  content: attr(data-emoji);
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: clamp(22px, 4.2cqw, 42px);
}

.char-img img {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.45s ease;
  background: transparent;
}

.char-img img.is-loaded {
  opacity: 1;
}

.char-img.img-failed img {
  display: none;
}

.char--farmer .char-img {
  background: #fff8e6;
  box-shadow:
    0 0 0 3px #ffd77e,
    0 0 0 6px rgba(255, 215, 126, 0.32),
    0 12px 16px -10px rgba(150, 100, 20, 0.55);
}

.char--wolf .char-img {
  background: #edf6fc;
  box-shadow:
    0 0 0 2px #c5d8e7,
    inset 0 -5px 10px rgba(0, 0, 0, 0.05);
}

.char--sheep .char-img {
  background: #fff1f5;
  box-shadow:
    0 0 0 2px #ffd9e6,
    inset 0 -5px 10px rgba(0, 0, 0, 0.05);
}

.char--cabbage .char-img {
  background: #f1fbe8;
  box-shadow:
    0 0 0 2px #c7ebba,
    inset 0 -5px 10px rgba(0, 0, 0, 0.05);
}

.char.is-active .char-img {
  box-shadow:
    0 0 0 3px #ffffff,
    0 0 0 7px rgba(255, 190, 75, 0.55),
    0 12px 18px -10px rgba(20, 80, 50, 0.55);
}

.char-name {
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #2b5b42;
  font-size: clamp(9px, 1.1cqw, 12px);
  font-weight: 800;
  line-height: 1.4;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(30, 80, 50, 0.14);
}

/* 上船 / 被吃 / 欢呼 */
.char--boarding {
  animation: boardPop 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.35);
}

@keyframes boardPop {
  0% { transform: scale(1); }
  45% { transform: scale(1.16) translateY(-7px); }
  100% { transform: scale(1); }
}

.char--eaten {
  animation: eaten 0.9s ease forwards;
}

@keyframes eaten {
  0% { filter: none; }
  25% { transform: translateX(-4px) rotate(-4deg); }
  55% { transform: translateX(5px) rotate(4deg); filter: grayscale(0.7); }
  100% { transform: scale(0.72) rotate(-8deg); opacity: 0.4; filter: grayscale(1); }
}

.char--chomp .char-img {
  animation: chomp 0.65s ease 2;
  border-color: #ffc0c0;
  box-shadow: 0 0 0 4px rgba(255, 120, 120, 0.35);
}

@keyframes chomp {
  0%, 100% { transform: scale(1) rotate(0); }
  45% { transform: scale(1.16) rotate(6deg); }
}

/* =========================================================
   小船
   ========================================================= */
.boat {
  position: absolute;
  left: 22%;
  bottom: 8.5%;
  width: 20%;
  z-index: 5;
  cursor: default;
  touch-action: manipulation;
  transition: left 1.15s cubic-bezier(0.36, 0.05, 0.3, 1);
  animation: boatFloat 3.2s ease-in-out infinite;
  outline: none;
}

.boat.at-right {
  left: 58%;
}

.stage[data-mode="manual"] .boat {
  cursor: pointer;
}

.stage[data-mode="manual"] .boat:hover .boat-hull {
  filter: brightness(1.08);
}

.boat:focus-visible .boat-hull {
  box-shadow:
    inset 0 -5px 0 rgba(0, 0, 0, 0.16),
    0 0 0 4px rgba(255, 205, 90, 0.75),
    0 10px 18px -8px rgba(20, 60, 90, 0.55);
}

.boat.sailing {
  animation: boatRock 0.9s ease-in-out infinite;
}

@keyframes boatFloat {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-5px) rotate(1.2deg); }
}

@keyframes boatRock {
  0%, 100% { transform: rotate(-2.4deg) translateY(0); }
  50% { transform: rotate(2.4deg) translateY(-3px); }
}

.boat::after {
  content: "";
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: -6px;
  height: 16px;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0.85), transparent 70%);
  opacity: 0;
  transition: opacity 0.25s ease;
}

.boat.sailing::after {
  opacity: 1;
  animation: splash 0.9s ease-in-out infinite;
}

@keyframes splash {
  0%, 100% { transform: scaleX(0.9); opacity: 0.55; }
  50% { transform: scaleX(1.1); opacity: 0.95; }
}

.boat-crew {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  min-height: clamp(38px, 5.6cqw, 68px);
}

.boat-slot {
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.boat-slot:empty {
  display: none;
}

.boat .char-img {
  width: clamp(30px, 4.6cqw, 54px);
  border-width: 2px;
  animation: none;
}

.boat .char-name {
  display: none;
}

.boat .char {
  filter: drop-shadow(0 4px 6px rgba(20, 50, 30, 0.28));
}

.boat .char:hover {
  transform: none;
}

.boat-hull {
  position: relative;
  z-index: 1;
  height: clamp(16px, 2.7cqw, 30px);
  margin-top: -4px;
  border-radius: 8px 8px 46% 46% / 8px 8px 90% 90%;
  background: linear-gradient(180deg, #d99a58 0%, #b47838 52%, #8b5820 100%);
  border: 2px solid #6f4318;
  box-shadow:
    inset 0 -5px 0 rgba(0, 0, 0, 0.16),
    0 10px 18px -8px rgba(20, 60, 90, 0.55);
  transition: filter 0.2s ease, box-shadow 0.2s ease;
}

.boat-hull::before {
  content: "";
  position: absolute;
  left: 4%;
  right: 4%;
  top: -5px;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(180deg, #f0c086, #d79c5c);
  border: 2px solid #6f4318;
}

.boat-hull::after {
  content: "";
  position: absolute;
  right: -8%;
  top: -10px;
  width: 24%;
  height: 4px;
  border-radius: 999px;
  background: #8a5a2a;
  border: 1px solid #684117;
  transform: rotate(30deg);
  transform-origin: left center;
}

.boat-stripe {
  position: absolute;
  left: 7%;
  right: 7%;
  top: 38%;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 240, 210, 0.28);
}

.boat-tag {
  position: absolute;
  left: 50%;
  bottom: -27px;
  transform: translateX(-50%) translateY(-4px);
  padding: 4px 10px;
  border-radius: 999px;
  background: #ffffff;
  color: #1c6a4c;
  font-size: clamp(8px, 1.05cqw, 11px);
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 5px 12px -5px rgba(20, 80, 60, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.boat-tag::after {
  content: "";
  position: absolute;
  left: 50%;
  top: -4px;
  width: 8px;
  height: 8px;
  background: #fff;
  transform: translateX(-50%) rotate(45deg);
  border-radius: 2px;
}

.boat-tag.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* =========================================================
   提示条与操作记录
   ========================================================= */
.stage-foot {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.hint {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 14px;
  background: #f4fbff;
  border: 1px dashed #cfe9f6;
  color: #5d7d92;
  font-size: 12.5px;
  line-height: 1.55;
}

.hint::before {
  content: "💡";
  flex: none;
  line-height: 1.5;
}

.move-log {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 2px 2px 6px;
  overflow-x: auto;
  scrollbar-width: thin;
  scroll-behavior: smooth;
}

.move-log::-webkit-scrollbar {
  height: 5px;
}

.move-log::-webkit-scrollbar-track {
  background: transparent;
}

.move-log::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #cfe6f2;
}

.log-empty {
  font-size: 12px;
  color: #a2b8c7;
}

.log-item {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #f3faff;
  border: 1px solid #e1eff8;
  color: #3c6076;
  font-size: 12px;
  font-weight: 700;
  animation: logIn 0.3s ease both;
}

.log-item--start {
  background: #eef9ff;
  border-color: #d8edf9;
  color: #3e7b9b;
}

.log-item--danger {
  background: #fff1f1;
  border-color: #ffd9d9;
  color: #c84a4a;
}

.log-item--success {
  background: #edfbf4;
  border-color: #c9f0db;
  color: #16845a;
}

@keyframes logIn {
  from { opacity: 0; transform: translateY(6px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

/* =========================================================
   侧边栏
   ========================================================= */
.side {
  display: grid;
  gap: 16px;
}

.panel {
  padding: 20px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 36px -30px rgba(23, 78, 112, 0.6);
}

.panel h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 15.5px;
  font-weight: 900;
  letter-spacing: 0.4px;
  color: var(--ink);
}

.panel h2 span {
  font-size: 17px;
}

.rule {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: #f8fcff;
  border: 1px solid #edf6fb;
}

.rule + .rule {
  margin-top: 8px;
}

.rule--danger {
  background: #fff8f7;
  border-color: #ffe4e0;
}

.rule-icon {
  flex: none;
  font-size: 20px;
  line-height: 1.2;
}

.rule b {
  display: block;
  margin-bottom: 2px;
  font-size: 12.8px;
  color: #274a63;
}

.rule p {
  font-size: 11.8px;
  line-height: 1.55;
  color: #7f98a9;
}

.panel-note {
  margin-top: 12px;
  font-size: 11.5px;
  line-height: 1.6;
  color: #92aab9;
  padding-left: 2px;
}

/* 解法列表 */
.solution-list {
  display: grid;
  gap: 5px;
}

.solution-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: 12px;
  border: 1px dashed transparent;
  color: #5b788c;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease, transform 0.25s ease;
}

.solution-item .num {
  flex: none;
  width: 21px;
  height: 21px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #eef8fd;
  color: #6b93aa;
  font-size: 10.5px;
  font-weight: 800;
  transition: background 0.25s ease, color 0.25s ease;
}

.solution-item .icon {
  flex: none;
  font-size: 16px;
}

.solution-item .txt {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.solution-item .txt b {
  font-size: 12.5px;
  font-weight: 800;
  color: inherit;
}

.solution-item .txt em {
  font-style: normal;
  font-size: 10.8px;
  color: #9db3c1;
}

.solution-item.active {
  background: #fff6e7;
  border-color: #ffdda8;
  color: #b07512;
  transform: translateX(3px);
}

.solution-item.active .num {
  background: #ffd88f;
  color: #8a5a00;
}

.solution-item.active .txt em {
  color: #c99a4a;
}

.solution-item.done {
  color: #9fb5c3;
}

.solution-item.done .num {
  background: #e3f8ed;
  color: #1c8a5a;
}

.solution-item.done .num span {
  display: none;
}

.solution-item.done .num::after {
  content: "✓";
  font-size: 11px;
  font-weight: 900;
}

/* =========================================================
   弹层
   ========================================================= */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  overflow: auto;
  background: rgba(16, 48, 66, 0.4);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.overlay.show {
  opacity: 1;
  visibility: visible;
}

.overlay--danger {
  background: rgba(120, 36, 36, 0.44);
}

.overlay--win {
  background: rgba(18, 82, 88, 0.4);
}

.modal {
  width: min(440px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 24px 26px;
  border-radius: 24px;
  border: 2px solid #ffffff;
  background: linear-gradient(180deg, #ffffff 0%, #f7fdff 100%);
  box-shadow: 0 34px 60px -22px rgba(10, 50, 80, 0.55);
  text-align: center;
  transform: translateY(14px) scale(0.95);
  transition: transform 0.38s cubic-bezier(0.2, 0.9, 0.3, 1.25);
}

.overlay.show .modal {
  transform: translateY(0) scale(1);
}

.modal-emoji {
  margin-bottom: 10px;
  font-size: clamp(28px, 4.2cqw, 44px);
  letter-spacing: 4px;
  line-height: 1.2;
}

.modal h2 {
  margin-bottom: 8px;
  font-size: clamp(17px, 2.2cqw, 21px);
  font-weight: 900;
  color: var(--ink);
  line-height: 1.35;
}

.modal p {
  font-size: clamp(12px, 1.5cqw, 13.5px);
  line-height: 1.7;
  color: #6a879b;
}

.modal p strong {
  color: #e08318;
}

.mini-rules {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px;
  margin: 14px 0 18px;
}

.mini-rules span {
  padding: 6px 11px;
  border-radius: 999px;
  background: #fff4e5;
  border: 1px solid #ffe1bc;
  color: #b1761a;
  font-size: 11.5px;
  font-weight: 800;
}

.modal-tip {
  margin-top: 10px;
  font-size: 11px;
  color: #9db4c2;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.result-actions .btn {
  padding: 11px 20px;
  font-size: 13px;
}

.result-modal .modal-emoji {
  animation: resultPop 0.7s cubic-bezier(0.2, 0.9, 0.3, 1.4) both;
}

@keyframes resultPop {
  0% { transform: scale(0.4) rotate(-12deg); opacity: 0; }
  60% { transform: scale(1.12) rotate(4deg); opacity: 1; }
  100% { transform: scale(1) rotate(0); }
}

/* =========================================================
   轻提示
   ========================================================= */
.toast {
  position: absolute;
  left: 50%;
  top: 14px;
  z-index: 25;
  max-width: 88%;
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(22, 54, 74, 0.92);
  color: #ffffff;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  box-shadow: 0 12px 24px -14px rgba(0, 30, 50, 0.8);
  backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, -8px);
  transition: opacity 0.28s ease, transform 0.28s ease, visibility 0.28s ease;
  pointer-events: none;
}

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

.toast--success {
  background: rgba(21, 138, 92, 0.94);
}

.toast--danger {
  background: rgba(191, 55, 55, 0.95);
}

.toast--warn {
  background: rgba(190, 120, 20, 0.95);
}

/* =========================================================
   动效：失败抖动 / 胜利彩纸
   ========================================================= */
.stage.shake {
  animation: stageShake 0.6s ease;
}

@keyframes stageShake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

.stage.celebrate .char {
  animation: cheer 0.8s ease 2;
}

@keyframes cheer {
  0%, 100% { transform: translateY(0) rotate(0); }
  50% { transform: translateY(-11px) rotate(4deg); }
}

.confetti {
  position: absolute;
  top: -24px;
  z-index: 26;
  width: 8px;
  height: 13px;
  border-radius: 3px;
  pointer-events: none;
  animation-name: confettiFall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@keyframes confettiFall {
  0% { opacity: 0; }
  8% { opacity: 1; }
  100% {
    transform: translateY(var(--fall, 600px)) rotate(720deg);
    opacity: 0.85;
  }
}

/* =========================================================
   页脚
   ========================================================= */
.page-foot {
  padding: 6px 26px 30px;
  text-align: center;
  font-size: 11.5px;
  color: #93acbc;
  letter-spacing: 0.4px;
}

/* =========================================================
   响应式
   ========================================================= */
@media (max-width: 1120px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .side {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

@media (max-width: 860px) {
  .topbar {
    padding: 20px 18px 14px;
  }

  .controls {
    width: 100%;
  }

  .controls .btn {
    flex: 1 1 0;
    min-width: 110px;
    padding: 11px 10px;
  }

  .layout {
    padding: 0 18px 18px;
  }

  .stage-card {
    padding: 12px;
    border-radius: 24px;
  }

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

@media (max-width: 760px) {
  .brand-mark {
    width: 48px;
    height: 48px;
    font-size: 24px;
    border-radius: 16px;
  }

  .brand-text p {
    font-size: 11.5px;
  }

  .stage {
    aspect-ratio: 4 / 3;
    border-radius: 20px;
  }

  .stage-card {
    padding: 10px;
  }

  .hud {
    padding: 4px 4px 10px;
  }

  .progress-label {
    display: none;
  }

  .progress span {
    width: 27px;
    height: 27px;
    font-size: 14px;
    border-radius: 9px;
  }

  .chip {
    padding: 6px 11px;
    font-size: 11.5px;
  }

  .chip--steps b {
    font-size: 14px;
  }

  .bank {
    width: 34%;
    height: 61%;
  }

  .bank-label {
    padding: 3px 8px;
    font-size: 9.5px;
  }

  .bank--left .characters {
    left: 4%;
    right: 15%;
  }

  .bank--right .characters {
    right: 4%;
    left: 15%;
  }

  .characters {
    gap: 5px 6px;
    bottom: 8%;
  }

  .char-img {
    width: clamp(40px, 10.5cqw, 58px);
    border-width: 2px;
  }

  .char-name {
    font-size: 9.5px;
    padding: 1px 6px;
  }

  .char--farmer .char-img {
    box-shadow:
      0 0 0 2px #ffd77e,
      0 0 0 4px rgba(255, 215, 126, 0.3),
      0 8px 12px -10px rgba(150, 100, 20, 0.55);
  }

  .boat {
    width: 24%;
    left: 21%;
    bottom: 9%;
  }

  .boat.at-right {
    left: 55%;
  }

  .boat .char-img {
    width: clamp(28px, 6.2cqw, 44px);
  }

  .boat-hull {
    height: clamp(14px, 3.4cqw, 22px);
  }

  .boat-tag {
    bottom: -21px;
    padding: 3px 8px;
    font-size: 9px;
  }

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

  .modal-emoji {
    font-size: 28px;
    letter-spacing: 2px;
    margin-bottom: 6px;
  }

  .modal p {
    font-size: 12px;
    line-height: 1.6;
  }

  .mini-rules {
    margin: 10px 0 14px;
    gap: 6px;
  }

  .mini-rules span {
    font-size: 10.5px;
    padding: 5px 8px;
  }

  .modal-tip {
    display: none;
  }

  .btn--lg {
    padding: 11px 24px;
    font-size: 14px;
  }

  .hint {
    font-size: 11.5px;
    padding: 9px 11px;
  }

  .move-log {
    min-height: 32px;
  }

  .log-item {
    font-size: 11px;
    padding: 5px 10px;
  }

  .side {
    gap: 12px;
  }

  .panel {
    padding: 16px;
  }
}

@media (max-width: 520px) {
  .stage {
    aspect-ratio: 1 / 1;
  }

  .overlay {
    padding: 10px;
  }

  .modal {
    padding: 16px;
  }

  .start-modal .modal-emoji {
    font-size: 24px;
    letter-spacing: 2px;
    margin-bottom: 4px;
  }

  .start-modal h2 {
    font-size: 16.5px;
    margin-bottom: 6px;
  }

  .start-modal p {
    font-size: 11.5px;
    line-height: 1.55;
  }

  .start-modal .mini-rules {
    margin: 8px 0 12px;
    gap: 5px;
  }

  .start-modal .mini-rules span {
    font-size: 10px;
    padding: 4px 7px;
  }

  .start-modal .btn--lg {
    padding: 10px 22px;
    font-size: 13.5px;
  }

  .result-actions {
    margin-top: 14px;
  }

  .toast {
    white-space: normal;
    line-height: 1.45;
    padding: 8px 13px;
    border-radius: 14px;
  }

  .bank--left .bank-deco,
  .bank--right .bank-deco {
    display: none;
  }
}

@media (max-width: 400px) {
  .controls .btn {
    min-width: 0;
    font-size: 12.5px;
    padding: 10px 8px;
  }

  .brand-text h1 {
    font-size: 19px;
  }

  .progress span {
    width: 24px;
    height: 24px;
    font-size: 12px;
  }
}

@media (max-width: 360px) {
  .stage {
    aspect-ratio: 1 / 1.08;
  }

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

  .controls .btn {
    width: 100%;
  }

  .topbar {
    padding: 16px 14px 12px;
  }

  .layout {
    padding: 0 14px 16px;
  }

  .start-modal .modal-emoji {
    font-size: 20px;
    letter-spacing: 1px;
    margin-bottom: 2px;
  }

  .start-modal h2 {
    font-size: 15px;
  }

  .start-modal p {
    font-size: 11px;
    line-height: 1.5;
  }

  .start-modal .mini-rules {
    margin: 6px 0 10px;
  }

  .start-modal .mini-rules span:last-child {
    display: none;
  }

  .start-modal .btn--lg {
    padding: 9px 20px;
    font-size: 13px;
  }
}

/* =========================================================
   降低动态效果
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
