:root {
  color-scheme: light;
  --bg: #f3f6f8;
  --panel: #ffffff;
  --ink: #15202b;
  --muted: #667789;
  --line: #d6e0e8;
  --soft: #eef4f8;
  --accent: #08775b;
  --accent-dark: #075f49;
  --warn: #9a5a00;
  --bad: #b42318;
  --good: #067647;
  --bar-height: 64px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  overflow-x: hidden;
}

button,
textarea,
input {
  font: inherit;
  min-width: 0;
}

button {
  border: 0;
  cursor: pointer;
}

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

.app {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
}

.creator,
.preview {
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.creator {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 18px;
}

.brand-block {
  display: grid;
  gap: 4px;
}

.brand {
  font-size: 24px;
  font-weight: 850;
}

.tagline,
.quote-kind,
.preview-bar span {
  color: var(--muted);
}

.tagline {
  font-size: 13px;
  font-weight: 750;
}

.prompt-label {
  font-size: 22px;
  line-height: 1.15;
  font-weight: 850;
}

textarea {
  width: 100%;
  min-height: 138px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdff;
  color: var(--ink);
  line-height: 1.45;
  overflow-wrap: break-word;
}

.firmware-input {
  display: none;
}

.create-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 12px;
  align-items: end;
}

.qty-label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.qty-label input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #ffffff;
  color: var(--ink);
}

.main-button,
.pay-button,
.tool {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 850;
  text-align: center;
  white-space: normal;
}

.main-button,
.pay-button {
  width: 100%;
  background: var(--accent);
  color: #ffffff;
}

.main-button:hover,
.pay-button:hover {
  background: var(--accent-dark);
}

.order {
  display: grid;
  gap: 12px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.status {
  width: fit-content;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 999px;
  padding: 7px 10px;
  background: #e7f7ef;
  color: var(--good);
  font-size: 12px;
  font-weight: 850;
}

.price {
  font-size: 40px;
  line-height: 1;
  font-weight: 900;
}

.quote-kind {
  font-size: 13px;
  line-height: 1.35;
}

.steps,
.simple-plan,
.quote-lines {
  display: none;
}

.preview {
  position: relative;
  min-height: calc(100svh - 32px);
  overflow: hidden;
  background: #e8eff4;
}

.preview-bar {
  position: relative;
  z-index: 2;
  min-height: var(--bar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
}

.preview-bar strong {
  display: block;
  font-size: 16px;
}

.preview-bar span {
  display: block;
  margin-top: 2px;
  font-size: 12px;
}

.preview-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.tool {
  border: 1px solid #17212b;
  background: #17212b;
  color: #ffffff;
}

.tool.active {
  border-color: #8dd4bc;
  background: #e7f7ef;
  color: var(--accent-dark);
}

.viewport,
.fallback-canvas {
  position: absolute;
  inset: var(--bar-height) 0 0;
}

.viewport canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.fallback-canvas {
  display: none;
  width: 100%;
  height: calc(100% - var(--bar-height));
}

pre {
  min-height: 180px;
  max-height: 240px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  border-radius: 8px;
  padding: 12px;
  background: #101926;
  color: #d1fae5;
  font-size: 11px;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(380px, 62svh) auto;
    gap: 12px;
    padding: 12px;
  }

  .preview {
    grid-row: 1;
    min-height: 380px;
  }

  .creator {
    grid-row: 2;
  }
}

@media (max-width: 560px) {
  :root {
    --bar-height: 58px;
  }

  .app {
    grid-template-rows: minmax(340px, 58svh) auto;
    gap: 10px;
    padding: 0;
  }

  .creator,
  .preview {
    border-left: 0;
    border-right: 0;
    border-radius: 0;
  }

  .creator {
    padding: 16px;
  }

  .brand {
    font-size: 22px;
  }

  .prompt-label {
    font-size: 20px;
  }

  textarea {
    min-height: 118px;
  }

  .create-row {
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 10px;
  }

  .main-button,
  .pay-button,
  .tool {
    min-height: 42px;
    padding: 0 12px;
  }

  .preview-bar {
    padding: 9px 12px;
  }

  .preview-bar strong {
    font-size: 15px;
  }

  .viewport canvas,
  .fallback-canvas {
    transform: scale(0.82);
    transform-origin: center center;
  }

  .price {
    font-size: 34px;
  }
}
