/* ============================================
   六六拼豆 · MARD 图纸生成器
   移动优先 · 现代简洁风
   ============================================ */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f4f4f5;
  --border: #e4e4e7;
  --border-strong: #d4d4d8;
  --text: #18181b;
  --text-muted: #52525b;
  --text-subtle: #a1a1aa;
  --primary: #0f172a;
  --primary-hover: #1e293b;
  --accent: #fd543d;
  --accent-hover: #f13a20;
  --success: #16a34a;
  --danger: #dc2626;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 12px 32px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --sheet-h: 300px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --surface: #18181b;
    --surface-2: #27272a;
    --border: #27272a;
    --border-strong: #3f3f46;
    --text: #fafafa;
    --text-muted: #a1a1aa;
    --text-subtle: #71717a;
    --primary: #fafafa;
    --primary-hover: #e4e4e7;
    --shadow: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 12px 32px rgba(0,0,0,0.5);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* 关键：CSS 的 display 会覆盖 HTML 的 hidden 属性，必须显式声明 */
[hidden] { display: none !important; }

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Hiragino Sans GB", "Microsoft YaHei", Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding-top: var(--safe-top);
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  padding: 0;
}

input, select {
  font-family: inherit;
  color: inherit;
}

/* ==================== 顶栏 ==================== */
.topbar {
  position: fixed;
  top: var(--safe-top);
  left: 0; right: 0;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  z-index: 100;
  backdrop-filter: saturate(1.5);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
}

.brand h1 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.brand-sub {
  font-size: 10px;
  font-weight: 500;
  color: var(--text-subtle);
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.05em;
}

.topbar-actions {
  display: flex;
  gap: 4px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover, .icon-btn:active {
  background: var(--surface-2);
  color: var(--text);
}

/* ==================== 舞台（查看器区域） ==================== */
.stage {
  position: fixed;
  top: calc(52px + var(--safe-top));
  left: 0; right: 0;
  bottom: 0;
  background: var(--bg);
  overflow: hidden;
  transition: bottom 0.3s cubic-bezier(.4,0,.2,1);
}

/* 空状态：整块可点击可拖拽的上传区域 */
.empty-state {
  position: absolute;
  inset: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
  gap: 14px;
  background: var(--surface);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
  color: inherit;
  font-family: inherit;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.empty-state:hover {
  border-color: var(--primary);
  background: var(--surface-2);
}

.empty-state:active {
  transform: scale(0.995);
}

.empty-state.dragging {
  border-color: var(--accent);
  background: var(--surface);
  border-style: solid;
  box-shadow: 0 0 0 4px rgba(253, 84, 61, 0.12);
}

.empty-illustration {
  margin-bottom: 4px;
  pointer-events: none;
}

.grid-mini {
  display: grid;
  grid-template-columns: repeat(3, 26px);
  grid-template-rows: repeat(3, 26px);
  gap: 3px;
  padding: 8px;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  transform: rotate(-6deg);
}

.grid-mini span {
  border-radius: 3px;
}

.empty-state h2 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 4px;
  pointer-events: none;
}

.empty-state p {
  color: var(--text-muted);
  max-width: 320px;
  font-size: 13px;
  pointer-events: none;
}

.empty-tip {
  font-size: 11px;
  color: var(--text-subtle);
  pointer-events: none;
}

.btn.as-cue {
  pointer-events: none;
  margin-top: 4px;
}

/* 查看器 */
.viewer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
}

.pv-canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
}

.pv-canvas:active {
  cursor: grabbing;
}

/* 悬浮工具栏 */
.floating-chips {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  background: var(--surface);
  padding: 6px;
  border-radius: 999px;
  box-shadow: var(--shadow-lg);
  max-width: calc(100% - 24px);
  overflow-x: auto;
  z-index: 10;
}

.floating-chips::-webkit-scrollbar { display: none; }

.chip {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  transition: all 0.15s;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.chip:hover {
  color: var(--text);
}

.chip[data-active="true"] {
  background: var(--primary);
  color: var(--surface);
}

.chip.icon-only {
  padding: 6px 8px;
}

.chip.tiny {
  padding: 3px 8px;
  font-size: 11px;
}

/* 加载 */
.loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(4px);
  z-index: 50;
}

@media (prefers-color-scheme: dark) {
  .loading { background: rgba(0,0,0,0.6); }
}

.spinner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid var(--surface-2);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  color: var(--text-muted);
  font-size: 13px;
}

/* ==================== 底部抽屉 ==================== */
.sheet {
  position: fixed;
  left: 0; right: 0;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  box-shadow: var(--shadow-lg);
  z-index: 90;
  transform: translateY(calc(100% - 68px - var(--safe-bottom)));
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
  padding-bottom: var(--safe-bottom);
  max-height: 82vh;
  display: flex;
  flex-direction: column;
}

.sheet.expanded {
  transform: translateY(0);
}

.sheet-handle {
  width: 100%;
  padding: 8px 0 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: transparent;
  border: none;
}

.sheet-handle-bar {
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-strong);
  transition: background 0.15s;
}

.sheet-handle:hover .sheet-handle-bar {
  background: var(--text-subtle);
}

.sheet-handle-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  padding: 4px 0;
}

.sheet-content {
  overflow-y: auto;
  padding: 4px 16px 20px;
  flex: 1;
  overscroll-behavior: contain;
}

.section {
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.section:last-of-type {
  border-bottom: none;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 8px;
  width: 100%;
}

.section-hint {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  margin-left: auto;
}

.section-desc {
  font-size: 11px;
  color: var(--text-subtle);
  margin-top: 6px;
  line-height: 1.5;
}

.collapsible-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
}

.collapsible .chev {
  transition: transform 0.2s;
  color: var(--text-subtle);
}

.collapsible.expanded .chev {
  transform: rotate(180deg);
}

.collapsible-body {
  padding-top: 8px;
}

/* 上传行 */
.upload-row {
  display: flex;
  gap: 8px;
}

/* 输入组 */
.grid-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input-group {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.input-group label {
  font-size: 11px;
  color: var(--text-subtle);
  font-weight: 500;
}

.input-group input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  text-align: right;
  color: var(--text);
}

.input-group input::-webkit-outer-spin-button,
.input-group input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Preset */
.preset-row {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  overflow-x: auto;
}

.preset-row::-webkit-scrollbar { display: none; }

.preset {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--surface-2);
  border-radius: 6px;
  white-space: nowrap;
  transition: all 0.15s;
}

.preset:hover, .preset.active {
  background: var(--primary);
  color: var(--surface);
}

/* Switch (checkbox) */
.switch-row {
  margin-top: 10px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  background: var(--border);
  border-radius: 999px;
  transition: background 0.2s;
  flex-shrink: 0;
}

.switch-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 0.2s;
}

.switch input:checked + .switch-track {
  background: var(--primary);
}

.switch input:checked + .switch-track .switch-thumb {
  transform: translateX(16px);
}

.switch input:focus-visible + .switch-track {
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.15);
}

.switch-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

/* Segment control */
.segment {
  display: flex;
  gap: 2px;
  padding: 2px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
}

.seg-btn {
  flex: 1;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}

.seg-btn:hover {
  color: var(--text);
}

.seg-btn.active {
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Slider */
.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

input[type="range"] {
  flex: 1;
  height: 4px;
  background: var(--surface-2);
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  border: 2px solid var(--surface);
}

input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: 2px solid var(--surface);
}

/* Palette */
.palette-actions {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  align-items: center;
}

.search-input {
  flex: 1;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  outline: none;
  min-width: 80px;
}

.search-input:focus {
  border-color: var(--primary);
}

.palette-series {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.series-group h4 {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-subtle);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.series-group h4 button {
  font-size: 10px;
  color: var(--text-muted);
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface-2);
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 4px;
}

.color-cell {
  aspect-ratio: 1;
  border-radius: 6px;
  border: 2px solid transparent;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s, border-color 0.15s;
  padding: 0;
}

.color-cell:hover {
  transform: scale(1.05);
}

.color-cell[data-selected="true"] {
  border-color: var(--primary);
}

.color-cell .code-label {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  font-size: 9px;
  font-weight: 600;
  padding: 1px 2px;
  text-align: center;
  background: rgba(0,0,0,0.5);
  color: #fff;
  line-height: 1.1;
}

.color-cell[data-selected="false"] .code-label {
  opacity: 0.7;
}

.color-cell[data-selected="false"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.6);
}

@media (prefers-color-scheme: dark) {
  .color-cell[data-selected="false"]::after {
    background: rgba(0,0,0,0.55);
  }
}

/* Action */
.action-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  white-space: nowrap;
  border: 1px solid transparent;
}

.btn.tiny {
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 6px;
}

.btn.large {
  padding: 12px 20px;
  font-size: 15px;
  font-weight: 600;
}

.btn.full {
  width: 100%;
}

.btn.primary {
  background: var(--primary);
  color: var(--surface);
}

.btn.primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn.primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn.secondary {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--border);
}

.btn.secondary:hover:not(:disabled) {
  background: var(--border);
}

.btn.secondary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn.ghost {
  background: transparent;
  color: var(--text-muted);
}

.btn.ghost:hover {
  color: var(--text);
  background: var(--surface-2);
}

.btn.tiny[data-linked="true"] {
  background: var(--primary);
  color: var(--surface);
}

/* BOM 配料清单 */
.bom-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  max-height: 300px;
  overflow-y: auto;
}

.bom-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

.bom-item:hover, .bom-item.active {
  background: var(--border);
}

.bom-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  flex-shrink: 0;
  border: 1px solid rgba(0,0,0,0.08);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
}

.bom-info {
  flex: 1;
  min-width: 0;
}

.bom-code {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.bom-meta {
  font-size: 11px;
  color: var(--text-subtle);
}

.bom-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.bom-count-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--surface);
  margin-top: 4px;
  overflow: hidden;
}

.bom-count-bar > div {
  height: 100%;
  background: var(--primary);
}

.bom-actions {
  display: flex;
  gap: 4px;
  align-items: center;
  margin-left: 4px;
}

.bom-action {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-subtle);
  background: transparent;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}

.bom-action:hover {
  background: var(--surface);
  color: var(--text);
}

.bom-action.active {
  color: var(--accent);
  background: rgba(253, 84, 61, 0.1);
}

.bom-item.hidden-color {
  opacity: 0.5;
}

.bom-item.hidden-color .bom-swatch {
  background-image:
    linear-gradient(45deg, rgba(0,0,0,0.2) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(0,0,0,0.2) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(0,0,0,0.2) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(0,0,0,0.2) 75%);
  background-size: 6px 6px;
  background-position: 0 0, 0 3px, 3px -3px, -3px 0;
}

.replaced-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 3px;
  margin-left: 4px;
  background: var(--accent);
  color: #fff;
  vertical-align: middle;
  font-weight: 600;
}

/* Picker modal 当前色号预览 */
.picker-current {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
}

.picker-current-swatch {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.08);
  flex-shrink: 0;
}

.picker-current-text {
  flex: 1;
  min-width: 0;
}

.picker-current-title {
  font-size: 12px;
  color: var(--text-subtle);
  margin-bottom: 2px;
}

.picker-current-name {
  font-size: 14px;
  font-weight: 600;
}

/* ==================== Modal ==================== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  animation: fadeIn 0.2s;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-panel {
  background: var(--surface);
  width: 100%;
  max-width: 640px;
  max-height: 88vh;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.25s cubic-bezier(.4,0,.2,1);
  padding-bottom: var(--safe-bottom);
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2 {
  font-size: 16px;
  font-weight: 600;
}

.modal-body {
  overflow-y: auto;
  padding: 12px 16px 20px;
  flex: 1;
}

.about-body p, .about-body ul {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
}

.about-body ul {
  padding-left: 20px;
  margin: 8px 0;
}

.about-body strong { color: var(--text); }

.about-body .version {
  margin-top: 12px;
  font-size: 11px;
  color: var(--text-subtle);
}

/* 历史列表 */
.history-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.history-item {
  display: flex;
  flex-direction: column;
  background: var(--surface-2);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
}

.history-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.history-thumb {
  width: 100%;
  aspect-ratio: 1;
  background: var(--surface);
  display: block;
  object-fit: contain;
  image-rendering: pixelated;
}

.history-meta {
  padding: 8px 10px;
}

.history-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-date {
  font-size: 10px;
  color: var(--text-subtle);
  margin-top: 2px;
}

.history-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  display: none;
  align-items: center;
  justify-content: center;
}

.history-item:hover .history-delete {
  display: inline-flex;
}

.history-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-subtle);
}

/* Toast */
.toast {
  position: fixed;
  top: calc(60px + var(--safe-top));
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: var(--surface);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 300;
  animation: toastIn 0.2s;
  max-width: 90%;
  text-align: center;
}

@keyframes toastIn {
  from { transform: translate(-50%, -20px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}

/* ==================== 桌面适配 ==================== */
@media (min-width: 900px) {
  .stage {
    left: 0;
    right: 420px;
  }
  .sheet {
    top: calc(52px + var(--safe-top));
    right: 0;
    left: auto;
    bottom: 0;
    width: 420px;
    max-height: none;
    border-radius: 0;
    border-top: none;
    border-left: 1px solid var(--border);
    transform: none !important;
    box-shadow: none;
    padding-bottom: 0;
  }
  .sheet-handle {
    display: none;
  }
  .sheet-content {
    padding: 16px 20px 40px;
  }
  .modal {
    align-items: center;
  }
  .modal-panel {
    border-radius: var(--radius-lg);
    max-height: 80vh;
  }
}
