/* ─────────────────────────────────────────────
   Design MD Generator · style.css
   只保留 Tailwind 無法處理的部分：
   CSS 變數、JS 互動狀態、複雜偽選擇器、scrollbar、動態 preview
   ───────────────────────────────────────────── */

@import url("https://font.emtech.cc/css/TaipeiSansTC");

/* ── CSS Variables ── */
:root {
  /* Tool chrome — fixed, never changes with user theme */
  --ui-bg:           #F0F0F0;
  --ui-surface:      #FFFFFF;
  --ui-surface2:     #F7F7F7;
  --ui-border:       #EBEBEB;
  --ui-border2:      #DADADA;
  --ui-text:         #111111;
  --ui-text2:        #555555;
  --ui-text3:        #888888;
  --ui-success:      #10B981;
  --ui-danger:       #EF4444;
  --ui-warning:      #F59E0B;

  /* Preview color — set by JS; only used inside preview renderers */
  --ui-primary:      #111111;
  --ui-primary-hover:#333333;
  --ui-secondary:    #3F3F46;
  --ui-active:              #2061F7;
  --ui-active-hover:        #1549C5;
  --ui-active-shadow:       rgba(32,97,247,.15);
  --ui-active-light:        #D9E4FF;
  --ui-active-light-border: #C0D3FF;

  --radius-sm: 6px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-sm: none;
  --shadow-md: 0 1px 4px rgba(0,0,0,.06);

  --left-width:  480px;
  --header-h:    80px;
  --tabnav-h:    64px;
  --tabfoot-h:   52px;
}

html {
  background-color: #EBEBEB;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
  box-sizing: border-box;
  font-family: 'TaipeiSansTC', 'Inter', system-ui, sans-serif;
  letter-spacing: 0.06em;
}

body {
  opacity: 0;
  background-color: #FAFAFA;
  background-image:
    linear-gradient(#EEEEEE 1px, transparent 1px),
    linear-gradient(90deg, #EEEEEE 1px, transparent 1px);
  background-size: 12px 12px;
  border-radius: 24px;
  width: 90%;
  max-width: 1440px;
  height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0,0,0,.10), 0 2px 8px rgba(0,0,0,.06);
  font-family: 'TaipeiSansTC', 'Inter', system-ui, sans-serif;
  font-size: 0.875rem;
  line-height: 1.625;
  color: var(--ui-text);
}

/* ── Tab Nav Buttons (JS toggles .active) ── */
.tab-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  min-width: 60px;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--ui-text2);
  border-bottom: 2px solid transparent;
  font-size: 10px;
  gap: 2.4px;
  transition: color .15s, border-color .15s;
  white-space: nowrap;
  font-family: inherit;
}
.tab-btn .tab-num {
  font-size: 10px;
  font-weight: 400;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--ui-border);
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0;
  transition: background .15s, color .15s;
}
.tab-btn .tab-name { font-size: 12px; }
.tab-btn:hover { color: var(--ui-primary); }
.tab-btn.active { color: var(--ui-primary); border-bottom-color: var(--ui-primary); }
.tab-btn.active .tab-num { background: var(--ui-primary); color: #fff; font-weight: 600; }

/* ── Tab Pane (JS toggles .active) ── */
.tab-pane { display: none; flex-direction: column; flex: 1; min-height: 0; }
.tab-pane.active { display: flex; }

/* ── Scrollbar ── */
.tab-content-wrapper {
  scrollbar-width: thin;
  scrollbar-color: #E3E3E8 transparent;
  scrollbar-gutter: stable both-edges;
  min-height: 0;
  overflow-x: hidden;
}
.preview-panel {
  scrollbar-width: thin;
  scrollbar-color: #E3E3E8 transparent;
}
.md-preview {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.15) transparent;
}

/* ── Preset Buttons ── */
.preset-btn {
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--ui-border2);
  border-radius: 20px;
  background: var(--ui-surface2);
  color: var(--ui-text);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  font-family: inherit;
}
.preset-btn:hover { background: var(--ui-active); color: #fff; border-color: var(--ui-active); }
.preset-btn.active { background: var(--ui-active); color: #fff; border-color: var(--ui-active); }

/* ── Custom Select Component ── */
.custom-select { position: relative; display: block; }
.custom-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 40px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--ui-border2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--ui-text);
  background: var(--ui-surface2);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  gap: 8px;
  letter-spacing: 0.06em;
  transition: border-color .15s, box-shadow .15s;
}
.custom-select-trigger:focus,
.custom-select.open .custom-select-trigger {
  border-color: var(--ui-primary);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ui-primary) 15%, transparent);
  outline: none;
}
.csel-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.csel-chevron { flex-shrink: 0; color: var(--ui-text3); transition: transform .2s; display: flex; }
.custom-select.open .csel-chevron { transform: rotate(180deg); }

.custom-select-dropdown {
  position: fixed;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.10), 0 2px 8px rgba(0,0,0,.06);
  list-style: none;
  padding: 4px;
  margin: 0;
  z-index: 9999;
}
.csel-option {
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--ui-text);
  letter-spacing: 0.06em;
  white-space: nowrap;
  transition: background .1s;
}
.csel-option:hover { background: var(--ui-surface2); }
.csel-option.selected { color: var(--ui-active); font-weight: 600; }

/* ── Preset Select Swatches ── */
.preset-select-wrapper { width: 200px; }
.preset-trigger-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.preset-name { font-size: 13px; color: var(--ui-text); white-space: nowrap; }
.preset-swatches { display: flex; gap: 3px; flex-shrink: 0; }
.preset-swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,.1); flex-shrink: 0; }
.preset-option-row { display: flex; align-items: center; gap: 10px; width: 100%; }

/* ── Toolbar Action Buttons ── */
.toolbar-action-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 500;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--ui-text2);
  cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
  font-family: inherit;
  letter-spacing: 0.06em;
}
.toolbar-action-btn:hover { background: var(--ui-border); color: var(--ui-text); }

/* ── Theme Toggle ── */

body.app-ready {
  opacity: 1;
  transition: opacity .12s ease;
}

/* ── Tab Footer ── */
[class~="h-tabfoot"] { border-top-color: #E8E8E8 !important; }

/* ── Nav Arrows ── */
.nav-arrow {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--ui-border2);
  border-radius: var(--radius-sm);
  background: var(--ui-surface2);
  color: var(--ui-text);
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.nav-arrow:hover:not(:disabled) { background: var(--ui-active); color: #fff; border-color: var(--ui-active); }
.nav-arrow:disabled { opacity: .3; cursor: not-allowed; }

/* ── Form Inputs ── */
.text-input {
  padding: 8px 12px;
  border: 1px solid var(--ui-border2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--ui-text);
  background: var(--ui-surface2);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}
.text-input:focus {
  border-color: var(--ui-active);
  box-shadow: 0 0 0 2px var(--ui-active-shadow);
}

.select-input {
  padding: 7px 32px 7px 12px;
  border: 1px solid var(--ui-border2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--ui-text);
  background-color: var(--ui-surface2);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  appearance: none;
  -webkit-appearance: none;
  outline: none;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s, box-shadow .15s;
}
.select-input:focus { border-color: var(--ui-primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--ui-primary) 15%, transparent); }

.color-picker {
  width: 40px;
  height: 36px;
  border: 1px solid var(--ui-border2);
  border-radius: var(--radius-sm);
  padding: 2px;
  cursor: pointer;
  background: transparent;
  flex-shrink: 0;
}

.hex-input {
  padding: 7px 10px;
  border: 1px solid var(--ui-border2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  color: var(--ui-text);
  background: var(--ui-surface2);
  outline: none;
  text-transform: uppercase;
}
.hex-input:focus { border-color: var(--ui-active); box-shadow: 0 0 0 2px var(--ui-active-shadow); }

/* ── Checkbox Items (:has not supported by Tailwind JIT) ── */
.checkbox-item {
  display: flex;
  align-items: center;
  padding: 6px 14px;
  height: 32px;
  padding: 0 14px;
  border: 1.5px solid var(--ui-border2);
  border-radius: 20px;
  background: var(--ui-surface2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--ui-text2);
  transition: background .15s, color .15s;
  user-select: none;
}
.checkbox-item input[type="checkbox"],
.checkbox-item input[type="radio"] { display: none; }
.checkbox-item:hover {
  background: color-mix(in srgb, var(--ui-primary) 25%, transparent);
  border-color: color-mix(in srgb, var(--ui-primary) 40%, transparent);
  color: var(--ui-primary);
}
.checkbox-item:has(input:checked) {
  background: var(--ui-primary);
  border-color: var(--ui-primary);
  color: #FFFFFF;
}

/* ── Radio Items ── */
.radio-item {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1.5px solid var(--ui-border2);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}
.radio-item input[type="radio"] { width: 14px; height: 14px; accent-color: var(--ui-primary); cursor: pointer; }
.radio-item:has(input:checked) { border-color: var(--ui-primary); background: color-mix(in srgb, var(--ui-primary) 5%, transparent); }

/* ── WCAG Panel ── */
.wcag-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--ui-border);
}
.wcag-row:last-of-type { border-bottom: none; }
.wcag-swatches { display: flex; align-items: center; gap: 4px; }
.wcag-swatch { width: 28px; height: 28px; border-radius: 6px; border: 1px solid rgba(0,0,0,.1); }
.wcag-on { font-size: 9px; color: var(--ui-text3); font-style: italic; }
.wcag-detail { display: flex; align-items: center; gap: 8px; flex: 1; }
.wcag-combo { font-size: 12px; color: var(--ui-text2); flex: 1; }
.wcag-ratio { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; min-width: 52px; }
.wcag-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 12px;
  background: var(--ui-border);
  color: var(--ui-text3);
  letter-spacing: .03em;
}
.wcag-badge.pass { background: rgba(16,185,129,.15); color: #059669; }
.wcag-badge.fail { background: rgba(239,68,68,.12); color: #DC2626; }
.wcag-suggestion {
  margin-top: 10px;
  padding: 8px 10px;
  background: rgba(245,158,11,.1);
  border: 1px solid rgba(245,158,11,.3);
  border-radius: var(--radius-sm);
  font-size: 11px;
  color: #92400E;
  display: none;
}
.wcag-suggestion.visible { display: block; }
.wcag-fix-color { display: inline-flex; align-items: center; gap: 5px; font-weight: 600; cursor: pointer; }
.wcag-fix-swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,.15); display: inline-block; }

/* ── Variant Swatches ── */
.variant-swatches { display: flex; gap: 6px; align-items: center; padding-bottom: 18px; }
.variant-swatch {
  position: relative;
  width: 36px;
  height: 28px;
  border-radius: 5px;
  border: 1px solid rgba(0,0,0,.1);
}
.variant-swatch::after {
  content: attr(data-label);
  position: absolute;
  bottom: -16px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--ui-text3);
  white-space: nowrap;
}

/* ── Type Scale Input ── */
.scale-input {
  width: 60px;
  padding: 5px 8px;
  border: 1px solid var(--ui-border2);
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-align: center;
  color: var(--ui-text);
  background: var(--ui-surface2);
  outline: none;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
}
.scale-input:focus { border-color: var(--ui-active); }

/* ── Type Scale ratio pills ── */
.ts-ratio-opt {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.ts-ratio-opt input { display: none; }
.ts-ratio-opt span {
  display: inline-block;
  padding: 3px 9px;
  border: 1.5px solid var(--ui-border2);
  border-radius: 99px;
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  color: var(--ui-text2);
  background: var(--ui-surface2);
  transition: background .12s, border-color .12s, color .12s;
  user-select: none;
}
.ts-ratio-opt input:checked + span {
  border-color: var(--ui-primary);
  background: color-mix(in srgb, var(--ui-primary) 10%, white);
  color: var(--ui-primary);
  font-weight: 600;
}
.ts-ratio-opt:hover span {
  border-color: var(--ui-primary);
  background: color-mix(in srgb, var(--ui-primary) 6%, white);
}

/* ── Type Scale token rows ── */
.ts-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ts-token {
  font-size: 11px;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 600;
  color: var(--ui-primary);
  width: 30px;
  flex-shrink: 0;
}
.ts-computed {
  font-size: 10px;
  color: var(--ui-text3);
  font-family: 'JetBrains Mono', monospace;
  width: 26px;
  text-align: right;
  flex-shrink: 0;
}
.ts-badge {
  font-size: 9px;
  padding: 1px 5px;
  border-radius: 99px;
  background: color-mix(in srgb, var(--ui-primary) 12%, white);
  color: var(--ui-primary);
  border: 1px solid color-mix(in srgb, var(--ui-primary) 25%, white);
  font-weight: 600;
  white-space: nowrap;
}
.ts-desc {
  font-size: 11px;
  color: var(--ui-text2);
  flex: 1;
}
.ts-scale-input {
  width: 52px;
}
.ts-scale-input.is-overridden {
  border-color: var(--ui-primary);
  background: color-mix(in srgb, var(--ui-primary) 5%, white);
}
.ts-scale-input.is-error {
  border-color: var(--ui-danger) !important;
  background: rgba(239,68,68,.05);
}
.ts-err-msg {
  font-size: 11px;
  color: var(--ui-danger);
  margin: 4px 0 0;
  display: flex;
  align-items: center;
  gap: 4px;
}
.ts-err-msg::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23EF4444' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='12' y1='8' x2='12' y2='12'/%3E%3Cline x1='12' y1='16' x2='12.01' y2='16'/%3E%3C/svg%3E") center/contain no-repeat;
  flex-shrink: 0;
}

/* ── Reset button ── */
.ts-reset-btn {
  font-size: 11px;
  padding: 3px 9px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--ui-border2);
  background: var(--ui-surface2);
  color: var(--ui-text2);
  cursor: pointer;
  transition: border-color .12s, color .12s;
}
.ts-reset-btn:hover {
  border-color: var(--ui-primary);
  color: var(--ui-primary);
}
.ts-reset-btn.hidden { display: none; }

/* ── Slider ── */
.slider {
  height: 4px;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  accent-color: var(--ui-active);
}

/* ── Component Previews ── */
.preview-btn {
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: default;
  color: #fff;
  background: var(--ui-primary);
  font-family: inherit;
}
.preview-input {
  padding: 9px 14px;
  font-size: 14px;
  border: 1.5px solid var(--ui-border2);
  color: var(--ui-text);
  background: white;
  outline: none;
  font-family: inherit;
  width: 200px;
}
.preview-card {
  background: white;
  border: 1px solid var(--ui-border);
  padding: 16px 20px;
  min-width: 200px;
  box-shadow: var(--shadow-sm);
}
.preview-card-title { font-size: 14px; font-weight: 600; color: var(--ui-text); margin-bottom: 4px; }
.preview-card-body { font-size: 12px; color: var(--ui-text2); }

/* ── Spacing Scale (JS renders this) ── */
.spacing-scale {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  background: var(--ui-surface2);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-sm);
}
.spacing-block { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.spacing-bar { width: 20px; background: var(--ui-primary); border-radius: 2px; opacity: .7; transition: height .2s; }
.spacing-tag { font-size: 9px; color: var(--ui-text3); font-variant-numeric: tabular-nums; }

/* ── Component Preview Separator ── */
.comp-preview-sep {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 12px;
}
.comp-preview-sep::before,
.comp-preview-sep::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--ui-border);
}
.comp-preview-label {
  font-size: 11px;
  color: #888888;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Component Block ── */
.comp-block { display: flex; flex-direction: column; }
.comp-live-area {
  padding: 20px 24px;
  background: var(--ui-surface2);
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Style Option Cards (Input / Card) ── */
.style-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.style-opt-card {
  position: relative;
  border: 1.5px solid var(--ui-border);
  border-radius: var(--radius-sm);
  padding: 12px;
  cursor: pointer;
  background: var(--ui-surface2);
  transition: border-color .15s, background .15s;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.style-opt-card:has(input:checked) {
  background: color-mix(in srgb, var(--ui-primary) 10%, white);
  border-color: var(--ui-active);
}
.style-opt-card:has(input:checked) .style-opt-name { color: var(--ui-text); }
.style-opt-card input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.style-opt-thumb {
  height: 72px;
  background: white;
  border-radius: 6px;
  border: 1px solid var(--ui-border);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  padding: 10px 12px;
  gap: 8px;
  margin-bottom: 4px;
}
.style-opt-name { font-size: 12px; font-weight: 600; color: var(--ui-text); }
.style-opt-desc { font-size: 11px; color: var(--ui-text3); line-height: 1.3; }

/* Mini Input thumbnails */
.mini-input-bordered {
  height: 20px;
  border: 1.5px solid #C4C4C8;
  border-radius: 4px;
  background: #FAFAFA;
}
.mini-input-underline {
  height: 20px;
  border: none;
  border-bottom: 2px solid #C4C4C8;
  background: transparent;
}

/* Mini Card thumbnails */
.mini-card {
  height: 58px;
  border-radius: 6px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  background: white;
}
.mini-card-bordered { border: 1px solid #D4D4D8; box-shadow: none; }
.mini-card-elevated { border: none; box-shadow: 0 4px 12px rgba(0,0,0,.13); }
.mini-card-line { height: 5px; background: #E4E4E7; border-radius: 2px; }
.mini-card-line-thin { height: 3px; background: #F0F0F2; }
.mini-card-btn { height: 12px; width: 32px; background: #E4E4E7; border-radius: 2px; }

/* Live Form (Input preview area) */
.live-form { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 280px; }
.live-form-group { display: flex; flex-direction: column; gap: 4px; }
.live-form-label { font-size: 11px; font-weight: 600; color: var(--ui-text2); }
.live-input {
  padding: 8px 12px;
  font-size: 13px;
  color: var(--ui-text);
  background: white;
  outline: none;
  font-family: inherit;
  width: 100%;
  transition: border-radius .15s;
}
.live-input.bordered {
  border: 1.5px solid var(--ui-border2);
  border-radius: 6px;
}
.live-input.underline {
  border: none;
  border-bottom: 2px solid var(--ui-border2);
  border-radius: 0;
  padding-left: 2px;
  padding-right: 2px;
  background: transparent;
}

/* Live Card (Card preview area) */
.live-card {
  padding: 16px 20px;
  background: white;
  width: 100%;
  max-width: 280px;
  border-radius: 10px;
  transition: box-shadow .25s, border .25s;
}
.live-card-title { font-size: 14px; font-weight: 600; color: var(--ui-text); margin-bottom: 4px; }
.live-card-body { font-size: 12px; color: var(--ui-text2); line-height: 1.6; }
.live-card-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 20px;
  margin-top: 10px;
  color: #fff;
}

/* Preview Button variants */
.preview-btn-sec {
  padding: 7px 20px;
  font-size: 14px;
  font-weight: 500;
  border: 2px solid;
  background: transparent;
  cursor: default;
  font-family: inherit;
  box-sizing: border-box;
}
.preview-btn-ghost {
  padding: 9px 20px;
  font-size: 14px;
  font-weight: 500;
  border: none;
  background: transparent;
  cursor: default;
  font-family: inherit;
  text-decoration: underline;
}

/* ── Button Radius Options ── */
.btn-radius-options { display: flex; gap: 10px; }
.btn-radius-opt { cursor: pointer; position: relative; flex: 1; }
.btn-radius-opt input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.btn-radius-card {
  width: 100%;
  height: 72px;
  background: var(--ui-surface2);
  border: 1.5px solid var(--ui-border);
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  font-size: 12px;
  color: var(--ui-text2);
  font-weight: 500;
}
.btn-radius-shape {
  width: 48px;
  height: 24px;
  border: 2px solid #C4C4C8;
  background: #EBEBEB;
  flex-shrink: 0;
}
.btn-radius-opt input:checked + .btn-radius-card {
  background: color-mix(in srgb, var(--ui-primary) 10%, white);
  border-color: var(--ui-active);
  color: var(--ui-text);
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0,0,0,.10);
}

/* ── Shadow Options ── */
.shadow-options { display: flex; gap: 10px; flex-wrap: wrap; }
.shadow-opt { cursor: pointer; position: relative; }
.shadow-opt input[type="radio"] { position: absolute; opacity: 0; width: 0; height: 0; }
.shadow-card {
  width: 86px;
  height: 64px;
  background: white;
  border-radius: var(--radius-md);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 8px;
  border: 2px solid transparent;
  transition: border-color .15s;
  font-size: 11px;
  color: var(--ui-text2);
  font-weight: 500;
}
.shadow-card span { position: relative; z-index: 1; }
.shadow-opt input:checked + .shadow-card { border-color: var(--ui-active); }
.s-none { box-shadow: none; border: 2px solid var(--ui-border); }
.s-soft { box-shadow: 0 2px 8px rgba(0,0,0,.08); }
.s-medium { box-shadow: 0 4px 16px rgba(0,0,0,.14); }
.s-strong { box-shadow: 0 8px 28px rgba(0,0,0,.22); }

/* ── Shadow Demo Card ── */
.shadow-demo-card {
  background: white;
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  transition: box-shadow .3s;
}
.shadow-demo-dot {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--ui-primary);
  flex-shrink: 0;
}
.shadow-token-list {
  font-size: 11px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  color: var(--ui-text2);
  background: var(--ui-surface2);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  line-height: 1.8;
}

/* ── Do's & Don'ts ── */
.rule-item { display: flex; align-items: center; gap: 6px; }
.rule-input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid var(--ui-border2);
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--ui-text);
  background: var(--ui-surface2);
  outline: none;
  font-family: inherit;
}
.rule-input:focus { border-color: var(--ui-active); box-shadow: 0 0 0 2px var(--ui-active-shadow); }
.rule-remove {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--ui-text3);
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
}
.rule-remove:hover { background: rgba(239,68,68,.1); color: var(--ui-danger); }
.add-rule-btn {
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px dashed;
  background: transparent;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.do-btn { border-color: #34D399; color: #059669; }
.do-btn:hover { background: rgba(52,211,153,.1); }
.dont-btn { border-color: #FCA5A5; color: #DC2626; }
.dont-btn:hover { background: rgba(252,165,165,.1); }

/* ── Right Tab Switcher (segmented pill) ── */
.right-tab-switcher {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--ui-surface2);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.right-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  height: auto;
  border: none;
  background: transparent;
  color: var(--ui-text2);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border-radius: calc(var(--radius-sm) - 3px);
  transition: background .15s, color .15s;
  font-family: inherit;
  white-space: nowrap;
}
.right-tab:hover { color: var(--ui-text); }
.right-tab.active { background: #FFFFFF; color: var(--ui-primary); font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ── Right Tab Actions (JS toggles .visible) ── */
.right-tab-actions { display: none; }
.right-tab-actions.visible { display: flex; }

/* ── Output Buttons ── */
.out-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
  font-family: inherit;
}
.out-btn.secondary { background: var(--ui-surface2); color: var(--ui-text); border-color: var(--ui-border2); }
.out-btn.secondary:hover { background: var(--ui-border); }
.out-btn.primary { background: var(--ui-active); color: white; }
.out-btn.primary:hover { background: var(--ui-active-hover); }

/* ── Preview Panel ── */
.preview-panel {
  flex: 1;
  overflow-y: auto;
  background: #FFFFFF;
}

/* ── Web Mockup Preview ── */
.web-mockup-wrap {
  font-family: 'Inter', system-ui, sans-serif;
  letter-spacing: 0;
  overflow: hidden;
  container-type: inline-size;
  container-name: mockup;
  position: relative;
}
.web-nav {
  display: flex;
  align-items: center;
  padding: 14px 28px;
  gap: 24px;
  position: relative;
  border-bottom: 1px solid rgba(0,0,0,.07);
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.web-nav-brand { display: flex; align-items: center; gap: 8px; flex-shrink: 0; line-height: 1; }
.web-nav-dot { width: 20px; height: 20px; border-radius: 6px; display: block; flex-shrink: 0; vertical-align: middle; }
.web-nav-logo { font-size: 15px; font-weight: 700; line-height: 1; }
.web-nav-links { display: flex; gap: 20px; flex: 1; justify-content: center; }
.web-nav-links span { font-size: 13px; cursor: pointer; transition: opacity .15s; }
.web-nav-links span:hover { opacity: .55; }
.web-nav-actions { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.web-nav-ghost { font-size: 13px; cursor: pointer; transition: opacity .15s; }
.web-nav-ghost:hover { opacity: .55; }
.web-cta-btn {
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border: none;
  border-radius: var(--mk-btn-radius, 8px);
  cursor: pointer;
  color: #fff;
  font-family: inherit;
  transition: opacity .15s, transform .1s;
}
.web-cta-btn:hover { opacity: .85; }
.web-cta-btn:active { transform: scale(.95); opacity: .7; }
.web-hero {
  display: flex;
  align-items: center;
  padding: 48px 28px 48px;
  gap: 24px;
  min-height: 320px;
}
.web-hero-left { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.web-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .06em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid;
  width: fit-content;
}
.web-hero-badge-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.web-hero-heading { font-size: 26px; font-weight: 700; line-height: 1.2; margin: 0; }
.web-hero-sub { font-size: 12px; line-height: 1.6; margin: 0; max-width: 340px; opacity: .6; }
.web-hero-btns { display: flex; align-items: center; gap: 12px; }
.web-cta-lg { font-size: 13px; padding: 9px 18px; }
.web-ghost-btn { font-size: 13px; font-weight: 500; background: none; border: none; cursor: default; font-family: inherit; opacity: .7; }
.web-hero-right { width: 200px; flex-shrink: 0; position: relative; }
.web-hero-card {
  background: #fff;
  border-radius: var(--mk-card-radius, 12px);
  padding: 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08), 0 8px 24px rgba(0,0,0,.10);
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  z-index: 1;
}
.web-hero-card-bar { height: 4px; border-radius: 2px; width: 40%; }
.web-hero-card-line { height: 8px; border-radius: 4px; background: #E5E7EB; }
.web-hero-card-stat { margin-top: 4px; }
.web-hero-stat-num { display: block; font-size: 20px; font-weight: 700; }
.web-hero-stat-label { display: block; font-size: 10px; opacity: .5; }
.web-hero-blob {
  position: absolute;
  bottom: -20px;
  right: -20px;
  width: 80px;
  height: 80px;
  border-radius: 20px;
  opacity: .25;
}

/* ── Web Mockup Extended Sections ── */
.mock-section {
  padding: 44px 28px;
  background: var(--mk-bg);
  color: var(--mk-text);
  border-top: 1px solid rgba(0,0,0,.06);
}
.mock-section-title {
  font-size: 20px;
  font-weight: 700;
  text-align: center;
  margin: 0 0 6px;
  color: var(--mk-text);
}
.mock-section-sub {
  font-size: 12px;
  text-align: center;
  opacity: .55;
  margin: 0 0 28px;
}

/* Feature */
.mock-feat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.mock-feat-card {
  background: #fff;
  border-radius: var(--mk-card-radius);
  padding: 18px 16px;
  box-shadow: var(--mk-shadow);
  border: var(--mk-card-border);
}
.mock-feat-icon { display: flex; margin-bottom: 10px; color: var(--mk-primary); }
.mock-feat-name { font-size: 13px; font-weight: 600; margin: 0 0 5px; color: var(--mk-text); }
.mock-feat-desc { font-size: 11px; line-height: 1.6; opacity: .6; margin: 0; color: var(--mk-text); }

/* Pricing */
.mock-pricing { border-top: 1px solid rgba(0,0,0,.06); }
.mock-price-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  align-items: center;
}
.mock-price-card {
  background: #fff;
  border-radius: var(--mk-card-radius);
  padding: 20px 16px 16px;
  box-shadow: var(--mk-shadow);
  border: var(--mk-card-border);
  position: relative;
}
.mock-price-featured {
  background: var(--mk-primary);
  color: var(--mk-primary-text);
  transform: scale(1.04);
  border: none;
  box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.mock-price-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-weight: 700;
  padding: 3px 10px;
  background: var(--mk-accent);
  color: #fff;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: .04em;
}
.mock-price-plan { font-size: 11px; font-weight: 600; opacity: .65; margin-bottom: 8px; }
.mock-price-featured .mock-price-plan { opacity: .85; }
.mock-price-amount { margin-bottom: 14px; line-height: 1; }
.mock-price-num { font-size: 22px; font-weight: 700; }
.mock-price-unit { font-size: 11px; opacity: .7; margin-left: 2px; }
.mock-price-list {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.mock-price-list li { font-size: 11px; opacity: .75; }
.mock-price-list li::before { content: '✓ '; }
.mock-price-btn {
  width: 100%;
  padding: 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: var(--mk-btn-radius);
  cursor: default;
  font-family: inherit;
  border: none;
}
.mock-price-btn-primary { background: #fff; color: var(--mk-primary); }
.mock-price-btn-outline {
  background: transparent;
  border: 1.5px solid rgba(0,0,0,.18);
  color: var(--mk-text);
}
.mock-price-featured .mock-price-btn-outline {
  border-color: rgba(255,255,255,.35);
  color: var(--mk-primary-text);
}

/* Contact / Form */
.mock-contact-form { max-width: 480px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.mock-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mock-form-group { display: flex; flex-direction: column; gap: 5px; }
.mock-form-label { font-size: 11px; font-weight: 600; color: var(--mk-text); opacity: .75; }
.mock-form-input {
  padding: 9px 12px;
  font-size: 12px;
  color: var(--mk-text);
  opacity: .45;
  background: #fff;
  font-family: inherit;
  cursor: default;
  transition: border-radius .15s;
}
.mock-form-textarea { height: 64px; }
.mock-input-bordered {
  border: 1.5px solid rgba(0,0,0,.15);
  border-radius: var(--mk-input-radius, 6px);
}
.mock-input-underline {
  border: none;
  border-bottom: 2px solid rgba(0,0,0,.2);
  border-radius: 0;
  background: transparent;
  padding-left: 2px;
  padding-right: 2px;
}
.mock-contact-btn {
  padding: 10px 24px;
  font-size: 12px;
  font-weight: 600;
  background: var(--mk-primary);
  color: var(--mk-primary-text);
  border: none;
  border-radius: var(--mk-btn-radius);
  cursor: pointer;
  font-family: inherit;
  align-self: flex-start;
  transition: opacity .15s, transform .1s;
}
.mock-contact-btn:hover { opacity: .85; }
.mock-contact-btn:active { transform: scale(.96); opacity: .7; }

/* CTA Banner */
.mock-cta-section {
  background: var(--mk-primary);
  color: var(--mk-primary-text);
  padding: 44px 28px;
  text-align: center;
  border-top: none;
}
.mock-cta-section-title { font-size: 22px; font-weight: 700; margin: 0 0 8px; }
.mock-cta-section-sub { font-size: 12px; opacity: .8; margin: 0 0 22px; }
.mock-cta-section-btn {
  padding: 10px 26px;
  font-size: 13px;
  font-weight: 600;
  background: #fff;
  color: var(--mk-primary);
  border: none;
  border-radius: var(--mk-btn-radius);
  cursor: pointer;
  font-family: inherit;
  transition: opacity .15s, transform .1s;
}
.mock-cta-section-btn:hover { opacity: .88; }
.mock-cta-section-btn:active { transform: scale(.96); opacity: .75; }

/* Footer */
.mock-footer {
  background: color-mix(in srgb, var(--mk-text) 6%, var(--mk-bg));
  color: var(--mk-text);
  padding: 24px 28px;
  border-top: 1px solid rgba(0,0,0,.07);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.mock-footer-brand { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.mock-footer-dot { width: 14px; height: 14px; border-radius: 4px; background: var(--mk-primary); display: block; }
.mock-footer-logo { font-size: 13px; font-weight: 700; }
.mock-footer-links { display: flex; gap: 16px; flex: 1; justify-content: center; }
.mock-footer-links span { font-size: 11px; opacity: .55; cursor: default; }
.mock-footer-copy { font-size: 10px; opacity: .35; flex-shrink: 0; }

/* ── MD Panel (JS toggles .active) ── */
.md-panel { flex: 1; display: none; overflow: hidden; background: #111111; }
.md-panel.active { display: flex; }

/* ── MD Preview ── */
.md-preview {
  flex: 1;
  padding: 20px 24px;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 12.5px;
  line-height: 1.75;
  color: #E4E4E7;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: transparent;
  border: none;
  outline: none;
  margin: 0;
  tab-size: 2;
  width: 100%;
  height: 100%;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1E293B;
  color: white;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  box-shadow: var(--shadow-md);
  transform: translateY(60px);
  opacity: 0;
  transition: all .3s cubic-bezier(.34,1.56,.64,1);
  z-index: 9999;
  pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }

/* ── Right Panel Preview: Color Scale ── */
.color-scale-row {
  display: flex;
  border-radius: 10px;
  overflow: hidden;
  height: 68px;
  box-shadow: var(--shadow-sm);
}
.scale-swatch {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .1s, filter .1s;
  position: relative;
  gap: 3px;
}
.scale-swatch:hover { filter: brightness(1.1); z-index: 1; transform: scaleY(1.05); }
.scale-swatch-num { font-size: 10px; font-weight: 700; line-height: 1; }
.scale-swatch-hex { font-size: 8px; font-family: 'JetBrains Mono', monospace; opacity: 0; transition: opacity .15s; }
.scale-swatch:hover .scale-swatch-hex { opacity: 1; }

/* ── Neutral Cards ── */
.prev-neutral-card {
  height: 56px;
  border-radius: 8px;
  border: 1px solid var(--ui-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  cursor: pointer;
  transition: opacity .15s;
}
.prev-neutral-card:hover { opacity: .85; }
.prev-neutral-name { font-size: 11px; font-weight: 600; }
.prev-neutral-hex { font-size: 11px; font-family: 'JetBrains Mono', monospace; opacity: .7; }

/* ── JS-generated Typography Preview ── */
.prev-typo-fonts { display: flex; gap: 24px; margin-bottom: 16px; }
.prev-font-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ui-text3); margin-bottom: 4px; }
.prev-font-name { font-size: 13px; font-weight: 500; color: var(--ui-text); }
.prev-font-sample { font-size: 20px; line-height: 1.3; color: var(--ui-text); margin-top: 2px; }
.prev-type-scale { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid var(--ui-border); }
.prev-scale-row { display: flex; align-items: baseline; gap: 12px; }
.prev-scale-meta { display: flex; flex-direction: column; align-items: flex-end; width: 48px; flex-shrink: 0; }
.prev-scale-token { font-size: 10px; font-family: 'JetBrains Mono', monospace; color: var(--ui-primary); font-weight: 600; }
.prev-scale-px { font-size: 9px; color: var(--ui-text3); }
.prev-scale-text { color: var(--ui-text); line-height: 1.2; flex: 1; }

/* ── JS-generated Component Preview ── */
.prev-comp-block { margin-bottom: 20px; }
.prev-comp-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ui-text3); margin-bottom: 10px; }
.prev-buttons-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.prev-btn-primary { padding: 9px 20px; font-size: 14px; font-weight: 500; border: none; color: #fff; cursor: default; font-family: inherit; }
.prev-btn-secondary { padding: 9px 20px; font-size: 14px; font-weight: 500; border: 2px solid; background: transparent; cursor: default; font-family: inherit; }
.prev-btn-ghost { padding: 9px 20px; font-size: 14px; font-weight: 500; border: none; background: transparent; cursor: default; font-family: inherit; text-decoration: underline; }
.prev-input-demo { padding: 10px 14px; font-size: 14px; border: 1.5px solid var(--ui-border2); color: var(--ui-text); background: white; outline: none; font-family: inherit; width: 100%; max-width: 300px; }
.prev-card-demo { padding: 18px 20px; background: white; border: 1px solid var(--ui-border); max-width: 280px; }
.prev-card-demo-title { font-size: 15px; font-weight: 600; color: var(--ui-text); margin-bottom: 6px; }
.prev-card-demo-body { font-size: 13px; color: var(--ui-text2); line-height: 1.6; }
.prev-card-demo-badge { display: inline-flex; align-items: center; padding: 2px 8px; font-size: 11px; font-weight: 600; border-radius: 20px; margin-top: 10px; color: #fff; }

/* ── JS-generated Spacing & Shadow Preview ── */
.prev-spacing-row { display: flex; align-items: flex-end; gap: 12px; padding: 12px 0; margin-bottom: 16px; }
.prev-space-item { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.prev-space-bar { width: 20px; border-radius: 3px; transition: height .2s, background .2s; }
.prev-space-tag { font-size: 9px; color: var(--ui-text3); text-align: center; line-height: 1.3; }
.prev-shadow-row { display: flex; gap: 12px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--ui-border); }
.prev-shadow-card { background: white; border-radius: 8px; padding: 12px 16px; min-width: 80px; text-align: center; }

/* ── Hamburger & Mobile Nav ── */
.web-nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}
.web-nav-hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 1px;
  background: currentColor;
  transition: transform .2s, opacity .2s;
}
.web-nav-hamburger.open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.web-nav-hamburger.open span:nth-child(2) { opacity: 0; }
.web-nav-hamburger.open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.web-nav-mobile {
  display: none;
  flex-direction: column;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 20px 4px;
  border-bottom: 1px solid rgba(0,0,0,.07);
  background: inherit;
}
.web-nav-mobile.open { display: flex; }
.web-nav-mobile span {
  font-size: 13px;
  padding: 11px 0;
  border-bottom: 1px solid rgba(0,0,0,.06);
  cursor: pointer;
  transition: opacity .15s;
}
.web-nav-mobile span:last-child { border-bottom: none; }
.web-nav-mobile span:hover { opacity: .55; }

/* ── Web Mockup Container Query RWD ── */
@container mockup (max-width: 580px) {

  /* Navbar: 隱藏中間連結，顯示 hamburger */
  .web-nav-links { display: none; }
  .web-nav { padding: 12px 20px; }
  .web-nav-hamburger { display: flex; margin-left: auto; }

  /* Hero: 上下堆疊 */
  .web-hero {
    flex-direction: column;
    align-items: stretch;
    padding: 28px 20px 24px;
    min-height: auto;
    gap: 36px;
  }
  .web-hero-left { max-width: 100%; align-items: center; text-align: center; }
  .web-hero-heading { font-size: 22px; }
  .web-hero-sub { max-width: 100%; }
  .web-hero-btns { justify-content: center; }
  .web-hero-right {
    width: 100%;
    display: flex;
    justify-content: center;
  }
  .web-hero-card {
    width: 100%;
    max-width: 320px;
  }
  .web-hero-blob { display: none; }

  /* Feature: 4 欄 → 2 欄 */
  .mock-feat-grid {
    grid-template-columns: 1fr 1fr;
  }
  /* Pricing: 3 欄 → 1 欄，等高，間距加大 */
  .mock-price-grid {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 24px;
    max-width: 320px;
    margin-left: auto;
    margin-right: auto;
  }
  .mock-price-card { text-align: center; }
  .mock-price-featured { transform: none; }
}

@container mockup (max-width: 380px) {
  /* Feature: 2 欄 → 1 欄 */
  .mock-feat-grid {
    grid-template-columns: 1fr;
  }
  /* Contact form: 姓名＋Email 並排 → 各佔一行 */
  .mock-form-row {
    grid-template-columns: 1fr;
  }
}

/* ── Modal Animations ── */
@keyframes fadeIn  { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px) } to { opacity: 1; transform: translateY(0) } }

/* ── Mobile-only elements (hidden on desktop) ── */
.mobile-panel-switcher { display: none; }
.mobile-bottom-bar     { display: none; }
.mobile-tab-nav        { display: none; }
.mobile-header-reset   { display: none; }

/* ── Desktop-hidden elements ── */
.rtab-mobile { display: none; }

/* ── Step Progress (mobile only) ── */
.step-progress {
  display: none;
  padding: 12px 16px 10px;
  border-bottom: 1px solid var(--ui-border);
  flex-shrink: 0;
}
.step-progress-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.step-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--ui-primary);
}
.step-count {
  font-size: 12px;
  color: var(--ui-text2);
}
.step-progress-bar {
  height: 3px;
  background: var(--ui-border);
  border-radius: 99px;
  overflow: hidden;
}
.step-progress-fill {
  height: 100%;
  width: 20%;
  background: var(--ui-primary);
  border-radius: 99px;
  transition: width 0.3s ease;
}

/* ── Mobile Panel Switcher base styles ── */
.mobile-panel-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 8px;
  font-size: 13px;
  font-weight: 500;
  border: none;
  background: transparent;
  color: var(--ui-text2);
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: .04em;
  transition: color .15s, border-color .15s;
}
.mobile-panel-btn .lucide { width: 16px; height: 16px; }
.mobile-panel-btn.active  { color: var(--ui-primary); border-bottom-color: var(--ui-primary); }

/* ── Right Tab Lucide icon sizing ── */
.right-tab .lucide { width: 13px; height: 13px; }


/* ── Mobile Tab Nav base styles ── */
.mobile-tab-prev, .mobile-tab-next {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background .15s, color .15s;
}
.mobile-tab-prev { background: var(--ui-surface2); color: var(--ui-text2); }
.mobile-tab-prev:hover { color: var(--ui-text); }
.mobile-tab-next { background: var(--ui-primary); color: #fff; }
.mobile-tab-next:hover { background: var(--ui-primary-hover); }
.mobile-tab-prev .lucide, .mobile-tab-next .lucide { width: 15px; height: 15px; }
.mobile-tab-counter { font-size: 13px; color: var(--ui-text3); font-weight: 500; }

/* ── Mobile: < 600px — 進度條取代 tab nav ── */
@media (max-width: 599px) {
  [role="tablist"] { display: none !important; }
  .step-progress { display: block !important; }
}

/* ── Responsive (< 1240px) ── */
@media (max-width: 1239px) {
  html {
    padding: 0;
    background: var(--ui-bg);
    align-items: stretch;
  }

  body {
    width: 100%;
    max-width: 100%;
    height: 100dvh;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    padding: 0 16px; /* 統一側邊基準，所有子元素對齊用 */
    box-sizing: border-box;
  }

  /* Header: 補回負 margin 讓它全寬 */
  header {
    border-radius: 0;
    padding: 10px 16px;
    height: 72px !important;
    margin-left: -16px;
    margin-right: -16px;
  }

  /* Toolbar: 撐滿 body 內容區 */
  #main-toolbar {
    width: 100% !important;
    margin: 10px 0 0 !important;
    box-sizing: border-box;
  }
  #main-toolbar .preset-select-wrapper { flex: 1; }

  /* Mobile panel switcher: 同寬 + 與 toolbar 間距 */
  .mobile-panel-switcher {
    display: flex !important;
    border-bottom: 1px solid var(--ui-border);
    background: var(--ui-surface);
    flex-shrink: 0;
    width: 100% !important;
    margin: 8px 0 0 !important;
    box-sizing: border-box !important;
    align-self: stretch;
  }

  /* 防止橫向捲動 */
  html, body { overflow-x: hidden !important; }

  /* Main layout: 側邊不加 padding（body 已處理） */
  main {
    flex-direction: column !important;
    padding: 8px 0 !important;
    gap: 0 !important;
    width: 100% !important;
    min-height: 0;
    overflow: hidden;
  }

  /* preset select wrapper 不寫死寬度 */
  .preset-select-wrapper { width: auto !important; max-width: 100%; }

  /* mockup 容器不溢出 */
  .web-mockup-wrap, #web-mockup-root { max-width: 100%; overflow-x: hidden; }
  .preview-panel, .md-panel { max-width: 100%; overflow-x: hidden; }

  #panel-left {
    flex: 1;
    width: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border-radius: 8px;
  }

  #panel-right {
    display: none;
    flex: 1;
    width: 100%;
    min-width: 0;
    border-radius: 8px;
  }

  /* 預覽模式切換 */
  body.mobile-preview #panel-left  { display: none; }
  body.mobile-preview #panel-right { display: flex; }

  /* Left tab nav: active 顯示 num+name（row），inactive 只顯示 num */
  .tab-btn { flex-direction: row; gap: 6px; padding: 0 10px; }
  .tab-btn.active { padding: 0 14px; }

  /* Mobile tab nav (bottom of left panel) */
  .mobile-tab-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-top: 1px solid var(--ui-border);
    flex-shrink: 0;
    background: var(--ui-surface);
  }

  /* Right sub-tabs */
  .rtab-desktop { display: none; }
  .rtab-mobile  { display: inline; }
  .right-tab { font-size: 15px; padding: 5px 10px; }
  .right-tab .lucide { width: 14px; height: 14px; }

  /* Mobile bottom bar */
  .mobile-bottom-bar {
    display: flex;
    gap: 8px;
    padding: 10px 14px;
    background: var(--ui-surface);
    border-top: 1px solid var(--ui-border);
    flex-shrink: 0;
  }
  .mobile-bottom-bar .out-btn {
    flex: 1;
    justify-content: center;
    padding: 10px 14px;
    font-size: 16px;
  }
  .mobile-bottom-bar .out-btn .lucide { width: 14px; height: 14px; }

  /* 上方複製/下載按鈕在手機版隱藏（底部 bar 已有） */
  #md-actions { display: none !important; }


  /* ── Mobile font-size overrides: 13px base → 16px (scale ×16/13) ── */
  body { font-size: 1.077rem; }
  .tab-btn { font-size: 12px; }
  .tab-btn .tab-num { font-size: 12px; }
  .tab-btn .tab-name { font-size: 15px; }
  .preset-btn { font-size: 15px; }
  .custom-select-trigger { font-size: 16px; }
  .csel-option { font-size: 16px; }
  .preset-name { font-size: 16px; }
  .toolbar-action-btn { font-size: 15px; }
  .nav-arrow { font-size: 15px; }
  .text-input { font-size: 16px; }
  .select-input { font-size: 16px; }
  .hex-input { font-size: 16px; }
  .checkbox-item { font-size: 16px; }
  .scale-input { font-size: 16px; }
  .wcag-on { font-size: 11px; }
  .wcag-combo { font-size: 15px; }
  .wcag-ratio { font-size: 16px; }
  .wcag-badge { font-size: 12px; }
  .wcag-suggestion { font-size: 14px; }
  .variant-swatch::after { font-size: 11px; }
  .ts-ratio-opt span { font-size: 14px; }
  .ts-token { font-size: 14px; }
  .ts-computed { font-size: 12px; }
  .ts-badge { font-size: 11px; }
  .ts-desc { font-size: 14px; }
  .ts-err-msg { font-size: 14px; }
  .ts-reset-btn { font-size: 14px; }
  .comp-preview-label { font-size: 14px; }
  .style-opt-name { font-size: 15px; }
  .style-opt-desc { font-size: 14px; }
  .live-form-label { font-size: 14px; }
  .btn-radius-card { font-size: 15px; }
  .shadow-card { font-size: 14px; }
  .shadow-token-list { font-size: 14px; }
  .rule-input { font-size: 15px; }
  .add-rule-btn { font-size: 15px; }
  .prev-font-tag { font-size: 12px; }
  .prev-font-name { font-size: 16px; }
  .prev-scale-token { font-size: 12px; }
  .prev-scale-px { font-size: 11px; }
  .prev-comp-label { font-size: 12px; }
  .mobile-panel-btn { font-size: 16px; }
  .mobile-tab-prev,
  .mobile-tab-next { font-size: 16px; }
  .mobile-tab-counter { font-size: 16px; }
}
