/* ==========================================================================
   方案 2：「马卡龙糖果像素风」—— 克制手作可爱 + 纯白零色偏画布工作区
   硬边界：
   1. 预览与精修画布区严格锁死纯白 #FFFFFF + 中性灰边框，绝无彩色透底或花纹干扰看色
   2. 手机首屏不堆砌装饰，保持大热区与柔和软糖像素回弹触感
   ========================================================================== */
:root {
  --bg: #f8f8fb;
  --surface: #ffffff;
  --surface-soft: #f3f1f7;
  --ink: #27222c;
  --muted: #767080;
  --border: #ebe5ee;
  --canvas-border: #e3e5ec;
  --accent: #ff7a95;
  --accent-ledge: #e05875;
  --accent-soft: #fff0f4;
  /* Restrained Macaron Functional Accents (controls/tags only, NEVER inside canvas) */
  --lavender-bg: #f3eeff;
  --lavender-ink: #6d4de0;
  --butter-bg: #fff8e6;
  --butter-ink: #b27000;
  --mint-bg: #e8faf3;
  --mint-ink: #158a63;
  --danger: #d63649;
  --danger-soft: #ffeff1;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow-card: 0 3px 0 #efe8f1, 0 6px 16px rgba(39, 34, 44, 0.04);
  --shadow-modal: 0 14px 36px rgba(39, 34, 44, 0.16);
}

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.app-shell {
  max-width: 500px;
  min-height: 100dvh;
  margin: 0 auto;
  padding-bottom: calc(70px + env(safe-area-inset-bottom, 0px));
  display: flex;
  flex-direction: column;
}

/* ---------- Top Bar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 52px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1.5px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -0.01em;
}

/* 4-Bead Macaron Pixel Logo */
.brand-beads {
  width: 24px;
  height: 24px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2.5px;
  padding: 2px;
  background: var(--surface-soft);
  border-radius: 7px;
  border: 1px solid var(--border);
}

.brand-beads i {
  display: block;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55);
}

.brand-beads i:nth-child(1) { background: #ff7a95; }
.brand-beads i:nth-child(2) { background: #ffd166; }
.brand-beads i:nth-child(3) { background: #7ed6b8; }
.brand-beads i:nth-child(4) { background: #b8a4ff; }

.card-pill {
  max-width: 64%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-pill.is-active {
  border-color: #b5ebd5;
  background: var(--mint-bg);
  color: var(--mint-ink);
}

.card-pill.is-warn {
  border-color: #f6db96;
  background: var(--butter-bg);
  color: var(--butter-ink);
}

.card-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

/* ---------- Views ---------- */
.tab-view {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ---------- Home Sticky Preview Stage (PURE WHITE ZERO-COLOR-CAST ZONE) ---------- */
.preview-stage {
  position: sticky;
  top: 52px;
  z-index: 30;
  background: var(--bg);
  padding: 10px 14px;
  border-bottom: 1.5px solid var(--border);
}

.stage-card {
  position: relative;
  background: #ffffff; /* Strictly pure white for zero color cast */
  border: 1.5px solid var(--canvas-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 230px;
}

.empty-upload {
  width: 100%;
  padding: 24px 16px 20px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
}

.upload-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1.5px solid #ffd4de;
  display: grid;
  place-items: center;
}

.empty-title {
  margin: 0;
  font-size: 16px;
  font-weight: 800;
}

.empty-hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  max-width: 300px;
}

.empty-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
  flex-wrap: wrap;
  justify-content: center;
}

.canvas-wrap {
  width: 100%;
  padding: 10px 10px 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.canvas-frame {
  width: min(100%, 268px);
  aspect-ratio: 1 / 1;
  background: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1.5px solid var(--canvas-border);
  position: relative;
}

#previewCanvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
}

/* Cute 3-Macaron-Bead Bouncing Loader */
.bead-loader {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  pointer-events: none;
}

.bead-loader span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2.5px rgba(255, 255, 255, 0.55);
  animation: beadBounce 0.65s infinite ease-in-out;
}

.bead-loader span:nth-child(1) { background: #ff7a95; animation-delay: 0s; }
.bead-loader span:nth-child(2) { background: #ffd166; animation-delay: 0.14s; }
.bead-loader span:nth-child(3) { background: #7ed6b8; animation-delay: 0.28s; }

@keyframes beadBounce {
  0%, 80%, 100% { transform: translateY(0) scale(0.95); }
  40% { transform: translateY(-7px) scale(1.08); }
}

.preview-mode-row {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.mode-switch-group {
  display: inline-flex;
  background: var(--surface-soft);
  border: 1.5px solid var(--border);
  border-radius: 999px;
  padding: 2px;
  gap: 2px;
}

.mode-switch-btn {
  border: none;
  background: transparent;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--muted);
}

.mode-switch-btn.is-active {
  background: #ffffff;
  color: var(--accent);
  box-shadow: 0 1px 4px rgba(39, 34, 44, 0.08);
}

.stage-mini-actions {
  display: flex;
  gap: 6px;
}

.mini-btn {
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
}

/* Buttercream Macaron Estimate Strip */
.estimate-strip {
  width: 100%;
  background: var(--butter-bg);
  border: 1.5px solid #f7e4b2;
  border-radius: 12px;
  padding: 7px 8px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  text-align: center;
}

.est-item-label {
  font-size: 10.5px;
  color: #96773a;
  font-weight: 600;
}

.est-item-val {
  font-size: 12px;
  font-weight: 800;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.est-item-sub {
  font-size: 10px;
  color: var(--butter-ink);
  font-weight: 700;
}

/* ---------- Home Parameter Settings Card ---------- */
.controls-panel {
  padding: 12px 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.param-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.card-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-heading {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}

.macaron-dots {
  display: inline-flex;
  gap: 4px;
}

.macaron-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: block;
}

.macaron-dots i:nth-child(1) { background: #ff7a95; }
.macaron-dots i:nth-child(2) { background: #ffd166; }
.macaron-dots i:nth-child(3) { background: #7ed6b8; }
.macaron-dots i:nth-child(4) { background: #b8a4ff; }

.param-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.param-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 700;
}

.param-val-accent {
  color: var(--accent);
  font-weight: 800;
  font-size: 14.5px;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.style-mode-pills {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.style-mode-btn {
  padding: 8px 4px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface-soft);
  text-align: center;
  transition: transform 0.1s ease, border-color 0.14s ease;
}

.style-mode-btn strong {
  display: block;
  font-size: 12.5px;
}

.style-mode-btn span {
  display: block;
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 1px;
}

.style-mode-btn.is-selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 2px 0 #ffd0db;
}

.style-mode-btn.is-selected span {
  color: #c94e69;
}

/* Tactile Soft-Pixel Stepper + Slider */
.stepper-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.step-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: #ffffff;
  color: var(--ink);
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  box-shadow: 0 2px 0 #e6dde9;
  transition: transform 0.08s ease;
}

.step-btn:active {
  transform: translateY(2px);
  box-shadow: none;
  background: var(--accent-soft);
  color: var(--accent);
}

.param-sub-note {
  font-size: 12px;
  color: var(--muted);
}

.quick-preset-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.quick-label {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.quick-pills {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.pill-preset {
  height: 35px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface-soft);
  font-size: 13px;
  font-weight: 800;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.pill-preset.is-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 3px 0 var(--accent-ledge);
}

.dual-select-row {
  display: grid;
  grid-template-columns: 1fr 1.48fr;
  gap: 10px;
}

.select-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.select-field label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.select-control {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface-soft);
  font-size: 12.5px;
  font-weight: 600;
  outline: none;
}

.adv-details {
  border-top: 1.5px dashed var(--border);
  padding-top: 10px;
}

.adv-details summary {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.adv-details summary::-webkit-details-marker {
  display: none;
}

.adv-details summary::after {
  content: "展开微调 ▾";
}

.adv-details[open] summary::after {
  content: "收起 ▴";
}

.adv-sliders {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.slider-label-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  margin-bottom: 5px;
}

.slider-val {
  color: var(--accent);
  font-weight: 700;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 7px;
  border-radius: 999px;
  background: #ece6f0;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 2px 6px rgba(224, 88, 117, 0.35);
  cursor: pointer;
}

/* Tactile Candy-Pixel Buttons */
.btn-primary {
  height: 45px;
  padding: 0 16px;
  border: none;
  border-radius: 13px;
  background: var(--accent);
  color: #fff;
  font-size: 14.5px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 3px 0 var(--accent-ledge);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.btn-primary:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--accent-ledge);
}

.btn-primary:disabled {
  opacity: 0.45;
  box-shadow: none;
  transform: none;
  cursor: not-allowed;
}

.btn-secondary {
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 2px 0 #ebe4ee;
}

.btn-secondary:active {
  transform: translateY(2px);
  box-shadow: none;
}

.btn-outline-accent {
  border-color: #ffc2d0;
  color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 2px 0 #ffd7e0;
}

.btn-lavender {
  border: 1.5px solid #dfd3ff;
  background: var(--lavender-bg);
  color: var(--lavender-ink);
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 11.5px;
  font-weight: 700;
}

.btn-full {
  width: 100%;
}

.home-cta-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ---------- 2nd Screen: Studio Editor ---------- */
.studio-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1.5px solid var(--border);
}

.studio-header h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 800;
}

.studio-body {
  padding: 10px 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.studio-toolbar-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  box-shadow: var(--shadow-card);
}

.view-pills-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.chip-btn {
  height: 29px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface-soft);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
}

.chip-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.bg-dots {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.bg-dot {
  width: 21px;
  height: 21px;
  border-radius: 50%;
  border: 2px solid var(--border);
  padding: 0;
}

.bg-dot.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-soft);
}

.zoom-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.zoom-val {
  min-width: 40px;
  text-align: right;
  font-weight: 800;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* 8 Tools Grid (4x2 clean thumb buttons) */
.edit-tools-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.tool-btn {
  padding: 7px 4px;
  border-radius: 11px;
  border: 1.5px solid var(--border);
  background: var(--surface-soft);
  font-size: 11.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.tool-btn.is-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.tool-btn[data-studio-tool="wand"].is-active,
.tool-btn[data-studio-tool="replace"].is-active {
  background: var(--lavender-bg);
  border-color: #cbb8ff;
  color: var(--lavender-ink);
}

.tool-btn:disabled {
  opacity: 0.35;
}

.studio-quick-magic {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  flex-wrap: wrap;
}

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

.replace-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--lavender-bg);
  color: var(--lavender-ink);
  font-size: 12px;
  font-weight: 700;
}

.replace-chip {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1.5px rgba(39, 34, 44, 0.25);
  flex-shrink: 0;
}

.swatch-tray {
  border-top: 1.5px dashed var(--border);
  padding-top: 9px;
}

.swatch-tray-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 11.5px;
  color: var(--muted);
}

.swatch-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  max-height: 106px;
  overflow-y: auto;
  padding: 2px;
}

.swatch-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid rgba(39, 34, 44, 0.22);
  padding: 0;
  flex-shrink: 0;
}

.swatch-dot.is-selected {
  transform: scale(1.15);
  border: 2.5px solid var(--ink);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent);
}

/* PURE WHITE NEUTRAL STUDIO CANVAS BOX */
.studio-canvas-scroll {
  width: 100%;
  max-height: 360px;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: #ffffff;
  border: 1.5px solid var(--canvas-border);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  box-shadow: var(--shadow-card);
}

.studio-canvas-scroll.is-paint-mode {
  touch-action: none;
}

#studioCanvas {
  display: block;
  border-radius: 6px;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
}

.metrics-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.metric-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 9px 6px;
  text-align: center;
  box-shadow: var(--shadow-card);
}

.metric-label {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

.metric-value {
  font-size: 17.5px;
  font-weight: 800;
  color: var(--accent);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.export-dual-row {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 9px;
}

/* ---------- Drafts / Card / Guide Views ---------- */
.page-pad {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.info-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-card);
}

.info-card h2 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 800;
}

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

.draft-item {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.draft-thumb {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  border: 1.5px solid var(--canvas-border);
  image-rendering: pixelated;
  flex-shrink: 0;
}

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

.draft-meta strong {
  display: block;
  font-size: 13.5px;
}

.draft-meta span {
  display: block;
  font-size: 12px;
  color: var(--muted);
}

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

.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 11px 0;
}

.faq-item:last-of-type {
  border-bottom: none;
}

.faq-item h4 {
  margin: 0 0 4px;
  font-size: 13.5px;
}

.faq-item p {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
}

.attribution-line {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1.5px dashed var(--border);
  font-size: 11.5px;
  color: #8f8899;
}

/* ---------- Bottom 4-Tab Nav ---------- */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 45;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(10px);
  border-top: 1.5px solid var(--border);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom, 0px));
}

.bottom-nav-inner {
  max-width: 500px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
}

.nav-tab {
  border: none;
  background: transparent;
  padding: 4px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.nav-tab .nav-ico {
  font-size: 18px;
  line-height: 1.1;
}

.nav-tab.is-active {
  color: var(--accent);
}

/* ---------- Inputs & Modals ---------- */
.text-input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--surface-soft);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  outline: none;
}

.text-input:focus {
  border-color: var(--accent);
  background: #fff;
}

.card-info-box {
  padding: 11px 12px;
  border-radius: 11px;
  background: var(--surface-soft);
  border: 1.5px solid var(--border);
  font-size: 12.5px;
  margin: 10px 0;
}

.card-info-box.is-ok {
  background: var(--mint-bg);
  border-color: #b5ebd5;
  color: #13684a;
}

.card-info-box.is-err {
  background: var(--danger-soft);
  border-color: #f8c2c9;
  color: var(--danger);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(29, 24, 34, 0.58);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-sheet {
  width: 100%;
  max-width: 500px;
  max-height: 92dvh;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-modal);
}

.modal-header {
  padding: 14px 16px;
  border-bottom: 1.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  margin: 0;
  font-size: 15.5px;
  font-weight: 800;
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface-soft);
  font-size: 18px;
}

.modal-body {
  padding: 14px 16px 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.crop-banner {
  background: var(--butter-bg);
  border: 1.5px solid #f7df9d;
  color: var(--butter-ink);
  border-radius: 12px;
  padding: 9px 11px;
  font-size: 12.5px;
  font-weight: 700;
  margin-bottom: 12px;
}

.crop-stage-wrap {
  width: min(100%, 336px);
  aspect-ratio: 1 / 1;
  margin: 0 auto 12px;
  border-radius: 14px;
  overflow: hidden;
  background: #1a1e23;
  touch-action: none;
  user-select: none;
  border: 2.5px solid var(--accent);
}

#cropCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.crop-zoom-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 12.5px;
  color: var(--muted);
}

.save-banner {
  background: var(--accent-soft);
  border: 1.5px solid #ffc7d4;
  color: #b0314e;
  border-radius: 13px;
  padding: 11px 12px;
  text-align: center;
  margin-bottom: 10px;
}

.save-banner strong {
  display: block;
  font-size: 15px;
  margin-bottom: 2px;
}

.save-banner span {
  font-size: 12px;
  color: #9e475c;
}

/* F2 Quadrant Slice Switcher Tabs inside Export Modal */
.slice-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.slice-tab-btn {
  flex: 1;
  min-width: 72px;
  height: 32px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface-soft);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
}

.slice-tab-btn.is-active {
  background: var(--lavender-bg);
  border-color: #c8b3ff;
  color: var(--lavender-ink);
}

.hd-img-wrap {
  background: #ffffff;
  border: 1.5px solid var(--canvas-border);
  border-radius: 12px;
  padding: 8px;
  margin-bottom: 12px;
}

#hdExportImage {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  -webkit-touch-callout: default;
  user-select: auto;
}

/* 0.6s Pure-CSS Macaron Bead Unlock Confetti Burst */
.confetti-burst {
  position: fixed;
  top: 22%;
  left: 50%;
  pointer-events: none;
  z-index: 250;
}

.confetti-dot {
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.55);
  animation: burstOut 0.62s ease-out forwards;
}

@keyframes burstOut {
  0% { transform: translate(0, 0) scale(0.7); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1.1); opacity: 0; }
}

.toast {
  position: fixed;
  top: 62px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  max-width: 88vw;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(39, 34, 44, 0.92);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-modal);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.toast.show {
  opacity: 1;
}

@media (min-width: 540px) {
  .modal-backdrop {
    align-items: center;
    padding: 16px;
  }
  .modal-sheet {
    border-radius: 22px;
  }
}
