: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 {
  margin-bottom: 6px;
}

/* IMAGEM DO NOME */
.nome-img {
  height: 104px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
  margin-bottom: -16px;
}

.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;
  touch-action: none;
  cursor: grab;
  border-radius: 8px;
  background:
    repeating-conic-gradient(
      #f1f4f8 0% 25%,
      #e6ebf2 0% 50%
    ) 50% / 24px 24px;
}

#canvas.is-dragging {
  cursor: grabbing;
}

.preview__hint {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: 10px;
}

/* Controls */
.controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.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: 14px;
  background: #e7edf5;
  border-radius: 999px;
  overflow: hidden;
}

.progress__bar {
  height: 100%;
  width: 38%;
  border-radius: 999px;
  background: linear-gradient(
    90deg,
    var(--blue-500),
    var(--blue-700)
  );
  transform: translateX(-130%);
  opacity: 0;
  will-change: transform;
}

#uploadBlock.is-loading {
  min-height: 84px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: stretch;
  gap: 8px;
}

#uploadBlock.is-loading > :not(.progress):not(.loading-note) {
  display: none;
}

#uploadBlock.is-loading .progress {
  margin-top: 0;
  width: 100%;
}

.loading-note {
  display: none;
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.2;
}

#uploadBlock.is-loading .loading-note {
  display: block;
}

#uploadBlock.is-loading .progress__bar {
  opacity: 1;
  animation: progress-indeterminate 2.6s ease-in-out infinite;
}

@keyframes progress-indeterminate {
  0% {
    transform: translateX(-130%);
  }

  55% {
    transform: translateX(95%);
  }

  100% {
    transform: translateX(220%);
  }
}

.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);
}

.adjust-tip {
  margin: -2px 0 12px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

/* 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);
}

.site-credit a {
  color: inherit;
  text-decoration: none;
}

.site-credit a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 860px) {

  .app {
    padding: 12px 12px 20px;
  }

  .app__header {
    margin-bottom: 2px;
  }

  .nome-img {
    height: 96px;
    margin-bottom: -22px;
  }

  .layout {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 10px;
  }

  .preview {
    position: sticky;
    top: 8px;
    z-index: 5;
  }

  .preview__frame {
    padding: 8px;
  }

  #canvas {
    max-height: 52vh;
    width: 100%;
    margin: 0 auto;
  }

  .card-block {
    padding: 12px;
  }

  .controls {
    gap: 10px;
  }

  .actions {
    gap: 8px;
  }

  .btn {
    padding: 11px 16px;
  }

  .footnote {
    margin-top: 0;
  }

  .field label {
    font-size: 14px;
    margin-bottom: 8px;
  }

  .adjust-tip {
    font-size: 11px;
    margin-bottom: 10px;
  }

  .field input[type="range"] {
    touch-action: pan-y;
    -webkit-appearance: none;
    appearance: none;
    height: 28px;
    background: transparent;
  }

  .field input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 999px;
    background: #d5deec;
  }

  .field input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--blue-500);
    border: 2px solid #fff;
    margin-top: -9px;
    box-shadow: 0 2px 8px rgba(10, 42, 99, 0.28);
  }

  .field input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: #d5deec;
  }

  .field input[type="range"]::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--blue-500);
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(10, 42, 99, 0.28);
  }
}