/* =========================================================
 *  图片压缩 · 样式
 *
 *  视觉基调对齐 iOS：系统色板、连续大圆角、毛玻璃、
 *  轻描边 + 柔和多层投影，交互带一点点回弹。
 * ========================================================= */

:root {
  --bg: #f5f5f7;
  --card: #ffffff;
  --card-t: rgba(255, 255, 255, .78);
  --fill: rgba(120, 120, 128, .12);
  --fill2: rgba(120, 120, 128, .08);
  --line: rgba(60, 60, 67, .12);
  --line2: rgba(60, 60, 67, .06);

  --tx: #1c1c1e;
  --tx2: rgba(60, 60, 67, .62);
  --tx3: rgba(60, 60, 67, .34);

  --brand: #0a84ff;
  --brand-d: #0071e3;
  --brand-soft: rgba(10, 132, 255, .1);
  --ok: #34c759;
  --err: #ff3b30;
  --gold: #ff9f0a;

  --r: 16px;
  --r-sm: 10px;
  --r-lg: 28px;

  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 28px rgba(0, 0, 0, .06);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, .05), 0 20px 50px rgba(0, 0, 0, .12);
  --ease: cubic-bezier(.32, .72, 0, 1);
}

* { box-sizing: border-box; }

/* .mask / .studio 这些自己带了 display，会盖掉 hidden 的默认样式，这里统一兜住 */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--tx);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro SC",
        "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -.01em;
  display: flex;
  flex-direction: column;
}

button { font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input { font: inherit; }
a { color: inherit; text-decoration: none; }

/* 手绘图标统一尺寸，跟着文字颜色走 */
.ic {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -.14em;
  flex: none;
}

/* ---------------- 顶栏 ---------------- */

.top {
  height: 54px;
  padding: 0 20px;
  background: rgba(245, 245, 247, .78);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex: none;
  position: relative;
  z-index: 10;
}

.logo { display: flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 600; }
.logo-ic {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 9px;
  background: linear-gradient(160deg, #4aa4ff, var(--brand));
  color: #fff;
  font-size: 18px;
  box-shadow: 0 2px 8px rgba(10, 132, 255, .32);
}

.top-nav { display: flex; align-items: center; gap: 14px; }
.top-nav > a { color: var(--tx2); font-size: 14px; transition: color .2s; }
.top-nav > a:hover { color: var(--brand); }

.btn-primary {
  height: 34px;
  padding: 0 17px;
  border: 0;
  border-radius: 99px;
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 2px 10px rgba(10, 132, 255, .26);
  transition: transform .25s var(--ease), background .2s, box-shadow .2s;
}
.btn-primary:hover { background: var(--brand-d); }
.btn-primary:active { transform: scale(.96); }
.btn-primary:disabled { background: var(--fill); color: var(--tx3); box-shadow: none; cursor: not-allowed; transform: none; }

.btn-ghost {
  height: 34px;
  padding: 0 15px;
  border: 0;
  border-radius: 99px;
  background: var(--fill);
  color: var(--tx);
  font-size: 14px;
  transition: transform .25s var(--ease), background .2s;
}
.btn-ghost:hover { background: rgba(120, 120, 128, .2); }
.btn-ghost:active { transform: scale(.96); }

.big { width: 100%; height: 46px; font-size: 16px; border-radius: 15px; }

.link {
  border: 0;
  background: none;
  padding: 0;
  color: var(--brand);
  font-size: inherit;
}
.link:hover { opacity: .7; }
.link.danger { color: var(--err); }

.me { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.me img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.me-ic {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--fill);
  color: var(--tx2);
  font-size: 17px;
}
.me-name { max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  padding: 2px 8px;
  border-radius: 99px;
  background: rgba(255, 159, 10, .16);
  color: #b26a00;
  font-size: 12px;
  font-weight: 500;
}

/* 会员功能角标。已是会员就没必要再提示，用 body.is-pro 统一隐藏 */
.vip-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 5px;
  background: linear-gradient(135deg, #ffb340, #ff9f0a);
  color: #fff;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: .04em;
  vertical-align: 1.5px;
}
.vip-tag.sm {
  padding: 0 5px;
  font-size: 9.5px;
  vertical-align: 1px;
}
body.is-pro .vip-tag { display: none; }

/* ---------------- 落地页 ---------------- */

.wrap { flex: 1; display: flex; flex-direction: column; min-height: 0; }

.hero {
  position: relative;
  max-width: 820px;
  margin: 0 auto;
  padding: 76px 20px 60px;
  text-align: center;
}
/* 首屏顶上铺一层很淡的光晕，比纯灰底有空气感 */
.hero::before {
  content: '';
  position: absolute;
  inset: -120px -40px auto;
  height: 420px;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(46rem 24rem at 26% 0%, rgba(10, 132, 255, .12), transparent 62%),
    radial-gradient(36rem 20rem at 82% 12%, rgba(52, 199, 89, .09), transparent 60%);
}
.hero h1 {
  margin: 0 0 14px;
  font-size: 42px;
  line-height: 1.16;
  font-weight: 700;
  letter-spacing: -.028em;
}
.hero .sub { margin: 0 auto 34px; max-width: 560px; color: var(--tx2); font-size: 17px; }

.drop {
  padding: 54px 20px;
  border: 1.5px dashed rgba(60, 60, 67, .22);
  border-radius: var(--r-lg);
  background: var(--card-t);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .03);
  transition: border-color .3s var(--ease), background .3s, transform .3s var(--ease), box-shadow .3s;
}
.drop:hover { border-color: rgba(10, 132, 255, .45); }
.drop.over {
  border-color: var(--brand);
  background: rgba(10, 132, 255, .06);
  transform: scale(1.012);
  box-shadow: var(--shadow);
}
.drop-ic {
  width: 62px; height: 62px;
  margin: 0 auto;
  display: grid; place-items: center;
  border-radius: 19px;
  background: linear-gradient(160deg, rgba(10, 132, 255, .16), rgba(10, 132, 255, .06));
  color: var(--brand);
  font-size: 32px;
}
.drop-tx { margin-top: 16px; font-size: 16px; font-weight: 500; }
.drop-hint { margin-top: 6px; color: var(--tx3); font-size: 13px; }

.feats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 34px 0 0;
  padding: 0;
  list-style: none;
  text-align: left;
}
.feats li {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 16px;
  background: var(--card-t);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line2);
  border-radius: var(--r);
  color: var(--tx2);
  font-size: 13px;
  line-height: 1.5;
}
.feat-ic {
  width: 32px; height: 32px;
  padding: 6px;
  border-radius: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 32px;
}
.feats b { display: block; margin-bottom: 2px; color: var(--tx); font-size: 14px; }

/* ---------------- 常见问题 ---------------- */

.faq {
  margin: 40px 0 0;
  text-align: left;
}
.faq > h2 {
  margin: 0 0 14px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.02em;
}
.faq-item {
  padding: 18px 20px;
  margin-bottom: 10px;
  background: var(--card-t);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--line2);
  border-radius: var(--r);
}
.faq-item:last-child { margin-bottom: 0; }
.faq-item h3 { margin: 0 0 7px; font-size: 15px; font-weight: 600; }
.faq-item p { margin: 0; color: var(--tx2); font-size: 13.5px; line-height: 1.65; }

/* ---------------- 工作区 ---------------- */

.studio {
  flex: 1;
  display: grid;
  grid-template-columns: 258px 1fr 300px;
  gap: 14px;
  padding: 14px;
  min-height: 0;
}

.files, .panel {
  background: var(--card);
  border: 1px solid var(--line2);
  border-radius: var(--r);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.files-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line2);
  font-size: 13px;
  color: var(--tx2);
}
.files-head > span { flex: 1; font-weight: 500; color: var(--tx); }

.file-list { flex: 1; margin: 0; padding: 6px; list-style: none; overflow-y: auto; }

.file {
  position: relative;
  padding: 10px 30px 10px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .2s;
}
.file:hover { background: var(--fill2); }
.file.on { background: var(--brand-soft); }
.file-name {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-meta {
  margin-top: 2px;
  color: var(--tx3);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 16px;
}
.file-meta b { color: var(--tx); font-weight: 600; }
.file-meta .down { color: var(--ok); }
.file-meta .up { color: var(--err); }
.file-x {
  position: absolute;
  top: 50%;
  right: 7px;
  transform: translateY(-50%);
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: none;
  color: var(--tx3);
  font-size: 13px;
  transition: background .2s, color .2s;
}
.file-x:hover { background: rgba(255, 59, 48, .12); color: var(--err); }

.err { color: var(--err); }

/* ---------------- 进度 ---------------- */

.prog {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  flex: 1;
}
.prog-bar {
  flex: 1;
  min-width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--fill);
  overflow: hidden;
}
.prog-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 2px;
  background: var(--brand);
  transition: width .25s var(--ease);
}
.prog-n {
  flex: none;
  font-variant-numeric: tabular-nums;
  color: var(--tx2);
}
/* 已经有快速结果了，进度条退到背景里 */
.prog.thin .prog-bar { height: 3px; opacity: .55; }
.prog.thin .prog-n { color: var(--tx3); }
.prog-size { flex: none; color: var(--tx2); }

.stage-prog {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: var(--r-sm);
  background: var(--card-t);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: 1px solid var(--line2);
  font-size: 13px;
  color: var(--tx2);
}
.stage-prog-bar {
  flex: 1;
  height: 5px;
  border-radius: 3px;
  background: var(--fill);
  overflow: hidden;
}
.stage-prog-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--brand), #5ac8fa);
  transition: width .25s var(--ease);
}
.stage-prog span {
  flex: none;
  font-variant-numeric: tabular-nums;
}

/* ---------------- 舞台 ---------------- */

.stage {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.stage-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* iOS 分段控件 */
.seg {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border-radius: 11px;
  background: var(--fill);
}
.seg button {
  padding: 6px 15px;
  border: 0;
  border-radius: 9px;
  background: none;
  color: var(--tx2);
  font-size: 13px;
  transition: background .25s var(--ease), color .2s;
}
.seg button.on {
  background: #fff;
  color: var(--tx);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .1);
}
.seg.wide { display: flex; margin-bottom: 6px; }
.seg.wide button { flex: 1; padding: 6px 0; }

.zoom { display: flex; align-items: center; gap: 6px; color: var(--tx2); font-size: 13px; }
.zoom button {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--fill);
  color: var(--tx);
  font-size: 15px;
  transition: background .2s, transform .25s var(--ease);
}
.zoom button:hover { background: rgba(120, 120, 128, .2); }
.zoom button:active { transform: scale(.9); }

.canvas-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
  border-radius: var(--r);
  border: 1px solid var(--line2);
  background:
    linear-gradient(45deg, #ececf0 25%, transparent 25%, transparent 75%, #ececf0 75%),
    linear-gradient(45deg, #ececf0 25%, #f9f9fb 25%, #f9f9fb 75%, #ececf0 75%);
  background-size: 18px 18px;
  background-position: 0 0, 9px 9px;
  overflow: hidden;
}

.cmp {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  user-select: none;
  cursor: ew-resize;
  line-height: 0;
}
.cmp-img { display: block; max-width: 100%; max-height: calc(100vh - 260px); object-fit: contain; }
.cmp-clip {
  position: absolute;
  inset: 0;
  width: 50%;
  overflow: hidden;
}
.cmp-clip .cmp-img { max-width: none; }
.cmp-handle {
  position: absolute;
  top: 0; bottom: 0;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: rgba(255, 255, 255, .95);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .12);
}
.cmp-handle span {
  position: absolute;
  top: 50%; left: 50%;
  width: 34px; height: 34px;
  margin: -17px 0 0 -17px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 3px 12px rgba(0, 0, 0, .22);
}
.cmp-handle span::before,
.cmp-handle span::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 0; height: 0;
  margin-top: -4px;
  border: 4px solid transparent;
}
.cmp-handle span::before { left: 7px; border-right-color: var(--tx2); }
.cmp-handle span::after { right: 7px; border-left-color: var(--tx2); }

.stage-empty { position: absolute; color: var(--tx3); font-size: 14px; }

.stat {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 13px 18px;
  background: var(--card);
  border: 1px solid var(--line2);
  border-radius: var(--r);
  box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
}
.stat-cell label { display: block; color: var(--tx3); font-size: 12px; }
.stat-cell b { font-size: 17px; font-weight: 600; letter-spacing: -.02em; }
.stat-cell.arrow { color: var(--tx3); font-size: 18px; }
.stat-cell.save { margin-left: auto; text-align: right; }
.stat .down { color: var(--ok); }
.stat .up { color: var(--err); }

/* ---------------- 参数面板 ---------------- */

.panel { padding: 18px; gap: 22px; overflow-y: auto; }

.pgroup { display: block; }
.plabel {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
  font-size: 13px;
  font-weight: 600;
}
.plabel b { margin-left: auto; color: var(--brand); }
.ptip { margin: 7px 0 0; color: var(--tx3); font-size: 12px; line-height: 1.5; }

/* iOS 复选框 */
input[type=checkbox] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px; height: 20px;
  margin: 0;
  border: 1.5px solid rgba(60, 60, 67, .26);
  border-radius: 50%;
  background: transparent;
  transition: background .2s, border-color .2s;
  flex: none;
  cursor: pointer;
}
input[type=checkbox]:checked {
  border-color: var(--brand);
  background: var(--brand)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4.7 12.9c1.7 1.4 3.2 2.9 4.4 4.5 2.6-4.6 5.7-8.3 9.4-11.2'/%3E%3C/svg%3E")
    center / 14px no-repeat;
}

/* iOS 滑块 */
input[type=range] {
  width: 100%;
  height: 26px;
  appearance: none;
  -webkit-appearance: none;
  background: none;
}
input[type=range]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: var(--fill);
}
input[type=range]::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 22px; height: 22px;
  margin-top: -9px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .12), 0 3px 8px rgba(0, 0, 0, .18);
}
input[type=range]::-moz-range-track { height: 4px; border-radius: 2px; background: var(--fill); }
input[type=range]::-moz-range-thumb {
  width: 22px; height: 22px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 1px rgba(0, 0, 0, .12), 0 3px 8px rgba(0, 0, 0, .18);
}
.range-tick { display: flex; justify-content: space-between; color: var(--tx3); font-size: 11px; }

.row { display: flex; align-items: center; gap: 8px; }
.row input[type=number] {
  flex: 1;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--fill2);
  color: var(--tx);
  transition: box-shadow .2s;
}
.row input:focus { outline: none; box-shadow: 0 0 0 3px var(--brand-soft); }
.unit { color: var(--tx3); font-size: 13px; }

.quota {
  margin-top: auto;
  padding: 11px 13px;
  border-radius: var(--r-sm);
  background: var(--fill2);
  color: var(--tx2);
  font-size: 13px;
}
.quota b { color: var(--tx); }
.quota.pro { background: rgba(255, 159, 10, .12); color: #b26a00; }

/* ---------------- 页脚 ---------------- */

.foot {
  padding: 18px;
  border-top: 1px solid var(--line2);
  color: var(--tx3);
  font-size: 13px;
  text-align: center;
  flex: none;
}
.foot p { margin: 2px 0; }
.foot-links a { color: var(--tx2); transition: color .2s; }
.foot-links a:hover { color: var(--brand); }

/* ---------------- 弹窗 ---------------- */

.mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(0, 0, 0, .36);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  animation: fade .24s var(--ease);
}
@keyframes fade { from { opacity: 0; } }

.modal {
  position: relative;
  width: 100%;
  max-width: 370px;
  padding: 30px 26px;
  border-radius: var(--r-lg);
  background: var(--card);
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: pop .38s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(16px) scale(.96); } }

.modal.wide { max-width: 450px; }
.modal h3 { margin: 0 0 6px; font-size: 20px; font-weight: 600; letter-spacing: -.02em; }
.modal-sub { margin: 0 0 20px; color: var(--tx2); font-size: 13.5px; }
.modal-tip { margin: 16px 0 0; color: var(--tx3); font-size: 12.5px; }

.close {
  position: absolute;
  top: 12px; right: 12px;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--fill);
  color: var(--tx2);
  font-size: 16px;
  transition: background .2s;
}
.close:hover { background: rgba(120, 120, 128, .22); }

.qr {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}
.qr img { width: 200px; height: 200px; border-radius: 14px; }

.spin {
  width: 26px; height: 26px;
  border: 2.5px solid rgba(120, 120, 128, .18);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 20px; }
.plan {
  position: relative;
  display: block;
  padding: 17px 14px;
  border: 1.5px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  text-align: left;
  transition: border-color .25s, background .25s, transform .25s var(--ease);
}
.plan:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
}
.plan:active { transform: scale(.98); }
.plan input { position: absolute; opacity: 0; }
.plan-tag {
  position: absolute;
  top: -9px; right: 10px;
  padding: 2px 9px;
  border-radius: 99px;
  background: var(--gold);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
}
.plan-name { display: block; font-size: 14px; font-weight: 600; }
.plan-price { display: block; margin: 7px 0 4px; color: var(--brand); font-size: 13px; }
.plan-price b { font-size: 24px; font-weight: 700; letter-spacing: -.02em; }
.plan-price i { font-style: normal; font-size: 13px; }
.plan-desc { display: block; color: var(--tx3); font-size: 12px; line-height: 1.4; }

.pay-amt { margin: 12px 0 0; color: var(--tx2); font-size: 13px; }
.pay-amt b { color: var(--tx); font-size: 17px; }

/* ---------------- 提示条 ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 44px;
  z-index: 60;
  transform: translateX(-50%);
  padding: 11px 20px;
  border-radius: 99px;
  background: rgba(28, 28, 30, .86);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #fff;
  font-size: 14px;
  box-shadow: var(--shadow-lg);
  animation: pop .38s var(--ease);
}

/* ---------------- 深色模式 ---------------- */

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --card: #1c1c1e;
    --card-t: rgba(28, 28, 30, .72);
    --fill: rgba(120, 120, 128, .24);
    --fill2: rgba(120, 120, 128, .16);
    --line: rgba(84, 84, 88, .5);
    --line2: rgba(84, 84, 88, .3);
    --tx: #f5f5f7;
    --tx2: rgba(235, 235, 245, .62);
    --tx3: rgba(235, 235, 245, .32);
  }
  .top { background: rgba(0, 0, 0, .68); }
  .seg button.on { background: #48484a; color: #fff; }
  .drop { border-color: rgba(235, 235, 245, .2); }
  .canvas-wrap {
    background:
      linear-gradient(45deg, #2c2c2e 25%, transparent 25%, transparent 75%, #2c2c2e 75%),
      linear-gradient(45deg, #2c2c2e 25%, #1c1c1e 25%, #1c1c1e 75%, #2c2c2e 75%);
    background-size: 18px 18px;
    background-position: 0 0, 9px 9px;
  }
  .cmp-handle span { background: rgba(58, 58, 60, .9); }
  input[type=checkbox] { border-color: rgba(235, 235, 245, .3); }
  .toast { background: rgba(58, 58, 60, .92); }
}

/* ---------------- 移动端 ---------------- */

/* 平板到窄桌面：顶栏先把间距收一收 */
@media (max-width: 860px) {
  .top { padding: 0 16px; }
  .top-nav { gap: 10px; }
  .feats { gap: 10px; }
  .feats li { padding: 14px; }
}

@media (max-width: 1000px) {
  /* 单列以后内容比屏幕高，不能再让工作区跟着视口收缩，否则会压到页脚上 */
  html, body { height: auto; }
  .studio {
    display: flex;
    flex-direction: column;
    padding: 12px;
    flex: none;
    min-height: auto;
  }
  /* 手机上先看图，再看参数，文件列表放最后（多图时才用得上） */
  .stage { order: 1; }
  .panel { order: 2; overflow: visible; }
  .files { order: 3; max-height: 240px; }
  .cmp-img { max-height: 46vh; }
  .quota { margin-top: 4px; }
}

@media (max-width: 640px) {
  .top {
    height: 52px;
    /* 刘海屏横屏时左右会被切掉，用安全区兜住 */
    padding: 0 max(14px, env(safe-area-inset-left)) 0 max(14px, env(safe-area-inset-right));
    gap: 10px;
  }
  .logo { font-size: 15px; min-width: 0; }
  .logo-ic { width: 28px; height: 28px; font-size: 17px; }
  .logo-tx { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  /* 顶栏塞不下「更多工具」+「开通会员」+ 登录，纯链接收掉，页脚仍有入口 */
  .top-nav { gap: 8px; flex: none; }
  .top-nav > a { display: none; }
  .btn-primary { height: 32px; padding: 0 14px; font-size: 13.5px; }
  .btn-ghost { height: 32px; padding: 0 12px; font-size: 13.5px; }
  .me { gap: 6px; font-size: 13px; }
  .me-name { max-width: 68px; }

  .hero { padding: 34px 16px 34px; }
  .hero h1 { font-size: 27px; }
  .hero .sub { font-size: 15px; margin-bottom: 24px; }
  .drop { padding: 32px 14px; border-radius: 22px; }
  .drop-ic { width: 54px; height: 54px; border-radius: 17px; font-size: 28px; }
  .drop-tx { margin-top: 13px; font-size: 15px; }
  .feats { grid-template-columns: 1fr; gap: 10px; margin-top: 26px; }
  .faq { margin-top: 30px; }
  .faq > h2 { font-size: 18px; }
  .faq-item { padding: 15px 16px; }
  .faq-item h3 { font-size: 14.5px; }

  /* 工作区：三个视图按钮 + 缩放在窄屏容易撑开，允许换行 */
  .studio { padding: 10px; gap: 10px; }
  .stage-bar { flex-wrap: wrap; gap: 8px; }
  .seg button { padding: 6px 12px; }
  .canvas-wrap { min-height: 210px; }
  .cmp-img { max-height: 52vh; }
  /* 手指要能拖到分割线，圆点做大一点 */
  .cmp-handle span { width: 40px; height: 40px; margin: -20px 0 0 -20px; }

  .stat { gap: 10px; padding: 11px 13px; }
  .stat-cell label { font-size: 11.5px; }
  .stat-cell b { font-size: 15px; }
  .panel { padding: 15px; gap: 18px; }
  .files { max-height: 200px; }

  .plans { grid-template-columns: 1fr; }
  .mask { padding: 16px; }
  .modal { padding: 26px 20px; border-radius: 22px; }
  .qr { min-height: 176px; }
  .qr img { width: 176px; height: 176px; }

  .foot { padding: 16px 16px calc(20px + env(safe-area-inset-bottom)); }

  /* 提示条抬高一点，避开 iOS Safari 底部工具栏 */
  .toast {
    bottom: calc(26px + env(safe-area-inset-bottom));
    max-width: calc(100% - 32px);
    text-align: center;
  }
}
