:root {
  --bg: #f5f7fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #5b6472;
  --line: #d9dee8;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --shadow: 0 24px 80px rgba(15, 23, 42, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, #e0ecff 0, transparent 34%), var(--bg);
  color: var(--text);
}

.page-shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0;
}

.hero {
  text-align: center;
  margin-bottom: 28px;
}

.brand-pill {
  display: inline-flex;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.7);
  font-size: 13px;
  font-weight: 700;
  color: var(--primary-dark);
}

h1 {
  margin: 16px 0 10px;
  font-size: clamp(32px, 6vw, 54px);
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.hero p {
  max-width: 720px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.app-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 430px);
  gap: 28px;
  padding: 28px;
  border: 1px solid rgba(217,222,232,0.9);
  border-radius: 28px;
  background: rgba(255,255,255,0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.form-panel, .preview-panel {
  min-width: 0;
}

label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  font-weight: 700;
}

textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}

textarea {
  resize: vertical;
  min-height: 138px;
  padding: 14px 16px;
  line-height: 1.45;
}

select {
  height: 48px;
  padding: 0 14px;
}

textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.13);
}

.grid {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

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

.color-field input {
  width: 100%;
  height: 48px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  cursor: pointer;
}

.actions {
  display: flex;
  gap: 12px;
  margin-top: 22px;
}

button {
  appearance: none;
  border: 0;
  border-radius: 16px;
  padding: 14px 18px;
  background: var(--primary);
  color: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease, opacity .12s ease;
}

button:hover { background: var(--primary-dark); transform: translateY(-1px); }
button:disabled { opacity: .45; cursor: not-allowed; transform: none; }
button.secondary { background: #e9eef8; color: #172033; }
button.secondary:hover { background: #dde5f2; }

.status {
  min-height: 22px;
  margin: 14px 2px 0;
  color: var(--muted);
  font-size: 14px;
}

.status.error { color: #b91c1c; }
.status.success { color: #166534; }

.preview-panel {
  display: flex;
  align-items: stretch;
}

.preview-box {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 430px;
  padding: 24px;
  border: 1px dashed #cbd5e1;
  border-radius: 24px;
  background: #f8fafc;
}

canvas {
  display: none;
  max-width: 100%;
  height: auto;
  border-radius: 14px;
  box-shadow: 0 14px 36px rgba(15, 23, 42, .12);
}

canvas.visible { display: block; }

.empty-state {
  position: absolute;
  inset: 24px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #7b8493;
  text-align: center;
  font-weight: 700;
}

.empty-state.hidden { display: none; }

@media (max-width: 820px) {
  .page-shell { width: min(100% - 24px, 720px); padding: 28px 0; }
  .app-card { grid-template-columns: 1fr; padding: 18px; border-radius: 22px; }
  .preview-box { min-height: 320px; }
}

@media (max-width: 520px) {
  .two-cols { grid-template-columns: 1fr; }
  .actions { flex-direction: column; }
  button { width: 100%; }
  .hero p { font-size: 15px; }
}
