:root {
  --page-bg: #f5f7fb;
  --panel-bg: #ffffff;
  --panel-border: #ebeff5;
  --text-main: #1f2937;
  --text-soft: #6b7280;
  --indigo: #4f46e5;
  --indigo-dark: #4338ca;
  --danger: #ef4444;
  --success: #16a34a;
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
  --checker:
    linear-gradient(45deg, #edf1f7 25%, transparent 25%),
    linear-gradient(-45deg, #edf1f7 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #edf1f7 75%),
    linear-gradient(-45deg, transparent 75%, #edf1f7 75%);
  --sticker-title-size: 40px;
  --sticker-products-size: 13px;
  --sticker-phrase-size: 17px;
  --sticker-social-size: 14px;
  --sticker-badge-size: 12px;
  --sticker-logo-size: 78px;
  --sticker-logo-padding: 15px;
  --sticker-logo-custom-size: 116px;
  --sticker-pattern-size: 78px;
  --sticker-content-padding: 12px;
  --sticker-content-gap: 5px;
  --sticker-content-offset-y: 0px;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body {
  width: 100%;
  min-width: 320px;
}
body {
  margin: 0;
  font-family: "Nunito", sans-serif;
  background: radial-gradient(circle at top, #ffffff 0%, #f5f7fb 45%, #eef2f8 100%);
  color: var(--text-main);
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; }
.hidden { display: none !important; }
.app-hidden { display: none; }

.welcome-gate {
  min-height: 100vh;
  padding: 24px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at top left, rgba(99, 102, 241, .18), transparent 28%),
    radial-gradient(circle at bottom right, rgba(251, 191, 36, .18), transparent 30%),
    linear-gradient(135deg, #f8fbff 0%, #eef3fb 100%);
}

.welcome-card {
  width: min(100%, 460px);
  background: rgba(255, 255, 255, .95);
  border: 1px solid rgba(226, 232, 240, .95);
  border-radius: 28px;
  padding: 24px 22px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, .12);
  text-align: center;
}
.auth-card {
  max-width: 520px;
}
.auth-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}
.auth-tab {
  border: 1px solid #d9e0ea;
  background: #f8fafc;
  color: #475569;
  border-radius: 12px;
  padding: 10px 8px;
  font-size: .82rem;
  font-weight: 800;
  cursor: pointer;
}
.auth-tab.is-active {
  background: #eef2ff;
  color: #4338ca;
  border-color: #a5b4fc;
}
.auth-panel {
  margin-top: 8px;
}
.auth-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.auth-links-row {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.auth-link-btn {
  border: none;
  background: transparent;
  color: #4f46e5;
  font-size: .95rem;
  font-weight: 800;
  cursor: pointer;
  padding: 4px 0;
}
.auth-link-btn:hover {
  color: #312e81;
  text-decoration: underline;
}
.auth-back-row {
  display: flex;
  justify-content: flex-start;
  margin: -2px 0 2px;
}
.auth-back-btn {
  width: 34px;
  height: 34px;
  border: 1px solid #dbe2f2;
  border-radius: 999px;
  background: rgba(255, 255, 255, .9);
  color: #4338ca;
  font-size: 1rem;
  font-weight: 900;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: .2s ease;
}
.auth-back-btn:hover {
  background: #eef2ff;
  color: #312e81;
  transform: translateX(-1px);
}
.secondary-inline-btn {
  border: 1px solid #c7d2fe;
  background: #fff;
  color: #4338ca;
  border-radius: 14px;
  padding: 12px 14px;
  font-weight: 800;
  cursor: pointer;
}
.secondary-inline-btn:hover {
  background: #eef2ff;
}
.profile-prompt {
  margin-top: 18px;
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid #dbe2f2;
  border-radius: 22px;
  background: #f8fbff;
  text-align: center;
}
.profile-prompt strong {
  display: block;
  color: #1f2937;
  font-size: 1.02rem;
}
.profile-prompt p {
  margin: 8px 0 0;
  color: #5b6b84;
  font-size: .98rem;
}
.profile-prompt-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 14px;
}
.header-auth {
  margin-top: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.auth-user-label {
  font-size: .92rem;
  color: #475569;
  font-weight: 700;
}

.welcome-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
  margin-bottom: 12px;
  border-radius: 999px;
  background: #eef2ff;
  color: #4338ca;
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .18em;
}

.welcome-card h1 {
  margin: 0 0 8px;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  line-height: 1;
  font-weight: 900;
}

.welcome-card p {
  margin: 0 auto 18px;
  max-width: 360px;
  color: #64748b;
  font-size: .94rem;
  line-height: 1.4;
}

.welcome-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.field select,
.welcome-form select {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid #dce3ee;
  border-radius: 14px;
  background: #f8fafc;
  transition: .2s ease;
  color: #1f2937;
  font-size: 16px;
}

.field select:focus,
.welcome-form select:focus {
  outline: none;
  border-color: #818cf8;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, .12);
  background: #fff;
}

.field select:disabled,
.welcome-form select:disabled {
  color: #94a3b8;
  cursor: not-allowed;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.range-row input[type="range"] {
  flex: 1;
  accent-color: #4f46e5;
}

.range-row strong {
  min-width: 44px;
  text-align: right;
  color: #64748b;
  font-size: .9rem;
  font-weight: 800;
}

.welcome-btn {
  border: none;
  border-radius: 18px;
  background: linear-gradient(135deg, #4f46e5 0%, #4338ca 100%);
  color: #fff;
  padding: 14px 16px;
  font-size: .96rem;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 18px 28px rgba(79, 70, 229, .24);
  transition: transform .2s ease, box-shadow .2s ease;
}

.welcome-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 32px rgba(79, 70, 229, .3);
}

.welcome-btn:disabled {
  background: linear-gradient(135deg, #cbd5e1 0%, #94a3b8 100%);
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
}

.app-shell { min-height: 100vh; padding: 16px; }
.page-header { text-align: center; margin: 0 auto 28px; }
.page-header h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  gap: 12px;
}
.page-header p { margin: 8px 0 0; color: var(--text-soft); }
.header-icon { width: 34px; height: 34px; color: var(--indigo); }

.layout {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(360px, 1.2fr);
  gap: 32px;
}

.layout,
.panel,
.controls-panel,
.preview-panel,
.preview-board,
.export-wrapper,
.field,
.social-grid,
.toggle-card {
  min-width: 0;
}

.panel {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--panel-border);
  border-radius: 32px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}
.controls-panel, .preview-panel { padding: 28px; }
.preview-panel { display: flex; flex-direction: column; }

.preview-panel > h2, .section-block h2 {
  margin: 0 0 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid #edf2f7;
  font-size: 1.15rem;
  font-weight: 800;
}

.section-block + .section-block {
  margin-top: 28px;
  padding-top: 8px;
  border-top: 1px solid #f1f5f9;
}

.field { display: flex; flex-direction: column; gap: 8px; }
.field + .field { margin-top: 16px; }
.field > span { font-size: .95rem; font-weight: 700; color: #374151; }
.field input:not([type="checkbox"]), .social-input {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid #dce3ee;
  border-radius: 14px;
  background: #f8fafc;
  transition: .2s ease;
  color: #1f2937;
  font-size: 16px;
}
.field input:not([type="checkbox"]):focus, .social-input:focus {
  outline: none;
  border-color: #818cf8;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, .12);
  background: #fff;
}
.field input:not([type="checkbox"])::placeholder,
.social-input::placeholder {
  color: #94a3b8;
}
.field select:invalid,
.welcome-form select:invalid {
  color: #94a3b8;
}
.field select:valid,
.welcome-form select:valid {
  color: #1f2937;
}
.field small { color: var(--text-soft); font-size: .78rem; }

.social-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}
.social-span-2 { grid-column: span 2; }
.toggle-card {
  background: #f8fafc;
  border: 1px solid #edf2f7;
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toggle-row, .toggle-line {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}
.toggle-line span:last-child { font-weight: 700; color: #4b5563; }
.social-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .94rem;
  font-weight: 700;
  color: #374151;
}
.social-icon, .inline-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}
.icon-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  font-weight: 900;
  text-align: center;
}
.bg-symbol {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
}
.bg-symbol svg {
  width: 100%;
  height: 100%;
  display: block;
}
.social-icon svg, .inline-icon svg { width: 100%; height: 100%; }
.social-icon svg {
  overflow: visible;
  display: block;
}
.social-icon-tiktok {
  width: 20px;
  height: 20px;
  padding: 1px;
  overflow: visible;
}
.social-icon-tiktok svg {
  width: 100%;
  height: 100%;
  transform: scale(.98);
  transform-origin: center;
  overflow: visible;
}
.instagram { color: #e1306c; }
.facebook { color: #1877f2; }
.tiktok { color: #111827; }

.toggle {
  position: relative;
  display: inline-flex;
  width: 34px;
  height: 20px;
}
.toggle.large { width: 42px; height: 24px; }
.toggle input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  margin: 0;
}
.toggle-track {
  width: 100%;
  height: 100%;
  background: #cbd5e1;
  border-radius: 999px;
  transition: background .2s ease;
}
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .18);
  transition: transform .2s ease;
}
.toggle.large .toggle-thumb { top: 4px; left: 3px; }
.toggle input:checked + .toggle-track { background: var(--indigo); }
.toggle input:checked ~ .toggle-thumb { transform: translateX(14px); }
.toggle.large input:checked ~ .toggle-thumb { transform: translateX(18px); }
.social-input { padding: 9px 12px; font-size: .82rem; background: #fff; }

.shipping-options { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 10px; }
.upload-row { display: flex; gap: 12px; align-items: center; }
.upload-button {
  flex: 1;
  border: 2px dashed #cbd5e1;
  background: #fff;
  color: #4b5563;
  border-radius: 14px;
  padding: 14px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: .2s ease;
}
.upload-button:hover { border-color: var(--indigo); background: #eef2ff; }
.danger-btn {
  border: none;
  background: transparent;
  color: var(--danger);
  padding: 12px 14px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
}
.danger-btn:hover { background: #fef2f2; }

.pill-group, .theme-group, .shape-group, .icon-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.pill-btn, .shape-btn, .icon-btn {
  border: 2px solid #e5e7eb;
  background: #fff;
  color: #4b5563;
  cursor: pointer;
  transition: all .2s ease;
}
.pill-btn {
  padding: 9px 14px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: .82rem;
  font-weight: 700;
}
.shape-btn {
  flex: 1;
  min-width: 120px;
  padding: 14px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-weight: 700;
}
.icon-btn {
  width: calc(14.285% - 9px);
  min-width: 52px;
  aspect-ratio: 1;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.pill-btn:hover, .shape-btn:hover, .icon-btn:hover {
  border-color: #a5b4fc;
  transform: translateY(-1px);
}
.is-active {
  border-color: var(--indigo) !important;
  background: #eef2ff !important;
  color: var(--indigo-dark) !important;
}

.theme-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 2px solid transparent;
  cursor: pointer;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.theme-btn:hover { transform: scale(1.08); }
.theme-btn.is-active {
  border-color: #111827 !important;
  box-shadow: 0 8px 16px rgba(15, 23, 42, .18);
  transform: scale(1.08);
}
.theme-inner { width: 100%; height: 100%; display: flex; }
.theme-inner span:first-child { width: 50%; opacity: .25; }
.theme-inner span:last-child { width: 50%; }

.preview-board {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  border-radius: 24px;
  overflow: hidden;
  background-color: #f9fbfd;
  background-image: var(--checker);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}
.export-wrapper {
  width: 100%;
  overflow-x: auto;
  padding: 16px;
  display: flex;
  justify-content: center;
}
.sticker {
  position: relative;
  width: 440px;
  height: 440px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 12px solid #fff;
  box-shadow: 0 22px 60px rgba(15, 23, 42, .22);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  transition: background-color .3s ease, color .3s ease, border-radius .3s ease;
}
.circle-shape { border-radius: 999px; }
.square-shape { border-radius: 3rem; }
.sticker-pattern {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: .08;
  mix-blend-mode: normal;
}
.pattern-icon { position: absolute; }
.pattern-glyph {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 64px;
  font-weight: 700;
  line-height: 1;
  user-select: none;
  opacity: .82;
  filter: saturate(.92);
}
.pattern-glyph svg {
  width: 100%;
  height: 100%;
  display: block;
  opacity: .46;
}
.p1 { top: -6px; left: -12px; width: 112px; height: 112px; transform: rotate(8deg); }
.p2 { right: -8px; bottom: -14px; width: 126px; height: 126px; transform: rotate(-8deg); }
.p3 { top: 22%; right: -14px; width: 72px; height: 72px; transform: rotate(18deg); }
.p4 { bottom: 22%; left: -14px; width: 72px; height: 72px; transform: rotate(-18deg); }
.p5 { top: -10px; left: 34%; width: 70px; height: 70px; transform: rotate(-10deg); }
.p6 { bottom: -12px; left: 32%; width: 70px; height: 70px; transform: rotate(10deg); }

.sticker-content {
  position: relative;
  top: var(--sticker-content-offset-y);
  z-index: 1;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 0 var(--sticker-content-padding);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--sticker-content-gap);
  transform: scale(var(--content-scale, 1));
  transform-origin: center top;
}
.main-logo-wrap { margin-bottom: 4px; }
.main-logo {
  width: var(--sticker-logo-size);
  height: var(--sticker-logo-size);
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: var(--sticker-logo-padding);
}
.main-logo > svg,
.main-logo .icon-fallback,
.main-logo > span {
  display: flex;
  align-items: center;
  justify-content: center;
}
.main-logo svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.main-logo.custom-logo {
  width: var(--sticker-logo-custom-size);
  height: var(--sticker-logo-custom-size);
  aspect-ratio: 1 / 1;
  padding: 0;
  background: #fff !important;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .14);
}
.main-logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  padding: 8px;
}
#previewBusinessName {
  margin: 0;
  max-width: 100%;
  min-width: 0;
  padding: 0 16px;
  font-size: var(--sticker-title-size);
  line-height: 1;
  font-weight: 900;
  letter-spacing: -.03em;
  text-align: center;
  overflow-wrap: anywhere;
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.products-badge {
  max-width: 88%;
  min-width: 0;
  padding: 6px 13px;
  border-radius: 10px;
  font-size: var(--sticker-products-size);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: .07em;
  word-spacing: .04em;
  text-transform: uppercase;
  text-align: center;
  overflow-wrap: anywhere;
  word-break: break-word;
  box-shadow: 0 6px 14px rgba(15, 23, 42, .08);
}
.phrase-text {
  margin: 0;
  max-width: 84%;
  padding: 4px 14px;
  font-size: var(--sticker-phrase-size);
  font-weight: 800;
  font-style: italic;
  line-height: 1.24;
  opacity: .86;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.35em;
  text-align: center;
  background: rgba(255, 255, 255, .42);
  border-radius: 14px;
  backdrop-filter: blur(2px);
}
.separator {
  width: 56px;
  height: 4px;
  border-radius: 999px;
  margin: 4px 0;
  opacity: .3;
}
.social-preview {
  width: 100%;
  max-width: 92%;
  min-width: 0;
  padding: 0 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 10px;
}
.social-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  max-width: 46%;
  min-width: 0;
  font-size: var(--sticker-social-size);
  font-weight: 800;
}
.social-chip > .inline-icon {
  flex: 0 0 auto;
}
.social-chip span:last-child {
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: .9;
}
.shipping-preview {
  width: 100%;
  max-width: 88%;
  margin-top: 6px;
  padding-top: 4px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.shipping-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: var(--sticker-badge-size);
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: 0 6px 14px rgba(15, 23, 42, .08);
}
.shipping-badge > .inline-icon {
  flex: 0 0 auto;
}
.shipping-badge-text {
  display: inline-block;
  white-space: nowrap;
  font-size: .94em;
  letter-spacing: 0;
  word-spacing: 0;
  font-kerning: none;
}

.download-row { display: flex; justify-content: center; margin-top: 24px; }
.preview-meta {
  display: flex;
  justify-content: center;
  margin: 0 0 16px;
}
.preview-meta div {
  padding: 12px 18px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #e5edf5;
  text-align: center;
}
.preview-meta strong {
  display: block;
  font-size: 1rem;
}
.preview-meta span {
  display: block;
  margin-top: 4px;
  font-size: .9rem;
  color: #64748b;
}

.sheet-section {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid #edf2f7;
}
.sheet-section h3 {
  margin: 0 0 6px;
  font-size: 1.1rem;
}
.sheet-section p {
  margin: 0 0 16px;
  color: #64748b;
  font-size: .92rem;
}
.a4-preview-wrap {
  overflow: hidden;
  padding: 18px;
  border-radius: 24px;
  background:
    linear-gradient(180deg, #f8fafc 0%, #eff4fb 100%);
  border: 1px solid #e5edf5;
  -webkit-overflow-scrolling: touch;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}
.a4-page {
  width: 794px;
  max-width: none;
  min-height: 1123px;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .12);
  padding: 28px;
  transform-origin: top center;
}
.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 18px;
  padding-bottom: 14px;
  margin-bottom: 18px;
  border-bottom: 2px solid #e2e8f0;
  font-size: .92rem;
  color: #475569;
}
.sheet-grid {
  display: grid;
  justify-content: center;
  gap: 12px;
}
.sheet-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  position: relative;
  background: transparent;
}
.sheet-cell::before {
  content: "✂";
  position: absolute;
  top: -16px;
  left: -10px;
  font-size: 14px;
  line-height: 1;
  color: #94a3b8;
  background: rgba(255, 255, 255, .88);
  border-radius: 999px;
  padding: 2px 4px;
  z-index: 2;
}
.sheet-cell::after {
  content: "";
  position: absolute;
  inset: -10px;
  border: 1px dashed rgba(99, 102, 241, .28);
  border-radius: 10px;
  pointer-events: none;
}
.sheet-cell::before {
  content: "\2702";
  top: 2px;
  left: 18px;
  transform: translate(-25%, -120%);
  font-size: 13px;
  color: #64748b;
  background: rgba(255, 255, 255, .96);
  border: 1px solid rgba(148, 163, 184, .35);
  padding: 2px 5px;
  z-index: 3;
  box-shadow: 0 4px 10px rgba(15, 23, 42, .08);
}
.sheet-cell::after {
  inset: -6px;
  border-width: 1.5px;
  border-color: rgba(99, 102, 241, .45);
  z-index: 1;
}
.sheet-cell.cut-circle::after {
  border-radius: 50%;
}
.sheet-cell.cut-square::after {
  border-radius: 3rem;
}
.sheet-cell {
  border: 0;
  border-radius: 0;
  overflow: visible;
  background: transparent;
}
.sheet-sticker-shell {
  width: 440px;
  height: 440px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  overflow: hidden;
}
.sheet-sticker-shell.circle-shape {
  border-radius: 50%;
}
.sheet-sticker-shell.square-shape {
  border-radius: 3rem;
}
.sheet-sticker-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}
.sheet-sticker-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(248, 250, 252, .7) 0%, rgba(255, 255, 255, .95) 100%);
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  padding: 12px;
}
.sheet-note {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.download-btn {
  border: none;
  border-radius: 999px;
  background: var(--indigo);
  color: #fff;
  padding: 16px 28px;
  font-size: 1.08rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  box-shadow: 0 16px 30px rgba(79, 70, 229, .28);
  transition: .2s ease;
}
.secondary-btn {
  background: #fff;
  color: #4338ca;
  border: 1px solid #c7d2fe;
  box-shadow: 0 16px 30px rgba(99, 102, 241, .12);
}
.download-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  background: var(--indigo-dark);
}
.secondary-btn:hover:not(:disabled) {
  background: #eef2ff;
}
.download-btn:disabled { background: #9ca3af; cursor: not-allowed; box-shadow: none; }
.download-help { text-align: center; color: #9ca3af; font-size: .8rem; margin: 16px 0 0; }

.toast {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 999;
  padding: 14px 18px;
  border-radius: 16px;
  color: #fff;
  font-weight: 800;
  box-shadow: 0 16px 30px rgba(15, 23, 42, .16);
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

@media (max-width: 1080px) {
  .layout { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .app-shell {
    max-width: 430px;
    margin: 0 auto;
    padding: 10px;
  }
  :root {
    --sticker-title-size: 29px;
    --sticker-products-size: 12px;
    --sticker-phrase-size: 14px;
    --sticker-social-size: 12.5px;
    --sticker-badge-size: 11px;
    --sticker-logo-size: 74px;
    --sticker-logo-padding: 14px;
    --sticker-logo-custom-size: 100px;
    --sticker-content-padding: 10px;
    --sticker-content-gap: 4px;
    --sticker-content-offset-y: 8px;
  }
  .page-header {
    margin-bottom: 14px;
    padding: 0;
    background: transparent;
    backdrop-filter: none;
    border-bottom: 0;
  }
  .page-header h1 {
    font-size: 1.65rem;
    gap: 8px;
  }
  .page-header p {
    font-size: .84rem;
    line-height: 1.3;
  }
  .header-icon {
    width: 28px;
    height: 28px;
  }
  .welcome-card {
    padding: 20px 18px;
    border-radius: 22px;
  }
  .auth-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .layout {
    display: flex;
    flex-direction: column;
    gap: 14px;
  }
  .panel {
    border-radius: 22px;
  }
  .controls-panel, .preview-panel {
    padding: 16px;
  }
  .preview-panel {
    order: -1;
  }
  .preview-panel > h2, .section-block h2 {
    margin-bottom: 14px;
    font-size: 1.02rem;
  }
  .section-block + .section-block {
    margin-top: 20px;
  }
  .field > span {
    font-size: .88rem;
  }
  .field input[type="text"],
  .field select,
  .social-input,
  .upload-button {
    padding: 11px 13px;
    font-size: 16px;
  }
  .toggle-card {
    padding: 12px;
  }
  .social-label,
  .toggle-line span:last-child {
    font-size: .88rem;
  }
  .shipping-options {
    gap: 12px;
  }
  .pill-group, .theme-group, .shape-group, .icon-group {
    gap: 8px;
  }
  .pill-btn {
    padding: 8px 12px;
    font-size: .76rem;
  }
  .shape-btn {
    min-width: 0;
    padding: 11px 10px;
    font-size: .85rem;
  }
  .download-row {
    position: static;
    left: auto;
    right: auto;
    bottom: auto;
    z-index: auto;
    margin-top: 20px;
    padding: 0;
    border-radius: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    backdrop-filter: none;
    flex-direction: column;
    align-items: center;
    gap: 10px;
  }
  .download-btn {
    width: 100%;
    justify-content: center;
    min-height: 48px;
    padding: 13px 18px;
    font-size: .95rem;
  }
  .a4-preview-wrap {
    padding: 8px;
    border-radius: 18px;
  }
  .a4-page {
    margin: 0 auto;
  }
  .social-grid { grid-template-columns: 1fr; }
  .social-span-2 { grid-column: span 1; }
  .icon-btn {
    width: calc(25% - 6px);
    min-width: 0;
  }
  .layout {
    gap: 16px;
  }
  .sticker {
    width: min(100%, 292px);
    height: min(calc(100vw - 76px), 292px);
    border-width: 9px;
  }
  .sticker-content {
    padding: 0 var(--sticker-content-padding);
    gap: var(--sticker-content-gap);
  }
  .main-logo-wrap {
    margin-bottom: 2px;
    margin-top: 2px;
    flex: 0 0 auto;
  }
  .main-logo.custom-logo {
    width: var(--sticker-logo-custom-size);
    height: var(--sticker-logo-custom-size);
  }
  .main-logo.custom-logo img {
    padding: 10px;
  }
  .products-badge {
    letter-spacing: .07em;
    word-spacing: .03em;
  }
  .phrase-text {
    padding: 4px 12px;
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
    min-height: 2.4em;
    line-height: 1.22;
    font-weight: 800;
    background: rgba(255, 255, 255, .42);
    border-radius: 14px;
    backdrop-filter: blur(2px);
  }
  .social-preview {
    gap: 6px 8px;
    padding: 0 10px;
  }
  .social-chip {
    max-width: 100%;
  }
  .shipping-preview {
    max-width: 82%;
    gap: 5px;
  }
  .shipping-badge {
    gap: 4px;
    padding: 5px 7px;
    font-size: 9px;
  }
  .shipping-badge-text {
    font-size: .88em;
  }
  .pattern-glyph { font-size: 48px; }
  .icon-group {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }
  .icon-btn {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .welcome-gate {
    padding: 14px 10px;
  }
  :root {
    --sticker-title-size: 24px;
    --sticker-products-size: 10px;
    --sticker-phrase-size: 11.5px;
    --sticker-social-size: 10.5px;
    --sticker-badge-size: 9px;
    --sticker-logo-size: 60px;
    --sticker-logo-padding: 10px;
    --sticker-logo-custom-size: 84px;
    --sticker-content-padding: 8px;
    --sticker-content-gap: 3px;
    --sticker-content-offset-y: 7px;
  }
  .welcome-card {
    width: 100%;
    max-width: 360px;
    padding: 18px 16px;
    border-radius: 20px;
  }
  .auth-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .welcome-badge {
    margin-bottom: 10px;
    padding: 6px 12px;
    font-size: .66rem;
  }
  .welcome-card h1 {
    font-size: 1.95rem;
  }
  .welcome-card p {
    margin-bottom: 14px;
    font-size: .86rem;
  }
  .welcome-form {
    gap: 10px;
  }
  .field select,
  .welcome-form select {
    padding: 11px 13px;
    font-size: 16px;
  }
  .welcome-btn {
    padding: 12px 14px;
    font-size: .92rem;
  }
  .app-shell {
    max-width: 390px;
    padding: 8px;
  }
  .page-header h1 {
    font-size: 1.5rem;
  }
  .panel {
    border-radius: 20px;
  }
  .controls-panel, .preview-panel {
    padding: 14px;
  }
  .field + .field {
    margin-top: 12px;
  }
  .upload-row {
    flex-direction: column;
    align-items: stretch;
  }
  .danger-btn {
    width: 100%;
    padding: 10px 12px;
  }
  .shape-group {
    flex-direction: column;
  }
  .shape-btn {
    width: 100%;
  }
  .icon-btn {
    width: calc(25% - 6px);
    aspect-ratio: 1 / 1;
  }
  .preview-board {
    padding: 10px;
    border-radius: 16px;
  }
  .export-wrapper {
    padding: 4px;
  }
  .sticker {
    width: min(100%, 268px);
    height: min(calc(100vw - 54px), 268px);
    border-width: 8px;
  }
  .sticker-content {
    padding: 0 var(--sticker-content-padding);
    gap: var(--sticker-content-gap);
  }
  .main-logo.custom-logo {
    width: var(--sticker-logo-custom-size);
    height: var(--sticker-logo-custom-size);
  }
  .main-logo.custom-logo img {
    padding: 9px;
  }
  #previewBusinessName { padding: 0 10px; }
  .products-badge {
    max-width: 100%;
    padding: 5px 10px;
    letter-spacing: .06em;
    word-spacing: .02em;
  }
  .phrase-text {
    padding: 4px 8px;
    line-height: 1.2;
    display: block;
    -webkit-line-clamp: unset;
    overflow: visible;
    min-height: 2.35em;
    font-weight: 800;
    background: rgba(255, 255, 255, .46);
    border-radius: 12px;
  }
  .separator {
    width: 44px;
    height: 3px;
  }
  .social-preview {
    flex-direction: row;
    gap: 4px 6px;
    padding: 0 6px;
  }
  .social-chip {
    justify-content: center;
    max-width: 48%;
    gap: 4px;
  }
  .social-chip span:last-child {
    max-width: 92px;
  }
  .shipping-preview {
    max-width: 82%;
    gap: 4px;
  }
  .shipping-badge {
    letter-spacing: 0;
    gap: 4px;
    padding: 4px 6px;
    font-size: 7.6px;
  }
  .shipping-badge-text {
    font-size: .84em;
  }
  .pattern-glyph {
    font-size: 38px;
  }
  .icon-group {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }
  .icon-btn {
    width: 100%;
    min-width: 0;
  }
  .preview-meta div {
    width: 100%;
    padding: 10px 14px;
  }
  .preview-meta strong {
    font-size: .92rem;
  }
  .preview-meta span {
    font-size: .8rem;
  }
  .sheet-section {
    margin-top: 18px;
    padding-top: 18px;
  }
  .sheet-section h3 {
    font-size: 1rem;
  }
  .sheet-section p {
    font-size: .82rem;
    margin-bottom: 12px;
  }
  .a4-page {
    margin: 0 auto;
  }
  .download-help {
    font-size: .74rem;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 10mm;
  }
  body {
    background: #fff;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  #welcomeGate,
  .controls-panel,
  .page-header,
  .preview-meta,
  .preview-board,
  .download-row,
  .download-help,
  .sheet-section h3,
  .sheet-section p,
  .toast {
    display: none !important;
  }
  .layout,
  .preview-panel,
  .panel,
  .app-shell {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    border: 0 !important;
    background: transparent !important;
  }
  .a4-preview-wrap {
    padding: 0;
    border: 0;
    background: transparent;
    overflow: visible;
  }
  .a4-page {
    width: 210mm;
    min-width: 210mm;
    min-height: 297mm;
    box-shadow: none;
    padding: 10mm;
  }
  .sheet-grid {
    gap: 4mm;
  }
  .sheet-cell {
    width: var(--print-cell-size) !important;
    height: var(--print-cell-size) !important;
    break-inside: avoid;
  }
  .sheet-cell::before {
    top: -1mm !important;
    left: 4mm !important;
    transform: translate(-25%, -125%) !important;
    background: #fff !important;
  }
  .sheet-cell::after {
    inset: -1.5mm !important;
  }
  .sheet-sticker-shell {
    width: 100% !important;
    height: 100% !important;
    transform: none !important;
  }
}
