:root {
  --blue-900: #0a2a63;
  --blue-700: #0e3f8c;
  --blue-500: #1c6fc0;
  --orange: #f28f1c;
  --orange-dark: #d97a0c;
  --bg: #eef2f7;
  --surface: #ffffff;
  --text: #17233a;
  --muted: #6b7890;
  --border: #d7dfea;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(10, 42, 99, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: linear-gradient(180deg, #f4f7fb 0%, var(--bg) 100%);
  color: var(--text);
  min-height: 100vh;
}

.app {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

.app__header h1 {
  margin: 0 0 6px;
  font-size: clamp(22px, 3vw, 30px);
  color: var(--blue-900);
}

.app__header p {
  margin: 0;
  color: var(--muted);
  max-width: 640px;
}

.layout {
  margin-top: 24px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 24px;
  align-items: start;
}

/* Preview */
.preview {
  position: sticky;
  top: 20px;
}

.preview__frame {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

#canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  background:
    repeating-conic-gradient(#f1f4f8 0% 25%, #e6ebf2 0% 50%) 50% / 24px 24px;
}

.preview__hint {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: 10px;
}

/* Controls */
.controls {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card-block h2 {
  margin: 0 0 12px;
  font-size: 16px;
  color: var(--blue-900);
}

.muted { color: var(--muted); font-size: 14px; }

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: 12px;
  padding: 22px 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  outline: none;
}

.dropzone:hover,
.dropzone:focus-visible,
.dropzone.is-drag {
  border-color: var(--blue-500);
  background: #f3f8ff;
}

.dropzone__icon {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--blue-500);
  color: #fff;
  font-size: 26px;
  line-height: 44px;
  text-align: center;
}

.dropzone__text { font-size: 14px; color: var(--muted); }
.dropzone__text strong { color: var(--text); }

/* Switch / checkbox rows */
.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  font-size: 14px;
  cursor: pointer;
}
.switch input { width: 18px; height: 18px; accent-color: var(--blue-500); }

/* Progress */
.progress {
  margin-top: 14px;
  height: 8px;
  background: #e7edf5;
  border-radius: 999px;
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--blue-500), var(--blue-700));
  transition: width .2s ease;
}

.status {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--muted);
  min-height: 18px;
}

/* Fields */
.field { margin-bottom: 14px; }
.field:last-child { margin-bottom: 0; }
.field label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.field label span { color: var(--blue-700); font-weight: 600; }
.field input[type="range"] {
  width: 100%;
  accent-color: var(--blue-500);
}

/* Actions */
.actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 10px;
  padding: 13px 18px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  background: var(--orange);
  color: #fff;
  transition: background .15s, transform .05s, opacity .15s;
  text-align: center;
}
.btn:hover { background: var(--orange-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn--secondary {
  background: var(--blue-500);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.btn--secondary:hover { background: var(--blue-700); }

.btn--ghost {
  background: transparent;
  color: var(--blue-700);
  border: 1px solid var(--border);
}
.btn--ghost:hover { background: #f1f5fb; }

.footnote {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin: 4px 2px 0;
}

.app__header .num { color: var(--orange); font-weight: 800; }

.site-credit {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 20px 0 6px;
}
.site-credit strong { color: var(--blue-700); }

/* Responsive */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .preview { position: static; }
}
