:root {
  --bg: #f7f3ff;
  --card: #ffffff;
  --text: #151323;
  --muted: #68627a;
  --purple: #6d36e8;
  --purple-dark: #5523c7;
  --purple-soft: #eee5ff;
  --border: #e6dcff;
  --shadow: 0 24px 60px rgba(109, 54, 232, 0.15);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  background: radial-gradient(circle at top, #ffffff 0, var(--bg) 42%, #f2eaff 100%);
  color: var(--text);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 76px;
  padding: 0 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.logo { display: flex; align-items: center; gap: 12px; }
.logo-icon {
  width: 42px;
  height: 42px;
  border-radius: 16px;
  background: var(--purple);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 900;
  box-shadow: 0 12px 30px rgba(109, 54, 232, 0.35);
}
.logo span { display: block; color: var(--muted); font-size: 12px; }
nav { display: flex; gap: 34px; }
nav a { text-decoration: none; color: var(--muted); font-weight: 800; font-size: 14px; }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: 0;
  border-radius: 18px;
  padding: 12px 20px;
  font-weight: 900;
  cursor: pointer;
}
.btn.primary { color: white; background: var(--purple); box-shadow: 0 14px 30px rgba(109, 54, 232, 0.28); }
.btn.primary:hover { background: var(--purple-dark); }
.btn.ghost { color: var(--text); background: white; border: 1px solid var(--border); }
.btn.large { padding: 16px 26px; }

.account-pill {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 8px 8px 16px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: white;
}
.account-pill span {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}
.account-pill button {
  border: 0;
  border-radius: 13px;
  padding: 9px 12px;
  background: var(--purple-soft);
  color: var(--purple);
  font-weight: 950;
  cursor: pointer;
}

.hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: 38px 48px 18px;
  text-align: center;
}
.badge {
  display: inline-block;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: white;
  color: var(--purple);
  font-weight: 900;
  margin-bottom: 22px;
}
.hero h1 {
  max-width: 900px;
  margin: 0 auto;
  font-size: clamp(38px, 4.4vw, 64px);
  line-height: 0.98;
  letter-spacing: -3px;
}
.hero h1 span { color: var(--purple); }
.hero p {
  margin: 24px auto 0;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.7;
  max-width: 760px;
}
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; margin-top: 30px; }

.editor-card {
  width: min(1520px, calc(100% - 64px));
  margin: 22px auto 50px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 34px;
  box-shadow: var(--shadow);
}
.editor-header {
  padding: 22px 26px;
  border-bottom: 1px solid #f0ebff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.editor-header h2 { margin: 0; font-size: 26px; }
.editor-header p { margin: 5px 0 0; color: var(--muted); font-size: 14px; }

.editor-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 18px;
  flex-wrap: wrap;
}
.header-action-group {
  display: grid;
  gap: 6px;
}
.header-action-group > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.editor-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: 280px minmax(520px, 1fr) 260px;
}

.panel { padding: 22px; background: #fbfaff; border-right: 1px solid #f0ebff; }
.right-panel { border-left: 1px solid #f0ebff; border-right: 0; background: white; }

.tabs { display: grid; grid-template-columns: 1fr; background: white; border-radius: 18px; padding: 5px; margin-bottom: 18px; }
.tabs button { border: 0; border-radius: 14px; padding: 12px; background: transparent; font-weight: 900; cursor: pointer; }
.tabs .active { background: var(--purple-soft); color: var(--purple); }

label {
  display: block;
  margin: 18px 0 8px;
  color: #918aa5;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
input, select {
  width: 100%;
  padding: 14px;
  border: 1px solid #ded6f7;
  border-radius: 18px;
  font-size: 15px;
  outline: none;
  background: white;
}
input:focus, select:focus { box-shadow: 0 0 0 4px var(--purple-soft); }
input[type="range"] { padding: 0; accent-color: var(--purple); }

.toggle {
  width: 100%;
  margin-top: 14px;
  border: 0;
  border-radius: 18px;
  padding: 14px;
  background: white;
  display: flex;
  justify-content: space-between;
  font-weight: 900;
  cursor: pointer;
}
.toggle span {
  width: 42px;
  height: 23px;
  border-radius: 999px;
  background: #ccc4df;
  position: relative;
}
.toggle span::after {
  content: "";
  width: 17px;
  height: 17px;
  background: white;
  border-radius: 999px;
  position: absolute;
  left: 3px;
  top: 3px;
  transition: 0.2s;
}
.toggle.active span { background: var(--purple); }
.toggle.active span::after { transform: translateX(19px); }

.upload-btn {
  margin-top: 22px;
  padding: 15px;
  text-align: center;
  border: 2px dashed var(--border);
  border-radius: 18px;
  background: white;
  cursor: pointer;
  color: var(--purple);
}
.hint { font-size: 13px; color: var(--muted); line-height: 1.5; }

.canvas-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  background:
    linear-gradient(#f5f1ff 1px, transparent 1px),
    linear-gradient(90deg, #f5f1ff 1px, transparent 1px),
    linear-gradient(135deg, #fff, #f8f3ff);
  background-size: 24px 24px, 24px 24px, 100% 100%;
  padding: 34px 32px 24px;
  overflow: hidden;
}
.ruler {
  position: absolute;
  background: rgba(255,255,255,0.82);
  border-color: #e7defc;
}
.top-ruler { top: 0; left: 0; right: 0; height: 28px; border-bottom: 1px solid #e7defc; }
.left-ruler { top: 0; left: 0; bottom: 0; width: 28px; border-right: 1px solid #e7defc; }

.canvas {
  width: min(100%, 500px);
  height: 560px;
  min-height: 0;
  border-radius: 30px;
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  box-shadow: inset 0 0 60px rgba(109, 54, 232, 0.06);
}
.preview-label {
  position: absolute;
  top: 18px;
  left: 18px;
  background: #151323;
  color: white;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 900;
  font-size: 12px;
}
.design-object {
  width: 100%;
  transform: scale(1);
  transition: transform 0.2s;
}
#nameSvg { width: 100%; height: auto; overflow: visible; }
#nameSvg .imported-object {
  cursor: grab;
  touch-action: none;
}
#nameSvg .imported-object.is-dragging {
  cursor: grabbing;
}
.canvas-zoom {
  margin-top: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.canvas-zoom button {
  width: 42px;
  height: 32px;
  border: 1px solid #e8ddff;
  background: white;
  border-radius: 10px;
  font-weight: 950;
  cursor: pointer;
}
.canvas-zoom strong {
  color: var(--muted);
  font-size: 13px;
}
#svgText {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 132px;
  font-style: italic;
  font-weight: 900;
  fill: url(#wood);
  stroke: #9d6424;
  stroke-width: 3px;
  paint-order: stroke;
}
#svgText.bold { font-family: Arial Black, Impact, sans-serif; font-style: normal; }
#svgText.elegant { font-family: Georgia, serif; font-style: italic; font-weight: 500; }
#svgText.no-join { letter-spacing: 12px; }
#svgLine { fill: url(#wood); stroke: #9d6424; stroke-width: 2px; }
#svgLine.hidden { display: none; }

.right-panel h3 { margin: 22px 0 14px; }
.export-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.export-grid button, .right-panel .next, .right-panel .download {
  width: 100%;
  padding: 18px 12px;
  border-radius: 18px;
  border: 1px solid #e8ddff;
  background: #fbfaff;
  font-weight: 950;
  cursor: pointer;
}
.export-grid button:hover, .right-panel .next:hover { background: var(--purple-soft); color: var(--purple); }
.export-grid button.is-loading,
.right-panel .download.is-loading {
  opacity: 0.62;
  cursor: wait;
}
.batch-box {
  border: 1px solid #eee8ff;
  background: #fbfaff;
  border-radius: 18px;
  padding: 16px;
}
.batch-box strong, .batch-box span { display: block; }
.batch-box span { color: var(--muted); margin-top: 4px; }
.right-panel .next { margin-top: 16px; color: var(--purple); }
.right-panel .download { margin-top: 14px; color: white; background: var(--purple); text-align: center; }
.save-status {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.features {
  max-width: 1240px;
  margin: 0 auto;
  padding: 34px 48px 54px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.features article {
  background: white;
  border: 1px solid var(--border);
  border-radius: 26px;
  padding: 26px;
  box-shadow: 0 12px 35px rgba(109, 54, 232, 0.07);
}
.features p { color: var(--muted); line-height: 1.6; }

.pricing {
  max-width: 1240px;
  margin: 0 auto 70px;
  background: #151323;
  color: white;
  border-radius: 34px;
  padding: 40px;
}
.pricing > p { color: #c9c2dc; }
.price-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin-top: 28px; }
.price-grid article { background: rgba(255,255,255,0.09); border-radius: 26px; padding: 26px; }
.price-grid article.featured { background: var(--purple); }
.price-grid strong { display: block; font-size: 42px; margin: 12px 0; }
.price-grid p { line-height: 1.9; color: #eeeafd; }

@media (max-width: 1200px) {
  .editor-header { align-items: flex-start; flex-direction: column; }
  .editor-actions { justify-content: flex-start; }
  .editor-grid { grid-template-columns: 1fr; }
  .panel, .right-panel { border: 0; }
  .canvas { min-height: 460px; }
  .export-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  nav { display: none; }
  .features, .price-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 650px) {
  .topbar { padding: 0 18px; }
  .hero { padding: 42px 18px; }
  .editor-card { width: calc(100% - 24px); }
  .editor-actions { width: 100%; }
  .header-action-group { width: 100%; }
  .editor-actions .import-grid,
  .editor-actions .export-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .features, .price-grid { grid-template-columns: 1fr; padding-left: 18px; padding-right: 18px; }
.pricing { margin-left: 18px; margin-right: 18px; }
}

.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(21, 19, 35, 0.46);
  backdrop-filter: blur(10px);
}
.auth-modal[hidden] { display: none; }
.reward-modal {
  position: fixed;
  inset: 0;
  z-index: 32;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(21, 19, 35, 0.52);
  backdrop-filter: blur(10px);
}
.reward-modal[hidden] { display: none; }
.auth-dialog {
  position: relative;
  width: min(430px, 100%);
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: white;
  box-shadow: 0 30px 80px rgba(21, 19, 35, 0.28);
}
.reward-dialog {
  position: relative;
  width: min(460px, 100%);
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: white;
  box-shadow: 0 30px 80px rgba(21, 19, 35, 0.28);
}
.reward-video {
  height: 220px;
  border-radius: 22px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(120deg, rgba(109, 54, 232, 0.92), rgba(21, 19, 35, 0.96) 48%, rgba(239, 68, 68, 0.72)),
    radial-gradient(circle at 20% 20%, rgba(255,255,255,0.32), transparent 28%);
}
.reward-video::after {
  content: "";
  position: absolute;
  inset: -40%;
  background:
    linear-gradient(90deg, transparent, rgba(255,255,255,0.22), transparent),
    repeating-linear-gradient(135deg, rgba(255,255,255,0.08) 0 10px, transparent 10px 24px);
  animation: reward-pan 3.2s linear infinite;
}
.reward-video::before {
  content: "MakerNames Free";
  position: absolute;
  top: 16px;
  left: 16px;
  color: white;
  font-size: 12px;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  z-index: 2;
}
.reward-scene {
  position: relative;
  z-index: 2;
  width: min(78%, 320px);
  padding: 22px;
  border: 1px solid rgba(255,255,255,0.24);
  border-radius: 20px;
  color: white;
  background: rgba(255,255,255,0.12);
  box-shadow: 0 22px 60px rgba(0,0,0,0.24);
  transform-origin: center;
  animation: reward-pulse 2.4s ease-in-out infinite;
}
.reward-scene strong,
.reward-scene small,
.reward-tag {
  display: block;
}
.reward-scene strong {
  margin-top: 20px;
  font-size: 25px;
  line-height: 1.05;
}
.reward-scene small {
  margin-top: 10px;
  opacity: 0.82;
  font-weight: 900;
}
.reward-tag {
  width: max-content;
  padding: 7px 10px;
  border-radius: 999px;
  background: white;
  color: var(--purple);
  font-size: 11px;
  font-weight: 950;
}
.reward-play {
  position: absolute;
  z-index: 3;
  right: 22px;
  bottom: 34px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  padding-left: 5px;
  color: var(--purple);
  background: white;
  font-size: 23px;
  box-shadow: 0 18px 44px rgba(0,0,0,0.24);
}
.reward-progress {
  position: absolute;
  z-index: 3;
  left: 18px;
  right: 92px;
  bottom: 24px;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,0.28);
}
.reward-progress span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: white;
  transform-origin: left;
  animation: reward-progress 8s linear forwards;
}
.reward-bars {
  position: absolute;
  z-index: 1;
  left: 18px;
  right: 18px;
  top: 70px;
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 1fr;
  gap: 8px;
  opacity: 0.5;
}
.reward-bars span {
  height: 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.48);
}
.reward-dialog h2 {
  margin: 20px 0 8px;
  font-size: 28px;
}
.reward-dialog p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}
.reward-submit {
  width: 100%;
  margin-top: 20px;
}
.reward-submit:disabled {
  opacity: 0.7;
  cursor: wait;
}
.reward-cancel {
  margin-top: 14px;
}
@keyframes reward-pan {
  from { transform: translateX(-18%) rotate(0deg); }
  to { transform: translateX(18%) rotate(0deg); }
}
@keyframes reward-pulse {
  0%, 100% { transform: scale(0.98) translateY(2px); }
  50% { transform: scale(1.02) translateY(-2px); }
}
@keyframes reward-progress {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
.auth-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfaff;
  cursor: pointer;
  font-size: 20px;
  font-weight: 900;
}
.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-right: 44px;
  padding: 5px;
  border-radius: 18px;
  background: #fbfaff;
}
.auth-tabs button {
  border: 0;
  border-radius: 14px;
  padding: 12px;
  background: transparent;
  font-weight: 950;
  cursor: pointer;
}
.auth-tabs button.active {
  background: var(--purple-soft);
  color: var(--purple);
}
.auth-form h2 {
  margin: 22px 0 4px;
  font-size: 28px;
}
.auth-form .auth-submit {
  width: 100%;
  margin-top: 18px;
}
.auth-link {
  display: inline-flex;
  margin-top: 10px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--purple);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}
.auth-link:hover { color: var(--purple-dark); }
.auth-link[hidden] { display: none; }
.auth-message {
  min-height: 18px;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.auth-message.error { color: #be123c; }
.auth-message.success { color: #047857; }


.letter-tools,
.accessory-tools {
  background: white;
  border: 1px solid #eee8ff;
  border-radius: 18px;
  padding: 12px;
}

.accessory-tools {
  display: grid;
  gap: 8px;
}

.accessory-tools > strong {
  color: var(--muted);
  font-size: 12px;
}

.line-tools {
  display: grid;
  grid-template-columns: 46px 1fr 46px;
  gap: 8px;
  align-items: center;
}

.spacing-tools {
  display: grid;
  grid-template-columns: 46px 1fr 46px;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.line-tools button {
  border: 1px solid #e8ddff;
  background: #fbfaff;
  border-radius: 14px;
  padding: 12px 8px;
  font-weight: 950;
  cursor: pointer;
  color: var(--purple);
}

.line-tools strong,
.spacing-tools strong {
  min-height: 43px;
  border: 1px solid #eee8ff;
  background: white;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.spacing-tools button {
  border: 1px solid #e8ddff;
  background: #fbfaff;
  border-radius: 14px;
  padding: 12px 8px;
  font-weight: 950;
  cursor: pointer;
  color: var(--purple);
}

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

.letter-nav button {
  border: 1px solid #e8ddff;
  background: #fbfaff;
  border-radius: 12px;
  padding: 10px 8px;
  font-weight: 900;
  cursor: pointer;
  color: var(--purple);
}

.letter-nav strong {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.tool-caption {
  display: block;
  margin: 10px 0 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.mini-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.transform-grid {
  grid-template-columns: repeat(2, 1fr);
}

.mini-grid button,
.small-action {
  border: 1px solid #e8ddff;
  background: #fbfaff;
  border-radius: 12px;
  padding: 10px;
  font-weight: 900;
  cursor: pointer;
}

.small-action {
  width: 100%;
  margin-top: 8px;
  color: var(--purple);
}

.import-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.import-grid label {
  border: 1px solid #e8ddff;
  background: #fbfaff;
  border-radius: 16px;
  padding: 14px 10px;
  text-align: center;
  font-weight: 950;
  cursor: pointer;
  color: var(--purple);
}

.editor-actions .import-grid,
.editor-actions .export-grid {
  grid-template-columns: repeat(3, 72px);
  gap: 8px;
}

.editor-actions .import-grid label,
.editor-actions .export-grid button {
  min-height: 40px;
  padding: 10px 12px;
  border-radius: 14px;
  display: grid;
  place-items: center;
}

.editor-actions .export-grid button {
  color: var(--purple);
  background: var(--purple-soft);
  border-color: #dacbff;
}

.svg-letter {
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
  font-weight: 900;
  fill: url(#wood);
  stroke: #9d6424;
  stroke-width: 3px;
  paint-order: stroke;
  cursor: grab;
}

.svg-letter.bold {
  font-family: Arial Black, Impact, sans-serif;
  font-style: normal;
}

.svg-letter.elegant {
  font-family: Georgia, serif;
  font-style: italic;
  font-weight: 500;
}

.svg-letter.selected {
  stroke: #6d36e8;
  stroke-width: 5px;
}
