:root {
  --canvas: #f2f0ea;
  --surface: #fffefa;
  --surface-strong: #ffffff;
  --surface-muted: #ebe8df;
  --ink: #202624;
  --ink-soft: #626966;
  --ink-faint: #858b88;
  --line: #d9d6cc;
  --line-strong: #c7c3b8;
  --accent: #b9563f;
  --accent-dark: #913d2c;
  --accent-soft: #f1d8d0;
  --success: #2f7157;
  --success-soft: #dfece5;
  --warning: #9a641f;
  --warning-soft: #f4e8d4;
  --danger: #a43e34;
  --danger-soft: #f4deda;
  --shadow: 0 18px 50px rgba(61, 55, 43, 0.12);
  --shadow-tight: 0 8px 24px rgba(61, 55, 43, 0.1);
  --radius-lg: 24px;
  --radius-md: 15px;
  --radius-sm: 10px;
  --header-height: 68px;
  color-scheme: light;
  font-family: "Aptos", "Segoe UI Variable", "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--canvas);
  color: var(--ink);
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  overflow-x: clip;
  background:
    linear-gradient(rgba(32, 38, 36, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(32, 38, 36, 0.025) 1px, transparent 1px),
    var(--canvas);
  background-size: 24px 24px;
  font-size: 14px;
  line-height: 1.45;
}

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

button,
label[for] {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

button:active:not(:disabled),
.button:active {
  transform: translateY(1px) scale(0.99);
}

:focus-visible {
  outline: 3px solid rgba(185, 86, 63, 0.34);
  outline-offset: 2px;
}

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

h1,
h2,
h3 {
  letter-spacing: -0.025em;
}

h1,
h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.15;
}

h3 {
  margin-bottom: 4px;
  font-size: 14px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.visually-hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 20;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon-button svg,
.button svg,
.guide-button svg,
.search-field svg,
.upload-zone svg,
.reallink-note svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.app-loading {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  align-content: center;
  gap: 24px;
  background: var(--canvas);
}

.loading-line,
.loading-card {
  display: block;
  overflow: hidden;
  border-radius: 999px;
  background: #dedbd2;
}

.loading-line::after,
.loading-card::after {
  display: block;
  width: 45%;
  height: 100%;
  content: "";
  background: rgba(255, 255, 255, 0.52);
  animation: loading-shimmer 1.2s ease-in-out infinite;
}

.loading-line--long {
  width: min(70vw, 420px);
  height: 12px;
}

.loading-card {
  width: min(78vw, 560px);
  aspect-ratio: 1.75;
  border-radius: 18px;
}

@keyframes loading-shimmer {
  from { transform: translateX(-110%); }
  to { transform: translateX(235%); }
}

.app {
  min-height: 100dvh;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  min-height: var(--header-height);
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 10px 18px;
  border-bottom: 1px solid rgba(199, 195, 184, 0.8);
  background: rgba(242, 240, 234, 0.94);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(16px);
}

.brand-lockup,
.brand-copy,
.header-actions,
.workspace-controls,
.zoom-control,
.document-status,
.image-file-row,
.dialog-header {
  display: flex;
  align-items: center;
}

.brand-lockup {
  min-width: 224px;
  gap: 10px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 750;
  letter-spacing: -0.05em;
}

.brand-copy {
  align-items: flex-start;
  flex-direction: column;
  line-height: 1.2;
}

.brand-copy strong {
  font-size: 14px;
}

.brand-copy span {
  color: var(--ink-soft);
  font-size: 11px;
}

.header-actions {
  justify-content: flex-end;
  gap: 6px;
}

.language-control select {
  height: 38px;
  padding: 0 30px 0 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 12px;
  font-weight: 700;
}

.button,
.icon-button,
.guide-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 11px;
  font-weight: 680;
  text-decoration: none;
  transition: background-color 180ms cubic-bezier(0.16, 1, 0.3, 1), border-color 180ms cubic-bezier(0.16, 1, 0.3, 1), transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.button {
  padding: 9px 14px;
}

.icon-button {
  width: 40px;
  padding: 0;
  border-color: var(--line);
  background: var(--surface);
}

.icon-button--small {
  width: 34px;
  min-height: 34px;
  border-radius: 9px;
}

.button--quiet,
.guide-button {
  border-color: var(--line);
  background: var(--surface);
  color: var(--ink);
}

.button--primary {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
  box-shadow: 0 5px 14px rgba(32, 38, 36, 0.15);
}

.button--primary:hover {
  background: #303936;
}

.button--quiet:hover,
.icon-button:hover:not(:disabled),
.guide-button:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.button-count {
  display: inline-grid;
  min-width: 19px;
  height: 19px;
  place-items: center;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--warning-soft);
  color: var(--warning);
  font-size: 10px;
}

.studio-shell {
  display: grid;
  height: calc(100dvh - var(--header-height));
  min-height: calc(100dvh - var(--header-height));
  grid-template-columns: minmax(250px, 0.72fr) minmax(440px, 1.55fr) minmax(300px, 0.88fr);
  align-items: stretch;
  overflow: hidden;
}

.template-rail,
.inspector {
  min-width: 0;
  background: rgba(255, 254, 250, 0.92);
}

.template-rail {
  border-right: 1px solid var(--line);
  padding: 22px 18px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.inspector {
  border-left: 1px solid var(--line);
  overflow: hidden;
}

.rail-heading,
.inspector-heading,
.workspace-topbar,
.subsection-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 780;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

.template-total {
  display: grid;
  min-width: 32px;
  height: 27px;
  place-items: center;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-family: "Cascadia Mono", "SFMono-Regular", monospace;
  font-size: 11px;
}

.rail-controls {
  display: grid;
  gap: 11px;
  margin: 20px 0 12px;
}

.field-block,
.range-field {
  display: grid;
  gap: 7px;
}

.field-block > span,
.range-field > span,
.choice-group legend {
  color: #3e4643;
  font-size: 12px;
  font-weight: 680;
}

.field-block > span b {
  margin-left: 3px;
  color: var(--accent);
}

.field-block input,
.field-block select,
.field-block textarea,
.search-field input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-strong);
  box-shadow: inset 0 1px 1px rgba(32, 38, 36, 0.025);
}

.field-block input,
.field-block select,
.field-block textarea {
  padding: 9px 11px;
}

.field-block input[type="color"] {
  height: 44px;
  padding: 5px;
}

.field-block textarea {
  min-height: 62px;
  resize: vertical;
}

.field-block small,
.range-field small,
.toggle-row small,
.format-option small {
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 450;
}

.field-block--compact {
  gap: 5px;
}

.field-block--compact input,
.field-block--compact select {
  min-height: 38px;
  padding: 7px 10px;
}

.custom-size-grid,
.two-column-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.two-column-fields {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.search-field {
  position: relative;
  display: flex;
  align-items: center;
}

.search-field svg {
  position: absolute;
  left: 11px;
  width: 16px;
  color: var(--ink-faint);
}

.search-field input {
  min-height: 40px;
  padding: 8px 10px 8px 35px;
}

.filter-strip {
  display: flex;
  gap: 7px;
  padding: 3px 0 13px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.filter-chip,
.text-button {
  border: 0;
  background: transparent;
}

.filter-chip {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 650;
}

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

.template-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.template-card {
  display: grid;
  min-width: 0;
  gap: 7px;
  padding: 7px;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  color: inherit;
  text-align: left;
  animation: template-in 320ms cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--template-index, 0) * 22ms);
}

@keyframes template-in {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.template-card:hover {
  background: var(--surface-muted);
}

.template-card.is-active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(185, 86, 63, 0.12);
}

.template-card canvas {
  display: block;
  width: 100%;
  border: 1px solid rgba(32, 38, 36, 0.12);
  border-radius: 7px;
  background: #fff;
  box-shadow: 0 3px 8px rgba(61, 55, 43, 0.1);
}

.template-card span {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 670;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-state {
  padding: 42px 12px;
  color: var(--ink-soft);
  text-align: center;
}

.empty-state-mark {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  margin: 0 auto 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 16px;
  color: var(--ink-faint);
  font-family: "Cascadia Mono", monospace;
}

.empty-state strong {
  display: block;
  color: var(--ink);
}

.empty-state p {
  max-width: 210px;
  margin: 5px auto 10px;
  font-size: 12px;
}

.text-button {
  padding: 2px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 720;
}

.text-button:hover {
  text-decoration: underline;
}

.text-button--danger {
  color: var(--danger);
}

.workspace {
  display: grid;
  min-width: 0;
  grid-template-rows: auto minmax(380px, 1fr) auto;
  padding: 22px clamp(18px, 3vw, 44px) 14px;
  overflow: hidden;
}

.workspace-topbar {
  align-items: center;
  padding-bottom: 16px;
}

.workspace-controls {
  gap: 8px;
}

.segmented-control {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.64);
}

.segmented-control button {
  min-height: 34px;
  padding: 6px 13px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 680;
}

.segmented-control button.is-active {
  background: var(--surface-strong);
  color: var(--ink);
  box-shadow: 0 2px 7px rgba(61, 55, 43, 0.1);
}

.segmented-control--wide {
  display: grid;
  width: 100%;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.guide-button {
  min-height: 40px;
  min-width: 122px;
  padding: 8px 13px;
  color: var(--ink-soft);
  font-size: 12px;
}

.guide-status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
}

.guide-button.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 5px 14px rgba(32, 38, 36, 0.14);
}

.guide-button.is-active .guide-status-dot {
  border-color: #fff;
  background: #fff;
}

.guide-button.is-active:hover {
  border-color: #303936;
  background: #303936;
  color: #fff;
}

.guide-button:active {
  transform: translateY(1px) scale(0.985);
}

.canvas-stage {
  display: grid;
  min-height: 0;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 22px;
  border: 1px solid rgba(199, 195, 184, 0.78);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 50% 0, rgba(255, 255, 255, 0.68), transparent 52%),
    #e9e6de;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.74);
  overflow: auto;
}

.canvas-surface {
  position: relative;
  width: min(100%, 720px);
  max-width: 100%;
  transform: scale(var(--preview-zoom, 1));
  transform-origin: center;
  transition: transform 220ms cubic-bezier(0.16, 1, 0.3, 1);
}

.canvas-surface canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 24px 54px rgba(61, 55, 43, 0.18), 0 4px 12px rgba(61, 55, 43, 0.12);
  cursor: default;
  touch-action: none;
}

.canvas-surface canvas.is-draggable {
  cursor: grab;
}

.canvas-surface canvas.is-dragging {
  cursor: grabbing;
}

.canvas-selection-label {
  position: absolute;
  top: -28px;
  right: 0;
  padding: 4px 8px;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

.canvas-instruction {
  color: var(--ink-faint);
  font-size: 11px;
  text-align: center;
}

.workspace-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding-top: 12px;
}

.zoom-control {
  gap: 8px;
}

.zoom-control output,
.size-readout {
  color: var(--ink-soft);
  font-family: "Cascadia Mono", "SFMono-Regular", monospace;
  font-size: 10px;
}

.zoom-control output {
  min-width: 38px;
  text-align: center;
}

.zoom-control input {
  width: 90px;
}

.document-status {
  justify-content: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 11px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
}

.document-status.is-saving .status-dot {
  background: var(--warning);
  animation: status-pulse 1s ease-in-out infinite;
}

@keyframes status-pulse {
  50% { opacity: 0.34; transform: scale(0.72); }
}

.size-readout {
  justify-self: end;
}

.inspector-heading {
  padding: 22px 18px 14px;
}

.inspector-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mobile-sheet-close {
  display: none;
}

.inspector-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}

.inspector-tabs button {
  min-height: 42px;
  padding: 8px 4px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--ink-faint);
  font-size: 11px;
  font-weight: 720;
}

.inspector-tabs button.is-active {
  border-bottom-color: var(--accent);
  color: var(--ink);
}

.inspector-scroll {
  max-height: calc(100dvh - var(--header-height) - 117px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.inspector-panel {
  padding: 18px 18px 80px;
}

.panel-intro {
  margin-bottom: 18px;
  padding: 13px 14px;
  border-left: 3px solid var(--accent);
  background: #f6eee9;
}

.panel-intro--privacy {
  border-left-color: var(--success);
  background: var(--success-soft);
}

.panel-intro strong {
  display: block;
  font-size: 12px;
}

.panel-intro p {
  margin: 3px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
}

.form-stack {
  display: grid;
  gap: 15px;
}

.subsection {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.subsection-heading p {
  margin-bottom: 12px;
  color: var(--ink-faint);
  font-size: 11px;
}

.field-order-list {
  display: grid;
  gap: 6px;
}

.field-order-row {
  display: grid;
  min-height: 43px;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.field-order-row input {
  width: 17px;
  height: 17px;
  accent-color: var(--accent);
}

.field-order-row span {
  overflow: hidden;
  font-size: 12px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-actions {
  display: flex;
  gap: 2px;
}

.order-actions button {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-soft);
}

.order-actions button:hover:not(:disabled) {
  background: var(--surface-muted);
}

.choice-group,
.export-format-grid {
  min-width: 0;
  padding: 0;
  margin: 0;
  border: 0;
}

.choice-group legend,
.export-format-grid legend {
  margin-bottom: 7px;
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.palette-button {
  min-height: 52px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}

.palette-button span {
  display: block;
  height: 100%;
  min-height: 38px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--palette-bg) 0 58%, var(--palette-accent) 58% 76%, var(--palette-ink) 76%);
}

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

.range-field > span {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.range-field output {
  color: var(--ink-faint);
  font-family: "Cascadia Mono", monospace;
  font-size: 10px;
}

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

.toggle-row {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0;
}

.toggle-row > span {
  display: grid;
  gap: 2px;
}

.toggle-row strong {
  font-size: 12px;
}

.toggle-row--featured {
  min-height: 66px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #f7f6f1;
}

.toggle-row--featured strong {
  font-size: 13px;
}

.toggle-row--featured small {
  max-width: 31ch;
  line-height: 1.45;
}

.toggle-row input[type="checkbox"] {
  width: 38px;
  height: 22px;
  appearance: none;
  flex: 0 0 auto;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-muted);
  transition: background-color 180ms ease;
}

.toggle-row input[type="checkbox"]::after {
  display: block;
  width: 16px;
  height: 16px;
  margin: 2px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 5px rgba(32, 38, 36, 0.22);
  content: "";
  transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.toggle-row input[type="checkbox"]:checked {
  border-color: var(--ink);
  background: var(--ink);
}

.toggle-row input[type="checkbox"]:checked::after {
  transform: translateX(16px);
}

.upload-zone {
  display: grid;
  min-height: 146px;
  place-items: center;
  align-content: center;
  gap: 5px;
  margin: 16px 0 8px;
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  background: #faf9f5;
  color: var(--ink-soft);
  cursor: pointer;
  text-align: center;
  transition: background-color 180ms ease, border-color 180ms ease;
}

.upload-zone:hover,
.upload-zone.is-dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.upload-zone strong {
  color: var(--ink);
  font-size: 13px;
}

.upload-zone span {
  font-size: 11px;
}

.field-error {
  margin: 3px 0 0;
  color: var(--danger);
  font-size: 11px;
  font-weight: 620;
}

.image-editor {
  display: grid;
  gap: 16px;
  padding-top: 14px;
}

.image-file-row {
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.image-file-row img {
  width: 46px;
  height: 46px;
  border-radius: 9px;
  object-fit: cover;
  background: var(--surface-muted);
}

.image-file-row div {
  display: grid;
  min-width: 0;
  flex: 1;
}

.image-file-row strong,
.image-file-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-file-row strong {
  font-size: 11px;
}

.image-file-row span {
  color: var(--ink-faint);
  font-size: 10px;
}

.reallink-note,
.qr-check-card,
.export-note {
  display: flex;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8f7f2;
}

.reallink-note svg {
  flex: 0 0 auto;
  color: var(--accent);
}

.reallink-note strong,
.qr-check-card strong,
.export-note strong {
  display: block;
  font-size: 11px;
}

.reallink-note p,
.qr-check-card p,
.export-note p {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 10px;
}

.qr-check-card {
  align-items: flex-start;
  margin-top: 22px;
}

.check-indicator {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  margin-top: 3px;
  border: 2px solid var(--ink-faint);
  border-radius: 50%;
}

.qr-check-card.is-pass .check-indicator {
  border-color: var(--success);
  background: var(--success);
}

.qr-check-card.is-error .check-indicator {
  border-color: var(--danger);
  background: var(--danger);
}

.mobile-action-bar {
  display: none;
}

.studio-dialog {
  width: min(94vw, 680px);
  max-height: min(88dvh, 820px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.studio-dialog::backdrop {
  background: rgba(32, 38, 36, 0.48);
  backdrop-filter: blur(4px);
}

.studio-dialog[open] {
  animation: dialog-in 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dialog-in {
  from { opacity: 0; transform: translateY(12px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.dialog-shell {
  max-height: min(88dvh, 820px);
  padding: 22px;
  overflow-y: auto;
}

.dialog-shell--small {
  max-width: 520px;
}

.dialog-header {
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 17px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  font-size: 22px;
}

.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.dialog-footer p {
  margin: 0;
  color: var(--ink-faint);
  font-size: 11px;
}

.preflight-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0;
}

.summary-metric {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #faf9f5;
}

.summary-metric strong {
  display: block;
  font-family: "Cascadia Mono", monospace;
  font-size: 20px;
}

.summary-metric span {
  color: var(--ink-faint);
  font-size: 10px;
}

.summary-metric--error strong { color: var(--danger); }
.summary-metric--warning strong { color: var(--warning); }
.summary-metric--pass strong { color: var(--success); }

.preflight-list {
  display: grid;
  gap: 7px;
}

.preflight-item {
  display: grid;
  grid-template-columns: 25px minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.preflight-icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: var(--success-soft);
  color: var(--success);
  font-size: 11px;
  font-weight: 800;
}

.preflight-item--warning .preflight-icon {
  background: var(--warning-soft);
  color: var(--warning);
}

.preflight-item--error .preflight-icon {
  background: var(--danger-soft);
  color: var(--danger);
}

.preflight-item strong {
  display: block;
  font-size: 12px;
}

.preflight-item p {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
}

.preflight-item button {
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 700;
}

.export-format-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin: 18px 0;
}

.export-format-grid legend {
  grid-column: 1 / -1;
  font-size: 12px;
  font-weight: 700;
}

.format-option {
  position: relative;
  display: grid;
  min-height: 128px;
  align-content: start;
  gap: 11px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
}

.format-option input {
  position: absolute;
  top: 10px;
  right: 10px;
  accent-color: var(--accent);
}

.format-option.is-selected {
  border-color: var(--accent);
  background: #fbf3ef;
  box-shadow: inset 0 0 0 1px rgba(185, 86, 63, 0.12);
}

.format-option > span:last-child {
  display: grid;
  gap: 3px;
}

.format-option strong {
  font-size: 12px;
}

.format-monogram {
  color: var(--accent-dark);
  font-family: "Cascadia Mono", monospace;
  font-size: 18px;
  font-weight: 800;
}

.export-options {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.export-note {
  margin-top: 16px;
  border-color: #ddd1bd;
  background: var(--warning-soft);
}

.export-error {
  margin-top: 12px;
  padding: 10px;
  border-radius: 10px;
  background: var(--danger-soft);
}

.export-progress,
.export-success {
  min-height: 310px;
  place-items: center;
  align-content: center;
  text-align: center;
}

.export-progress {
  display: grid;
}

.progress-track {
  width: min(100%, 420px);
  height: 7px;
  margin-bottom: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-muted);
}

.progress-track span {
  display: block;
  width: 10%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: transform 300ms cubic-bezier(0.16, 1, 0.3, 1);
  transform: scaleX(var(--progress, 0.1));
  transform-origin: left;
}

.export-progress strong {
  font-size: 15px;
}

.export-progress p {
  max-width: 420px;
  margin: 5px auto 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.export-success {
  display: grid;
}

.success-mark {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  margin-bottom: 13px;
  border-radius: 18px;
  background: var(--success-soft);
  color: var(--success);
}

.success-mark svg {
  width: 28px;
  height: 28px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.export-success h3 {
  margin: 0;
  font-size: 22px;
}

.export-success p {
  margin: 4px 0 18px;
  color: var(--ink-soft);
}

.export-success small {
  max-width: 420px;
  color: var(--ink-faint);
  font-size: 10px;
}

.tool-help {
  width: min(1180px, calc(100% - 36px));
  margin: 72px auto 88px;
  color: var(--ink);
}

.tool-help__back {
  display: inline-flex;
  margin-bottom: 28px;
  color: var(--accent-dark);
  font-weight: 750;
  text-underline-offset: 3px;
}

.tool-help__intro {
  display: grid;
  max-width: 800px;
  gap: 12px;
  margin-bottom: 34px;
}

.tool-help__intro h2 {
  max-width: 760px;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.03;
}

.tool-help__intro p {
  max-width: 700px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 16px;
}

.tool-help__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 50px;
  padding: 0;
  list-style: none;
}

.tool-help__grid li {
  min-height: 180px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 254, 250, 0.88);
  box-shadow: var(--shadow-tight);
}

.tool-help__grid h3 {
  margin-bottom: 10px;
  font-size: 16px;
}

.tool-help__grid p,
.tool-help__faq p {
  margin: 0;
  color: var(--ink-soft);
}

.tool-help__faq {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.tool-help__faq h2 {
  grid-column: 1 / -1;
  margin-bottom: 6px;
  font-size: 24px;
}

.tool-help__faq details {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 254, 250, 0.88);
}

.tool-help__faq summary {
  cursor: pointer;
  font-weight: 750;
}

.tool-help__faq details p {
  padding-top: 12px;
}

@media (max-width: 1180px) {
  .studio-shell {
    grid-template-columns: 220px minmax(390px, 1fr) 292px;
  }

  .template-list {
    grid-template-columns: 1fr;
  }

  .header-text-action span {
    display: none;
  }

  .header-text-action {
    width: 40px;
    padding: 0;
  }

  .workspace {
    padding-right: 20px;
    padding-left: 20px;
  }

  .workspace-footer {
    grid-template-columns: auto 1fr;
  }

  .document-status {
    justify-self: end;
  }

  .size-readout {
    display: none;
  }

  .tool-help__grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  :root {
    --header-height: 60px;
  }

  .app-header {
    min-height: var(--header-height);
    padding: 8px 12px;
  }

  .brand-lockup {
    min-width: 0;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand-copy span,
  .header-actions > .icon-button,
  .header-text-action,
  .header-actions #preflightButton,
  .header-actions #downloadButton {
    display: none;
  }

  .studio-shell {
    display: flex;
    height: auto;
    min-height: 0;
    flex-direction: column;
    padding-bottom: 128px;
    overflow: visible;
  }

  .workspace {
    order: 1;
    grid-template-rows: auto auto auto;
    padding: 14px 14px 8px;
    overflow: visible;
  }

  .template-rail {
    order: 2;
    padding: 18px 14px;
    border-top: 1px solid var(--line);
    border-right: 0;
    overflow: visible;
  }

  .inspector {
    position: fixed;
    right: 0;
    bottom: calc(112px + env(safe-area-inset-bottom));
    left: 0;
    z-index: 10;
    order: 3;
    max-height: min(66dvh, 620px);
    border: 1px solid var(--line-strong);
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 22px 22px 0 0;
    background: var(--surface);
    box-shadow: 0 -18px 52px rgba(61, 55, 43, 0.2);
    border-left: 0;
    overflow: hidden;
    transform: translateY(calc(100% + 130px));
    visibility: hidden;
    transition: transform 280ms cubic-bezier(0.16, 1, 0.3, 1), visibility 280ms;
  }

  .inspector.is-mobile-open {
    transform: translateY(0);
    visibility: visible;
  }

  .mobile-sheet-close {
    display: inline-flex;
  }

  .inspector-heading {
    padding: 14px 14px 10px;
  }

  .canvas-stage {
    min-height: 300px;
    padding: 24px 18px;
  }

  .canvas-surface {
    width: min(100%, 620px);
  }

  .workspace-footer {
    grid-template-columns: 1fr auto;
  }

  .zoom-control input {
    width: 74px;
  }

  .template-list {
    display: flex;
    gap: 10px;
    padding-bottom: 8px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
  }

  .template-card {
    width: 156px;
    flex: 0 0 156px;
    scroll-snap-align: start;
  }

  .template-card canvas {
    aspect-ratio: 1.7;
  }

  .inspector-heading {
    padding: 18px 14px 12px;
  }

  .inspector-tabs {
    position: sticky;
    top: var(--header-height);
    z-index: 5;
    padding: 0 8px;
    background: rgba(255, 254, 250, 0.95);
    backdrop-filter: blur(12px);
  }

  .inspector-tabs button {
    min-height: 46px;
  }

  .inspector-scroll {
    max-height: calc(min(66dvh, 620px) - 110px);
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .inspector-panel {
    padding: 18px 14px 38px;
  }

  .mobile-action-bar {
    position: fixed;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 7;
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 8px max(12px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
    border-top: 1px solid var(--line);
    background: rgba(242, 240, 234, 0.96);
    box-shadow: 0 -8px 24px rgba(61, 55, 43, 0.08);
    backdrop-filter: blur(14px);
  }

  .mobile-action-bar .button {
    min-height: 42px;
  }

  .mobile-edit-actions,
  .mobile-export-actions {
    display: grid;
    gap: 7px;
  }

  .mobile-edit-actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .mobile-export-actions {
    grid-template-columns: 0.9fr 1.1fr;
  }

  .mobile-edit-actions button {
    min-height: 36px;
    padding: 4px 3px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ink-soft);
    font-size: 11px;
    font-weight: 720;
  }

  .mobile-edit-actions button.is-active {
    background: var(--surface-strong);
    color: var(--accent-dark);
    box-shadow: inset 0 0 0 1px var(--line);
  }
}

@media (max-width: 560px) {
  .brand-copy strong {
    max-width: 156px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .workspace-topbar {
    align-items: flex-end;
  }

  .guide-button {
    width: auto;
    min-width: 108px;
    padding: 0 10px;
  }

  .guide-button svg {
    width: 16px;
    height: 16px;
  }

  .canvas-stage {
    min-height: 244px;
    padding: 28px 12px 22px;
    border-radius: 17px;
  }

  .canvas-instruction {
    display: none;
  }

  .workspace-footer {
    grid-template-columns: 1fr;
  }

  .document-status {
    display: none;
  }

  .zoom-control {
    justify-content: center;
  }

  .custom-size-grid,
  .two-column-fields {
    grid-template-columns: 1fr 1fr;
  }

  .dialog-shell {
    padding: 17px;
  }

  .dialog-header h2 {
    font-size: 19px;
  }

  .preflight-summary,
  .export-format-grid {
    grid-template-columns: 1fr;
  }

  .tool-help {
    width: min(100% - 24px, 720px);
    margin: 54px auto 72px;
  }

  .tool-help__grid,
  .tool-help__faq {
    grid-template-columns: 1fr;
  }

  .tool-help__grid li {
    min-height: 0;
  }

  .format-option {
    min-height: 84px;
    grid-template-columns: 54px 1fr;
    align-items: center;
  }

  .dialog-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .dialog-footer .button {
    width: 100%;
  }
}

@media (max-width: 360px) {
  .brand-copy strong {
    max-width: 132px;
    font-size: 12px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .workspace {
    padding-right: 10px;
    padding-left: 10px;
  }

  .workspace-controls {
    gap: 5px;
  }

  .segmented-control button {
    min-height: 32px;
    padding: 5px 9px;
  }

  .template-rail,
  .inspector-panel {
    padding-right: 10px;
    padding-left: 10px;
  }

  .inspector-tabs button {
    font-size: 10px;
  }

  .mobile-edit-actions button {
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
