/* 解压玩具箱 · 马卡龙配色样式 */

/* ---------- 设计变量 ---------- */
:root {
  --bg: #fff6f1;
  --paper: #ffffff;
  --ink: #5a4660;
  --ink-2: #8c7a90;
  --ink-3: #65516b;
  --line: rgba(90, 70, 96, 0.13);

  --pink: #ffc4d6;
  --pink-d: #f497b6;
  --peach: #ffd6b8;
  --peach-d: #f5ad7e;
  --lemon: #fff0a6;
  --lemon-d: #ecc94b;
  --mint: #bff0d8;
  --mint-d: #6fcfa6;
  --sky: #c4e3ff;
  --sky-d: #78b7ee;
  --lilac: #ddd0ff;
  --lilac-d: #a891f0;

  /* 玩具页会按主题覆盖这几项 */
  --theme: var(--pink);
  --theme-d: var(--pink-d);
  --theme-ink: #c9577f;
  --theme-bg: var(--bg);

  --radius-sm: 12px;
  --radius: 20px;
  --radius-lg: 28px;
  --shadow-soft: 0 10px 30px rgba(90, 70, 96, 0.1);
  --shadow-pop: 0 18px 50px rgba(90, 70, 96, 0.2);

  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
    "Source Han Sans SC", "Helvetica Neue", Arial, sans-serif;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);

  --ease-out: cubic-bezier(0.2, 0.7, 0.3, 1);
  --ease-back: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ---------- 基础 ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 6%, rgba(255, 196, 214, 0.55), transparent 40%),
    radial-gradient(circle at 94% 16%, rgba(196, 227, 255, 0.6), transparent 38%),
    radial-gradient(circle at 82% 94%, rgba(191, 240, 216, 0.55), transparent 42%),
    radial-gradient(circle at 4% 86%, rgba(255, 240, 166, 0.5), transparent 38%),
    var(--bg);
  background-attachment: fixed;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--theme-ink);
  outline-offset: 3px;
}

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.app {
  min-height: 100vh;
  min-height: 100dvh;
}

.noscript {
  max-width: 28em;
  margin: 20vh auto 0;
  padding: 24px;
  text-align: center;
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

/* ---------- 图标与按钮 ---------- */
.icon {
  display: inline-flex;
  flex: none;
  width: 20px;
  height: 20px;
}

.icon svg,
.icon-btn svg,
.pill-btn__icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.88);
  color: var(--ink);
  box-shadow: 0 3px 0 var(--line), 0 6px 16px rgba(90, 70, 96, 0.08);
  transition: transform 0.12s var(--ease-out), box-shadow 0.12s var(--ease-out), background-color 0.2s;
  touch-action: manipulation;
}

.icon-btn:hover {
  background: #fff;
}

.icon-btn:active {
  transform: translateY(2px) scale(0.96);
  box-shadow: 0 1px 0 var(--line), 0 3px 8px rgba(90, 70, 96, 0.08);
}

.icon-btn[aria-pressed="true"] {
  background: var(--theme);
}

.pill-btn {
  --pb: #fff;
  --pb-d: rgba(90, 70, 96, 0.16);
  --pb-ink: var(--ink);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--pb);
  color: var(--pb-ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  box-shadow: 0 4px 0 var(--pb-d), 0 8px 18px rgba(90, 70, 96, 0.08);
  transition: transform 0.1s var(--ease-out), box-shadow 0.1s var(--ease-out), background-color 0.2s;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.pill-btn:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--pb-d), 0 3px 8px rgba(90, 70, 96, 0.08);
}

.pill-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pill-btn--sm {
  min-height: 38px;
  padding: 7px 14px;
  font-size: 14px;
}

.pill-btn--primary,
.pill-btn[aria-pressed="true"] {
  --pb: var(--theme);
  --pb-d: var(--theme-d);
}

.pill-btn--danger {
  --pb: #ffe1e8;
  --pb-d: #f3a9bb;
  --pb-ink: #b03a5f;
}

.pill-btn__icon {
  display: inline-flex;
  flex: none;
  width: 18px;
  height: 18px;
}

/* 开关（设置页） */
.switch {
  position: relative;
  flex: none;
  width: 54px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #e9e1ea;
  box-shadow: inset 0 2px 4px rgba(90, 70, 96, 0.15);
  transition: background-color 0.2s;
  touch-action: manipulation;
}

.switch__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(90, 70, 96, 0.25);
  transition: transform 0.22s var(--ease-back);
}

.switch[aria-checked="true"] {
  background: var(--mint-d);
}

.switch[aria-checked="true"] .switch__thumb {
  transform: translateX(22px);
}

.switch:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* 滑块（音量） */
.range {
  --fill: 50%;
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  height: 32px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  touch-action: pan-y;
}

.range:focus-visible {
  outline: none;
}

.range::-webkit-slider-runnable-track {
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--theme-d) var(--fill), #eee5ef var(--fill));
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 26px;
  height: 26px;
  margin-top: -8px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(90, 70, 96, 0.3), 0 0 0 4px var(--theme);
}

.range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--theme-ink);
}

.range::-moz-range-track {
  height: 10px;
  border-radius: 999px;
  background: #eee5ef;
}

.range::-moz-range-progress {
  height: 10px;
  border-radius: 999px;
  background: var(--theme-d);
}

.range::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 6px rgba(90, 70, 96, 0.3), 0 0 0 4px var(--theme);
}

.range:focus-visible::-moz-range-thumb {
  box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--theme-ink);
}

/* ---------- 首页 ---------- */
.home {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: calc(20px + var(--safe-t)) calc(18px + var(--safe-r)) calc(28px + var(--safe-b)) calc(18px + var(--safe-l));
}

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.home-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.home-logo {
  flex: none;
  width: 60px;
  height: 60px;
  animation: logo-bob 3.2s ease-in-out infinite;
}

.home-logo svg {
  display: block;
  width: 100%;
  height: 100%;
}

.home-title {
  font-size: clamp(24px, 6vw, 34px);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: 0.04em;
}

.home-subtitle {
  margin-top: 4px;
  font-size: 14px;
  color: var(--ink-2);
}

.home-settings {
  flex: none;
}

.total-pill {
  display: table;
  margin: 18px auto;
  padding: 8px 20px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 3px 0 var(--line);
  font-size: 14px;
  color: var(--ink-2);
}

.total-pill__num {
  margin: 0 2px;
  font-size: 22px;
  font-weight: 900;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.toy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.toy-grid__item {
  display: flex;
}

.card {
  --c: var(--pink);
  --c-d: var(--pink-d);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  min-height: 172px;
  padding: 16px 16px 14px;
  border-radius: var(--radius-lg);
  background: radial-gradient(circle at 88% 4%, rgba(255, 255, 255, 0.75), transparent 46%), var(--c);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 6px 0 var(--c-d), 0 14px 26px rgba(90, 70, 96, 0.1);
  transition: transform 0.16s var(--ease-out), box-shadow 0.16s var(--ease-out);
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 9px 0 var(--c-d), 0 18px 30px rgba(90, 70, 96, 0.14);
}

.card:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--c-d), 0 6px 12px rgba(90, 70, 96, 0.1);
  transition-duration: 0.06s;
}

.card:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 4px;
}

.card__icon {
  display: block;
  width: 64px;
  height: 64px;
  margin-bottom: 8px;
  transition: transform 0.3s var(--ease-back);
}

.card__icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.card:hover .card__icon {
  transform: rotate(-6deg) scale(1.06);
}

.card__name {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.3;
}

.card__desc {
  flex: 1 1 auto;
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-3);
}

.card__stat {
  margin-top: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.card__stat:empty {
  display: none;
}

.card--pink {
  --c: var(--pink);
  --c-d: var(--pink-d);
}

.card--peach {
  --c: var(--peach);
  --c-d: var(--peach-d);
}

.card--lemon {
  --c: var(--lemon);
  --c-d: var(--lemon-d);
}

.card--mint {
  --c: var(--mint);
  --c-d: var(--mint-d);
}

.card--sky {
  --c: var(--sky);
  --c-d: var(--sky-d);
}

.card--lilac {
  --c: var(--lilac);
  --c-d: var(--lilac-d);
}

/* 首次进入时卡片依次弹出；只用 backwards 填充，结束后不影响悬停/按下效果 */
.home--intro .home-header,
.home--intro .total-pill {
  animation: fade-up 0.5s var(--ease-out) backwards;
}

.home--intro .card {
  animation: card-in 0.55s var(--ease-back) backwards;
  animation-delay: calc(var(--i, 0) * 70ms + 120ms);
}

.home-footer {
  margin-top: 30px;
  text-align: center;
  font-size: 12px;
  color: var(--ink-2);
}

@keyframes logo-bob {
  0%,
  100% {
    transform: translateY(0) rotate(-3deg);
  }
  50% {
    transform: translateY(-5px) rotate(3deg);
  }
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
}

@keyframes card-in {
  from {
    opacity: 0;
    transform: translateY(26px) scale(0.92);
  }
}

@media (min-width: 720px) {
  .home {
    padding-top: calc(36px + var(--safe-t));
  }

  .toy-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 22px;
  }

  .card {
    min-height: 200px;
    padding: 20px 20px 16px;
  }

  .card__icon {
    width: 76px;
    height: 76px;
  }
}

@media (max-width: 380px) {
  .home {
    padding-left: calc(12px + var(--safe-l));
    padding-right: calc(12px + var(--safe-r));
  }

  .home-logo {
    width: 48px;
    height: 48px;
  }

  .home-subtitle {
    font-size: 13px;
  }

  .home-settings {
    padding: 10px 12px;
  }

  .toy-grid {
    gap: 12px;
  }

  .card {
    min-height: 152px;
    padding: 12px 12px 12px;
    border-radius: 22px;
  }

  .card__icon {
    width: 52px;
    height: 52px;
  }

  .card__name {
    font-size: 16px;
  }
}

/* ---------- 弹窗 ---------- */
html.modal-open,
html.modal-open body {
  overflow: hidden;
}

.modal-backdrop {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r)) calc(16px + var(--safe-b)) calc(16px + var(--safe-l));
  background: rgba(90, 70, 96, 0.32);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: fade-in 0.18s ease-out;
}

.modal-backdrop.is-closing {
  pointer-events: none;
  animation: fade-out 0.16s ease-in forwards;
}

.modal {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 440px;
  max-height: 100%;
  border-radius: var(--radius-lg);
  background: var(--paper);
  box-shadow: var(--shadow-pop);
  animation: modal-in 0.28s var(--ease-back);
}

.modal:focus {
  outline: none;
}

.modal--small {
  max-width: 360px;
}

.modal-backdrop.is-closing .modal {
  animation: modal-out 0.16s ease-in forwards;
}

.modal__head {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 16px 6px 22px;
}

.modal__title {
  font-size: 20px;
  font-weight: 800;
}

.modal__close {
  width: 40px;
  height: 40px;
  padding: 9px;
  background: #f6eff5;
  box-shadow: none;
}

.modal__body {
  min-height: 0;
  padding: 6px 22px 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.confirm__msg {
  font-size: 15px;
  line-height: 1.65;
}

.confirm__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

/* ---------- 设置 ---------- */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px dashed var(--line);
}

.setting-row--stack {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.setting-row__line {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.setting-label {
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.setting-value {
  font-size: 14px;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

.setting-note {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-2);
}

.setting-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 10px;
  padding: 18px 0 6px;
}

.setting-actions .pill-btn {
  flex: 1 1 auto;
}

.setting-tips {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--bg);
  font-size: 13px;
  color: var(--ink-3);
}

.setting-tips__title {
  margin-bottom: 4px;
  font-weight: 800;
  color: var(--ink);
}

.setting-tips ul {
  margin: 0;
  padding-left: 1.2em;
}

.setting-tips li + li {
  margin-top: 3px;
}

/* ---------- 提示条 ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + var(--safe-b));
  z-index: 200;
  max-width: calc(100vw - 32px);
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(90, 70, 96, 0.92);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  box-shadow: var(--shadow-soft);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 20px);
  transition: transform 0.25s var(--ease-back), opacity 0.2s, visibility 0s 0.25s;
  pointer-events: none;
}

.toast.is-show {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
  transition: transform 0.25s var(--ease-back), opacity 0.2s, visibility 0s;
}

/* ---------- 飘字：外层是 0×0 的定位点，flex 居中让文字以点为中心 ---------- */
.float-text {
  position: absolute;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 0;
  height: 0;
  pointer-events: none;
}

.float-text__inner {
  flex: none;
  white-space: nowrap;
  font-size: 22px;
  font-weight: 900;
  color: var(--theme-ink);
  text-shadow: 0 0 2px #fff, 0 2px 0 #fff, 0 0 14px rgba(255, 255, 255, 0.95);
  will-change: transform, opacity;
}

/* ---------- 波纹（由 JS 动画控制透明度和缩放） ---------- */
.ripple {
  position: absolute;
  z-index: 5;
  border: 3px solid var(--theme-d);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
}

/* ---------- 彩纸 ---------- */
.confetti-layer {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 150;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------- 操作提示气泡 ---------- */
.hint {
  position: absolute;
  top: 14px;
  left: 50%;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  max-width: 92%;
  max-width: min(92%, 440px);
  padding: 10px 16px 10px 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  box-shadow: 0 4px 0 var(--theme-d), var(--shadow-soft);
  transform: translateX(-50%);
  animation: hint-in 0.4s var(--ease-back) both;
  pointer-events: none;
}

.hint.is-leaving {
  animation: hint-out 0.4s ease-in forwards;
}

.hint__icon {
  flex: none;
  width: 22px;
  height: 22px;
  color: var(--theme-ink);
}

.hint__icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes fade-out {
  to {
    opacity: 0;
  }
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.94);
  }
}

@keyframes modal-out {
  to {
    opacity: 0;
    transform: translateY(8px) scale(0.97);
  }
}

@keyframes hint-in {
  from {
    opacity: 0;
    transform: translate(-50%, -12px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes hint-out {
  from {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -10px) scale(0.96);
  }
}

/* ---------- 玩具页框架 ---------- */
html.in-toy,
html.in-toy body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

.theme-pink {
  --theme: var(--pink);
  --theme-d: var(--pink-d);
  --theme-ink: #c9577f;
  --theme-bg: #fff0f4;
}

.theme-peach {
  --theme: var(--peach);
  --theme-d: var(--peach-d);
  --theme-ink: #bd6a35;
  --theme-bg: #fff4ea;
}

.theme-lemon {
  --theme: var(--lemon);
  --theme-d: var(--lemon-d);
  --theme-ink: #9c7900;
  --theme-bg: #fffbe8;
}

.theme-mint {
  --theme: var(--mint);
  --theme-d: var(--mint-d);
  --theme-ink: #2f9468;
  --theme-bg: #effbf5;
}

.theme-sky {
  --theme: var(--sky);
  --theme-d: var(--sky-d);
  --theme-ink: #3b7fc0;
  --theme-bg: #eef6ff;
}

.theme-lilac {
  --theme: var(--lilac);
  --theme-d: var(--lilac-d);
  --theme-ink: #7357d1;
  --theme-bg: #f5f1ff;
}

.toy-page {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.9), transparent 38%),
    radial-gradient(circle at 92% 96%, var(--theme), transparent 55%),
    var(--theme-bg);
}

.topbar {
  position: relative;
  z-index: 10;
  flex: none;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  grid-template-areas: "back title actions tools";
  align-items: center;
  gap: 10px;
  padding: calc(10px + var(--safe-t)) calc(12px + var(--safe-r)) 10px calc(12px + var(--safe-l));
}

.topbar__back {
  grid-area: back;
}

.topbar__title {
  grid-area: title;
  min-width: 0;
  overflow: hidden;
  font-size: 20px;
  font-weight: 800;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.topbar__title:focus {
  outline: none;
}

.topbar__actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.topbar__actions:empty {
  display: none;
}

.topbar__tools {
  grid-area: tools;
  display: flex;
  gap: 8px;
}

@media (max-width: 600px) {
  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "back title tools"
      "actions actions actions";
    row-gap: 8px;
  }

  .topbar__actions {
    justify-content: center;
  }
}

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.stage--switch-board {
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
}

.toy-canvas {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.toy-error {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  font-size: 16px;
  text-align: center;
}

/* 画布类玩具共用的计数小牌 */
.hud {
  position: absolute;
  left: 50%;
  bottom: calc(14px + var(--safe-b));
  z-index: 4;
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 6px 16px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 3px 0 var(--theme-d);
  transform: translateX(-50%);
  pointer-events: none;
}

.hud--top {
  top: 12px;
  bottom: auto;
}

.hud__num {
  font-size: 20px;
  font-weight: 900;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.hud__sep {
  margin: 0 4px;
  opacity: 0.45;
}

/* ---------- 减少动态效果 ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }

  .home-logo {
    animation: none;
  }
}

/* ---------- 各玩具的专属样式 ---------- */

/* 电子木鱼 */
.stage--wooden-fish {
  cursor: pointer;
}

.fish-scene {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 12px calc(66px + var(--safe-b));
  pointer-events: none;
}

.fish-svg {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 520px;
  max-height: 460px;
  overflow: visible;
}

.fish-text__label {
  margin: 0 0 12px;
  color: var(--ink-2);
  font-size: 14px;
}

.fish-text__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fish-text__form {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.fish-text__form .pill-btn {
  flex: none;
}

/* 字号 16px，避免 iOS 聚焦输入框时自动放大页面 */
.fish-text__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 44px;
  padding: 0 14px;
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px;
}

.fish-text__input::placeholder {
  color: var(--ink-2);
  opacity: 0.7;
}

.fish-text__input:focus {
  outline: none;
  border-color: var(--theme-d);
  box-shadow: 0 0 0 3px var(--theme);
}

.fish-float--gold .float-text__inner {
  color: #e0a100;
  font-size: 34px;
  text-shadow: 0 0 3px #fff, 0 2px 0 #fff, 0 0 18px rgba(255, 226, 122, 0.95);
}

.fish-float--combo .float-text__inner {
  color: #e8743b;
  font-size: 18px;
}

/* 开关面板 */
.sb {
  display: flex;
  min-height: 100%;
  padding: 16px max(12px, var(--safe-r)) calc(24px + var(--safe-b)) max(12px, var(--safe-l));
}

.sb-panel {
  --glow: 0.55;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "head head"
    "toggles toggles"
    "buttons buttons"
    "rockers knob"
    "fader fader"
    "big big";
  gap: 12px;
  width: 100%;
  max-width: 760px;
  margin: auto;
  padding: 18px 14px 20px;
  border: 2px solid rgba(236, 201, 75, 0.55);
  border-radius: 30px;
  background: radial-gradient(circle, rgba(156, 121, 0, 0.07) 1px, transparent 1.6px) 0 0 / 14px 14px,
    linear-gradient(180deg, #fffdf6, #fff8dc);
  box-shadow: 0 6px 0 #f1d77a, 0 18px 40px rgba(156, 121, 0, 0.16);
}

/* 只用单个类名重置，后面各控件的同级规则才能覆盖它 */
.sb-toggle,
.sb-push,
.sb-rocker,
.sb-big {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  -webkit-tap-highlight-color: transparent;
}

.sb-screw {
  position: absolute;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: linear-gradient(145deg, #fff, #eadfb8);
  box-shadow: inset 0 0 0 1.5px rgba(156, 121, 0, 0.25);
}

.sb-screw::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 2px;
  right: 2px;
  height: 2px;
  border-radius: 1px;
  background: rgba(156, 121, 0, 0.38);
  transform: rotate(35deg);
}

.sb-screw--tl {
  top: 9px;
  left: 9px;
}

.sb-screw--tr {
  top: 9px;
  right: 9px;
}

.sb-screw--tr::before {
  transform: rotate(-20deg);
}

.sb-screw--bl {
  bottom: 9px;
  left: 9px;
}

.sb-screw--bl::before {
  transform: rotate(80deg);
}

.sb-screw--br {
  right: 9px;
  bottom: 9px;
}

.sb-screw--br::before {
  transform: rotate(10deg);
}

.sb-head {
  grid-area: head;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 12px 0;
}

.sb-brand {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.2;
  color: var(--theme-ink);
}

.sb-brand b {
  font-size: 17px;
  font-weight: 900;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.sb-brand small {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.25em;
  opacity: 0.6;
}

.sb-lcd {
  position: relative;
  flex: none;
  padding: 7px 12px;
  border-radius: 10px;
  background: #4f5c4b;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4), 0 2px 0 #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.08em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.sb-lcd__ghost {
  color: rgba(198, 247, 168, 0.1);
}

.sb-lcd__num {
  position: absolute;
  top: 0;
  left: 0;
  padding: inherit;
  color: #c6f7a8;
  text-shadow: 0 0 6px rgba(170, 255, 140, 0.6);
  opacity: calc(0.55 + var(--glow) * 0.45);
}

.sb-sec {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 8px;
  min-width: 0;
  padding: 22px 8px 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: inset 0 0 0 2px rgba(236, 201, 75, 0.28), inset 0 -4px 0 rgba(236, 201, 75, 0.16);
}

.sb-tag {
  position: absolute;
  top: 7px;
  left: 14px;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.2em;
  color: var(--theme-ink);
  opacity: 0.7;
  pointer-events: none;
}

.sb-sec--toggles {
  grid-area: toggles;
}

.sb-sec--buttons {
  grid-area: buttons;
  align-items: center;
  padding-bottom: 16px;
}

.sb-sec--rockers {
  grid-area: rockers;
}

.sb-sec--knob {
  grid-area: knob;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.sb-sec--fader {
  grid-area: fader;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}

.sb-sec--big {
  grid-area: big;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.sb-c--pink {
  --c: var(--pink-d);
  --c-l: var(--pink);
}

.sb-c--peach {
  --c: var(--peach-d);
  --c-l: var(--peach);
}

.sb-c--mint {
  --c: var(--mint-d);
  --c-l: var(--mint);
}

.sb-c--sky {
  --c: var(--sky-d);
  --c-l: var(--sky);
}

.sb-c--lilac {
  --c: var(--lilac-d);
  --c-l: var(--lilac);
}

.sb-tg,
.sb-rk {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.sb-label {
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  color: var(--ink-2);
  white-space: nowrap;
}

.sb-led {
  display: block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #e4dbe3;
  box-shadow: inset 0 1px 2px rgba(90, 70, 96, 0.25);
  transition: background-color 0.12s, box-shadow 0.2s, opacity 0.2s;
}

.sb-tg.is-on .sb-led {
  background: var(--c);
  opacity: calc(0.45 + var(--glow) * 0.55);
  box-shadow: 0 0 calc(var(--glow) * 14px) var(--c);
}

.sb-toggle {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 66px;
  border-radius: 14px;
  touch-action: manipulation;
}

.sb-toggle__plate {
  position: relative;
  display: block;
  width: 34px;
  height: 56px;
  border-radius: 12px;
  background: linear-gradient(180deg, #f7f0e1, #ebe1cc);
  box-shadow: inset 0 0 0 2px rgba(156, 121, 0, 0.14), 0 3px 0 rgba(156, 121, 0, 0.16);
}

.sb-toggle__plate::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  background: radial-gradient(circle, #d6c8aa 0 35%, #f3ead6 42%);
  box-shadow: 0 0 0 2px rgba(156, 121, 0, 0.18);
}

.sb-toggle__lever {
  position: absolute;
  bottom: 50%;
  left: 50%;
  width: 8px;
  height: 21px;
  margin-left: -4px;
  border-radius: 4px;
  background: linear-gradient(90deg, #d3ccd8, #fff 45%, #cbc3d1);
  transform: scaleY(-1);
  transform-origin: 50% 100%;
  transition: transform 0.16s var(--ease-back);
}

.sb-toggle__lever::after {
  content: "";
  position: absolute;
  top: -8px;
  left: 50%;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 42%, #fff 0 16%, var(--c-l) 30%, var(--c) 78%);
}

.sb-tg.is-on .sb-toggle__lever {
  transform: scaleY(1);
}

.sb-push {
  position: relative;
  display: block;
  flex: 0 1 60px;
  min-width: 46px;
  height: 58px;
  padding: 5px 5px 6px;
  border-radius: 18px;
  background: #efe6d2;
  box-shadow: inset 0 2px 5px rgba(156, 121, 0, 0.22);
  touch-action: none;
}

.sb-push__cap {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(255, 255, 255, 0) 55%), var(--c-l);
  box-shadow: 0 5px 0 var(--c), 0 7px 10px rgba(90, 70, 96, 0.12);
  transform: translateY(-5px);
  transition: transform 0.1s var(--ease-out), box-shadow 0.1s var(--ease-out), filter 0.1s;
}

.sb-push.is-down .sb-push__cap {
  transform: translateY(0);
  box-shadow: 0 0 0 var(--c), 0 0 4px var(--c);
  filter: brightness(1.04) saturate(1.2);
  transition-duration: 0.04s;
}

.sb-rk--fan {
  --c: var(--sky-d);
  --c-l: var(--sky);
}

.sb-rk--bulb {
  --c: var(--lemon-d);
  --c-l: var(--lemon);
}

.sb-gadget {
  display: block;
  width: 36px;
  height: 36px;
}

.sb-gadget svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.sb-fan {
  animation: sb-spin 0.45s linear infinite paused;
}

.sb-rk--fan.is-on .sb-fan {
  animation-play-state: running;
}

.sb-fan__blades path {
  fill: #dad3df;
  transition: fill 0.2s;
}

.sb-rk--fan.is-on .sb-fan__blades path {
  fill: var(--sky-d);
}

.sb-fan__hub {
  fill: #fff;
  stroke: #b9aebf;
  stroke-width: 1.6;
}

.sb-bulb {
  transition: filter 0.2s;
}

.sb-bulb__glass {
  fill: #fffdf6;
  stroke: #c8bdcc;
  stroke-width: 1.8;
  transition: fill 0.15s, stroke 0.15s;
}

.sb-bulb__fil {
  fill: none;
  stroke: #c8bdcc;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.15s;
}

.sb-bulb__base {
  fill: none;
  stroke: #b2a6b8;
  stroke-width: 2.2;
  stroke-linecap: round;
}

.sb-bulb__rays {
  fill: none;
  stroke: var(--lemon-d);
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0;
  transition: opacity 0.2s;
}

.sb-rk--bulb.is-on .sb-bulb {
  filter: drop-shadow(0 0 calc(var(--glow) * 9px) rgba(255, 200, 60, 0.85));
}

.sb-rk--bulb.is-on .sb-bulb__glass {
  fill: #fff2a0;
  stroke: var(--lemon-d);
}

.sb-rk--bulb.is-on .sb-bulb__fil {
  stroke: #f08a3c;
}

.sb-rk--bulb.is-on .sb-bulb__rays {
  opacity: var(--glow);
}

.sb-rocker {
  display: block;
  width: 46px;
  height: 64px;
  padding: 4px;
  border-radius: 13px;
  background: #efe6d2;
  box-shadow: inset 0 0 0 2px rgba(156, 121, 0, 0.14), inset 0 2px 5px rgba(156, 121, 0, 0.2);
  perspective: 160px;
  touch-action: manipulation;
}

.sb-rocker__face {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 9px;
  background: #fffaf0;
  box-shadow: 0 2px 4px rgba(90, 70, 96, 0.18);
  transform: rotateX(-14deg);
  transition: transform 0.12s var(--ease-back), background-color 0.15s;
}

.sb-rocker__i,
.sb-rocker__o {
  display: flex;
  flex: 1 1 50%;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  color: var(--ink-2);
  transition: background-color 0.15s, color 0.15s;
}

.sb-rocker__i {
  background: linear-gradient(180deg, #fff, rgba(255, 255, 255, 0));
}

.sb-rocker__o {
  background: rgba(156, 121, 0, 0.1);
}

.sb-rk.is-on .sb-rocker__face {
  background: var(--c-l);
  transform: rotateX(14deg);
}

.sb-rk.is-on .sb-rocker__i {
  background: rgba(90, 70, 96, 0.08);
  color: var(--ink);
}

.sb-rk.is-on .sb-rocker__o {
  background: linear-gradient(0deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0));
}

@keyframes sb-spin {
  to {
    transform: rotate(360deg);
  }
}

.sb-knobwrap {
  position: relative;
  flex: none;
  width: 96px;
  height: 96px;
}

.sb-ticks {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.sb-tick {
  stroke: #eadfca;
  stroke-width: 4;
  stroke-linecap: round;
  transition: stroke 0.15s;
}

.sb-tick.is-on {
  stroke: var(--peach-d);
}

.sb-knob {
  position: absolute;
  top: 16px;
  left: 16px;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #efe6d2;
  box-shadow: 0 4px 0 rgba(156, 121, 0, 0.22), 0 8px 16px rgba(90, 70, 96, 0.14);
  cursor: grab;
  touch-action: none;
}

.sb-knob.is-grab {
  cursor: grabbing;
}

.sb-knob__grip {
  position: absolute;
  top: 4px;
  left: 4px;
  right: 4px;
  bottom: 4px;
  border-radius: 50%;
  background: #fbf5e8;
  background: repeating-conic-gradient(#fffaf0 0deg 9deg, #efe5cf 9deg 18deg);
  box-shadow: inset 0 0 0 2px rgba(156, 121, 0, 0.12);
  transform: rotate(-135deg);
  transition: transform 0.16s var(--ease-back);
}

.sb-knob.is-grab .sb-knob__grip {
  transition-duration: 0.08s;
}

.sb-knob__grip::after {
  content: "";
  position: absolute;
  top: 28%;
  left: 28%;
  width: 44%;
  height: 44%;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff, #f1e7d2);
  box-shadow: 0 1px 3px rgba(90, 70, 96, 0.2);
}

.sb-knob__mark {
  position: absolute;
  top: 4px;
  left: 50%;
  width: 6px;
  height: 14px;
  margin-left: -3px;
  border-radius: 3px;
  background: var(--peach-d);
}

.sb-knob__val {
  min-width: 2ch;
  margin-top: 2px;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  color: var(--theme-ink);
  font-variant-numeric: tabular-nums;
}

.sb-meter {
  display: flex;
  gap: 5px;
  padding: 0 20px;
}

.sb-meter__seg {
  flex: 1 1 0;
  height: 8px;
  border-radius: 4px;
  background: #eee5d3;
  transition: background-color 0.12s, box-shadow 0.12s;
}

.sb-meter__seg.is-on {
  background: var(--mint-d);
  box-shadow: 0 0 calc(var(--glow) * 10px) var(--mint-d);
}

.sb-meter__seg:nth-child(3).is-on,
.sb-meter__seg:nth-child(4).is-on {
  background: var(--lemon-d);
  box-shadow: 0 0 calc(var(--glow) * 10px) var(--lemon-d);
}

.sb-meter__seg:nth-child(5).is-on {
  background: var(--pink-d);
  box-shadow: 0 0 calc(var(--glow) * 10px) var(--pink-d);
}

.sb-fader {
  --pos: 0;
  position: relative;
  display: block;
  height: 48px;
  padding: 0 20px;
  border-radius: 14px;
  cursor: pointer;
  touch-action: none;
}

.sb-fader.is-grab {
  cursor: grabbing;
}

.sb-fader__track {
  position: relative;
  display: block;
  height: 100%;
}

.sb-fader__slot {
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 8px;
  margin-top: -4px;
  border-radius: 4px;
  background: #e9dfca;
  box-shadow: inset 0 1px 3px rgba(90, 70, 96, 0.25);
}

.sb-fader__slot::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: calc(var(--pos) * 100%);
  border-radius: inherit;
  background: var(--lemon-d);
  transition: width 0.14s var(--ease-out);
}

.sb-fader__notch {
  position: absolute;
  top: 50%;
  width: 2px;
  height: 22px;
  margin: -11px 0 0 -1px;
  border-radius: 1px;
  background: rgba(156, 121, 0, 0.22);
}

.sb-fader__cap {
  position: absolute;
  top: 50%;
  left: calc(var(--pos) * 100%);
  width: 30px;
  height: 40px;
  margin-top: -20px;
  border-radius: 10px;
  background: linear-gradient(180deg, #fff, #f1eadb);
  box-shadow: 0 3px 0 rgba(156, 121, 0, 0.22), 0 6px 12px rgba(90, 70, 96, 0.14),
    inset 0 0 0 2px rgba(156, 121, 0, 0.12);
  transform: translateX(-50%);
  transition: left 0.14s var(--ease-out);
}

.sb-fader__cap::after {
  content: "";
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 50%;
  width: 4px;
  margin-left: -2px;
  border-radius: 2px;
  background: var(--theme-ink);
}

.sb-fader.is-grab .sb-fader__cap,
.sb-fader.is-grab .sb-fader__slot::after {
  transition-duration: 0.07s;
}

.sb-bigwrap {
  flex: none;
  padding: 11px;
  border-radius: 50%;
  background: repeating-linear-gradient(-45deg, #ffd96a 0 10px, #6b5870 10px 20px);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.3), 0 3px 0 #fff;
}

.sb-big {
  display: block;
  width: 150px;
  height: 150px;
  padding: 10px;
  border-radius: 50%;
  background: #fffaf0;
  box-shadow: inset 0 3px 7px rgba(90, 70, 96, 0.28);
  touch-action: none;
}

.sb-big__cap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 30%, #fff 0, #ffd3e1 20%, #f7a8c3 55%, #ec86aa 100%);
  box-shadow: 0 9px 0 #d9729a, 0 14px 22px rgba(217, 114, 154, 0.35), inset 0 -6px 12px rgba(217, 114, 154, 0.35);
  transform: translateY(-9px);
  transition: transform 0.14s var(--ease-back), box-shadow 0.14s var(--ease-out);
}

.sb-big.is-down .sb-big__cap {
  transform: translateY(0) scale(1.03, 0.96);
  box-shadow: 0 1px 0 #d9729a, 0 2px 6px rgba(217, 114, 154, 0.3), inset 0 -3px 10px rgba(217, 114, 154, 0.45);
  transition-duration: 0.05s;
}

.sb-big__text {
  font-size: 26px;
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow: 0 2px 0 rgba(200, 90, 130, 0.55);
  white-space: nowrap;
  pointer-events: none;
}

@media (hover: hover) {
  .sb-push:hover .sb-push__cap,
  .sb-big:hover .sb-big__cap {
    filter: brightness(1.04);
  }

  .sb-toggle:hover .sb-toggle__plate {
    box-shadow: inset 0 0 0 2px rgba(156, 121, 0, 0.26), 0 3px 0 rgba(156, 121, 0, 0.16);
  }

  .sb-rocker:hover {
    box-shadow: inset 0 0 0 2px rgba(156, 121, 0, 0.26), inset 0 2px 5px rgba(156, 121, 0, 0.2);
  }
}

.sb-panel.is-shake {
  animation: sb-shake 0.42s linear;
}

.sb-panel.is-party {
  animation: sb-party 1.8s linear;
}

.sb-panel.is-shake.is-party {
  animation: sb-shake 0.42s linear, sb-party 1.8s linear;
}

.sb-panel.is-party .sb-led,
.sb-panel.is-party .sb-lcd__num {
  animation: sb-blink 0.3s ease-in-out 6;
}

@keyframes sb-shake {
  0%,
  100% {
    transform: none;
  }
  12% {
    transform: translate(-7px, 2px) rotate(-1.2deg);
  }
  26% {
    transform: translate(6px, -2px) rotate(1deg);
  }
  40% {
    transform: translate(-5px, 1px) rotate(-0.7deg);
  }
  55% {
    transform: translate(4px, -1px) rotate(0.5deg);
  }
  70% {
    transform: translate(-2px, 0) rotate(-0.3deg);
  }
  85% {
    transform: translate(1px, 0) rotate(0.1deg);
  }
}

@keyframes sb-party {
  0%,
  100% {
    border-color: rgba(236, 201, 75, 0.55);
  }
  20% {
    border-color: var(--pink-d);
  }
  40% {
    border-color: var(--mint-d);
  }
  60% {
    border-color: var(--sky-d);
  }
  80% {
    border-color: var(--lilac-d);
  }
}

@keyframes sb-blink {
  50% {
    opacity: 0.2;
  }
}

/* 宽屏：三列，大按钮放到右上 */
@media (min-width: 720px) {
  .sb-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas:
      "head head head"
      "toggles toggles big"
      "buttons buttons big"
      "rockers knob fader";
    gap: 14px;
    padding: 20px 18px 22px;
  }

  .sb-sec--fader {
    justify-content: center;
  }

  .sb-big {
    width: 164px;
    height: 164px;
  }
}

@media (max-width: 360px) {
  .sb {
    padding-right: max(8px, var(--safe-r));
    padding-left: max(8px, var(--safe-l));
  }

  .sb-panel {
    gap: 10px;
    padding: 16px 10px 18px;
  }

  .sb-sec {
    padding-right: 6px;
    padding-left: 6px;
  }

  .sb-toggle {
    width: 44px;
  }

  .sb-brand b {
    font-size: 15px;
  }

  .sb-lcd {
    padding: 6px 9px;
    font-size: 18px;
  }

  .sb-big {
    width: 136px;
    height: 136px;
  }
}
