/* ============================================================
 *  app.css — Stripchat 设备控制器（移动端）
 *  配色 / 尺寸均按参考图取样：底色 #190C20、梅紫 #3B1F4A、主粉 #F35689
 * ============================================================ */

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

:root {
  --pink:      #f3568a;
  --pink-lt:   #fb709b;
  --pink-dk:   #e94978;
  --bg-deep:   #190c20;
  --plum:      #3b1f4a;
  --txt:       #ffffff;
  --txt-2:     rgba(255, 255, 255, .62);
  --txt-3:     rgba(255, 255, 255, .40);
  --glass:     rgba(255, 255, 255, .055);
  --glass-2:   rgba(255, 255, 255, .15);
  --line:      rgba(255, 255, 255, .16);
  --pad:       clamp(20px, 8.4vw, 40px);
  --pad-add:   clamp(24px, 10.6vw, 50px);
  --ease:      cubic-bezier(.22, .8, .3, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", "Hiragino Sans",
          "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Noto Sans SC", "Microsoft YaHei",
          "Helvetica Neue", Arial, sans-serif;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #070309;
  font-family: var(--font);
  color: var(--txt);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

body { overflow: hidden; }

button, input, select, textarea { font-family: inherit; }

/* ---------- 舞台 / 手机外框 ---------- */
.stage {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  background:
    radial-gradient(70% 50% at 50% 0%, rgba(90, 40, 110, .35), transparent 70%),
    #070309;
}

.phone {
  position: relative;
  width: min(430px, 100vw);
  height: min(940px, 100dvh);
  overflow: hidden;
  background: #120a18;
}

@media (min-width: 520px) and (min-height: 780px) {
  .phone {
    border-radius: 40px;
    box-shadow:
      0 0 0 1px rgba(255, 255, 255, .07),
      0 40px 100px rgba(0, 0, 0, .75),
      0 0 90px rgba(120, 40, 100, .25);
  }
}

/* ---------- 屏 ---------- */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: scale(.985) translateY(8px);
  pointer-events: none;
  transition: opacity .42s ease, transform .46s var(--ease);
  overflow: hidden;
  padding: max(env(safe-area-inset-top), 10px) 0 0;
}

.screen.is-active {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* 背景：梅紫光晕 + 底部粉光 */
.screen--add {
  background:
    radial-gradient(90% 42% at 50% 6%, rgba(126, 72, 146, .62), transparent 66%),
    radial-gradient(80% 34% at 50% 46%, rgba(92, 44, 116, .38), transparent 72%),
    radial-gradient(120% 40% at 50% 100%, rgba(214, 58, 122, .42), transparent 72%),
    linear-gradient(180deg, #2a1436 0%, #200f2b 42%, #1f0d29 74%, #1c0b25 100%);
}

.screen--ctl {
  background:
    radial-gradient(85% 34% at 50% 2%, rgba(120, 68, 142, .62), transparent 70%),
    radial-gradient(90% 30% at 50% 58%, rgba(150, 60, 120, .30), transparent 74%),
    radial-gradient(120% 34% at 50% 99%, rgba(210, 56, 120, .40), transparent 72%),
    linear-gradient(180deg, #2b1537 0%, #22102d 38%, #200e2a 66%, #1d0c26 100%);
}

/* 漂浮微尘 */
.screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(1.6px 1.6px at 12% 18%, rgba(255, 255, 255, .55), transparent),
    radial-gradient(1.4px 1.4px at 84% 24%, rgba(255, 255, 255, .45), transparent),
    radial-gradient(1.2px 1.2px at 32% 52%, rgba(255, 255, 255, .35), transparent),
    radial-gradient(1.6px 1.6px at 72% 68%, rgba(255, 255, 255, .40), transparent),
    radial-gradient(1.2px 1.2px at 22% 78%, rgba(255, 255, 255, .30), transparent),
    radial-gradient(1.4px 1.4px at 60% 88%, rgba(255, 255, 255, .28), transparent);
  opacity: .8;
  animation: dust 9s ease-in-out infinite alternate;
}

@keyframes dust {
  from { opacity: .35; }
  to   { opacity: .85; }
}

/* ---------- 顶栏 ---------- */
.bar {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  height: 54px;
  padding: 0 calc(var(--pad) - 8px);
  flex: 0 0 auto;
}

.bar__title {
  margin: 0;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: .2px;
  text-align: center;
  color: #fff;
}

.bar__spacer { width: 40px; height: 40px; }

.icon-btn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  border-radius: 50%;
  color: rgba(255, 255, 255, .78);
  cursor: pointer;
  transition: background .2s, color .2s, transform .2s;
}

.icon-btn:active { background: rgba(255, 255, 255, .09); transform: scale(.94); }

.icon-btn svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bar__gear { color: rgba(255, 255, 255, .34); }
.bar__gear:hover { color: rgba(255, 255, 255, .75); }

/* ---------- 屏 1：添加设备 ---------- */
.add__body {
  position: relative;
  z-index: 2;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 var(--pad-add) 4vh;
}

.bt-orb {
  width: clamp(104px, 30vw, 132px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .13);
  background:
    radial-gradient(60% 60% at 50% 42%, rgba(255, 255, 255, .13), rgba(255, 255, 255, .04) 62%, rgba(255, 255, 255, .015) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, .18),
    inset 0 -18px 40px rgba(120, 40, 110, .28),
    0 16px 46px rgba(20, 6, 26, .55);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform .25s var(--ease), box-shadow .25s;
  animation: orbIn .8s var(--ease) both;
}

.bt-orb:active { transform: scale(.95); }

.bt-orb svg {
  width: 42%;
  height: 42%;
  fill: none;
  stroke: #fff;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, .45));
}

@keyframes orbIn {
  from { opacity: 0; transform: scale(.88); }
  to   { opacity: 1; transform: none; }
}

.add__title {
  margin: clamp(26px, 5.4vh, 46px) 0 0;
  font-size: clamp(23px, 6.4vw, 27px);
  font-weight: 700;
  letter-spacing: .3px;
  text-align: center;
  color: #fff;
  text-shadow: 0 2px 20px rgba(0, 0, 0, .25);
}

.add__sub {
  margin: 12px 0 0;
  font-size: 13.5px;
  font-weight: 400;
  line-height: 1.5;
  text-align: center;
  color: rgba(255, 255, 255, .55);
  max-width: 26em;
}

.field {
  position: relative;
  width: 100%;
  margin-top: clamp(32px, 7vh, 58px);
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(60, 20, 50, .30);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .30), inset 0 0 24px rgba(150, 50, 120, .10);
  transition: border-color .25s, box-shadow .25s, background .25s;
}

/* 固定 ID：输入框锁定态（小锁 + 字距放大） */
.field__lock {
  display: none;
  position: absolute;
  inset-inline-end: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(255, 255, 255, .32);
  pointer-events: none;
}

.field__lock svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.field.is-locked { border-color: rgba(255, 255, 255, .14); }
.field.is-locked .field__lock { display: block; }
.field.is-locked .field__input {
  letter-spacing: .18em;
  font-weight: 600;
  cursor: default;
}
.field.is-locked:focus-within { box-shadow: inset 0 1px 2px rgba(0, 0, 0, .3); border-color: rgba(255, 255, 255, .14); }

.field:focus-within {
  border-color: rgba(243, 86, 137, .70);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .3), 0 0 0 3px rgba(243, 86, 137, .16);
}

.field.is-error {
  border-color: rgba(255, 120, 140, .85);
  animation: shake .34s;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

.field__input {
  width: 100%;
  height: clamp(54px, 14vw, 60px);
  padding: 0 22px;
  border: 0;
  outline: 0;
  border-radius: 999px;
  background: transparent;
  color: #fff;
  font-size: 15.5px;
  font-weight: 500;
  letter-spacing: .06em;
  text-align: center;
}

.field__input::placeholder {
  color: rgba(255, 255, 255, .34);
  letter-spacing: 0;
  font-weight: 400;
}

.field__err {
  margin: 10px 0 0;
  font-size: 12px;
  color: #ff9db0;
  text-align: center;
}

.btn-primary {
  position: relative;
  width: 100%;
  height: clamp(56px, 15vw, 62px);
  margin-top: clamp(18px, 3.4vh, 26px);
  border: 0;
  border-radius: 999px;
  color: #fff;
  font-size: 16.5px;
  font-weight: 700;
  letter-spacing: .04em;
  cursor: pointer;
  background: linear-gradient(168deg, var(--pink-lt) 0%, #f7568d 48%, var(--pink-dk) 100%);
  box-shadow:
    0 10px 34px rgba(243, 86, 137, .42),
    0 2px 0 rgba(255, 255, 255, .18) inset,
    0 -2px 10px rgba(150, 20, 70, .35) inset;
  transition: transform .18s var(--ease), box-shadow .25s, filter .25s;
  overflow: hidden;
}

.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(60% 120% at 50% 0%, rgba(255, 255, 255, .28), transparent 62%);
  pointer-events: none;
}

.btn-primary:active { transform: scale(.978); box-shadow: 0 6px 20px rgba(243, 86, 137, .34); }

.btn-primary__label { position: relative; z-index: 2; }

.btn-primary__spin {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
}

.btn-primary__spin::after {
  content: "";
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.btn-primary.is-loading { pointer-events: none; filter: saturate(.9); }
.btn-primary.is-loading .btn-primary__label { opacity: 0; }
.btn-primary.is-loading .btn-primary__spin { display: grid; }

.add__remember {
  margin: 16px 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, .40);
  letter-spacing: .02em;
}

.add__glow {
  position: absolute;
  left: 50%;
  bottom: -14%;
  width: 150%;
  height: 46%;
  transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 50%, rgba(235, 70, 130, .38), transparent 70%);
  filter: blur(24px);
  pointer-events: none;
  z-index: 0;
}

/* ---------- 屏 2：控制台 ---------- */
.status {
  margin: 2px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 12.5px;
  letter-spacing: .01em;
  color: rgba(255, 255, 255, .74);
  z-index: 2;
  padding: 0 var(--pad);
}

.status__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #35e08a;
  box-shadow: 0 0 8px rgba(53, 224, 138, .8);
  flex: 0 0 auto;
  animation: pulseDot 2.4s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .55; transform: scale(.86); }
}

.status.is-off .status__dot { background: #ff7d8e; box-shadow: 0 0 8px rgba(255, 125, 142, .8); }

.readout {
  text-align: center;
  z-index: 2;
  margin-top: clamp(20px, 4.4vh, 36px);
}

.readout__pct {
  font-size: clamp(34px, 9.8vw, 44px);
  font-weight: 300;
  letter-spacing: .01em;
  line-height: 1;
  color: #fff;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 2px 24px rgba(255, 140, 180, .22);
  transition: transform .16s var(--ease);
}

.readout__pct.is-bump { transform: scale(1.05); }

.readout__sign {
  font-size: .58em;
  font-weight: 300;
  margin-inline-start: .06em;
  color: rgba(255, 255, 255, .92);
}

.readout__cap {
  margin-top: clamp(12px, 2.2vh, 18px);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .52);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .7em;
}

.readout__cap .dot { opacity: .55; letter-spacing: 0; }

/* 可视化区 */
.viz {
  position: relative;
  flex: 1 1 auto;
  min-height: 150px;
  margin-top: clamp(4px, 1.2vh, 12px);
  overflow: hidden;
  z-index: 1;
}

.viz__ring {
  position: absolute;
  left: 50%;
  top: 54%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .07);
  pointer-events: none;
}

.viz__ring--1 { width: 64%;  aspect-ratio: 1; }
.viz__ring--2 { width: 88%;  aspect-ratio: 1; }
.viz__ring--3 { width: 116%; aspect-ratio: 1; }

.viz__glow {
  position: absolute;
  left: 50%;
  top: 54%;
  width: 84%;
  aspect-ratio: 1.02;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(50% 50% at 50% 50%,
      rgba(255, 148, 195, calc(.42 + var(--lvl, .65) * .32)) 0%,
      rgba(238, 92, 152, calc(.26 + var(--lvl, .65) * .22)) 34%,
      rgba(190, 62, 128, .12) 58%,
      transparent 70%);
  filter: blur(8px);
  pointer-events: none;
  transition: background .3s linear;
}

#waveCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: none;
}

/* 胶囊 tab */
.tabs {
  position: relative;
  z-index: 2;
  display: flex;
  gap: 4px;
  margin: 0 var(--pad) 0;
  padding: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .055);
  border: 1px solid rgba(255, 255, 255, .05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06);
  flex: 0 0 auto;
}

.tabs__item {
  flex: 1 1 0;
  height: clamp(40px, 11vw, 46px);
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(255, 255, 255, .72);
  font-size: clamp(13.5px, 3.9vw, 15px);
  font-weight: 500;
  letter-spacing: .04em;
  cursor: pointer;
  transition: background .28s var(--ease), color .22s, box-shadow .28s, transform .2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 4px;
}

.tabs__item.is-active {
  background: rgba(255, 255, 255, .135);
  color: #fff;
  font-weight: 700;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), 0 6px 16px rgba(20, 4, 26, .22);
}

.tabs__item:active { transform: scale(.97); }

/* 滑杆 */
.sliders {
  position: relative;
  z-index: 2;
  padding: 0 var(--pad);
  margin-top: clamp(18px, 3.6vh, 30px);
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 3vh, 26px);
  flex: 0 0 auto;
}

.slider__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}

.slider__label {
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, .88);
  letter-spacing: .01em;
}

.slider__value {
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, .92);
  font-variant-numeric: tabular-nums;
  letter-spacing: .01em;
}

.range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  outline: none;
  margin: 0;
  display: block;
  --p: 50%;
  cursor: pointer;
}

.range::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg,
    rgba(255, 255, 255, .96) 0 var(--p),
    rgba(255, 255, 255, .26) var(--p) 100%);
}

.range::-moz-range-track {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .26);
}

.range::-moz-range-progress {
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .96);
}

.range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  margin-top: -8px;
  border-radius: 50%;
  background: #fff;
  border: 0;
  box-shadow: 0 2px 8px rgba(20, 4, 26, .45), 0 0 0 1px rgba(255, 255, 255, .35);
  transition: transform .16s var(--ease);
}

.range::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(20, 4, 26, .45);
}

.range:active::-webkit-slider-thumb { transform: scale(1.14); }

/* RTL：滑杆从右往左填充，跟滑块位置对齐 */
[dir="rtl"] .range::-webkit-slider-runnable-track {
  background: linear-gradient(270deg,
    rgba(255, 255, 255, .96) 0 var(--p),
    rgba(255, 255, 255, .26) var(--p) 100%);
}

/* 传输按钮 */
.transport {
  position: relative;
  z-index: 2;
  margin-top: clamp(22px, 4.4vh, 38px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(16px, 5.4vw, 30px);
  flex: 0 0 auto;
}

.rbtn {
  width: clamp(50px, 13vw, 58px);
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .10);
  background: linear-gradient(170deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, .045));
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 8px 22px rgba(16, 3, 20, .30);
  transition: transform .16s var(--ease), background .22s;
}

.rbtn svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.rbtn:active { transform: scale(.93); }
.rbtn.is-pressed { background: rgba(255, 255, 255, .18); }

.rbtn--main {
  width: clamp(68px, 18.4vw, 82px);
  border: 0;
  background: linear-gradient(168deg, #ff87ac 0%, #f75a90 46%, #e54277 100%);
  box-shadow:
    0 0 0 8px rgba(243, 86, 137, .10),
    0 0 42px rgba(243, 86, 137, .55),
    0 12px 30px rgba(160, 20, 70, .40),
    inset 0 2px 0 rgba(255, 255, 255, .28);
  animation: mainGlow 3.6s ease-in-out infinite;
}

@keyframes mainGlow {
  0%, 100% { box-shadow: 0 0 0 8px rgba(243, 86, 137, .10), 0 0 34px rgba(243, 86, 137, .45), 0 12px 30px rgba(160, 20, 70, .40), inset 0 2px 0 rgba(255, 255, 255, .28); }
  50%      { box-shadow: 0 0 0 10px rgba(243, 86, 137, .13), 0 0 54px rgba(243, 86, 137, .62), 0 12px 30px rgba(160, 20, 70, .40), inset 0 2px 0 rgba(255, 255, 255, .28); }
}

.rbtn--main svg { width: 30px; height: 30px; stroke-width: 2.6; }
.rbtn--main .ico-play { display: none; fill: #fff; stroke: #fff; }
.rbtn--main.is-paused { animation: none; filter: saturate(.85) brightness(.94); }
.rbtn--main.is-paused .ico-pause { display: none; }
.rbtn--main.is-paused .ico-play { display: block; }

.foot {
  position: relative;
  z-index: 2;
  margin: clamp(16px, 3vh, 26px) 0 max(calc(env(safe-area-inset-bottom) + 14px), 18px);
  text-align: center;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, .40);
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.foot__val { color: rgba(255, 255, 255, .58); }
.foot .dot { opacity: .5; margin: 0 .5em; letter-spacing: 0; }

.ctl__glow {
  position: absolute;
  left: 50%;
  bottom: -16%;
  width: 160%;
  height: 40%;
  transform: translateX(-50%);
  background: radial-gradient(50% 50% at 50% 50%, rgba(235, 70, 130, .42), transparent 70%);
  filter: blur(26px);
  pointer-events: none;
  z-index: 0;
  transition: opacity .3s linear;
}

/* ---------- toast ---------- */
.toast {
  position: absolute;
  left: 50%;
  bottom: 54px;
  transform: translate(-50%, 14px);
  padding: 11px 20px;
  border-radius: 999px;
  background: rgba(28, 10, 36, .92);
  border: 1px solid rgba(255, 255, 255, .10);
  color: #fff;
  font-size: 13px;
  letter-spacing: .02em;
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s, transform .28s var(--ease);
  z-index: 40;
  backdrop-filter: blur(12px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .5);
  max-width: 80%;
  text-align: center;
}

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

/* ---------- 语言设置面板 ---------- */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  visibility: hidden;
}

.sheet.is-open { pointer-events: auto; visibility: visible; }

.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 3, 12, .62);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity .3s;
}

.sheet.is-open .sheet__backdrop { opacity: 1; }

.sheet__panel {
  position: relative;
  width: min(430px, 100vw);
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #2a1338 0%, #1e0e28 40%, #1a0b23 100%);
  border-radius: 26px 26px 0 0;
  border-top: 1px solid rgba(255, 255, 255, .10);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, .6);
  transform: translateY(102%);
  transition: transform .38s var(--ease);
  padding-bottom: env(safe-area-inset-bottom);
}

.sheet.is-open .sheet__panel { transform: none; }

.sheet__head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 56px;
  flex: 0 0 auto;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}

.sheet__title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: .02em;
}

.sheet__close, .sheet__back {
  position: absolute;
  top: 8px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(255, 255, 255, .6);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.sheet__close { inset-inline-end: 8px; }
.sheet__back { inset-inline-start: 8px; }
.sheet__close:active, .sheet__back:active { background: rgba(255, 255, 255, .09); }

.sheet__close svg, .sheet__back svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
}

.sheet__view {
  padding: 16px 18px 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1 1 auto;
  min-height: 0;
}

.sheet__hint {
  margin: 0 0 14px;
  font-size: 12.5px;
  line-height: 1.6;
  color: rgba(255, 255, 255, .50);
}

.switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, .045);
  border: 1px solid rgba(255, 255, 255, .07);
  font-size: 13.5px;
  color: rgba(255, 255, 255, .85);
  cursor: pointer;
  margin-bottom: 14px;
}

.switch input { position: absolute; opacity: 0; pointer-events: none; }

.switch__ui {
  position: relative;
  width: 44px;
  height: 26px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .14);
  flex: 0 0 auto;
  transition: background .25s;
}

.switch__ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform .25s var(--ease);
  box-shadow: 0 2px 6px rgba(0, 0, 0, .35);
}

.switch input:checked + .switch__ui { background: var(--pink); }
.switch input:checked + .switch__ui::after { transform: translateX(18px); }
[dir="rtl"] .switch input:checked + .switch__ui::after { transform: translateX(-18px); }

.lang-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

/* 语言搜索条 */
.lang-tools {
  position: sticky;
  top: -16px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 10px;
  margin: -8px 0 6px;
  background: linear-gradient(180deg, #271231 0%, #271231 72%, rgba(39, 18, 49, 0) 100%);
}

.lang-search {
  flex: 1 1 auto;
  min-width: 0;
  height: 38px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(0, 0, 0, .28);
  color: #fff;
  font-size: 13px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .2s, background .2s;
}

.lang-search::placeholder { color: rgba(255, 255, 255, .34); }
.lang-search:focus { border-color: rgba(243, 86, 137, .62); background: rgba(0, 0, 0, .38); }
.lang-search::-webkit-search-cancel-button { -webkit-appearance: none; }

.lang-count {
  flex: 0 0 auto;
  font-size: 11px;
  letter-spacing: .04em;
  color: rgba(255, 255, 255, .38);
  font-variant-numeric: tabular-nums;
}

.lang-chip__txt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.lang-empty {
  grid-column: 1 / -1;
  margin: 18px 0;
  text-align: center;
  font-size: 13px;
  color: rgba(255, 255, 255, .30);
}

.lang-chip {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, .08);
  background: rgba(255, 255, 255, .04);
  color: rgba(255, 255, 255, .86);
  font-size: 13.5px;
  text-align: start;
  cursor: pointer;
  transition: border-color .2s, background .2s, transform .16s;
}

.lang-chip:active { transform: scale(.98); }

.lang-chip.is-active {
  border-color: rgba(243, 86, 137, .75);
  background: rgba(243, 86, 137, .14);
  box-shadow: 0 0 0 1px rgba(243, 86, 137, .25) inset;
}

.lang-chip__name { font-weight: 600; }
.lang-chip__code { font-size: 10.5px; color: rgba(255, 255, 255, .40); letter-spacing: .04em; }

.lang-chip__badge {
  position: absolute;
  top: -6px;
  inset-inline-end: 10px;
  font-size: 9px;
  letter-spacing: .06em;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(243, 86, 137, .85);
  color: #fff;
}

.sheet__actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.sheet__actions--sticky {
  position: sticky;
  bottom: 0;
  margin: 0;
  padding: 12px 18px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(26, 11, 35, 0), #1a0b23 42%);
}

.btn-ghost {
  flex: 1 1 auto;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .05);
  color: rgba(255, 255, 255, .88);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .16s;
}

.btn-ghost:active { transform: scale(.98); background: rgba(255, 255, 255, .10); }
.btn-ghost--sm { min-height: 38px; font-size: 12.5px; padding: 0 10px; }
.btn-ghost--danger { color: #ff9db0; border-color: rgba(255, 120, 150, .28); }

.btn-solid {
  flex: 0 0 96px;
  min-height: 44px;
  border: 0;
  border-radius: 13px;
  background: linear-gradient(168deg, var(--pink-lt), var(--pink-dk));
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(243, 86, 137, .32);
}

.io { margin-top: 16px; }

.io__row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.io__row .btn-ghost { min-width: 0; white-space: nowrap; }

.io__text {
  width: 100%;
  height: 108px;
  margin-top: 10px;
  padding: 12px;
  border-radius: 13px;
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(0, 0, 0, .28);
  color: rgba(255, 255, 255, .82);
  font-size: 11.5px;
  line-height: 1.55;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  resize: vertical;
  outline: none;
}

/* 编辑器 */
.edit__meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 14px;
}

.edit__row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12.5px;
  color: rgba(255, 255, 255, .55);
}

.edit__row > span { flex: 0 0 82px; }

.edit__input {
  flex: 1 1 auto;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(0, 0, 0, .26);
  color: #fff;
  font-size: 13px;
  outline: none;
}

.edit__input:disabled { opacity: .5; }

.edit__list { display: flex; flex-direction: column; gap: 10px; }

.edit__item { display: flex; flex-direction: column; gap: 6px; }

.edit__key {
  font-size: 10.5px;
  letter-spacing: .06em;
  color: rgba(255, 255, 255, .34);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.edit__field {
  width: 100%;
  min-height: 40px;
  padding: 9px 12px;
  border-radius: 11px;
  border: 1px solid rgba(255, 255, 255, .10);
  background: rgba(0, 0, 0, .24);
  color: #fff;
  font-size: 13.5px;
  outline: none;
  resize: none;
  line-height: 1.4;
}

.edit__field:focus { border-color: rgba(243, 86, 137, .6); }

[dir="rtl"] .readout__cap,
[dir="rtl"] .tabs,
[dir="rtl"] .status { direction: rtl; }

@media (max-height: 700px) {
  .viz { min-height: 110px; }
  .readout { margin-top: 8px; }
  .sliders { gap: 12px; margin-top: 14px; }
  .transport { margin-top: 14px; }
  .foot { margin-top: 12px; }
}

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