:root {
  color-scheme: light;
  --ink: #263044;
  --muted: #657083;
  --paper: #fffdf8;
  --blue: #8fd3ff;
  --pink: #ff9fbd;
  --yellow: #ffe47a;
  --green: #8fe0bb;
  --violet: #a8a4ff;
  --line: rgba(38, 48, 68, 0.14);
  --shadow: 0 20px 50px rgba(43, 69, 100, 0.18);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    linear-gradient(180deg, #dff5ff 0 34%, #fff6c6 34% 36%, #eafff4 36% 100%);
}

button, select { font: inherit; }

.app {
  width: min(1120px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.hero {
  min-height: 190px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  padding: 24px 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 20%, rgba(255, 255, 255, .9) 0 11%, transparent 12%),
    radial-gradient(circle at 30% 18%, rgba(255, 255, 255, .75) 0 8%, transparent 9%),
    linear-gradient(135deg, #ffffff, #e8f8ff 52%, #fff8dd);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.kicker {
  margin: 0 0 8px;
  color: #397798;
  font-size: 13px;
  font-weight: 800;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1.02;
  letter-spacing: 0;
}

.intro {
  max-width: 620px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.mascot {
  position: relative;
  width: 148px;
  height: 148px;
  flex: 0 0 auto;
}

.ear {
  position: absolute;
  top: 4px;
  width: 36px;
  height: 84px;
  border-radius: 50% 50% 42% 42%;
  background: #fff;
  border: 3px solid #34405a;
}

.left-ear { left: 34px; transform: rotate(-16deg); }
.right-ear { right: 34px; transform: rotate(16deg); }

.face {
  position: absolute;
  left: 14px;
  bottom: 0;
  width: 120px;
  height: 106px;
  border: 3px solid #34405a;
  border-radius: 46% 46% 42% 42%;
  background: #fff;
  display: flex;
  justify-content: center;
  gap: 26px;
  padding-top: 38px;
}

.eye {
  width: 13px;
  height: 18px;
  border-radius: 50%;
  background: #34405a;
}

.nose {
  position: absolute;
  top: 62px;
  width: 16px;
  height: 12px;
  border-radius: 50%;
  background: var(--pink);
}

.control-panel {
  margin: 16px 0;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.select-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  color: #314459;
}

select, button {
  border: 2px solid #34405a;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  min-height: 44px;
}

select { padding: 0 40px 0 14px; }

button {
  padding: 0 18px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 5px 0 #34405a;
  transition: transform .12s ease, box-shadow .12s ease;
}

button:hover { transform: translateY(-1px); }
button:active { transform: translateY(4px); box-shadow: 0 1px 0 #34405a; }

#startBtn { background: var(--yellow); }
#resetBtn { background: #ffe0eb; }

.game-shell {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.mission, .board-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, .86);
  box-shadow: var(--shadow);
}

.mission { padding: 20px; }

h2 {
  margin: 0 0 10px;
  font-size: 24px;
}

#missionText {
  min-height: 58px;
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.55;
}

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 0 0 14px;
}

.stats div {
  padding: 10px;
  border-radius: 8px;
  background: #f4fbff;
  border: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

dd {
  margin: 4px 0 0;
  font-size: 22px;
  font-weight: 900;
}

.hint-card {
  padding: 12px;
  border-radius: 8px;
  background: #fff4bd;
  border: 1px solid rgba(52, 64, 90, .16);
  line-height: 1.55;
}

.hint-card p { margin: 6px 0 0; }

.message {
  min-height: 54px;
  margin: 14px 0 0;
  padding: 12px;
  border-radius: 8px;
  background: #eefcf5;
  border: 1px solid rgba(65, 142, 102, .25);
  font-weight: 800;
  line-height: 1.45;
}

.board-wrap {
  padding: 18px;
  display: grid;
  gap: 16px;
  justify-items: center;
}

.board {
  width: min(100%, 620px);
  display: grid;
  gap: 8px;
  padding: 12px;
  border-radius: 8px;
  background: #bfefff;
  border: 3px solid #34405a;
}

.cell {
  aspect-ratio: 1;
  min-width: 0;
  border: 2px solid rgba(52, 64, 90, .2);
  border-radius: 8px;
  background: #fffdf8;
  display: grid;
  place-items: center;
  font-size: clamp(20px, 4.6vw, 40px);
  font-weight: 900;
  position: relative;
  user-select: none;
}

.cell.wall {
  background:
    linear-gradient(135deg, #9cd3ad 25%, transparent 25%) 0 0 / 18px 18px,
    #76bf92;
}

.cell.ice { background: #d8f6ff; }
.cell.arrow { background: #fff1bf; color: #314459; }
.cell.goal { background: linear-gradient(135deg, #ffb2c8, #fff6a6, #96e2c2, #8fd3ff); }

.player {
  width: 72%;
  height: 72%;
  border-radius: 50% 50% 42% 42%;
  background: #fff;
  border: 3px solid #34405a;
  position: relative;
}

.player::before, .player::after {
  content: "";
  position: absolute;
  top: -20%;
  width: 25%;
  height: 42%;
  border: 2px solid #34405a;
  border-radius: 50%;
  background: #fff;
}

.player::before { left: 23%; transform: rotate(-18deg); }
.player::after { right: 23%; transform: rotate(18deg); }

.dpad {
  display: grid;
  grid-template-columns: repeat(3, 56px);
  gap: 8px;
}

.dpad button {
  width: 56px;
  height: 50px;
  padding: 0;
  background: #fff;
  font-size: 24px;
}

.dpad button:first-child { grid-column: 2; }
.dpad button:nth-child(2) { grid-column: 1; }
.dpad button:nth-child(3) { grid-column: 3; }
.dpad button:nth-child(4) { grid-column: 2; }

@media (max-width: 820px) {
  .hero { align-items: flex-start; }
  .mascot { width: 110px; height: 110px; }
  .game-shell { grid-template-columns: 1fr; }
  .mission { order: 2; }
  .board-wrap { order: 1; }
}

@media (max-width: 560px) {
  .app { width: min(100% - 18px, 1120px); padding-top: 9px; }
  .hero { padding: 18px; }
  .mascot { display: none; }
  .board { gap: 5px; padding: 8px; }
  .cell { border-radius: 6px; }
}
