/* 金毛 & 边牧 · 云端跑酷 —— UI 样式 */
:root {
  --ink: #4a3b52;
  --ink-soft: #7d6b86;
  --paper: #fffaf6;
  --coral: #ff8fa3;
  --coral-deep: #f4708a;
  --mint: #7fd8be;
  --sky: #8fc4ff;
  --butter: #ffd76e;
  --lilac: #c2a9f2;
  --shadow: 0 12px 28px rgba(122, 92, 140, .18);
  --radius: 26px;
  --font: "Rounded Mplus 1p", "PingFang SC", "HarmonyOS Sans SC",
    "Hiragino Sans GB", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  overflow: hidden;
  background: #bfe0ff;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#scene {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

/* 柔光叠加，让 3D 画面更梦幻 */
.vignette {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  pointer-events: none;
  z-index: 2;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, .28), transparent 55%),
    radial-gradient(110% 80% at 50% 110%, rgba(255, 210, 226, .30), transparent 60%);
  mix-blend-mode: soft-light;
}

.hidden { display: none !important; }

/* ---------------- 通用屏幕 ---------------- */
.screen {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 10;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px;
  overflow-y: auto;
}
.screen.active { display: flex; animation: fadeUp .38s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px) scale(.985); }
  to { opacity: 1; transform: none; }
}

.glass {
  background: rgba(255, 252, 249, .93);
  background: linear-gradient(rgba(255, 253, 250, .95), rgba(255, 246, 250, .93));
  backdrop-filter: blur(16px) saturate(1.15);
  border: 2px solid rgba(255, 255, 255, .95);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .9);
}

/* ---------------- 标题页 ---------------- */
#screen-title {
  justify-content: flex-start;
  padding-top: 5vh;
  gap: 14px;
}
#screen-title .badge {
  font-size: 13px;
  letter-spacing: .22em;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, .78);
  padding: 7px 16px;
  border-radius: 999px;
  border: 1.5px dashed rgba(255, 143, 163, .55);
}

.dog-pair {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: -6px;
}
.dog-pair svg { width: 104px; height: 104px; filter: drop-shadow(0 8px 14px rgba(120, 90, 140, .18)); }
.dog-pair .heart {
  font-size: 26px;
  color: var(--coral);
  animation: beat 1.5s ease-in-out infinite;
  margin: 0 2px;
}
@keyframes beat {
  0%, 100% { transform: scale(1); }
  35% { transform: scale(1.22); }
  60% { transform: scale(.96); }
}

h1.title {
  margin: 0;
  font-size: clamp(34px, 7vw, 62px);
  line-height: 1.06;
  letter-spacing: .04em;
  text-align: center;
  background: linear-gradient(160deg, #ff9fb2 8%, #ffc978 45%, #8fd8ff 92%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 rgba(255, 255, 255, .85)) drop-shadow(0 10px 18px rgba(255, 143, 163, .3));
}
.title-sub {
  margin: 0;
  font-size: clamp(13px, 2.4vw, 17px);
  color: var(--ink-soft);
  letter-spacing: .16em;
}

/* ---------------- 按钮 ---------------- */
.btn {
  font-family: inherit;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: .06em;
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 15px 40px;
  cursor: pointer;
  background: linear-gradient(170deg, #ffb0c0, var(--coral-deep));
  box-shadow: 0 10px 20px rgba(244, 112, 138, .35), inset 0 -3px 0 rgba(0, 0, 0, .09),
    inset 0 2px 0 rgba(255, 255, 255, .5);
  transition: transform .14s, box-shadow .14s, filter .14s;
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 14px 26px rgba(244, 112, 138, .42), inset 0 -3px 0 rgba(0, 0, 0, .09); }
.btn:active { transform: translateY(1px) scale(.985); }
.btn.ghost {
  color: var(--ink);
  background: rgba(255, 255, 255, .9);
  box-shadow: var(--shadow), inset 0 0 0 2px rgba(194, 169, 242, .5);
  font-size: 15px;
  padding: 12px 28px;
}
.btn.small { font-size: 14px; padding: 10px 20px; border-radius: 14px; }
.btn.mint { background: linear-gradient(170deg, #a8ecd8, #4fc3a1); box-shadow: 0 10px 20px rgba(79, 195, 161, .32), inset 0 -3px 0 rgba(0, 0, 0, .08); }
.btn:disabled { filter: grayscale(.6) opacity(.6); cursor: not-allowed; transform: none; }

.hint {
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: .08em;
  background: rgba(255, 255, 255, .62);
  padding: 8px 18px;
  border-radius: 999px;
}

/* ---------------- 面板 ---------------- */
.panel {
  width: min(680px, 100%);
  padding: 28px clamp(18px, 4vw, 34px) 30px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: center;
}
.panel h2 {
  margin: 0;
  font-size: clamp(21px, 4vw, 27px);
  letter-spacing: .1em;
}
.panel h2 small { display: block; font-size: 12px; color: var(--ink-soft); letter-spacing: .18em; margin-top: 6px; font-weight: 400; }

.mode-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; }
@media (max-width: 620px) { .mode-grid { grid-template-columns: 1fr; } }

.mode-card {
  font-family: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, .82);
  border: 2.5px solid rgba(255, 255, 255, .95);
  border-radius: 22px;
  padding: 18px 12px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow: 0 8px 18px rgba(122, 92, 140, .13);
  transition: transform .16s, box-shadow .16s, border-color .16s, background .16s;
}
.mode-card:hover { transform: translateY(-4px); border-color: rgba(255, 143, 163, .8); background: #fff; box-shadow: 0 16px 26px rgba(255, 143, 163, .26); }
.mode-card i { font-size: 30px; font-style: normal; line-height: 1; }
.mode-card b { font-size: 16px; letter-spacing: .05em; }
.mode-card span { font-size: 11.5px; color: var(--ink-soft); letter-spacing: .04em; }

/* ---------------- 联机面板 ---------------- */
.tabs { display: flex; gap: 8px; background: rgba(255, 255, 255, .6); padding: 5px; border-radius: 999px; }
.tab {
  font-family: inherit; font-size: 14px; font-weight: 700; color: var(--ink-soft);
  border: none; background: transparent; padding: 9px 22px; border-radius: 999px; cursor: pointer;
  transition: all .15s;
}
.tab.on { background: #fff; color: var(--ink); box-shadow: 0 4px 12px rgba(122, 92, 140, .18); }

.net-step { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.net-step p { margin: 0; font-size: 13.5px; color: var(--ink); letter-spacing: .04em; }
.net-step p b { color: var(--coral-deep); }

textarea.code {
  width: 100%;
  min-height: 76px;
  max-height: 130px;
  resize: vertical;
  font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
  word-break: break-all;
  color: #5d5168;
  background: rgba(255, 255, 255, .95);
  border: 2px solid rgba(194, 169, 242, .45);
  border-radius: 14px;
  padding: 10px 12px;
  outline: none;
}
textarea.code:focus { border-color: var(--lilac); box-shadow: 0 0 0 4px rgba(194, 169, 242, .18); }

.row { display: flex; gap: 10px; width: 100%; align-items: center; flex-wrap: wrap; }
.row.center { justify-content: center; }

#netStatus {
  font-size: 13.5px;
  letter-spacing: .06em;
  min-height: 20px;
  color: var(--ink-soft);
  text-align: center;
}
#netStatus.ok { color: #2e9d7c; font-weight: 700; }
#netStatus.err { color: var(--coral-deep); font-weight: 700; }

/* ---------------- 操作说明 ---------------- */
.keys { width: 100%; display: flex; flex-direction: column; gap: 9px; }
.keys .kr { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.keys .kr .who { width: 74px; flex: none; color: var(--ink-soft); font-size: 12px; letter-spacing: .06em; }
kbd {
  display: inline-block;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  min-width: 26px;
  text-align: center;
  padding: 4px 8px;
  border-radius: 8px;
  color: var(--ink);
  background: linear-gradient(#fff, #f1ebf7);
  border: 1.5px solid rgba(194, 169, 242, .55);
  box-shadow: 0 2px 0 rgba(194, 169, 242, .5);
}
.keys .kr .desc { color: var(--ink-soft); font-size: 12.5px; }

/* ---------------- HUD ---------------- */
#hud { position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 8; pointer-events: none; }

.hud-top {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-start;
}
.hud-chip {
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .05em;
  color: var(--ink);
  background: rgba(255, 255, 255, .82);
  border: 2px solid rgba(255, 255, 255, .95);
  border-radius: 999px;
  padding: 8px 16px;
  box-shadow: 0 6px 16px rgba(122, 92, 140, .16);
  backdrop-filter: blur(8px);
}
.hud-chip .em { font-size: 16px; }
.hud-chip.pulse { animation: chipPulse .45s ease; }
@keyframes chipPulse {
  0% { transform: scale(1); }
  40% { transform: scale(1.14); }
  100% { transform: scale(1); }
}
#hudPartner { margin-left: auto; }
#hudPartner.gone { color: var(--coral-deep); }
#hudPartner.gone .em { animation: beat 1s infinite; }

.hud-progress {
  position: absolute;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 40px));
  height: 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .68);
  box-shadow: inset 0 2px 5px rgba(122, 92, 140, .18), 0 6px 14px rgba(122, 92, 140, .12);
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, .9);
}
#hudProgressFill {
  position: absolute;
  top: 0; right: 100%; bottom: 0; left: 0;
  background: linear-gradient(90deg, #ffd76e, #ff9fb2 55%, #b8a4ff);
  transition: right .18s linear;
}
.hud-progress .pct {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: grid;
  place-items: center;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .18em;
  color: #6b5a76;
  text-shadow: 0 1px 0 rgba(255, 255, 255, .9);
}

.hud-prompt {
  position: absolute;
  left: 50%;
  bottom: 62px;
  transform: translateX(-50%);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .08em;
  color: #fff;
  background: linear-gradient(170deg, rgba(255, 143, 163, .96), rgba(200, 120, 255, .92));
  padding: 10px 22px;
  border-radius: 999px;
  box-shadow: 0 10px 22px rgba(190, 120, 200, .35), inset 0 1px 0 rgba(255, 255, 255, .55);
  animation: promptFloat 1.6s ease-in-out infinite;
}
@keyframes promptFloat {
  0%, 100% { transform: translate(-50%, 0); }
  50% { transform: translate(-50%, -5px); }
}

#hudToast {
  position: absolute;
  left: 50%;
  top: 78px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: max-content;
  max-width: 88vw;
}
.toast {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: .05em;
  color: var(--ink);
  background: rgba(255, 255, 255, .94);
  border-radius: 999px;
  padding: 9px 20px;
  box-shadow: 0 8px 18px rgba(122, 92, 140, .2);
  animation: toastIn .3s cubic-bezier(.2, .9, .3, 1.4) both;
}
.toast.fade { animation: toastOut .45s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(.94); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-8px) scale(.97); } }

/* ---------------- 结算 ---------------- */
.result-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
}
.stat {
  flex: 1 1 120px;
  min-width: 108px;
  text-align: center;
  background: rgba(255, 255, 255, .85);
  border: 2px solid rgba(255, 255, 255, .95);
  border-radius: 20px;
  padding: 14px 10px;
  box-shadow: 0 8px 18px rgba(122, 92, 140, .13);
}
.stat .k { font-size: 11px; letter-spacing: .16em; color: var(--ink-soft); }
.stat .v { font-size: 24px; font-weight: 800; margin-top: 4px; letter-spacing: .02em; }
.stat .v em { font-style: normal; font-size: 13px; color: var(--ink-soft); margin-left: 2px; }

.rank {
  font-size: 72px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: .02em;
  color: #ff8fa3;
  text-shadow:
    0 2px 0 #fff,
    0 4px 0 rgba(255, 255, 255, .75),
    0 10px 20px rgba(255, 143, 163, .38);
}

/* ---------------- 开发日志 ---------------- */
#devlog {
  position: fixed;
  left: 0;
  bottom: 0;
  z-index: 999;
  max-width: 46vw;
  max-height: 40vh;
  overflow: auto;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 10.5px;
  line-height: 1.35;
  color: #b8ffcf;
  background: rgba(20, 14, 28, .78);
  padding: 6px 8px;
  border-radius: 8px 8px 0 0;
  white-space: pre-wrap;
  pointer-events: none;
  display: none;
}
#devlog.on { display: block; }
#devlog .err { color: #ff9b9b; }

/* ---------------- 载入 ---------------- */
#loading {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  background: linear-gradient(170deg, #d6ecff, #ffe9f1 60%, #fff6e6);
  transition: opacity .5s;
}
#loading.done { opacity: 0; pointer-events: none; }
.pawloader { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pawloader .paws { display: flex; gap: 10px; }
.pawloader .paw {
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--coral);
  animation: hop 1s ease-in-out infinite;
}
.pawloader .paw:nth-child(2) { animation-delay: .12s; background: var(--butter); }
.pawloader .paw:nth-child(3) { animation-delay: .24s; background: var(--mint); }
.pawloader .paw:nth-child(4) { animation-delay: .36s; background: var(--lilac); }
@keyframes hop { 0%, 100% { transform: translateY(0) scale(.9); opacity: .55; } 50% { transform: translateY(-11px) scale(1.1); opacity: 1; } }
.pawloader p { margin: 0; font-size: 13px; letter-spacing: .2em; color: var(--ink-soft); }

/* ---------------- 首页大按钮 ---------------- */
.start-btns {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(380px, 88vw);
  margin-top: 4px;
}
.btn.big {
  width: 100%;
  font-size: 19px;
  padding: 17px 20px;
  letter-spacing: .16em;
}
.btn.sky {
  background: linear-gradient(170deg, #a8d3ff, #6aa9f0);
  box-shadow: 0 10px 20px rgba(106, 169, 240, .34), inset 0 -3px 0 rgba(0, 0, 0, .08),
    inset 0 2px 0 rgba(255, 255, 255, .5);
}
.link-btn {
  font-family: inherit;
  font-size: 13.5px;
  color: var(--ink-soft);
  background: rgba(255, 255, 255, .74);
  border: 1.5px dashed rgba(255, 143, 163, .5);
  border-radius: 999px;
  padding: 8px 20px;
  margin-top: 4px;
  cursor: pointer;
  letter-spacing: .12em;
  backdrop-filter: blur(4px);
}
.link-btn:hover { color: var(--coral-deep); border-color: var(--coral); background: #fff; }

.hud-chip .tot { font-weight: 400; color: #9d8aa6; }

/* ---------------- 触屏操作 ---------------- */
#touch {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 9;
  pointer-events: none;
  touch-action: none;
}
#stick {
  position: absolute;
  left: max(16px, env(safe-area-inset-left));
  bottom: calc(84px + env(safe-area-inset-bottom));
  width: 124px;
  height: 124px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .34);
  border: 2px solid rgba(255, 255, 255, .8);
  box-shadow: 0 8px 20px rgba(122, 92, 140, .18), inset 0 0 22px rgba(255, 255, 255, .55);
  backdrop-filter: blur(6px);
  pointer-events: auto;
  touch-action: none;
}
#stickKnob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border-radius: 50%;
  background: linear-gradient(165deg, #fff0f4, #ff9fb2);
  border: 2px solid rgba(255, 255, 255, .95);
  box-shadow: 0 6px 14px rgba(244, 112, 138, .42);
  transition: transform .06s linear;
}
#stickKnob.active { transition: none; }

.touch-right {
  position: absolute;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(78px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}
.tbtn {
  pointer-events: auto;
  font-family: inherit;
  font-weight: 800;
  color: #fff;
  border: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  letter-spacing: .04em;
  transition: transform .08s, filter .08s;
}
.tbtn:active, .tbtn.down { transform: scale(.92); filter: brightness(1.06); }
.tbtn.jump {
  width: 92px;
  height: 92px;
  font-size: 25px;
  background: linear-gradient(165deg, #ffc2d0, #f4708a);
  box-shadow: 0 10px 22px rgba(244, 112, 138, .42), inset 0 -4px 0 rgba(0, 0, 0, .1),
    inset 0 3px 0 rgba(255, 255, 255, .5);
}
.tbtn.dash {
  width: 66px;
  height: 66px;
  font-size: 19px;
  background: linear-gradient(165deg, #b9e6ff, #6aa9f0);
  box-shadow: 0 8px 18px rgba(106, 169, 240, .4), inset 0 -3px 0 rgba(0, 0, 0, .09),
    inset 0 2px 0 rgba(255, 255, 255, .5);
}
.tbtn.hand {
  width: 66px;
  height: 66px;
  font-size: 17px;
  background: linear-gradient(165deg, #ffd9f0, #c58cf0);
  box-shadow: 0 8px 18px rgba(197, 140, 240, .4), inset 0 -3px 0 rgba(0, 0, 0, .09),
    inset 0 2px 0 rgba(255, 255, 255, .5);
}
.tbtn.pause {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  top: calc(14px + env(safe-area-inset-top));
  width: 46px;
  height: 46px;
  font-size: 15px;
  color: var(--ink);
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 6px 16px rgba(122, 92, 140, .18);
  border: 2px solid rgba(255, 255, 255, .95);
}

/* ---------------- 手机 / 竖屏 ---------------- */
@media (max-width: 620px) {
  .panel { padding: 20px 14px 22px; }
  .dog-pair svg { width: 88px; height: 88px; }
  h1.title {
    font-size: clamp(30px, 9vw, 44px);
    background: linear-gradient(160deg, #ff6f8d 6%, #ff9f3d 46%, #4f9df0 94%);
    -webkit-background-clip: text;
    background-clip: text;
    filter: drop-shadow(0 2px 0 rgba(255, 255, 255, .95)) drop-shadow(0 8px 14px rgba(255, 143, 163, .32));
  }
  .title-sub { color: #7a6a86; }
  .hint { font-size: 12px; padding: 7px 14px; }
  /* 手机上首页用干净的渐变，不被 3D 场景干扰 */
  #screen-title {
    justify-content: center;
    padding-top: 0;
    background: linear-gradient(180deg, #cfe9ff 0%, #e8f3ff 36%, #ffe8f2 100%);
  }
  #screen-title::after {
    content: "";
    position: absolute;
    top: auto; right: -10%; bottom: -12%; left: -10%;
    height: 42%;
    background: radial-gradient(60% 100% at 50% 100%, rgba(147, 220, 185, .5), transparent 70%);
    pointer-events: none;
  }
  .start-btns { margin-top: 10px; }
  .dog-pair .heart { font-size: 20px; }
}

@media (max-width: 520px) {
  .hud-top { top: calc(8px + env(safe-area-inset-top)); left: 10px; right: 62px; gap: 7px; }
  .hud-chip { font-size: 12.5px; padding: 5px 11px; gap: 5px; }
  .hud-chip .em { font-size: 13px; }
  #hudPartner { max-width: 40vw; overflow: hidden; white-space: nowrap; }
  .hud-progress { bottom: calc(10px + env(safe-area-inset-bottom)); height: 13px; width: calc(100% - 24px); }
  .hud-prompt {
    bottom: auto;
    top: calc(56px + env(safe-area-inset-top));
    font-size: 12.5px;
    padding: 8px 16px;
  }
  #hudToast { top: calc(102px + env(safe-area-inset-top)); }
  .toast { font-size: 12.5px; padding: 7px 15px; }
  .result-stats { gap: 7px; }
  .stat { flex: 1 1 84px; min-width: 84px; padding: 10px 6px; }
  .stat .v { font-size: 19px; }
  .btn.big { font-size: 17px; padding: 15px 18px; }
}

/* 横屏手机：压低 UI 高度 */
@media (max-height: 460px) and (orientation: landscape) {
  #stick { width: 96px; height: 96px; bottom: calc(60px + env(safe-area-inset-bottom)); }
  #stickKnob { width: 44px; height: 44px; margin: -22px 0 0 -22px; }
  .tbtn.jump { width: 74px; height: 74px; font-size: 21px; }
  .tbtn.dash, .tbtn.hand { width: 56px; height: 56px; font-size: 15px; }
  .touch-right { bottom: calc(54px + env(safe-area-inset-bottom)); }
  #screen-title { padding-top: 2vh; gap: 8px; }
  .dog-pair svg { width: 62px; height: 62px; }
  .start-btns { flex-direction: row; width: min(620px, 94vw); gap: 10px; }
  .btn.big { font-size: 15px; padding: 12px 10px; }
}

/* ---------------- 启动失败提示 ---------------- */
#fatal {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(170deg, #d6ecff, #ffe9f1 60%, #fff6e6);
}
#fatal.hidden { display: none; }
.fatal-card {
  width: min(460px, 100%);
  background: #fff;
  border-radius: 22px;
  padding: 22px 20px 18px;
  box-shadow: 0 18px 40px rgba(122, 92, 140, .22);
  text-align: center;
  max-height: 86vh;
  overflow-y: auto;
}
.fatal-card .fatal-emoji { font-size: 34px; line-height: 1; }
.fatal-card h3 { margin: 10px 0 12px; font-size: 18px; color: #4a3b52; letter-spacing: .04em; }
.fatal-card pre {
  margin: 0 0 14px;
  text-align: left;
  font-family: ui-monospace, Consolas, monospace;
  font-size: 11px;
  line-height: 1.55;
  color: #5d5168;
  background: #f7f3fb;
  border-radius: 12px;
  padding: 10px 12px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 190px;
  overflow-y: auto;
}
.fatal-hint { margin: 12px 0 0; font-size: 11.5px; line-height: 1.7; color: #8b7c94; }
/* ---------------- 设置界面 ---------------- */
.link-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

.setting { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.setting-head { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; letter-spacing: .04em; }
.setting-head b { color: var(--coral-deep); font-size: 15px; }
.setting-hint { font-size: 11.5px; color: var(--ink-soft); letter-spacing: .03em; }

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 28px;
  background: transparent;
  cursor: pointer;
  outline: none;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffd76e, #ff9fb2 55%, #b8a4ff);
  box-shadow: inset 0 2px 4px rgba(122, 92, 140, .18);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  margin-top: -8px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #ff8fa3;
  box-shadow: 0 4px 10px rgba(244, 112, 138, .4);
}
input[type="range"]::-moz-range-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffd76e, #ff9fb2 55%, #b8a4ff);
}
input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #ff8fa3;
}

.setting-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 14px;
  letter-spacing: .04em;
  padding: 6px 2px;
}
.switch {
  width: 54px;
  height: 30px;
  border-radius: 999px;
  border: none;
  padding: 0;
  cursor: pointer;
  position: relative;
  background: rgba(180, 170, 190, .38);
  transition: background .2s;
}
.switch i {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .18);
  transition: left .18s;
}
.switch.on { background: linear-gradient(90deg, #ffb0c0, #f4708a); }
.switch.on i { left: 27px; }