* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #120008 0%, #06000a 60%, #000 100%);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  font-family: 'Cinzel', serif;
  color: #e8d5d5;
  padding: 1.75rem 1rem;
}

@media (min-width: 768px) {
  body { padding: 3rem 1.5rem; }
}

#wrap {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

h1 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--red-strong);
  text-shadow: 0 0 25px var(--red-glow), 0 2px 4px rgba(0,0,0,0.8);
  font-weight: 400;
  text-align: center;
}

@media (min-width: 480px) {
  h1 { font-size: 2.2rem; }
}

img.deco {
  height: 22px;
  width: auto;
  opacity: 0.7;
  filter: drop-shadow(0 0 6px rgba(140, 80, 0, 0.3));
}

.subtitle {
  text-align: center;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  color: rgba(200, 170, 170, 0.6);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

/* ── Upload ── */
.upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  padding: 2.5rem 1rem;
  border: 1px dashed rgba(160, 10, 10, 0.4);
  color: var(--red-soft);
  font-size: 0.9rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
}
.upload-label:hover {
  border-color: var(--red-soft);
  background: rgba(255, 20, 20, 0.05);
}

.upload-icon {
  font-size: 1.6rem;
  opacity: 0.8;
}

/* ── Editor ── */
#editor.hidden,
#upload-step.hidden {
  display: none;
}

#editor {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#preview-wrap {
  position: relative;
  align-self: center;
  width: auto;
  height: min(48vh, 420px);
  max-width: 100%;
  aspect-ratio: 3 / 4; /* ajustado via JS assim que o template carrega */
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(120, 20, 10, 0.4);
  touch-action: none;
  cursor: grab;
}
#preview-wrap:active { cursor: grabbing; }

#preview-photo {
  position: absolute;
  left: 0;
  top: 0;
  max-width: none;
  pointer-events: none;
  user-select: none;
}

#preview-template {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  user-select: none;
}

.hint {
  text-align: center;
  font-size: 0.75rem;
  color: rgba(180, 140, 120, 0.55);
  font-style: italic;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

label {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: rgba(180, 140, 120, 0.7);
}

.zoom-label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

#zoom-value {
  font-size: 0.8rem;
  color: var(--red-soft);
  font-variant-numeric: tabular-nums;
}

.zoom-control {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.zoom-icon {
  font-size: 1.1rem;
  color: rgba(200, 170, 170, 0.5);
  flex-shrink: 0;
  user-select: none;
}

input[type="range"] {
  flex: 1;
  width: 100%;
  height: 28px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

/* trilho */
input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 26, 26, 0.15);
  border: 1px solid rgba(160, 10, 10, 0.4);
}
input[type="range"]::-moz-range-track {
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 26, 26, 0.15);
  border: 1px solid rgba(160, 10, 10, 0.4);
}

/* bolinha */
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -9px;
  border-radius: 50%;
  background: var(--red-strong);
  border: 2px solid #1a0004;
  box-shadow: 0 0 12px var(--red-glow);
  transition: transform 0.15s;
}
input[type="range"]::-webkit-slider-thumb:active {
  transform: scale(1.15);
}
input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--red-strong);
  border: 2px solid #1a0004;
  box-shadow: 0 0 12px var(--red-glow);
  transition: transform 0.15s;
}
input[type="range"]::-moz-range-thumb:active {
  transform: scale(1.15);
}

.actions {
  display: flex;
  gap: 0.75rem;
}

.primary-btn,
.secondary-btn {
  flex: 1;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.75rem 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}

.primary-btn {
  background: transparent;
  border: 1px solid var(--red-dim);
  color: var(--red-soft);
}
.primary-btn:hover:not(:disabled) {
  border-color: var(--red-soft);
  color: var(--red-strong);
  background: rgba(255, 20, 20, 0.08);
}
.primary-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.secondary-btn {
  background: transparent;
  border: 1px solid rgba(180, 140, 120, 0.3);
  color: rgba(200, 170, 170, 0.7);
}
.secondary-btn:hover {
  border-color: rgba(200, 170, 170, 0.6);
  color: rgba(230, 210, 210, 0.9);
}

/* ── Status ── */
.status {
  text-align: center;
  font-size: 0.85rem;
  letter-spacing: 0.04em;
}
.status.ok  { color: rgba(130, 180, 100, 0.85); }
.status.err { color: rgba(220, 70, 70, 0.85); }
.status.hidden { display: none; }
