:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e7eb;
  --surface: #ffffff;
  --soft: #f8fafc;
  --cyan: #00c4cc;
  --blue: #2563eb;
  --violet: #7d2ae8;
  --yellow: #ffde59;
  --red: #ff5757;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.16);
  font-family: "Canva Sans", Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 20% 10%, rgba(0, 196, 204, 0.16), transparent 26rem),
    radial-gradient(circle at 88% 78%, rgba(125, 42, 232, 0.14), transparent 25rem),
    #f3f6fb;
  color: var(--ink);
}

button,
input {
  font: inherit;
}

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

.phone-shell {
  position: relative;
  width: min(100vw, 430px);
  min-height: 100svh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.06), var(--shadow);
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  min-height: 100svh;
  padding: calc(env(safe-area-inset-top) + 18px) 18px calc(env(safe-area-inset-bottom) + 18px);
  overflow: hidden auto;
  background: var(--surface);
}

.screen.is-active {
  display: block;
}

.brandbar,
.screen-header,
.editor-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brandmark {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0;
  color: var(--cyan);
}

.brandmark span {
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
}

.ghost-btn,
.finish-btn,
.utility-btn,
.chip,
.primary-btn,
.share-actions button,
.export-options button,
.inspector-actions button,
.ai-actions button {
  border: 0;
  cursor: pointer;
}

.ghost-btn {
  min-width: 54px;
  height: 36px;
  border-radius: 18px;
  background: #eef2ff;
  color: #334155;
  font-weight: 800;
}

.screen-home {
  display: none;
  padding-bottom: 24px;
}

.hero-canvas {
  position: relative;
  height: min(52svh, 430px);
  min-height: 350px;
  margin: 22px -18px 0;
  overflow: hidden;
  background:
    radial-gradient(circle at 22% 20%, rgba(0, 196, 204, 0.22), transparent 13rem),
    radial-gradient(circle at 78% 72%, rgba(125, 42, 232, 0.18), transparent 14rem),
    #f8fbff;
  border-block: 0;
  --mx: 0;
  --my: 0;
}

.hero-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  filter: saturate(1.08) contrast(1.02);
  pointer-events: none;
}

.hero-canvas::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at calc(50% + var(--mx) * 18px) calc(48% + var(--my) * 18px), rgba(255, 255, 255, 0.24), transparent 11rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.16));
  pointer-events: none;
}

.hero-glass-poster,
.glass-orbit {
  position: absolute;
  z-index: 1;
  border: 1px solid rgba(255, 255, 255, 0.36);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.1));
  box-shadow: 0 24px 58px rgba(3, 7, 18, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
}

.hero-glass-poster {
  left: 48px;
  top: 34px;
  width: 248px;
  height: 316px;
  padding: 22px;
  border-radius: 18px;
  color: #111827;
  transform: translate(calc(var(--mx) * 12px), calc(var(--my) * 10px)) rotate(-5deg);
  transition: transform 0.12s ease-out;
}

.hero-glass-poster::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(circle at calc(50% + var(--mx) * 34%) calc(42% + var(--my) * 34%), rgba(255, 255, 255, 0.42), transparent 38%);
  pointer-events: none;
}

.poster-topline,
.poster-footer {
  position: relative;
  font-size: 12px;
  font-weight: 900;
  color: rgba(17, 24, 39, 0.72);
}

.poster-title {
  position: relative;
  margin-top: 22px;
  font-size: 46px;
  font-weight: 950;
  line-height: 0.98;
  letter-spacing: 0;
}

.poster-strip {
  position: relative;
  height: 18px;
  border-radius: 99px;
}

.poster-strip.cyan {
  width: 148px;
  margin-top: 26px;
  background: rgba(0, 196, 204, 0.9);
}

.poster-strip.violet {
  width: 196px;
  margin-top: 14px;
  background: rgba(125, 42, 232, 0.86);
}

.poster-footer {
  margin-top: 28px;
}

.glass-orbit {
  width: 68px;
  height: 68px;
  border-radius: 50%;
}

.orbit-a {
  left: 36px;
  bottom: 64px;
  transform: translate(calc(var(--mx) * 22px), calc(var(--my) * -16px));
}

.orbit-b {
  right: 132px;
  bottom: 30px;
  width: 42px;
  height: 42px;
  transform: translate(calc(var(--mx) * -18px), calc(var(--my) * 18px));
}

.home-copy {
  padding-top: 26px;
}

.eyebrow,
.screen-header p,
.editor-top p {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 9em;
  font-size: clamp(34px, 10vw, 46px);
  line-height: 1.06;
}

.home-copy > p:last-of-type {
  margin: 14px 0 20px;
  color: #111827;
  font-size: 16px;
  line-height: 1.65;
}

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

.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 186px;
  height: 52px;
  border-radius: 26px;
  background: var(--ink);
  color: #fff;
  font-size: 16px;
  font-weight: 900;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.24);
}

.primary-btn.full {
  width: 100%;
  margin-top: 18px;
}

.btn-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--cyan);
}

.icon-btn {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
}

.screen-header {
  justify-content: flex-start;
  margin-bottom: 22px;
}

.screen-header h2 {
  font-size: 22px;
  line-height: 1.22;
}

.mode-list {
  display: grid;
  gap: 12px;
}

.mode-item {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 104px;
  padding: 16px;
  border: 1px solid #dbe3f0;
  border-radius: 8px;
  background: #fff;
  text-align: left;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.07);
  cursor: pointer;
}

.mode-item strong {
  display: block;
  margin-bottom: 5px;
  font-size: 19px;
}

.mode-item em {
  color: var(--muted);
  font-size: 14px;
  font-style: normal;
}

.mode-icon {
  position: relative;
  display: block;
  width: 58px;
  height: 58px;
  border-radius: 8px;
  background: #e6fbfc;
}

.mode-icon.draw::after {
  content: "";
  position: absolute;
  left: 12px;
  top: 27px;
  width: 36px;
  height: 7px;
  border-radius: 99px;
  background: var(--cyan);
  transform: rotate(-18deg);
}

.mode-icon.shape {
  background: #f3eaff;
}

.mode-icon.shape::after {
  content: "";
  position: absolute;
  inset: 12px;
  border: 8px solid var(--violet);
  border-radius: 50%;
}

.mode-icon.template {
  background: #fff6d7;
}

.mode-icon.template::after,
.mode-icon.template::before {
  content: "";
  position: absolute;
  left: 12px;
  right: 12px;
  height: 8px;
  border-radius: 99px;
  background: #d9a500;
}

.mode-icon.template::before {
  top: 17px;
}

.mode-icon.template::after {
  bottom: 17px;
}

.quick-palette {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.quick-palette span {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.8), 0 6px 16px rgba(15, 23, 42, 0.14);
}

.screen-editor {
  padding: calc(env(safe-area-inset-top) + 12px) 12px calc(env(safe-area-inset-bottom) + 12px);
  background: #f6f8fb;
}

.editor-top {
  margin-bottom: 10px;
}

.editor-top > div {
  flex: 1;
}

.editor-top strong {
  display: block;
  font-size: 17px;
}

.finish-btn {
  height: 38px;
  padding: 0 16px;
  border-radius: 19px;
  background: var(--cyan);
  color: #052b31;
  font-weight: 900;
}

.stage-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 640 / 1008;
  max-height: calc(100svh - 338px);
  min-height: 300px;
  margin: 0 auto;
  overflow: hidden;
  border: 1px solid #d7dee9;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.12);
  touch-action: none;
}

.workflow-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 0 0 10px;
}

.workflow-steps span {
  display: grid;
  place-items: center;
  height: 26px;
  border-radius: 13px;
  background: #e9eef6;
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
}

.workflow-steps span.is-current {
  background: #dffbfc;
  color: #006a70;
}

#artboard {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  background: #fff;
  shape-rendering: geometricPrecision;
  text-rendering: geometricPrecision;
  user-select: none;
}

.canvas-watermark {
  position: absolute;
  right: 12px;
  bottom: 10px;
  color: rgba(17, 24, 39, 0.38);
  font-size: 12px;
  font-weight: 900;
  pointer-events: none;
}

.inspector {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 50px;
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid #dbe3f0;
  border-radius: 8px;
  background: #fff;
}

.inspector p {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.inspector strong {
  display: block;
  max-width: 128px;
  overflow: hidden;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.text-editor {
  flex: 1 1 auto;
  min-width: 0;
  height: 30px;
  border: 1px solid #dbe3f0;
  border-radius: 6px;
  padding: 0 9px;
  color: #111827;
  font-size: 12px;
  font-weight: 800;
  background: #f8fafc;
}

.text-editor:disabled {
  color: #94a3b8;
  background: #f1f5f9;
}

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

.inspector-actions button {
  height: 30px;
  padding: 0 9px;
  border-radius: 6px;
  background: #f1f5f9;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
}

.tool-dock {
  position: fixed;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  width: min(calc(100vw - 20px), 410px);
  transform: translateX(-50%);
  padding: 10px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.18);
  backdrop-filter: blur(16px);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 4px;
  border-radius: 8px;
  background: #eef2f7;
}

.segmented button {
  height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #475569;
  font-size: 13px;
  font-weight: 900;
}

.segmented button.is-selected {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.12);
}

.tool-panel {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  overflow-x: auto;
  padding: 8px 2px 6px;
}

.tool-panel.is-hidden {
  display: none;
}

.chip,
.utility-btn {
  flex: 0 0 auto;
  height: 34px;
  padding: 0 12px;
  border-radius: 17px;
  background: #f1f5f9;
  color: #334155;
  font-size: 13px;
  font-weight: 900;
}

.chip.is-selected {
  background: #e6fbfc;
  color: #006a70;
}

.range-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 128px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.range-label input {
  width: 78px;
}

.shape-btn,
.swatch,
.sticker-btn {
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border: 0;
  background: #eef2f7;
  cursor: pointer;
}

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

.shape-btn {
  position: relative;
  border-radius: 50%;
  background: var(--cyan);
}

.shape-btn.square {
  border-radius: 8px;
  background: var(--violet);
}

.shape-btn.triangle {
  position: relative;
  border-radius: 8px;
  background: #eef2f7;
}

.shape-btn.triangle::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 5px;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-bottom: 25px solid var(--yellow);
}

.shape-btn.line {
  position: relative;
  border-radius: 8px;
  background: #eef2f7;
}

.shape-btn.line::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  top: 18px;
  height: 4px;
  border-radius: 99px;
  background: var(--red);
  transform: rotate(-25deg);
}

.sticker-btn {
  width: auto;
  min-width: 42px;
  padding: 0 10px;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
}

.swatch {
  border-radius: 50%;
  background: var(--c);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.85);
}

.swatch.is-selected {
  outline: 3px solid rgba(0, 196, 204, 0.28);
}

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

.utility-btn {
  width: 100%;
  border-radius: 6px;
}

.utility-btn.danger {
  background: #fff1f2;
  color: #be123c;
}

.preview-card {
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 640 / 1008;
  max-height: 54svh;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.preview-card > div,
.export-preview > div,
.preview-card svg,
.export-preview svg {
  display: block;
  width: 100%;
  height: 100%;
}

.ai-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.ai-actions button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 60px;
  padding: 12px 14px;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  text-align: left;
}

.ai-actions strong {
  font-size: 16px;
}

.ai-actions span {
  color: var(--muted);
  font-size: 13px;
}

.export-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid #dbe3f0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.12);
}

.export-preview {
  width: 100%;
  max-height: 54svh;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.export-preview svg {
  aspect-ratio: 640 / 1008;
  height: auto;
}

.export-meta {
  display: grid;
  gap: 3px;
}

.export-meta p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.export-meta strong {
  font-size: 18px;
}

.export-meta span {
  color: var(--muted);
  font-size: 13px;
}

.export-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.export-options button {
  min-height: 40px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #334155;
  font-size: 13px;
  font-weight: 900;
}

.export-options button.is-selected {
  background: #dffbfc;
  color: #006a70;
  box-shadow: inset 0 0 0 1px rgba(0, 196, 204, 0.3);
}

.share-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 14px;
}

.share-actions button {
  min-height: 44px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 900;
}

.export-actions button:nth-child(2) {
  background: #334155;
}

.export-actions button:nth-child(3) {
  background: #eef2f7;
  color: #111827;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 5;
  max-width: min(340px, calc(100vw - 34px));
  padding: 10px 14px;
  border-radius: 20px;
  background: rgba(17, 24, 39, 0.92);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  opacity: 0;
  transform: translate(-50%, 12px);
  transition: 0.2s ease;
  pointer-events: none;
}

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

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

  .phone-shell {
    min-height: min(860px, calc(100svh - 48px));
    border-radius: 28px;
  }

  .screen {
    min-height: min(860px, calc(100svh - 48px));
  }
}

@media (max-height: 720px) {
  .stage-wrap {
    max-height: calc(100svh - 298px);
    min-height: 260px;
  }

  .tool-panel {
    min-height: 42px;
    padding-block: 6px 4px;
  }
}
