:root {
  --bg: #edf1f7;
  --ink: #101828;
  --muted: #657085;
  --line: #d8deea;
  --panel: #ffffff;
  --accent: #1457ff;
  --accent-dark: #0d3cc4;
  --shadow: 0 14px 34px rgba(26, 38, 63, .11);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, Arial, sans-serif;
}

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

.site-header {
  align-items: center;
  background: rgba(255, 255, 255, .9);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: auto minmax(0, 1fr) auto;
  min-height: 56px;
  padding: 8px 16px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  align-items: center;
  color: var(--ink);
  display: inline-flex;
  font-size: 14px;
  font-weight: 650;
  gap: 8px;
  text-decoration: none;
  white-space: nowrap;
}

.brand img {
  display: block;
  height: 32px;
  width: 32px;
}

.brand span {
  align-items: center;
  background: var(--accent);
  border-radius: 8px;
  color: #fff;
  display: inline-flex;
  height: 36px;
  justify-content: center;
  width: 36px;
}

.main-menu {
  align-items: center;
  display: flex;
  gap: 6px;
  justify-content: center;
  min-width: 0;
}

.menu-item {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
  min-height: 32px;
  padding: 0 10px;
  white-space: nowrap;
}

.menu-item:hover {
  background: #eef3ff;
  color: var(--ink);
}

.menu-item.is-active {
  background: #e8efff;
  border-color: #c9d8ff;
  color: var(--accent);
}

.feature-page {
  display: none;
}

.feature-page.is-active {
  display: block;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 14px;
  min-height: calc(100vh - 56px);
  padding: 14px;
}

.workspace,
.controls {
  min-width: 0;
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.topbar {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.zoom-controls {
  align-items: center;
  background: rgba(255, 255, 255, .34);
  border: 1px solid rgba(216, 222, 234, .72);
  border-radius: 7px;
  display: inline-flex;
  gap: 4px;
  padding: 4px;
}

.zoom-controls button {
  background: rgba(247, 249, 253, .72);
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  height: 28px;
  min-width: 34px;
  padding: 0 8px;
}

.zoom-controls button:hover {
  border-color: #c9d8ff;
  color: var(--accent);
}

.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 24px;
  line-height: 1.05;
  font-weight: 720;
}

h2 {
  font-size: 14px;
  line-height: 1.2;
  font-weight: 680;
}

.canvas-frame {
  background:
    linear-gradient(45deg, rgba(151, 163, 184, .15) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(151, 163, 184, .15) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(151, 163, 184, .15) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(151, 163, 184, .15) 75%),
    #edf1f7;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
  background-size: 16px 16px;
  border: 1px solid rgba(216, 222, 234, .86);
  border-radius: 8px;
  box-shadow: var(--shadow);
  flex: 1;
  height: calc(100vh - 124px);
  min-height: 380px;
  overflow: auto;
  padding: 16px;
}

.canvas-stage {
  display: block;
  height: max-content;
  margin: 0 auto;
  position: relative;
  width: max-content;
}

canvas {
  background: transparent;
  border-radius: 6px;
  box-shadow: 0 10px 24px rgba(16, 24, 40, .18);
  display: block;
}

.canvas-text-box {
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
}

.canvas-text-editor {
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, .64);
  border-radius: 6px;
  box-shadow: none;
  caret-color: currentColor;
  line-height: 1.18;
  min-height: 0;
  outline: none;
  overflow: hidden;
  padding: 6px;
  position: relative;
  resize: none;
  width: 100%;
}

.canvas-text-editor:focus {
  border-color: rgba(255, 255, 255, .95);
  box-shadow: 0 0 0 3px rgba(20, 87, 255, .28);
}

.text-drag-handle,
.text-resize-handle {
  background: rgba(20, 87, 255, .16);
  border: 1px solid rgba(255, 255, 255, .78);
  border-radius: 6px;
  box-shadow: 0 5px 14px rgba(16, 24, 40, .16);
  cursor: grab;
  height: 22px;
  padding: 0;
  position: absolute;
  width: 22px;
  z-index: 3;
}

.text-drag-handle {
  left: -10px;
  top: -10px;
}

.text-drag-handle::before {
  color: #fff;
  content: "+";
  display: block;
  font-size: 16px;
  font-weight: 700;
  line-height: 20px;
}

.text-resize-handle {
  bottom: -10px;
  cursor: nwse-resize;
  right: -10px;
}

.text-resize-handle::before {
  background: linear-gradient(135deg, transparent 45%, #fff 45%, #fff 55%, transparent 55%);
  content: "";
  display: block;
  height: 12px;
  margin: 4px;
  width: 12px;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
  padding-right: 2px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 7px;
  box-shadow: 0 8px 22px rgba(26, 38, 63, .06);
  display: grid;
  gap: 8px;
  padding: 10px;
}

.grid {
  display: grid;
  gap: 8px;
}

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

.grid.three {
  grid-template-columns: 88px 88px minmax(0, 1fr);
}

.style-grid {
  grid-template-columns: minmax(112px, 1.1fr) 82px 86px;
}

.style-grid .field:first-child {
  grid-column: 1 / -1;
}

.content-color-grid {
  align-items: end;
  grid-template-columns: 54px 54px minmax(0, 1fr);
}

.field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

textarea,
select,
input[type="file"],
input[type="number"] {
  background: #f9fbff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  outline: none;
  width: 100%;
}

input[type="number"] {
  appearance: textfield;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
}

textarea {
  line-height: 1.45;
  min-height: 78px;
  padding: 7px 8px;
  resize: vertical;
}

select,
input[type="file"],
input[type="number"] {
  min-height: 32px;
  padding: 5px 8px;
}

input[type="color"] {
  background: transparent;
  border: 0;
  cursor: pointer;
  height: 32px;
  padding: 0;
  width: 100%;
}

input[type="range"] {
  accent-color: var(--accent);
  min-height: 32px;
  width: 100%;
}

.switch-row {
  align-items: center;
  background: #f7f9fd;
  border: 1px solid var(--line);
  border-radius: 7px;
  display: grid;
  gap: 9px;
  grid-template-columns: auto minmax(0, 1fr);
  padding: 9px;
}

.switch-row strong {
  display: block;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
}

.switch-row small {
  color: var(--muted);
  display: block;
  font-size: 11px;
  line-height: 1.45;
  margin-top: 3px;
}

.switch {
  display: inline-grid;
}

.switch input {
  clip: rect(0 0 0 0);
  height: 1px;
  overflow: hidden;
  position: absolute;
  width: 1px;
}

.switch span {
  background: #c9d2e1;
  border-radius: 999px;
  cursor: pointer;
  display: block;
  height: 22px;
  position: relative;
  transition: .2s ease;
  width: 40px;
}

.switch span::after {
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 8px rgba(16, 24, 40, .24);
  content: "";
  height: 18px;
  left: 3px;
  position: absolute;
  top: 3px;
  transition: .2s ease;
  width: 18px;
}

.switch input:checked + span {
  background: var(--accent);
}

.switch input:checked + span::after {
  transform: translateX(18px);
}

.primary-action,
.secondary-action {
  align-items: center;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  display: inline-flex;
  font-size: 13px;
  font-weight: 650;
  gap: 7px;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  white-space: nowrap;
}

.primary-action {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 18px rgba(20, 87, 255, .22);
}

.primary-action:hover {
  background: var(--accent-dark);
}

.secondary-action {
  background: #e8edf7;
  color: var(--ink);
  width: 100%;
}

.coming-soon {
  align-items: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 10px;
  margin: 14px;
  max-width: 720px;
  padding: 18px;
}

.coming-soon p {
  color: var(--muted);
  line-height: 1.7;
  margin: 0;
}

.coming-icon {
  align-items: center;
  background: #e8efff;
  border-radius: 8px;
  color: var(--accent);
  display: inline-flex;
  font-size: 20px;
  font-weight: 900;
  height: 48px;
  justify-content: center;
  width: 48px;
}

.canvas-text-box .canvas-text-editor {
  background: transparent;
  border: 1px dashed rgba(255, 255, 255, .64);
  border-radius: 6px;
  box-shadow: none;
  color: inherit;
  min-height: 0;
  overflow: hidden;
  padding: 6px;
  resize: none;
  width: 100%;
}

.canvas-text-box .canvas-text-editor:focus {
  border-color: rgba(255, 255, 255, .95);
  box-shadow: 0 0 0 3px rgba(20, 87, 255, .24);
}

@media (max-width: 980px) {
  .site-header {
    grid-template-columns: 1fr auto;
  }

  .main-menu {
    grid-column: 1 / -1;
    justify-content: flex-start;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .controls {
    overflow: visible;
  }

  .canvas-frame {
    height: auto;
    min-height: 360px;
    padding: 14px;
  }

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

@media (max-width: 560px) {
  .site-header {
    gap: 10px;
    padding: 10px 14px;
  }

  .header-download {
    min-height: 40px;
    padding: 0 12px;
  }

  .app-shell {
    gap: 14px;
    padding: 14px;
  }

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

  .zoom-controls {
    align-self: flex-start;
  }

  h1 {
    font-size: 28px;
  }

  .workspace .primary-action {
    width: 100%;
  }

  .grid.two,
  .grid.three,
  .style-grid,
  .content-color-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 420px) {
  .brand strong {
    display: none;
  }
}
