/* ============================================================
   BRAND-TYPO — COLLAGE URBANO / NYC
   Foto de fondo (valla + skyline), capa de color vino sobre las
   pantallas internas, acentos salmón con borde blanco tipo
   pegatina, tipografía bloque muy gruesa.
   ============================================================ */
:root {
  --salmon:      #FF4649;
  --salmon-ink:  oklch(0.5 0.19 21);   /* acento oscurecido para hover/texto sobre claro */
  --overlay:     rgba(85, 65, 65, 0.52); /* #554141 @ 52% */

  --ink:         oklch(0.16 0.01 40);
  --paper:       oklch(0.985 0.006 80);   /* tarjetas claras */
  --paper-dim:   oklch(0.93 0.01 60);
  --white-line:  oklch(0.99 0 0);
  --muted:       oklch(0.9 0.01 60 / 0.78);

  --font-display: "TS Block", "Archivo Black", sans-serif;
  --font-block:   "TS Block", "Archivo Black", sans-serif;
  --font-ui:      "TS Block", "Archivo Black", sans-serif;

  --radius: 8px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  color: var(--white-line);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  overscroll-behavior: none;
  background: var(--ink);
}

/* ---------- Fondo fotográfico + capa de color ---------- */
.bg-photo {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image: url("../Gemini_Generated_Image_tb9ul0tb9ul0tb9u.jpg");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.bg-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: var(--overlay);
  opacity: 0;
  transition: opacity 0.25s ease-out;
  pointer-events: none;
}
body:not([data-step="1"]) .bg-overlay { opacity: 1; }

.topbar, main, .loader, .about-layer { position: relative; z-index: 5; }

/* ---------- Cabecera ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px clamp(20px, 4vw, 48px);
  flex-wrap: wrap;
}

.logo-badge,
.about-badge {
  display: block;
  background: none;
  border: none;
  padding: 0;
  line-height: 0;
  cursor: pointer;
  transition: transform 0.15s ease-out, opacity 0.15s ease-out;
}
.logo-badge img,
.about-badge img {
  display: block;
  height: auto;
}
.logo-badge img { width: 100px; }
.about-badge img { width: 100px; }
.logo-badge {
  user-select: none;
  -webkit-user-select: none;
}
.logo-badge:hover,
.about-badge:hover {
  opacity: 0.85;
}
.logo-badge:active,
.about-badge:active {
  opacity: 1;
}

.steps { display: flex; gap: clamp(14px, 2.4vw, 30px); flex-wrap: wrap; }
.step {
  font-family: var(--font-block);
  font-size: 13px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--white-line);
  padding-bottom: 3px;
  border-bottom: 2.5px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.step.is-active { color: var(--salmon); border-bottom-color: var(--salmon); }

/* ---------- Pantallas ---------- */
main { max-width: 1280px; margin: 0 auto; padding: clamp(20px, 4vw, 32px) clamp(20px, 4vw, 48px) 120px; }
.screen { display: none; animation: fade 0.3s cubic-bezier(0.22, 1, 0.36, 1); }
.screen.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

#screen-2.is-active,
#screen-3.is-active {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 150px);
}

.screen-head { margin-bottom: clamp(20px, 3vw, 34px); }
.screen-head h2 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(30px, 6vw, 58px);
  line-height: 1;
  margin: 0;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--white-line);
}
.screen-head p {
  font-family: var(--font-ui);
  color: var(--muted);
  margin: 12px 0 0;
  font-size: clamp(13px, 1.3vw, 15px);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  max-width: 62ch;
  line-height: 1.4;
}
.screen-head strong { color: var(--salmon); }

/* ---------- Tarjetas ---------- */
.card {
  background: color-mix(in oklch, var(--paper) 96%, transparent);
  border: 3px solid var(--white-line);
  border-radius: 3px;
  color: var(--ink);
}

/* ---------- Botones ---------- */
.btn {
  border: 3px solid var(--white-line);
  background: var(--salmon);
  color: var(--white-line);
  padding: 12px 24px;
  border-radius: var(--radius);
  font-family: var(--font-block);
  font-size: 14px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.btn:hover { background: var(--ink); border-color: var(--ink); }
.btn-primary { background: var(--salmon); border-color: var(--salmon); }
.btn-gold { background: var(--white-line); color: var(--salmon-ink); border-color: var(--salmon); }
.btn-gold:hover { background: var(--salmon); color: var(--white-line); }
.btn-ghost {
  border-color: color-mix(in oklch, var(--ink) 25%, transparent);
  background: none;
  color: var(--ink);
}
.btn-ghost:hover { background: var(--salmon); color: var(--white-line); border-color: var(--salmon); }
.btn-tiny { padding: 8px 12px; font-size: 11px; }
.btn.full { width: 100%; }
#z-back, #z-front { background: var(--ink); border: none; color: var(--white-line); }
#z-back:hover, #z-front:hover { background: var(--salmon); }

/* flecha circular de vuelta, esquina inferior izquierda de cada pantalla */
.back-arrow {
  margin-top: clamp(20px, 3vw, 32px);
  width: 52px;
  height: 52px;
  border-radius: var(--radius);
  border: none;
  background: none;
  color: var(--salmon);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color 0.15s ease-out;
}
.back-arrow:hover { color: var(--ink); }
.flip-h { transform: scaleX(-1); }

/* ---------- Paso 1: PÓSTER ---------- */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: calc(100dvh - 130px);
  justify-content: center;
  padding-bottom: 8vh;
}
.poster {
  margin: 0;
  width: clamp(280px, 60vw, 750px);
}
.poster img {
  display: block;
  width: 100%;
  height: auto;
}
.poster-sub {
  margin: 4px 0 0;
  font-family: var(--font-block);
  font-size: clamp(15px, 2vw, 22px);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--white-line);
}

.name-form {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  max-width: 320px;
  margin-top: clamp(64px, 10vw, 112px);
  border-bottom: 3.75px solid var(--white-line);
  padding-bottom: 4px;
}
#name-input {
  flex: 1;
  font-family: var(--font-block);
  font-size: clamp(10px, 1.4vw, 16px);
  letter-spacing: 0.01em;
  line-height: 1;
  padding: 6px 4px 0;
  border: none;
  background: transparent;
  color: var(--white-line);
  outline: none;
  text-align: center;
  text-transform: uppercase;
}
#name-input::placeholder { color: rgba(255, 255, 255, 0.55); font-size: 1.2em; letter-spacing: 0.3em; }

.btn-arrow {
  flex: none;
  width: 36px;
  height: 44px;
  border: none;
  background: none;
  color: var(--salmon);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color 0.15s ease-out;
}
.btn-arrow:hover { color: var(--ink); }

.hint { min-height: 18px; color: var(--salmon); font-family: var(--font-block); font-size: 12px; text-transform: uppercase; letter-spacing: 0.02em; margin: 14px 0 0; }
.hint.flash { animation: shake 0.4s; }
@keyframes shake { 0%,100%{transform:none} 25%{transform:translateX(-6px)} 75%{transform:translateX(6px)} }

/* ---------- Paso 2: ruletas ---------- */
.card-reels {
  padding: clamp(20px, 3vw, 32px);
  flex: 1;
  display: flex;
  flex-direction: column;
  background: color-mix(in oklch, var(--paper) 55%, transparent);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: none;
}
.reels-wrap { overflow-x: auto; padding: 6px 2px 18px; flex: 1; display: flex; align-items: center; }
.reels {
  display: flex;
  gap: clamp(16px, 2.4vw, 28px);
  justify-content: center;
  min-width: min-content;
  padding: 0 6px;
  width: 100%;
}
.reel-col { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.reel-label {
  font-family: var(--font-block);
  font-size: clamp(18px, 2.2vw, 26px);
  letter-spacing: 0;
  text-transform: uppercase;
  color: var(--ink);
}

.reel-machine {
  position: relative;
  width: 140px;
  height: 120px;
  background: var(--white-line);
  border: 3px solid var(--ink);
  border-radius: 3px;
  overflow: hidden;
}
.reel-scroll {
  width: 100%;
  overflow-x: scroll;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.reel-scroll::-webkit-scrollbar { display: none; }
.reel-scroll.spinning { scroll-snap-type: none; }

.reel-track { display: flex; padding: 0; height: 100%; }
.reel-item {
  flex: 0 0 140px;
  width: 140px;
  height: 100%;
  scroll-snap-align: center;
  display: grid;
  place-items: center;
  padding: 18px;
  opacity: 0.14;
  transform: scale(0.66);
  transition: opacity 0.2s, transform 0.2s;
}
.reel-item svg { width: 100%; height: 100%; }
.reel-item.is-selected { opacity: 1; transform: scale(1); }

.reel-window {
  position: absolute;
  top: 0; bottom: 0;
  left: 0; right: 0;
  pointer-events: none;
  border-left: 3px solid var(--salmon);
  border-right: 3px solid var(--salmon);
  z-index: 3;
}

.reel-hcontrols { display: flex; align-items: center; gap: 6px; }

.reel-btn {
  width: 140px;
  border: 3px solid var(--ink);
  background: var(--white-line);
  color: var(--ink);
  padding: 7px 11px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: var(--font-block);
  font-size: 12px;
  letter-spacing: 0.02em;
  transition: background 0.16s, color 0.16s;
}
.reel-btn.left, .reel-btn.right { width: auto; border: none; background: none; padding: 4px 8px; font-size: 18px; line-height: 1; color: var(--salmon); }
.reel-btn.left:hover, .reel-btn.right:hover { background: none; color: var(--ink); }
.reel-btn.spin { background: var(--ink); color: var(--white-line); border-color: var(--ink); }
.reel-btn.spin:hover { background: var(--salmon); border-color: var(--salmon); }

.reel-gap {
  align-self: center;
  width: 26px;
  height: 120px;
  display: grid;
  place-items: center;
}
.reel-gap span {
  writing-mode: vertical-rl;
  color: color-mix(in oklch, var(--ink) 40%, transparent);
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  font-family: var(--font-block);
}

.card-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
  padding-top: 0;
  margin-top: clamp(8px, 1.4vw, 14px);
}

/* ---------- Paso 3: editor ---------- */
.editor { display: grid; grid-template-columns: 1fr 300px; align-items: start; gap: clamp(20px, 3vw, 32px); flex: 1; }
.editor-left { display: flex; flex-direction: column; }
@media (max-width: 860px) { .editor { grid-template-columns: 1fr; } }

.card-canvas {
  padding: clamp(18px, 2.6vw, 28px);
  background: color-mix(in oklch, var(--paper) 55%, transparent);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border: none;
}
.editor-toolbar {
  display: flex;
  gap: clamp(16px, 2.4vw, 28px);
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.mini { font-family: var(--font-ui); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; color: var(--ink); display: flex; align-items: center; gap: 8px; }
.mini input[type="range"] { width: 120px; }
.mini.chk { gap: 6px; }
.mini input[type="color"] { width: 30px; height: 24px; border: 1px solid var(--ink); border-radius: 6px; padding: 0; background: none; cursor: pointer; }

.editor-canvas {
  position: relative;
  height: clamp(180px, 24vw, 240px);
  border-radius: 3px;
  background:
    repeating-conic-gradient(oklch(0.9 0.006 60) 0% 25%, var(--paper) 0% 50%) 50% / 22px 22px;
  display: grid;
  place-items: center;
  overflow: hidden;
  touch-action: none;
}
.editor-canvas svg { width: 100%; height: 100%; }

.letter-gallery {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 14px 2px 4px;
  scrollbar-width: thin;
}
.letter-gallery[hidden] { display: none; }
.gal-item {
  flex: 0 0 auto;
  width: 60px;
  height: 60px;
  padding: 8px;
  background: var(--white-line);
  border: 3px solid color-mix(in oklch, var(--ink) 18%, transparent);
  border-radius: 3px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color 0.16s, background 0.16s;
}
.gal-item svg { width: 100%; height: 100%; }
.gal-item:hover { border-color: var(--salmon); }
.gal-item.is-active { border-color: var(--salmon); background: color-mix(in oklch, var(--salmon) 16%, var(--paper)); }

.editor-panel { display: flex; flex-direction: column; gap: clamp(8px, 1.2vw, 12px); }
.card-controls { padding: clamp(10px, 1.6vw, 16px); flex: 1; }
.card-dl { padding: clamp(10px, 1.4vw, 14px); display: flex; flex-direction: column; gap: 8px; }

.panel-empty { color: color-mix(in oklch, var(--ink) 55%, transparent); text-align: center; padding: 44px 6px; font-size: 13px; }

.dl-menu { position: relative; }
.dl-list {
  position: absolute;
  left: 0; right: 0;
  bottom: calc(100% + 8px);
  display: flex;
  flex-direction: column;
  background: var(--white-line);
  border: 3px solid var(--ink);
  border-radius: 3px;
  overflow: hidden;
  z-index: 20;
}
.dl-list[hidden] { display: none; }
.dl-opt {
  border: none;
  background: none;
  text-align: left;
  padding: 6px 14px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.14s, color 0.14s;
}
.dl-opt:hover { background: var(--salmon); color: var(--white-line); }

.ctrl { margin-bottom: 8px; }
.ctrl-row { display: flex; justify-content: space-between; font-family: var(--font-ui); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.02em; color: color-mix(in oklch, var(--ink) 60%, transparent); margin-bottom: 4px; }
.ctrl-row b { color: var(--salmon-ink); }
.ctrl input[type="range"] { width: 100%; }

.order-row { display: flex; gap: 8px; }
.order-row .btn { flex: 1; }

input[type="range"] { accent-color: var(--salmon); }

/* ---------- Panel ABOUT ---------- */
.about-layer { position: fixed; inset: 0; z-index: 50; }
.about-layer[hidden] { display: none; }
.about-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 12, 12, 0.6);
}
.about-panel {
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: min(420px, 92vw);
  background: color-mix(in oklch, var(--paper) 55%, transparent);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  color: var(--ink);
  border-left: 6px solid var(--salmon);
  padding: clamp(28px, 5vw, 40px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  animation: slidein 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}
.about-collab { margin-top: auto; padding-top: 24px; }
@keyframes slidein { from { transform: translateX(100%); } to { transform: translateX(0); } }
.about-panel h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(24px, 4vw, 32px);
  text-transform: uppercase;
  color: var(--salmon);
  margin: 0 0 20px;
}
.about-panel h4 {
  font-family: var(--font-block);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--salmon);
  margin: 26px 0 8px;
}
.about-panel p { font-size: 13px; line-height: 1.35; margin: 0 0 2px; }
.about-panel a { color: var(--salmon); font-weight: 700; text-decoration-thickness: 2px; }
.about-panel strong { color: var(--salmon); }
.about-prompt {
  font-style: italic;
  background: color-mix(in oklch, var(--salmon) 10%, var(--paper));
  border-radius: 3px;
  padding: 14px 16px;
  margin-top: 8px;
}
.about-close {
  position: absolute;
  top: 18px; right: 18px;
  width: 36px; height: 36px;
  border-radius: var(--radius);
  border: none;
  background: none;
  color: var(--ink);
  font-size: 32px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 0.14s, color 0.14s;
}
.about-close:hover { background: none; color: var(--salmon); }

/* ---------- Loader ---------- */
.loader {
  position: fixed; inset: 0;
  background: rgba(20, 12, 12, 0.55);
  display: grid; place-items: center;
  z-index: 100;
}
.loader[hidden] { display: none; }
.loader-card { text-align: center; }
.loader-card p { font-family: var(--font-block); font-size: 12px; color: var(--white-line); margin: 0; letter-spacing: 0.04em; text-transform: uppercase; }
.spinner {
  width: 38px; height: 38px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: var(--salmon);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .screen, .about-panel { animation-duration: 0.01ms; }
}

/* ============================================================
   MOBILE — vertical scroll, stacked header, letters in a column
   ============================================================ */
@media (max-width: 640px) {
  html, body {
    overflow-y: auto;
    overflow-x: hidden;
    height: auto;
    min-height: 100%;
  }

  main { padding-bottom: 60px; }

  /* Header: logo + about on row 1, steps below on row 2 */
  .topbar {
    justify-content: space-between;
    padding: 16px clamp(16px, 5vw, 24px);
    row-gap: 10px;
  }
  .logo-badge { order: 1; }
  .about-badge { order: 2; }
  .steps {
    order: 3;
    flex-basis: 100%;
    justify-content: center;
    gap: 16px;
  }
  .logo-badge img { width: 78px; }
  .about-badge img { width: 78px; }
  .step { font-size: 11px; }

  /* Slightly smaller type across the board */
  .screen-head h2 { font-size: clamp(24px, 8vw, 36px); }
  .screen-head p { font-size: 12px; }
  .poster-sub { font-size: clamp(13px, 4vw, 17px); }
  .hint { font-size: 11px; }
  .btn { font-size: 12px; padding: 10px 18px; }
  .btn-tiny { font-size: 10px; }
  .mini { font-size: 11px; }
  .ctrl-row { font-size: 11px; }
  .reel-label { font-size: clamp(16px, 5vw, 20px); }
  .reel-btn { font-size: 11px; }
  .dl-opt { font-size: 11px; }
  .about-panel p { font-size: 12px; }
  .about-panel h3 { font-size: clamp(20px, 6vw, 26px); }

  #screen-2.is-active,
  #screen-3.is-active { min-height: 0; }

  .hero { min-height: calc(100dvh - 110px); padding: 0; }

  .name-form { margin-top: clamp(32px, 5vw, 56px); }

  /* Letters: one column per name letter, stacked vertically */
  .reels-wrap {
    overflow-x: hidden;
    overflow-y: visible;
    padding: 6px 2px 18px;
  }
  .reels {
    flex-direction: column;
    align-items: center;
  }
  .reel-gap { display: none; }
}
