:root {
  color-scheme: light;
  --bg: #f3f6f5;
  --paper: #ffffff;
  --panel: #f7faf8;
  --ink: #111827;
  --muted: #667085;
  --line: #e2e8f0;
  --accent: #e56b2f;
  --teal: #0f9f8f;
  --green: #22c55e;
  --blue: #2563eb;
  --danger: #b42318;
  --shadow: 0 18px 42px rgba(15, 23, 42, .10);
  --radius: 12px;
}

* { box-sizing: border-box; }

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  width: 100%;
  min-height: 100vh;
  overflow-x: hidden;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(145deg, rgba(15, 159, 143, .08) 0%, transparent 34%),
    linear-gradient(180deg, #fbfdfc 0%, var(--bg) 48%, #fff7ef 100%);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

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

button { cursor: pointer; }

.app-shell {
  width: 100%;
  max-width: 540px;
  min-height: 100vh;
  margin: 0 auto;
  overflow-x: hidden;
  background: rgba(255, 255, 255, .72);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, .06);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 12px 8px;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(15, 23, 42, .08);
}

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

.brand-lockup img {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: #fff;
}

.brand-lockup strong,
.brand-lockup span {
  display: block;
}

.brand-lockup strong {
  font-size: 15px;
  line-height: 1.1;
}

.brand-lockup span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.top-actions {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

.icon-btn,
.tool-btn {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  color: var(--ink);
  text-decoration: none;
  box-shadow: none;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease, border-color .15s ease, color .15s ease;
}

.icon-btn:hover,
.tool-btn:hover,
.tool-btn:focus-visible,
.icon-btn:focus-visible {
  border-color: rgba(15, 159, 143, .55);
  color: var(--teal);
  box-shadow: 0 10px 24px rgba(15, 159, 143, .16);
  outline: none;
}

.icon-btn svg,
.tool-btn svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-btn:active,
.tool-btn:active,
.mode-toggle:active,
.choice-card:active,
.pattern-card:active,
.primary-btn:active,
.secondary-btn:active,
.whatsapp-btn:active {
  transform: scale(.97);
}

main {
  display: grid;
  gap: 10px;
  padding: 8px 8px calc(18px + env(safe-area-inset-bottom));
}

.stage-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 0 0 18px 18px;
  background:
    linear-gradient(135deg, rgba(15, 159, 143, .12), rgba(37, 99, 235, .06) 52%, rgba(229, 107, 47, .10)),
    #eef7f4;
  box-shadow: var(--shadow);
}

.stage-head {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 104px 6px 12px;
}

.stage-head > div {
  min-width: 0;
}

.eyebrow {
  display: block;
  color: var(--teal);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .04em;
  text-transform: uppercase;
}

h1 {
  margin: 3px 0 0;
  font-size: 22px;
  line-height: 1.05;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.stage-note {
  margin: 5px 0 0;
  max-width: 285px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 800;
  line-height: 1.25;
}

.mode-toggle {
  position: absolute;
  right: 12px;
  top: 12px;
  flex: 0 0 auto;
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  padding: 8px 12px;
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: #fff;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(15, 159, 143, .22);
}

.canvas-viewport {
  position: relative;
  height: clamp(600px, 80svh, 820px);
  display: grid;
  place-items: center;
  padding: 6px 4px 138px;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 12%, rgba(15, 159, 143, .10), transparent 30%),
    linear-gradient(90deg, rgba(17, 24, 39, .045) 1px, transparent 1px),
    linear-gradient(0deg, rgba(17, 24, 39, .045) 1px, transparent 1px),
    #f9fbff;
  background-size: 26px 26px;
  touch-action: none;
  cursor: grab;
}

#designCanvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 24px 58px rgba(17, 24, 39, .22);
  pointer-events: none;
  transition: transform .26s ease, box-shadow .26s ease;
}

#designCanvas.pop {
  animation: canvasPop .34s ease;
}

body.previewing #designCanvas {
  transform: none;
  box-shadow: 0 34px 78px rgba(17, 24, 39, .30);
}

.view-zoom-panel {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 14px;
  z-index: 14;
  display: none;
  grid-template-columns: 40px 1fr 40px 86px 62px;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(17, 24, 39, .1);
  border-radius: 16px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 18px 42px rgba(17, 24, 39, .16);
  backdrop-filter: blur(12px);
}

body.previewing .view-zoom-panel {
  display: grid;
}

body.previewing.quick-editor-open .view-zoom-panel {
  display: none;
}

.view-tool-dock {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 16;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 7px;
  border: 1px solid rgba(17, 24, 39, .10);
  border-radius: 18px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 18px 42px rgba(17, 24, 39, .16);
  backdrop-filter: blur(12px);
}

body.previewing .view-tool-dock {
  bottom: 82px;
}

body.previewing.quick-editor-open .view-tool-dock {
  display: none;
}

.view-tool {
  min-width: 0;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  display: grid;
  grid-template-columns: 18px 1fr;
  justify-items: center;
  align-items: center;
  gap: 3px;
  padding: 7px 3px;
  font-size: 11px;
  font-weight: 900;
}

.view-tool svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.view-tool.active {
  border-color: rgba(15, 159, 143, .24);
  background: linear-gradient(135deg, rgba(15, 159, 143, .16), rgba(37, 99, 235, .13));
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(15, 159, 143, .14);
}

.view-tool:active {
  transform: scale(.97);
}

.zoom-btn,
.zoom-reset-btn {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  color: var(--ink);
  font-weight: 900;
}

.zoom-btn:active,
.zoom-reset-btn:active {
  transform: scale(.96);
}

.zoom-reset-btn {
  font-size: 12px;
}

#viewZoomRange {
  min-height: 38px;
  padding: 0;
}

#viewZoomValue {
  min-width: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
}

.gesture-hint {
  position: absolute;
  left: 14px;
  right: auto;
  bottom: 112px;
  max-width: min(285px, calc(100% - 92px));
  padding: 7px 10px;
  border-radius: 13px;
  background: rgba(15, 23, 42, .82);
  color: #fff;
  text-align: left;
  font-size: 11px;
  font-weight: 800;
  pointer-events: none;
}

.floating-tools {
  position: absolute;
  right: 10px;
  top: 64px;
  z-index: 15;
  display: grid;
  gap: 7px;
  padding: 6px;
  border: 1px solid rgba(15, 23, 42, .08);
  border-radius: 18px;
  background: rgba(255, 255, 255, .9);
  box-shadow: 0 16px 34px rgba(15, 23, 42, .16);
  backdrop-filter: blur(12px);
}

body.quick-editor-open #quickTextBtn {
  border-color: rgba(229, 107, 47, .65);
  color: var(--accent);
  background: #fff7ed;
  box-shadow: 0 0 0 3px rgba(229, 107, 47, .16);
}

.quick-editor {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  z-index: 18;
  display: grid;
  gap: 9px;
  padding: 10px;
  border: 1px solid rgba(15, 159, 143, .2);
  border-radius: 18px 18px 16px 16px;
  background: rgba(255, 255, 255, .94);
  box-shadow: 0 20px 48px rgba(15, 23, 42, .2);
  backdrop-filter: blur(16px);
  animation: editorIn .18s ease;
  max-height: min(242px, calc(100% - 26px));
  overflow: auto;
}

.quick-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.quick-editor-head strong {
  color: var(--teal);
  font-size: 13px;
  font-weight: 900;
}

.editor-close {
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

#quickTextInput {
  min-height: 42px;
  border-color: rgba(15, 159, 143, .28);
  font-weight: 900;
}

.quick-editor-grid {
  display: grid;
  grid-template-columns: minmax(128px, .9fr) 1fr;
  gap: 8px;
}

.quick-editor label,
.quick-rotation {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.quick-editor select,
.quick-editor input[type="range"] {
  margin-top: 5px;
  min-height: 36px;
}

.quick-color-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 1px 0 3px;
}

.quick-color {
  width: 32px;
  height: 32px;
  min-width: 32px;
  border: 1px solid rgba(15, 23, 42, .16);
  border-radius: 999px;
  background: var(--quick-color);
}

.quick-color.active {
  box-shadow: 0 0 0 3px rgba(15, 159, 143, .2);
  border-color: var(--teal);
}

.workflow-card {
  overflow: hidden;
  border: 1px solid rgba(17, 24, 39, .08);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow);
}

.step-tabs {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 5px;
  padding: 8px;
  border-bottom: 1px solid rgba(17, 24, 39, .08);
  background: #f9faf7;
}

.step-tab {
  min-width: 0;
  min-height: 39px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.step-tab.active {
  background: var(--teal);
  color: #fff;
  box-shadow: 0 10px 22px rgba(15, 159, 143, .18);
}

.step-panel {
  display: none;
  padding: 15px;
  animation: panelIn .2s ease;
}

.step-panel.active { display: block; }

.mode-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.choice-card {
  min-width: 0;
  min-height: 80px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  text-align: left;
  padding: 12px;
}

.choice-card strong,
.choice-card span {
  display: block;
}

.choice-card strong { font-size: 17px; }

.choice-card span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.choice-card.active {
  border-color: var(--teal);
  background: #e9fbf8;
  box-shadow: 0 0 0 3px rgba(15, 159, 143, .14);
}

label {
  display: block;
  margin: 14px 0 7px;
  color: #344054;
  font-size: 13px;
  font-weight: 900;
}

input,
select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 159, 143, .15);
}

.hidden { display: none !important; }

.input-with-unit,
.range-line {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.input-with-unit span,
output {
  min-width: 52px;
  color: var(--accent);
  font-weight: 900;
  text-align: right;
}

input[type="range"] {
  accent-color: var(--teal);
}

.microcopy {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.assist-card {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid #bfe7c7;
  border-radius: 16px;
  background: #f0fff4;
}

.assist-card strong {
  color: #14532d;
  font-size: 13px;
}

.assist-card span {
  color: #315443;
  font-size: 12px;
  line-height: 1.35;
}

.install-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(37, 99, 235, .18);
  border-radius: 12px;
  background: #f4f8ff;
}

.install-card strong,
.install-card span {
  display: block;
}

.install-card strong {
  color: #1e3a8a;
  font-size: 13px;
  font-weight: 900;
}

.install-card span {
  margin-top: 4px;
  color: #475467;
  font-size: 12px;
  line-height: 1.35;
}

.install-card.installed {
  border-color: rgba(34, 197, 94, .22);
  background: #effdf4;
}

.quick-links {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 3px;
}

.preset-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  max-height: 228px;
  overflow: auto;
  padding-right: 2px;
}

.preset-btn {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  padding: 10px;
  text-align: left;
}

.preset-btn strong,
.preset-btn span {
  display: block;
}

.preset-btn span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.preset-btn.active {
  border-color: var(--teal);
  background: #e9fbf8;
  box-shadow: 0 0 0 3px rgba(15, 159, 143, .15);
}

.custom-size {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.custom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.custom-grid select,
.custom-grid button {
  grid-column: span 2;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.background-adjust {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid rgba(229, 107, 47, .20);
  border-radius: 12px;
  background: #fff8f1;
}

.adjust-title strong,
.adjust-title span {
  display: block;
}

.adjust-title strong {
  color: #9a3412;
  font-size: 13px;
  font-weight: 900;
}

.adjust-title span {
  margin-top: 3px;
  color: #7c4a2d;
  font-size: 12px;
}

.background-adjust label {
  margin: 5px 0 0;
}

.file-chip,
.secondary-file,
.upload-main {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 14px;
  padding: 11px 12px;
  background: linear-gradient(180deg, #eef6ff 0%, #f7fbff 100%);
  color: #1e3a8a;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.file-chip input,
.secondary-file input,
.upload-main input {
  display: none;
}

.category-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 12px -15px 10px;
  padding: 0 15px 6px;
  scrollbar-width: thin;
}

.category-chip {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 8px 12px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.category-chip.active {
  background: var(--teal);
  color: #fff;
  border-color: var(--teal);
  box-shadow: 0 8px 18px rgba(15, 159, 143, .16);
}

.pattern-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-height: 430px;
  overflow: auto;
  padding-right: 2px;
}

.pattern-card {
  position: relative;
  min-height: 106px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #e9eee5;
  padding: 0;
}

.pattern-card img {
  width: 100%;
  height: 100%;
  min-height: 106px;
  object-fit: cover;
  display: block;
}

.pattern-card span {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  padding: 6px 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, .88);
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.pattern-card.active {
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(15, 159, 143, .18);
}

.upload-panel,
.selected-card,
.export-card {
  display: grid;
  gap: 6px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
}

.upload-panel strong,
.selected-card strong,
.export-card strong {
  font-size: 17px;
}

.upload-panel span,
.selected-card span,
.export-card span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 12px;
}

.primary-btn,
.secondary-btn,
.whatsapp-btn,
.store-btn,
.whatsapp-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 900;
  text-align: center;
  text-decoration: none;
}

.primary-btn {
  background: linear-gradient(135deg, var(--teal), var(--blue));
  color: #fff;
  box-shadow: 0 12px 24px rgba(15, 159, 143, .18);
}

.secondary-btn {
  background: #eef6ff;
  color: var(--ink);
}

.secondary-btn.full,
.whatsapp-btn,
.store-btn.full {
  width: 100%;
  margin-top: 10px;
}

.whatsapp-btn {
  background: var(--green);
  color: #073b1d;
}

.whatsapp-mini {
  min-height: 44px;
  background: var(--green);
  color: #073b1d;
}

.store-btn {
  min-height: 44px;
  background: #eef6ff;
  color: #1e3a8a;
  border: 1px solid #bfdbfe;
}

.swatch-row {
  display: flex;
  gap: 9px;
  margin-top: 14px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.swatch {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--swatch);
}

.swatch.active {
  box-shadow: 0 0 0 3px rgba(15, 159, 143, .2);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + env(safe-area-inset-bottom));
  z-index: 100;
  max-width: min(440px, calc(100vw - 28px));
  padding: 12px 15px;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  font-size: 13px;
  font-weight: 900;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 16px) scale(.98);
  transition: opacity .18s ease, transform .18s ease;
}

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

.update-banner {
  position: fixed;
  left: 50%;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 130;
  width: min(500px, calc(100vw - 20px));
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(15, 159, 143, .24);
  border-radius: 14px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 24px 64px rgba(17, 24, 39, .24);
  transform: translateX(-50%);
}

.update-banner strong,
.update-banner span {
  display: block;
}

.update-banner strong {
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.update-banner span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.update-banner .primary-btn,
.update-banner .secondary-btn {
  min-height: 38px;
  padding-inline: 10px;
}

.done-layer {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(17, 24, 39, .5);
  backdrop-filter: blur(10px);
}

.done-card {
  width: min(100%, 360px);
  overflow: hidden;
  border-radius: 22px;
  background: #fff;
  padding: 0 16px 16px;
  text-align: center;
  box-shadow: 0 26px 70px rgba(17, 24, 39, .28);
  animation: modalIn .25s ease;
}

.done-card canvas {
  display: block;
  width: 100%;
  height: 170px;
}

.done-card strong,
.done-card span {
  display: block;
}

.done-card strong {
  font-size: 24px;
}

.done-card span {
  margin: 6px 0 14px;
  color: var(--muted);
  font-size: 13px;
}

body.previewing .workflow-card,
body.previewing .gesture-hint {
  opacity: 0;
  pointer-events: none;
}

body.quick-editor-open .gesture-hint {
  opacity: 0;
}

body.previewing .stage-head {
  display: none;
}

body.previewing .canvas-viewport {
  height: calc(100dvh - 104px);
  padding-bottom: 76px;
}

body.previewing .floating-tools {
  top: 18px;
  right: 10px;
}

body.previewing .quick-editor {
  left: 8px;
  right: 8px;
  bottom: 8px;
  max-height: min(226px, calc(100% - 28px));
}

@keyframes panelIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes canvasPop {
  0% { transform: scale(.985); }
  65% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

@keyframes editorIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (min-width: 900px) {
  body {
    display: grid;
    place-items: center;
    padding: 24px;
  }

  .app-shell {
    min-height: min(900px, calc(100vh - 48px));
    border-radius: 28px;
    overflow: hidden;
  }
}

@media (max-width: 420px) {
  main {
    padding-inline: 8px;
  }

  .stage-head {
    gap: 8px;
    padding-inline: 12px;
  }

  h1 {
    font-size: 21px;
  }

  .stage-note {
    max-width: 245px;
    font-size: 10px;
  }

  .mode-toggle {
    padding-inline: 10px;
    font-size: 13px;
  }

  .top-actions {
    gap: 4px;
  }

  .view-zoom-panel {
    grid-template-columns: 36px 1fr 36px 74px 56px;
    gap: 6px;
  }

  .view-tool-dock {
    left: 8px;
    right: 8px;
    gap: 4px;
    padding: 6px;
  }

  .view-tool {
    min-height: 44px;
    font-size: 9.5px;
  }

  .step-tab {
    padding-inline: 2px;
    font-size: 11px;
  }

  .mode-grid {
    gap: 8px;
  }

  .install-card,
  .update-banner {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  .step-tabs {
    gap: 3px;
    padding: 6px;
  }

  .step-tab {
    font-size: 11px;
  }

  .floating-tools {
    right: 8px;
    gap: 5px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
