/* 米家照片拼版台 · 胶片暗房放大台
   暗房炭黑 + 安全灯琥珀红 + 银盐暖白。
   桌面端双栏工作台，手机端固定画布 + 底部四格抽屉。 */

:root {
  --bg: #110e0d;
  --bg-deep: #0d0a09;
  --bg-lift: #1f1815;
  --panel: #1a1513;
  --card: #241d1a;
  --card-hi: #2b2320;
  --line: rgba(255, 224, 194, 0.1);
  --line-hi: rgba(255, 224, 194, 0.2);
  --amber: #e55b2b;
  --amber-hi: #f27644;
  --amber-soft: rgba(229, 91, 43, 0.16);
  --ink: #f2ece4;
  --muted: #a79c91;
  --dim: #6f655d;
  --green: #4ade80;
  --green-soft: rgba(34, 197, 94, 0.15);
  --warn: #fbbf24;
  --warn-soft: rgba(245, 158, 11, 0.16);
  --red: #f87171;
  --red-soft: rgba(239, 68, 68, 0.16);
  --radius: 2px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100vh;
  height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
h3,
p {
  margin: 0;
}

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

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(242, 118, 68, 0.6);
  outline-offset: 2px;
}

::selection {
  background: rgba(229, 91, 43, 0.4);
  color: #fff;
}

/* ============ 顶栏 ============ */

.topbar {
  flex: 0 0 auto;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  background: linear-gradient(180deg, #1d1714 0%, #171210 100%);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 5;
}

.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(229, 91, 43, 0.35), transparent);
  pointer-events: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.brand-mark {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 3px;
  background: radial-gradient(circle at 35% 30%, #f27644, #c7461c 78%);
  color: #1c0d06;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 0 0 1px rgba(255, 214, 186, 0.22) inset,
    0 6px 18px rgba(229, 91, 43, 0.28);
}

.brand-text h1 {
  font-size: 15px;
  font-weight: 650;
  letter-spacing: 0.3px;
}

.brand-text p {
  margin-top: 2px;
  font-size: 11.5px;
  color: var(--muted);
}

.view-switch {
  display: flex;
  gap: 2px;
  margin-left: 8px;
  padding: 3px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 3px;
}

.view-tab {
  border: 0;
  background: transparent;
  padding: 6px 14px;
  border-radius: 2px;
  font-size: 12.5px;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.16s, color 0.16s, box-shadow 0.16s;
}

.view-tab:hover {
  color: var(--ink);
}

.view-tab.is-active {
  background: linear-gradient(180deg, #3a2c25, #2a211c);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 0 rgba(255, 224, 194, 0.12) inset,
    0 2px 6px rgba(0, 0, 0, 0.35);
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.lbl-short {
  display: none;
}

/* ============ 按钮 ============ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 3px;
  font-size: 12.5px;
  font-weight: 550;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s, border-color 0.16s, color 0.16s, opacity 0.16s,
    box-shadow 0.16s;
}

.btn-primary {
  background: linear-gradient(180deg, #f27644 0%, #e55b2b 62%, #d24e21 100%);
  color: #1b0d06;
  font-weight: 700;
  box-shadow: 0 1px 0 rgba(255, 232, 214, 0.4) inset,
    0 4px 14px rgba(229, 91, 43, 0.26);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #ff8a58 0%, #f27644 60%, #e55b2b 100%);
}

.btn-ghost {
  background: rgba(255, 224, 194, 0.04);
  border-color: var(--line);
  color: var(--ink);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 224, 194, 0.09);
  border-color: var(--line-hi);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  height: 44px;
  font-size: 13.5px;
  margin-top: 10px;
}

.btn-mini {
  height: 28px;
  padding: 0 10px;
  font-size: 11.5px;
  background: rgba(255, 224, 194, 0.05);
  border-color: var(--line);
  color: var(--ink);
}

.btn-mini:hover {
  background: rgba(255, 224, 194, 0.1);
  border-color: var(--line-hi);
}

.btn:disabled,
button:disabled {
  opacity: 0.38;
  cursor: not-allowed;
  box-shadow: none;
}

/* ============ 主区 ============ */

.workspace {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
}

.canvas-pane {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px 12px;
  background: radial-gradient(120% 88% at 50% 0%, #1f1815 0%, #14100e 56%, #0d0a09 100%);
  position: relative;
}

.canvas-pane::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    46% 34% at 50% 6%,
    rgba(229, 91, 43, 0.09),
    rgba(229, 91, 43, 0) 70%
  );
  pointer-events: none;
}

.canvas-head {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.paper-info {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.paper-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.paper-px {
  font-size: 11.5px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.stat-row {
  display: flex;
  gap: 6px;
}

.stat-chip {
  padding: 4px 9px;
  border-radius: 2px;
  border: 1px solid var(--line);
  background: rgba(255, 224, 194, 0.04);
  color: var(--muted);
  font-size: 11.5px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.stat-chip.is-green {
  color: var(--green);
  background: var(--green-soft);
  border-color: rgba(74, 222, 128, 0.28);
}

.stat-chip.is-amber {
  color: var(--warn);
  background: var(--warn-soft);
  border-color: rgba(251, 191, 36, 0.28);
}

.stat-chip.is-red {
  color: var(--red);
  background: var(--red-soft);
  border-color: rgba(248, 113, 113, 0.3);
}

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
  background: radial-gradient(112% 86% at 50% 12%, #241c18 0%, #15100e 58%, #0b0908 100%);
  box-shadow: inset 0 1px 0 rgba(255, 224, 194, 0.07),
    inset 0 -40px 70px rgba(0, 0, 0, 0.35);
  transition: box-shadow 0.16s;
}

body.is-dragover .stage {
  box-shadow: inset 0 0 0 2px var(--amber-hi),
    inset 0 1px 0 rgba(255, 224, 194, 0.12);
}

.stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.stage-foot {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 0 4px;
  font-size: 11.5px;
  color: var(--dim);
}

.foot-note {
  flex: 0 0 auto;
  color: var(--dim);
}

/* ============ 空状态 ============ */

.dropzone {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  cursor: pointer;
}

.dz-paper {
  position: relative;
  height: min(88%, 540px);
  width: auto;
  max-width: 94%;
  aspect-ratio: 100 / 148;
  overflow: hidden;
  background: #fff;
  border-radius: 0;
  box-shadow: 0 26px 60px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 236, 215, 0.16),
    0 0 46px rgba(229, 91, 43, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.dz-dash {
  position: absolute;
  inset: 11px;
  border: 1.5px dashed #d6dce5;
  border-radius: 0;
  pointer-events: none;
}

.dz-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 18px;
  max-width: 100%;
  max-height: 100%;
}

.dz-icon {
  width: 34px;
  height: 34px;
  border-radius: 2px;
  background: rgba(229, 91, 43, 0.08);
  color: #c7461c;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 300;
  line-height: 1;
}

.dz-inner h2 {
  margin-top: 10px;
  font-size: 14.5px;
  font-weight: 650;
  color: #1a1512;
}

.dz-inner p {
  margin-top: 4px;
  font-size: 11.5px;
  color: #6b6159;
  line-height: 1.5;
}

.dz-steps {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  text-align: left;
  font-size: 11px;
  color: #4a423b;
  line-height: 1.9;
}

.dz-steps li {
  display: flex;
  gap: 7px;
  align-items: baseline;
}

.dz-steps b {
  color: #c7461c;
  font-weight: 600;
}

.dz-btn {
  margin-top: 13px;
  height: 32px;
  padding: 0 18px;
  font-size: 12px;
}

/* ============ 右侧面板 ============ */

.panel {
  flex: 0 0 372px;
  background: linear-gradient(180deg, #1b1614 0%, #161110 100%);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #3a2f29 transparent;
}

.panel::-webkit-scrollbar {
  width: 10px;
}

.panel::-webkit-scrollbar-thumb {
  background: #3a2f29;
  border-radius: 3px;
  border: 3px solid #171210;
}

.panel-section {
  padding: 16px 18px 17px;
  border-bottom: 1px solid var(--line);
}

.panel-section:last-child {
  border-bottom: 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 11px;
}

.section-head h2 {
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0.2px;
}

.section-hint {
  font-size: 11px;
  color: var(--dim);
}

.micro-hint {
  margin-top: 7px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--dim);
}

/* 照片列表 */

.photo-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.photo-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(255, 224, 194, 0.03);
  cursor: grab;
  transition: border-color 0.16s, background 0.16s, box-shadow 0.16s;
}

.photo-row:hover {
  border-color: var(--line-hi);
}

.photo-row.is-selected {
  border-color: rgba(242, 118, 68, 0.75);
  background: rgba(229, 91, 43, 0.09);
  box-shadow: 0 0 0 2px rgba(229, 91, 43, 0.1);
}

.photo-row.is-dragging {
  opacity: 0.45;
}

.photo-slot {
  flex: 0 0 auto;
  width: 21px;
  height: 21px;
  border-radius: 2px;
  background: rgba(255, 224, 194, 0.07);
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  display: grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}

.photo-row.is-selected .photo-slot {
  background: rgba(229, 91, 43, 0.24);
  color: var(--amber-hi);
}

.photo-thumb {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 0;
  overflow: hidden;
  background: #100d0b;
  box-shadow: 0 0 0 1px rgba(255, 236, 215, 0.12) inset;
}

.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.photo-meta {
  flex: 1 1 auto;
  min-width: 0;
}

.photo-name {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}

.photo-sub {
  margin-top: 2px;
  font-size: 10.5px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.photo-actions {
  flex: 0 0 auto;
  display: flex;
  gap: 4px;
}

/* 上移 / 下移是触屏专用；桌面用拖拽换位 */
.mini-btn[data-act="up"],
.mini-btn[data-act="down"] {
  display: none;
}

.mini-btn {
  height: 26px;
  padding: 0 7px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(255, 224, 194, 0.04);
  color: var(--muted);
  font-size: 10.5px;
  cursor: pointer;
  white-space: nowrap;
}

.mini-btn:hover {
  border-color: var(--line-hi);
  color: var(--ink);
}

.mini-btn.danger:hover {
  color: var(--red);
  border-color: rgba(248, 113, 113, 0.4);
  background: var(--red-soft);
}

.upload-btn {
  width: 100%;
  height: 38px;
  margin-top: 9px;
  border: 1px dashed rgba(229, 91, 43, 0.42);
  border-radius: 3px;
  background: rgba(229, 91, 43, 0.05);
  color: var(--amber-hi);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.16s, border-color 0.16s;
}

.upload-btn:hover:not(:disabled) {
  background: rgba(229, 91, 43, 0.12);
  border-color: rgba(242, 118, 68, 0.7);
}

/* 推荐版式（接触印相） */

.candidate-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  min-height: 0;
}

.cand-card {
  display: block;
  position: relative;
  padding: 6px 6px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: linear-gradient(180deg, #261e1b 0%, #1e1815 100%);
  box-shadow: inset 0 1px 0 rgba(255, 224, 194, 0.06);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s, box-shadow 0.16s, transform 0.12s;
}

.cand-card:hover {
  border-color: var(--line-hi);
}

.cand-card:active {
  transform: scale(0.992);
}

.cand-card.is-active {
  border-color: rgba(242, 118, 68, 0.85);
  box-shadow: 0 0 0 2px rgba(229, 91, 43, 0.16),
    0 8px 20px rgba(0, 0, 0, 0.35);
}

.cand-thumb {
  display: block;
  width: 100%;
  height: 126px;
  border-radius: 0;
  background: #0f0c0a;
}

.cand-body {
  padding: 6px 3px 0;
}

.cand-name {
  display: block;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cand-crop {
  display: block;
  margin-top: 1px;
  font-size: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.cand-crop.is-green {
  color: var(--green);
}

.cand-crop.is-amber {
  color: var(--warn);
}

.cand-crop.is-red {
  color: var(--red);
}

.cand-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 4px;
  min-height: 16px;
}

.tag {
  padding: 1px 6px;
  border-radius: 2px;
  background: rgba(255, 224, 194, 0.07);
  color: var(--muted);
  font-size: 9.5px;
  white-space: nowrap;
}

.tag-blue {
  background: rgba(229, 91, 43, 0.16);
  color: var(--amber-hi);
}

.tag-green {
  background: var(--green-soft);
  color: var(--green);
}

/* 微调 */

.cell-pick {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.cell-chip {
  height: 34px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(255, 224, 194, 0.04);
  color: var(--muted);
  font-size: 11.5px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.cell-chip:hover {
  border-color: var(--line-hi);
  color: var(--ink);
}

.cell-chip.is-active {
  border-color: rgba(242, 118, 68, 0.8);
  background: rgba(229, 91, 43, 0.14);
  color: var(--amber-hi);
}

.adjust-empty {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 3px;
  background: rgba(255, 224, 194, 0.025);
  text-align: center;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--dim);
}

.adjust-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.row-label {
  flex: 0 0 auto;
  width: 56px;
  font-size: 11.5px;
  color: var(--muted);
}

.adjust-row input[type="range"] {
  flex: 1 1 auto;
  min-width: 0;
}

.cell-size {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.value-badge {
  min-width: 52px;
  padding: 3px 8px;
  border-radius: 2px;
  background: rgba(255, 224, 194, 0.06);
  color: var(--ink);
  font-size: 11px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.adjust-block {
  margin-bottom: 11px;
}

.segmented {
  display: flex;
  gap: 2px;
  margin-top: 5px;
  padding: 3px;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid var(--line);
  border-radius: 3px;
}

.segmented button {
  flex: 1;
  min-width: 0;
  border: 0;
  border-radius: 2px;
  background: transparent;
  padding: 6px 4px;
  color: var(--muted);
  font-size: 11.5px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.16s, color 0.16s, box-shadow 0.16s;
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button.is-active {
  background: linear-gradient(180deg, #3c2d26, #2a211c);
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 0 rgba(255, 224, 194, 0.12) inset,
    0 2px 5px rgba(0, 0, 0, 0.3);
}

.swap-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}

.swap-btn {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(255, 224, 194, 0.04);
  color: var(--muted);
  font-size: 11px;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
}

.swap-btn:hover {
  border-color: rgba(242, 118, 68, 0.6);
  background: rgba(229, 91, 43, 0.12);
  color: var(--amber-hi);
}

/* 相纸设置 */

.paper-chips {
  display: none;
}

.field {
  margin-bottom: 12px;
}

.field:last-child {
  margin-bottom: 0;
}

.field-label {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
}

.field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1px;
}

select {
  width: 100%;
  height: 36px;
  margin-top: 5px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: #211a17;
  color: var(--ink);
  font-family: inherit;
  font-size: 12px;
}

.custom-row {
  display: flex;
  gap: 8px;
  margin-top: 7px;
}

.custom-row label {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--muted);
}

.custom-row input {
  width: 100%;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #211a17;
  font-family: inherit;
  font-size: 12px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

input[type="range"] {
  width: 100%;
  height: 20px;
  margin: 2px 0 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 2px;
  background: #3a302a;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  margin-top: -5.5px;
  border-radius: 2px;
  border: 2px solid #f27644;
  background: #1b1411;
  box-shadow: 0 0 0 3px rgba(229, 91, 43, 0.12);
}

input[type="range"]::-moz-range-track {
  height: 4px;
  border-radius: 2px;
  background: #3a302a;
}

input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 2px;
  border: 2px solid #f27644;
  background: #1b1411;
}

.swatch-row {
  display: flex;
  gap: 7px;
  margin-top: 6px;
}

.swatch-row button {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(255, 224, 194, 0.04);
  color: var(--muted);
  font-size: 10.5px;
  cursor: pointer;
}

.swatch-row button i {
  display: block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 1px solid rgba(255, 236, 215, 0.3);
}

.swatch-row button.is-active {
  border-color: rgba(242, 118, 68, 0.8);
  color: var(--ink);
  background: rgba(229, 91, 43, 0.1);
  box-shadow: 0 0 0 2px rgba(229, 91, 43, 0.1);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.switch-row:first-of-type {
  border-top: 0;
  padding-top: 2px;
}

.switch-row .field-label {
  color: var(--ink);
  font-size: 11.5px;
}

.switch-row small {
  display: block;
  margin-top: 2px;
  font-size: 10.5px;
  line-height: 1.45;
  color: var(--dim);
}

.switch-row.is-sub {
  border-top: 0;
  padding: 6px 0 8px;
  margin-top: -2px;
}

.switch-row.is-sub > div {
  position: relative;
  padding-left: 12px;
}

.switch-row.is-sub > div::before {
  content: "";
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 2px;
  border-radius: 2px;
  background: rgba(255, 224, 194, 0.1);
}

.switch-row.is-sub .field-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
}

.switch-row.is-sub small {
  font-size: 10px;
}

.switch-row.is-sub .switch {
  width: 32px;
  height: 18px;
}

.switch-row.is-sub .switch span::after {
  width: 12px;
  height: 12px;
  top: 3px;
  left: 3px;
}

.switch-row.is-sub .switch input:checked + span::after {
  transform: translateX(14px);
}

.switch {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 22px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 2px;
  background: #3d322c;
  cursor: pointer;
  transition: background 0.18s, box-shadow 0.18s;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 2px;
  background: #d9cec3;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  transition: transform 0.18s, background 0.18s;
}

.switch input:checked + span {
  background: linear-gradient(180deg, #f27644, #d24e21);
  box-shadow: 0 0 12px rgba(229, 91, 43, 0.3);
}

.switch input:checked + span::after {
  transform: translateX(16px);
  background: #fff8f2;
}

/* 导出 */

.panel-export {
  border-bottom: 0;
}

.export-meta {
  margin-top: 9px;
  font-size: 11px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.export-warn {
  margin-top: 9px;
  padding: 8px 10px;
  border: 1px solid rgba(251, 191, 36, 0.28);
  border-radius: 2px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 11px;
  line-height: 1.55;
}

/* ============ 底部 Tab（仅手机） ============ */

.tabbar {
  display: none;
}

/* ============ 提示条 ============ */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  z-index: 60;
  max-width: 80vw;
  padding: 9px 16px;
  border-radius: 2px;
  background: rgba(36, 29, 26, 0.96);
  border: 1px solid var(--line-hi);
  color: var(--ink);
  font-size: 12px;
  text-align: center;
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

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

/* ============ 成图预览弹窗 ============ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 6, 5, 0.84);
}

.modal-card {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  padding: 14px 14px 15px;
  border: 1px solid var(--line-hi);
  border-radius: 4px;
  background: linear-gradient(180deg, #241d1a 0%, #1a1513 100%);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.66),
    0 0 0 1px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 224, 194, 0.08);
  animation: modalIn 0.22s ease;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.modal-head h2 {
  font-size: 14px;
  font-weight: 650;
}

.modal-sub {
  margin-top: 2px;
  font-size: 11px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.modal-close {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(255, 224, 194, 0.05);
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  color: var(--ink);
  border-color: var(--line-hi);
}

.modal-preview {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  place-items: center;
  margin: 10px 0;
  padding: 10px;
  border-radius: 3px;
  background: radial-gradient(90% 80% at 50% 40%, #2a211c 0%, #120e0c 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 224, 194, 0.06);
  overflow: hidden;
}

.modal-preview img {
  display: block;
  max-width: 100%;
  max-height: 50vh;
  max-height: 50dvh;
  border-radius: 0;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
  -webkit-touch-callout: default;
  -webkit-user-select: auto;
  user-select: auto;
}

.modal-hint {
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--muted);
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 11px;
}

.modal-actions .btn {
  height: 44px;
  font-size: 13px;
}

/* ============ 自适应：手机 / 窄屏 ============ */

@media (max-height: 640px) and (min-width: 901px) {
  .dz-steps,
  .dz-icon {
    display: none;
  }
  .dz-inner h2 {
    margin-top: 0;
  }
}

@media (max-width: 900px) {
  .topbar {
    height: calc(46px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 12px 0;
    gap: 8px;
  }

  .brand {
    gap: 8px;
  }

  .brand-mark {
    width: 26px;
    height: 26px;
    border-radius: 2px;
    font-size: 13px;
  }

  .brand-text h1 {
    font-size: 13px;
    white-space: nowrap;
  }

  .brand-text p {
    display: none;
  }

  .view-switch {
    margin-left: 0;
    padding: 2px;
    border-radius: 3px;
  }

  .view-tab {
    padding: 8px 10px;
    font-size: 12px;
    border-radius: 2px;
  }

  .lbl-long {
    display: none;
  }

  .lbl-short {
    display: inline;
  }

  .topbar-actions {
    gap: 6px;
  }

  .topbar-actions .btn {
    height: 40px;
    padding: 0 11px;
    font-size: 12px;
    border-radius: 3px;
  }

  .workspace {
    flex-direction: column;
    min-height: 0;
  }

  .canvas-pane {
    flex: 0 0 auto;
    height: 50dvh;
    min-height: 218px;
    gap: 6px;
    padding: 8px 10px 4px;
  }

  .canvas-head {
    flex-wrap: nowrap;
    gap: 8px;
  }

  .paper-info {
    flex: 1 1 auto;
    overflow: hidden;
  }

  .paper-title {
    font-size: 11.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .paper-px {
    display: none;
  }

  .stat-row {
    flex: 0 0 auto;
  }

  .stat-chip.is-avg {
    display: none;
  }

  .stat-chip {
    padding: 3px 8px;
    font-size: 10.5px;
  }

  .stage {
    border-radius: 2px;
  }

  .stage-foot {
    display: none;
  }

  .dropzone {
    padding: 10px;
  }

  .dz-paper {
    height: 90%;
    max-width: 100%;
    border-radius: 0;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 236, 215, 0.16);
  }

  .dz-dash {
    inset: 7px;
  }

  .dz-inner {
    padding: 10px;
  }

  .dz-icon,
  .dz-steps {
    display: none;
  }

  .dz-inner h2 {
    margin-top: 0;
    font-size: 12.5px;
  }

  .dz-inner p {
    margin-top: 2px;
    font-size: 10.5px;
    line-height: 1.4;
  }

  .dz-btn {
    height: 36px;
    margin-top: 8px;
    padding: 0 16px;
    font-size: 12px;
  }

  .panel {
    flex: 1 1 auto;
    width: 100%;
    min-height: 0;
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .panel-section {
    display: none;
    padding: 12px 14px 22px;
    border-bottom: 0;
  }

  .panel-section.is-current {
    display: block;
  }

  .section-head {
    margin-bottom: 10px;
  }

  .section-head h2 {
    font-size: 12.5px;
  }

  .candidate-grid {
    gap: 8px;
  }

  .cand-card {
    padding: 5px 5px 7px;
  }

  .cand-thumb {
    height: 104px;
  }

  .cand-name {
    font-size: 11px;
  }

  .cand-tags {
    min-height: 15px;
  }

  .tag {
    font-size: 9px;
    padding: 1px 5px;
  }

  /* 照片：触屏两行式条目，按钮够大拇指 */
  .photo-row {
    display: grid;
    grid-template-columns: 22px 48px minmax(0, 1fr);
    grid-template-areas:
      "slot thumb meta"
      "actions actions actions";
    align-items: center;
    gap: 8px 9px;
    padding: 9px 10px;
  }

  .photo-slot {
    grid-area: slot;
  }

  .photo-thumb {
    grid-area: thumb;
    width: 48px;
    height: 48px;
  }

  .photo-meta {
    grid-area: meta;
  }

  .photo-actions {
    grid-area: actions;
    display: flex;
    gap: 6px;
    margin-top: 2px;
  }

  .photo-actions .mini-btn {
    flex: 1 1 0;
    height: 40px;
    padding: 0 6px;
    font-size: 11.5px;
    border-radius: 2px;
  }

  .mini-btn[data-act="up"],
  .mini-btn[data-act="down"] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .upload-btn {
    height: 44px;
    margin-top: 10px;
    font-size: 12.5px;
  }

  .micro-hint {
    font-size: 10.5px;
  }

  .cell-pick {
    gap: 7px;
    margin-bottom: 11px;
  }

  .cell-chip {
    flex: 1 1 0;
    min-width: 68px;
    height: 40px;
    padding: 0 8px;
    font-size: 12px;
  }

  .adjust-empty {
    padding: 16px 14px;
  }

  .adjust-row {
    margin-bottom: 12px;
  }

  .row-label {
    width: 48px;
    font-size: 12px;
  }

  .btn-mini {
    height: 40px;
    padding: 0 14px;
    font-size: 12px;
    border-radius: 3px;
  }

  .cell-size {
    font-size: 11.5px;
  }

  .value-badge {
    min-width: 56px;
    padding: 4px 8px;
    font-size: 11.5px;
  }

  input[type="range"] {
    height: 44px;
  }

  input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
  }

  input[type="range"]::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
    margin-top: -7px;
  }

  input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 3px;
  }

  input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
  }

  .segmented button {
    height: 40px;
    font-size: 12px;
  }

  .swap-btn {
    height: 40px;
    padding: 0 14px;
    font-size: 12px;
    border-radius: 3px;
  }

  .btn-touch {
    height: 44px;
    font-size: 13px;
  }

  .switch-row {
    padding: 12px 0;
  }

  .switch {
    width: 46px;
    height: 28px;
  }

  .switch span::after {
    width: 22px;
    height: 22px;
  }

  .switch input:checked + span::after {
    transform: translateX(18px);
  }

  .switch-row.is-sub .switch {
    width: 38px;
    height: 22px;
  }

  .switch-row.is-sub .switch span::after {
    width: 16px;
    height: 16px;
    top: 3px;
    left: 3px;
  }

  .switch-row.is-sub .switch input:checked + span::after {
    transform: translateX(16px);
  }

  .field-select {
    display: none;
  }

  .paper-chips {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
  }

  .paper-chip {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 1px;
    height: 52px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: rgba(255, 224, 194, 0.04);
    color: var(--ink);
    font-size: 12.5px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
  }

  .paper-chip small {
    font-size: 10px;
    font-weight: 400;
    color: var(--dim);
    font-variant-numeric: tabular-nums;
  }

  .paper-chip.is-active {
    border-color: rgba(242, 118, 68, 0.8);
    background: rgba(229, 91, 43, 0.12);
    box-shadow: 0 0 0 2px rgba(229, 91, 43, 0.1);
  }

  .paper-chip.is-active small {
    color: rgba(255, 214, 186, 0.75);
  }

  .swatch-row button {
    height: 40px;
  }

  .btn-lg {
    height: 46px;
    font-size: 13.5px;
  }

  .tabbar {
    position: relative;
    flex: 0 0 auto;
    display: flex;
    height: calc(54px + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: linear-gradient(180deg, #1d1714 0%, #130f0d 100%);
    border-top: 1px solid var(--line-hi);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.35);
    z-index: 6;
  }

  .tab-btn {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border: 0;
    background: transparent;
    color: var(--dim);
    font-size: 10.5px;
    cursor: pointer;
    transition: color 0.16s;
  }

  .tab-btn svg {
    width: 20px;
    height: 20px;
  }

  .tab-btn:active {
    background: rgba(255, 224, 194, 0.04);
  }

  .tab-btn.is-active {
    color: var(--amber-hi);
  }

  .tab-btn.is-active::after {
    content: "";
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 26px;
    height: 2px;
    border-radius: 2px;
    background: var(--amber-hi);
    box-shadow: 0 0 10px rgba(242, 118, 68, 0.8);
  }

  .toast {
    bottom: calc(66px + env(safe-area-inset-bottom));
    max-width: 84vw;
    font-size: 11.5px;
  }

  .modal {
    padding: 12px;
    padding-top: calc(12px + env(safe-area-inset-top));
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    align-items: center;
  }

  .modal-card {
    width: 100%;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
    border-radius: 4px;
    padding: 12px 12px 13px;
  }

  .modal-preview img {
    max-height: 46dvh;
  }

  .modal-hint {
    font-size: 11px;
  }

  .modal-actions .btn {
    height: 46px;
  }
}

@media (max-width: 560px) {
  .brand-text {
    display: none;
  }

  .canvas-pane {
    height: 50dvh;
    min-height: 206px;
    padding: 7px 8px 3px;
  }

  .cand-thumb {
    height: 96px;
  }
}

@media (max-width: 380px) {
  .view-tab {
    padding: 5px 8px;
    font-size: 11.5px;
  }

  .topbar-actions .btn {
    padding: 0 8px;
    font-size: 11px;
  }

  .cand-thumb {
    height: 88px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
