/* Fondos: fondo_mobile (768×1376), fondo_ipad (1792×2400), fondo_desktop (1376×768) */

:root {
  --content-max: 100%;
  --pad-x: clamp(18px, 5vw, 48px);
  --pad-top: clamp(20px, 5vw, 32px);
  --pad-bottom: clamp(48px, 10vw, 72px);
  --hero-size: clamp(2.35rem, 9.2vw, 3.4rem);
  --panel-text: clamp(1.25rem, 4.2vw, 1.65rem);
  --btn-size: clamp(18px, 4.5vw, 22px);
  --btn-pad: clamp(14px, 3.5vw, 18px);
  --bg-position: center bottom;
  --orange: #ff7900;
  --orange-hover: #e66700;
  --logo-shift-x: 0;
}

@media (min-width: 481px) {
  :root {
    --content-max: 720px;
    --pad-x: clamp(32px, 5vw, 56px);
    --hero-size: clamp(2.8rem, 4.5vw, 3.6rem);
    --panel-text: clamp(1.4rem, 2.5vw, 1.75rem);
    --logo-shift-x: clamp(-8px, -1vw, -20px);
  }
}

@media (min-width: 1025px) {
  :root {
    --content-max: 560px;
    --pad-x: 40px;
    --pad-top: 24px;
    --hero-size: 3.2rem;
    --panel-text: 1.6rem;
    --bg-position: center center;
    --logo-inset: clamp(32px, 5vw, 72px);
    --logo-shift-x: clamp(-50px, -5vw, -72px);
  }

  .app-inner {
    margin-left: var(--logo-inset);
    margin-right: auto;
  }
}

*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  color: #fff;
  background-color: #000;
}

/* Visibilidad (controlada por JS con clases, sin inline styles) */
.is-hidden { display: none; }

.app {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  background-color: #000;
  overflow: hidden;
}

.app-bg-wrap {
  position: absolute;
  inset: 0;
  z-index: 0;
  margin: 0;
  pointer-events: none;
}

.app-bg {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--bg-position);
}

.app-inner {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding:
    calc(var(--pad-top) + env(safe-area-inset-top, 0px))
    var(--pad-x)
    calc(var(--pad-bottom) + env(safe-area-inset-bottom, 0px));
}

.logo {
  display: block;
  width: clamp(44px, 11vw, 56px);
  height: auto;
  margin: 0 0 clamp(14px, 4vw, 22px);
  transform: translateX(var(--logo-shift-x));
}

.hero-title {
  font-size: var(--hero-size);
  line-height: 1.05;
  font-weight: 800;
  color: #fff;
  margin: 0 0 clamp(20px, 5vw, 32px);
  text-align: left;
}

.hero-title span,
.accent {
  color: var(--orange);
}

.screen {
  display: none;
  text-align: center;
}

.screen.is-active {
  display: block;
}

.panel {
  border: 2px solid var(--orange);
  padding: clamp(20px, 5vw, 32px) clamp(18px, 4vw, 28px);
  margin-bottom: clamp(20px, 5vw, 32px);
  text-align: left;
}

.panel-text {
  font-size: var(--panel-text);
  line-height: 1.35;
  color: #fff;
  margin: 0 0 clamp(18px, 4vw, 26px);
}

.panel-text:last-child {
  margin-bottom: 0;
}

.panel-text strong {
  color: var(--orange);
  font-weight: 800;
}

.photo-slots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(12px, 3vw, 20px);
}

.photo-slot {
  aspect-ratio: 1;
  border: 2px solid #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: #fff;
}

.photo-slot .plus {
  font-size: clamp(2.2rem, 8vw, 3rem);
  line-height: 1;
  font-weight: 300;
}

.photo-slot .slot-label {
  font-size: clamp(0.95rem, 3.2vw, 1.15rem);
}

.photo-slot.filled .plus,
.photo-slot.filled .slot-label {
  display: none;
}

.photo-slot.filled {
  border-color: var(--orange);
}

.shirt-grid-select {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: clamp(10px, 2.5vw, 16px);
  justify-items: center;
}

.shirt-square {
  width: 100%;
  max-width: clamp(64px, 14vw, 96px);
  aspect-ratio: 1;
  object-fit: cover;
  border: 3px solid transparent;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.shirt-square.selected {
  border-color: var(--orange);
}

.loading-block {
  padding: clamp(24px, 6vw, 40px) 0;
}

.loading-title {
  color: var(--orange);
  font-size: clamp(2.4rem, 9vw, 3.6rem);
  font-weight: 800;
  margin: 0;
}

.loading-progress {
  margin: clamp(28px, 6vw, 40px) auto 0;
  width: 100%;
  max-width: 320px;
  height: 8px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  overflow: hidden;
}

.loading-progress-fill {
  width: 0;
  height: 100%;
  background: var(--orange);
  border-radius: 4px;
}

#screen3.is-active .loading-progress-fill {
  animation: loadProgress 120s linear forwards;
}

@keyframes loadProgress {
  from { width: 0%; }
  to { width: 92%; }
}

#finalImage,
#usedImage {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  display: block;
}

.result-title {
  color: #fff;
  font-size: clamp(1.4rem, 4.5vw, 1.9rem);
  font-weight: 700;
  margin: 0 0 clamp(14px, 4vw, 22px);
}

.result-actions {
  display: flex;
  gap: clamp(10px, 3vw, 16px);
  margin-top: 16px;
}

.result-actions a {
  flex: 1;
  text-decoration: none;
}

.error {
  display: none;
  color: var(--orange);
  padding: 8px;
  text-align: center;
  margin-top: 10px;
}

.error.is-visible {
  display: block;
}

/* Botones: base + variantes explícitas (sin pisarse en :hover) */
button {
  width: 100%;
  padding: var(--btn-pad);
  font-size: var(--btn-size);
  font-weight: bold;
  border: none;
  margin-top: 10px;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

button.btn-primary {
  background-color: var(--orange);
  color: #000;
}

button.btn-primary:hover {
  background-color: var(--orange-hover);
  color: #000;
}

button.btn-secondary {
  background-color: #000;
  border: 2px solid var(--orange);
  color: var(--orange);
}

button.btn-secondary:hover {
  background-color: #1a1a1a;
}

button.btn-ghost {
  background: transparent;
  border: 2px solid rgba(255, 255, 255, 0.45);
  color: #fff;
}

button.btn-ghost:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

.result-actions button {
  margin-top: 0;
}
