/* 妃位合成记 · 方块合成 —— 暖宫墙 / 金漆木框 / 玉牌方块 */
:root {
  --orange: #FF8A3D;
  --orange-deep: #E96A16;
  --gold: #C89446;
  --gold-deep: #A9792F;
  --gold-light: #F3D9A4;
  --ink: #4A2A12;
  --ink-soft: #7A5528;
  --muted: #9A7442;
  --paper: #FFF7E6;
  --line: #D9BC84;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(130% 90% at 50% -10%, #FDF1D6 0%, #F7DFB6 44%, #EDC78F 100%);
  overflow-x: hidden;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 50% 16%, rgba(255, 255, 255, .55), transparent 46%),
    repeating-linear-gradient(45deg, rgba(150, 98, 40, .045) 0 1px, transparent 1px 16px),
    repeating-linear-gradient(-45deg, rgba(150, 98, 40, .045) 0 1px, transparent 1px 16px);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 44%, transparent 52%, rgba(120, 70, 20, .2) 100%);
}

.app {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(10px, env(safe-area-inset-top)) 16px max(12px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------- 顶部数据条 ---------- */
.hud { display: flex; gap: 8px; }

.stat {
  position: relative;
  flex: 1;
  min-width: 0;
  padding: 5px 11px 6px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #FFFCF2, #F7E5C2);
  box-shadow: inset 0 1px 0 #fff, 0 3px 8px rgba(120, 70, 20, .12);
  overflow: hidden;
}

.stat::after {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, #FFB273, var(--orange));
  opacity: .9;
}

.stat .lbl {
  display: block;
  font-size: 10px;
  line-height: 1.2;
  letter-spacing: .16em;
  color: var(--muted);
  font-weight: 600;
}

.stat strong {
  display: block;
  font-size: 21px;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stat strong small {
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  margin-left: 2px;
}

.stat.bump strong { animation: numberBump .32s ease-out; }

/* ---------- 任务卡 ---------- */
.mission {
  position: relative;
  padding: 9px 12px 9px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at 88% 8%, rgba(255, 255, 255, .8), transparent 42%),
    linear-gradient(180deg, #FFF9EB, #F7E3BE);
  box-shadow: inset 0 1px 0 #fff, 0 4px 12px rgba(120, 70, 20, .1);
}

.mission-top { display: flex; align-items: center; gap: 10px; }

.seal {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  transform: rotate(-4deg);
  color: #FFE9D0;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: 22px;
  font-weight: 700;
  background: linear-gradient(145deg, #E45A3E, #B62F25);
  box-shadow:
    inset 0 0 0 2px rgba(255, 225, 190, .5),
    0 3px 7px rgba(160, 50, 30, .32);
}

.mission-copy { min-width: 0; flex: 1; }

.mission-title {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mission-title em {
  font-style: normal;
  color: var(--orange-deep);
  padding: 0 2px;
}

.mission-sub {
  margin: 2px 0 0;
  font-size: 10.5px;
  line-height: 1.3;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mission-meta {
  flex: 0 0 auto;
  text-align: right;
  line-height: 1.2;
}

.mission-meta span {
  display: block;
  font-size: 9px;
  color: var(--muted);
  letter-spacing: .08em;
}

.mission-meta b {
  display: block;
  margin-top: 2px;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: 16px;
  color: #8A5218;
}

/* 晋级阶梯 */
.ladder {
  display: flex;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(180, 130, 70, .35);
}

.step {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: #AB8D64;
  font-size: 8.5px;
  line-height: 1;
  letter-spacing: .01em;
  transition: color .25s;
}

.step .lbl { white-space: nowrap; }

.step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 5px;
  left: calc(50% + 8px);
  right: calc(-50% + 8px);
  height: 2px;
  border-radius: 2px;
  background: rgba(175, 130, 75, .26);
}

.step.done:not(:last-child)::after {
  background: linear-gradient(90deg, var(--rc), rgba(255, 138, 61, .55));
}

.step .dot {
  position: relative;
  z-index: 1;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid rgba(170, 125, 70, .45);
  background: #FFF8E8;
  box-shadow: 0 0 0 2px rgba(255, 250, 235, .8);
  transition: background .25s, border-color .25s, box-shadow .25s, transform .25s;
}

.step.done { color: #6E4A1E; font-weight: 700; }

.step.done .dot {
  background: var(--rc);
  border-color: #fff;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .8), 0 0 8px var(--rc);
}

.step.next { color: var(--orange-deep); font-weight: 800; }

.step.next .dot {
  background: #FFE1C0;
  border-color: var(--orange);
  animation: dotPulse 1.5s ease-in-out infinite;
}

.step.goal { color: #A8761E; font-weight: 700; }

/* ---------- 棋盘 ---------- */
.board-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  padding: 2px 0;
}

.board {
  position: relative;
  width: min(100%, 380px);
  aspect-ratio: 1 / 1;
  padding: 10px;
  border-radius: 22px;
  border: 3px solid #C79A50;
  background:
    radial-gradient(circle at 30% 12%, #FFFDF4, transparent 58%),
    linear-gradient(158deg, #FBEDD1 0%, #F3DDB4 58%, #E8CB96 100%);
  box-shadow:
    0 0 0 3px rgba(255, 248, 228, .7),
    0 0 0 5px rgba(170, 115, 45, .32),
    0 16px 32px rgba(100, 55, 10, .22),
    inset 0 0 30px rgba(170, 110, 40, .16);
}

.board::before {
  content: "";
  position: absolute;
  inset: 5px;
  z-index: 0;
  border: 1px solid rgba(180, 130, 60, .42);
  border-radius: 17px;
  pointer-events: none;
}

.board::after {
  content: "宫";
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 0;
  transform: translate(-50%, -50%);
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: 150px;
  line-height: 1;
  color: rgba(150, 95, 35, .07);
  pointer-events: none;
  user-select: none;
}

.corner {
  position: absolute;
  z-index: 3;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(178, 126, 48, .85);
  pointer-events: none;
}

.corner.tl { top: 5px; left: 5px; border-right: 0; border-bottom: 0; border-radius: 8px 0 0 0; }
.corner.tr { top: 5px; right: 5px; border-left: 0; border-bottom: 0; border-radius: 0 8px 0 0; }
.corner.bl { bottom: 5px; left: 5px; border-right: 0; border-top: 0; border-radius: 0 0 0 8px; }
.corner.br { bottom: 5px; right: 5px; border-left: 0; border-top: 0; border-radius: 0 0 8px 0; }

.grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, 1fr);
  gap: 7px;
  width: 100%;
  height: 100%;
}

.cell {
  position: relative;
  border-radius: 12px;
  border: 1px dashed rgba(165, 115, 55, .28);
  background: rgba(255, 250, 236, .4);
  box-shadow: inset 0 2px 5px rgba(150, 100, 40, .08);
  transition: background .18s, border-color .18s, box-shadow .18s;
}

.cell.is-target {
  border: 1.5px solid rgba(240, 120, 30, .8);
  background: linear-gradient(180deg, rgba(255, 170, 90, .34), rgba(255, 138, 61, .14));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .42), 0 0 12px rgba(255, 138, 61, .4);
  animation: targetPulse 1.35s ease-in-out infinite;
}

.cell.is-target::after {
  content: "+";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 300;
  color: rgba(226, 106, 20, .55);
}

.tiles {
  position: absolute;
  left: 10px;
  top: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 2;
  pointer-events: none;
}

/* ---------- 方块 ---------- */
.tile {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: auto;
  cursor: pointer;
  transition: transform .17s cubic-bezier(.25, .8, .3, 1), width .2s, height .2s;
  will-change: transform;
}

.tile .face {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 13px;
  border: 2px solid rgba(255, 245, 215, .72);
  color: #fff;
  background: linear-gradient(155deg, #79d8c2, #218d7c);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .42),
    inset 0 -4px 0 rgba(0, 0, 0, .17),
    0 5px 10px rgba(70, 40, 10, .22);
  transition: transform .16s cubic-bezier(.2, .9, .3, 1.25), box-shadow .16s, opacity .2s, filter .2s;
}

.tile .face::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(255, 248, 220, .4);
  border-radius: 9px;
  pointer-events: none;
}

.tile .face::after {
  content: "";
  position: absolute;
  left: -35%;
  top: -60%;
  width: 70%;
  height: 170%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .32), transparent);
  transform: rotate(14deg);
  pointer-events: none;
}

.tile .name {
  position: relative;
  z-index: 1;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: clamp(16px, 5.4vw, 22px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: .08em;
  text-indent: .08em;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .18);
  white-space: nowrap;
}

/* 各品级配色：从青玉一路到金漆 */
.tile[data-rank="1"] .face { background: linear-gradient(155deg, #84ddc8 0%, #37a691 46%, #1E7C6B 100%); }
.tile[data-rank="2"] .face { background: linear-gradient(155deg, #8ecbf4 0%, #3d7fbd 48%, #28598F 100%); }
.tile[data-rank="3"] .face { background: linear-gradient(155deg, #b8adf5 0%, #7460cc 48%, #513C9E 100%); }
.tile[data-rank="4"] .face { background: linear-gradient(155deg, #dbaaf0 0%, #9b51bd 48%, #6F2E8E 100%); }
.tile[data-rank="5"] .face { background: linear-gradient(155deg, #ffb6a8 0%, #DA4B55 48%, #A82B3B 100%); }
.tile[data-rank="6"] .face { background: linear-gradient(155deg, #ffc07a 0%, #ED7B37 48%, #B4431F 100%); }
.tile[data-rank="7"] .face {
  border-color: #F0D5A2;
  background: linear-gradient(155deg, #e08aa6 0%, #A33A5F 48%, #671D3B 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .4),
    inset 0 -4px 0 rgba(60, 10, 30, .28),
    0 0 14px rgba(196, 90, 130, .35),
    0 5px 10px rgba(70, 40, 10, .22);
}
.tile[data-rank="7"] .name {
  font-size: clamp(12px, 3.9vw, 16px);
  letter-spacing: 0;
  text-indent: 0;
}
.tile[data-rank="8"] .face {
  color: #5B3606;
  border-color: #FFF2C2;
  background: linear-gradient(155deg, #FFEFAF 0%, #F5C651 42%, #D99C1F 100%);
  box-shadow:
    inset 0 2px 0 rgba(255, 255, 255, .7),
    inset 0 -4px 0 rgba(140, 85, 10, .28),
    0 0 18px rgba(255, 190, 60, .55),
    0 5px 12px rgba(120, 70, 10, .25);
}

.tile[data-rank="8"] .name { text-shadow: 0 1px 0 rgba(255, 250, 220, .8), 0 0 12px rgba(255, 245, 190, .65); }

.tile.is-selected { z-index: 6; }

.tile.is-mergeable { z-index: 4; }

.tile.is-mergeable .face {
  box-shadow:
    0 0 0 2px rgba(255, 238, 186, .95),
    0 0 16px rgba(255, 176, 66, .75),
    inset 0 2px 0 rgba(255, 255, 255, .5),
    inset 0 -4px 0 rgba(0, 0, 0, .16);
  animation: mergePulse 1.15s ease-in-out infinite;
}

.tile.is-selected .face {
  transform: scale(1.06) translateY(-2px);
  box-shadow:
    0 0 0 2px #FFE0AF,
    0 0 0 4px rgba(255, 138, 61, .55),
    0 10px 20px rgba(80, 40, 5, .3),
    inset 0 2px 0 rgba(255, 255, 255, .5);
}

.tile.spawn .face { animation: spawnIn .3s cubic-bezier(.2, 1.35, .4, 1) backwards; animation-delay: var(--delay, 0s); }
.tile.pop .face { animation: popTile .36s cubic-bezier(.2, 1.4, .4, 1); }
.tile.vanish .face { opacity: 0; transform: scale(1.3); filter: blur(2px); }
.tile.gone .face { opacity: 0; transform: scale(.55) rotate(8deg); }

.float-score {
  position: absolute;
  z-index: 8;
  pointer-events: none;
  font-size: 17px;
  font-weight: 800;
  color: #E8641C;
  text-shadow: 0 1px 0 #FFF6DF, 0 4px 10px rgba(200, 100, 20, .4);
  transform: translate(-50%, -50%);
  animation: floatUp .85s ease-out forwards;
}

/* ---------- 按钮 ---------- */
.controls { display: flex; gap: 10px; }

.btn {
  position: relative;
  flex: 1;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 12px;
  border: 0;
  border-radius: 15px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .02em;
  cursor: pointer;
  user-select: none;
  transition: transform .08s, box-shadow .08s, opacity .2s;
}

.btn .mp-icon { width: 18px; height: 18px; flex: 0 0 auto; }

.btn.ghost {
  color: #7A4E1E;
  border: 1px solid #D7B77E;
  background: linear-gradient(180deg, #FFFCF3, #F6E3BF);
  box-shadow:
    0 3px 0 rgba(180, 130, 65, .45),
    0 6px 14px rgba(120, 70, 20, .12),
    inset 0 1px 0 #fff;
}

.btn.primary {
  color: #fff;
  border: 1px solid #D45F0E;
  background: linear-gradient(180deg, #FFA35C, #F0741C);
  box-shadow:
    0 4px 0 #B44B08,
    0 8px 18px rgba(220, 110, 25, .35),
    inset 0 1px 0 rgba(255, 255, 255, .45);
  text-shadow: 0 1px 0 rgba(150, 60, 0, .3);
}

.btn:active { transform: translateY(3px); }

.btn.ghost:active {
  box-shadow: 0 1px 0 rgba(180, 130, 65, .45), inset 0 2px 5px rgba(150, 100, 40, .16);
}

.btn.primary:active {
  box-shadow: 0 1px 0 #B44B08, inset 0 2px 6px rgba(150, 60, 0, .28);
}

.btn:disabled,
.btn.is-disabled {
  opacity: .45;
  pointer-events: none;
  transform: none;
}

.btn .undo-count {
  min-width: 22px;
  height: 20px;
  padding: 0 5px;
  display: inline-grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, .7);
  border: 1px solid rgba(190, 145, 80, .55);
  color: #A05A18;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.btn.wide { width: 100%; flex: none; margin-top: 16px; }

.hint {
  margin: 0;
  text-align: center;
  font-size: 10.5px;
  line-height: 1.4;
  letter-spacing: .01em;
  color: rgba(110, 72, 30, .72);
}

/* ---------- 轻提示 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 40;
  max-width: 86vw;
  padding: 8px 15px;
  border-radius: 999px;
  background: rgba(68, 38, 12, .92);
  color: #FFE9C7;
  font-size: 12px;
  letter-spacing: .01em;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity .2s, transform .2s;
  box-shadow: 0 8px 20px rgba(40, 20, 0, .25);
}

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

/* ---------- 结算 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(55, 28, 6, .56);
  -webkit-backdrop-filter: blur(5px);
  backdrop-filter: blur(5px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s;
}

.overlay.show { opacity: 1; pointer-events: auto; }

.result {
  position: relative;
  width: 100%;
  max-width: 330px;
  padding: 26px 22px 22px;
  text-align: center;
  border-radius: 24px;
  border: 2px solid #C99B52;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, .9), transparent 44%),
    linear-gradient(180deg, #FFFAEF, #F6E3BD);
  box-shadow:
    0 0 0 4px rgba(255, 246, 222, .45),
    0 26px 60px rgba(30, 12, 0, .4),
    inset 0 1px 0 #fff;
  transform: translateY(18px) scale(.94);
  transition: transform .34s cubic-bezier(.2, 1.25, .4, 1);
}

.overlay.show .result { transform: none; }

.result .medal {
  width: 88px;
  height: 88px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: 40px;
  font-weight: 700;
  color: #5B3606;
  border: 3px solid #FFF1B8;
  background: radial-gradient(circle at 32% 26%, #FFF7CE, #F5CB55 48%, #C58C1B 100%);
  box-shadow:
    0 0 0 4px rgba(255, 246, 210, .5),
    0 0 32px rgba(255, 196, 60, .55),
    inset 0 -4px 9px rgba(120, 70, 10, .25);
  animation: medalGlow 2.4s ease-in-out infinite;
}

.result.lose .medal {
  color: #6F6252;
  border-color: #EFE7D6;
  background: radial-gradient(circle at 32% 26%, #FFFDF6, #E4D9C4 58%, #C2AF8F 100%);
  box-shadow:
    0 0 0 4px rgba(255, 250, 238, .5),
    inset 0 -4px 9px rgba(90, 70, 40, .22);
  animation: none;
}

.result h2 {
  margin: 0;
  font-family: "Songti SC", "STSong", "SimSun", serif;
  font-size: 25px;
  letter-spacing: .12em;
  text-indent: .12em;
  color: #5B3410;
}

.result-text {
  margin: 7px 0 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
}

.result-score {
  margin-top: 16px;
  padding: 11px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: 13px;
  border: 1px solid rgba(190, 145, 80, .45);
  background: rgba(255, 252, 242, .75);
}

.result-score span { font-size: 11px; color: var(--muted); letter-spacing: .1em; }
.result-score strong { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; color: #8A5218; }

.best-line {
  min-height: 16px;
  margin: 8px 0 0;
  font-size: 11px;
  color: var(--orange-deep);
  font-weight: 600;
}

.petal {
  position: fixed;
  top: -16px;
  z-index: 70;
  width: 9px;
  height: 13px;
  border-radius: 2px 8px 2px 8px;
  pointer-events: none;
  animation-name: petalFall;
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

/* ---------- 动画 ---------- */
@keyframes dotPulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(255, 255, 255, .85), 0 0 0 0 rgba(255, 138, 61, .45); }
  50% { box-shadow: 0 0 0 2px rgba(255, 255, 255, .85), 0 0 0 6px rgba(255, 138, 61, 0); }
}

@keyframes targetPulse {
  0%, 100% { opacity: .85; }
  50% { opacity: 1; }
}

@keyframes spawnIn {
  from { opacity: 0; transform: scale(.4) rotate(-8deg); }
  70% { opacity: 1; transform: scale(1.08) rotate(2deg); }
  to { opacity: 1; transform: scale(1) rotate(0); }
}

@keyframes popTile {
  0% { transform: scale(1); }
  38% { transform: scale(1.18); filter: brightness(1.2); }
  100% { transform: scale(1); }
}

@keyframes mergePulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.18); }
}

@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(.7); }
  20% { opacity: 1; transform: translate(-50%, -70%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -190%) scale(.95); }
}

@keyframes numberBump {
  0% { transform: scale(1); }
  40% { transform: scale(1.14); color: var(--orange-deep); }
  100% { transform: scale(1); }
}

@keyframes medalGlow {
  0%, 100% { transform: translateY(0); box-shadow: 0 0 0 4px rgba(255, 246, 210, .5), 0 0 26px rgba(255, 196, 60, .45), inset 0 -4px 9px rgba(120, 70, 10, .25); }
  50% { transform: translateY(-3px); box-shadow: 0 0 0 4px rgba(255, 246, 210, .65), 0 0 40px rgba(255, 196, 60, .75), inset 0 -4px 9px rgba(120, 70, 10, .25); }
}

@keyframes petalFall {
  0% { opacity: 0; transform: translateY(0) rotate(0); }
  10% { opacity: .95; }
  100% { opacity: .1; transform: translateY(105vh) rotate(540deg); }
}

@media (max-width: 350px) {
  .app { padding-left: 12px; padding-right: 12px; }
  .mission-title { font-size: 13px; }
  .mission-meta b { font-size: 14px; }
  .mission-sub { font-size: 9.5px; }
  .tile .name { font-size: 16px; }
  .btn { font-size: 14px; }
}

@media (max-height: 630px) {
  .app { gap: 7px; padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  .board { width: min(100%, 300px); }
  .mission { padding-top: 7px; padding-bottom: 7px; }
  .mission-sub { display: none; }
  .hint { display: none; }
  .btn { height: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; animation-iteration-count: 1 !important; }
  .tile { transition-duration: .02s; }
}
