:root {
  --green: #1f6b3a; --green-d: #154d29; --green-l: #e8f3ec; --ink: #1c2a21; --muted: #5c6b61;
  --line: #d9e3dc; --bg: #f6faf7; --card: #fff; --warn: #b3261e; --radius: 14px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink); background: var(--bg); padding-bottom: env(safe-area-inset-bottom);
}
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; padding-top: calc(12px + env(safe-area-inset-top)); background: var(--green); color: #fff;
}
.brand { font-weight: 700; font-size: 1.05rem; }
#app { max-width: 760px; margin: 0 auto; padding: 16px; }
.hero h1 { margin: 8px 0 4px; font-size: 1.6rem; line-height: 1.2; }
.hero p { margin: 0 0 16px; color: var(--muted); }
.hero.compact { margin-bottom: 8px; }

.space {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(0,0,0,.04);
}
.space-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.space-head h2 { margin: 0; font-size: 1.1rem; }
.link { background: none; border: 0; color: var(--warn); font: inherit; cursor: pointer; padding: 4px; }
label.lbl { display: block; font-weight: 600; margin: 14px 0 6px; font-size: .95rem; }
.hint { font-weight: 400; color: var(--muted); font-size: .85rem; }

.types { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.type {
  border: 2px solid var(--line); border-radius: 12px; padding: 10px; background: #fff; text-align: left;
  font: inherit; cursor: pointer; min-height: 64px; color: var(--ink);
}
.type b { display: block; font-size: .95rem; }
.type span { font-size: .8rem; color: var(--muted); }
.type[aria-pressed="true"] { border-color: var(--green); background: var(--green-l); }

.dims { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
input[type=number] {
  width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff;
}
input[type=number]:focus, button:focus-visible { outline: 3px solid #8fd0a5; outline-offset: 1px; }
.money { position: relative; }
.money::before { content: "$"; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.money input { padding-left: 26px; }
.money::after { content: "MXN"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: .8rem; }

.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot {
  position: relative; aspect-ratio: 1; border: 2px dashed #9dbba8; border-radius: 12px; background: var(--green-l);
  display: flex; align-items: center; justify-content: center; text-align: center; color: var(--green-d);
  font-size: .8rem; cursor: pointer; overflow: hidden; padding: 4px;
}
.slot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slot input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.slot .x {
  position: absolute; top: 4px; right: 4px; z-index: 2; width: 26px; height: 26px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.65); color: #fff; font-size: 16px; line-height: 1; cursor: pointer;
}

button { font: inherit; }
.primary {
  display: block; width: 100%; margin-top: 14px; padding: 16px; border: 0; border-radius: 12px; cursor: pointer;
  background: var(--green); color: #fff; font-weight: 700; font-size: 1.05rem;
}
.primary:hover { background: var(--green-d); }
.primary:disabled { opacity: .6; cursor: wait; }
.ghost {
  display: block; width: 100%; padding: 13px; border: 2px solid var(--green); border-radius: 12px; background: transparent;
  color: var(--green); font-weight: 600; cursor: pointer;
}
.ghost.small { width: auto; padding: 6px 12px; border-color: #fff; color: #fff; font-size: .85rem; }
.error { color: var(--warn); font-weight: 600; margin-top: 12px; }

.bar { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
#barFill { height: 100%; width: 0; background: var(--green); transition: width .4s; }

.result { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 14px 0; }
.result h2 { margin: 0 0 2px; font-size: 1.1rem; }
.result .sub { color: var(--muted); margin: 0 0 12px; font-size: .9rem; }
.gallery { display: grid; gap: 10px; }
.shot { position: relative; border-radius: 12px; overflow: hidden; background: #e6ece8; min-height: 140px; }
.shot img { display: block; width: 100%; height: auto; }
.shot .ph { padding: 36px 12px; text-align: center; color: var(--muted); }
.shot .tag {
  position: absolute; left: 8px; bottom: 8px; background: rgba(0,0,0,.65); color: #fff; padding: 2px 8px;
  border-radius: 99px; font-size: .75rem;
}
.shot .save {
  position: absolute; right: 8px; bottom: 8px; background: rgba(255,255,255,.92); color: var(--ink); padding: 4px 10px;
  border-radius: 99px; font-size: .8rem; text-decoration: none;
}
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: sp 1s linear infinite; margin: 0 auto 8px; }
@keyframes sp { to { transform: rotate(360deg); } }
.product { display: flex; gap: 12px; align-items: center; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.product img { width: 72px; height: 72px; object-fit: contain; border-radius: 10px; background: #fff; border: 1px solid var(--line); }
.product .info { flex: 1; min-width: 0; }
.product .name { font-weight: 600; }
.product .price { color: var(--green-d); font-weight: 700; font-size: 1.15rem; }
.buy {
  display: inline-block; margin-top: 6px; padding: 12px 20px; border-radius: 12px; background: var(--green); color: #fff;
  text-decoration: none; font-weight: 700;
}
.buy:hover { background: var(--green-d); }
.more { display: block; margin-top: 8px; font-size: .85rem; color: var(--green); text-decoration: underline; }
.alts { margin-top: 12px; }
.alts button {
  margin: 4px 6px 0 0; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--green); background: #fff;
  color: var(--green-d); font-size: .85rem; cursor: pointer;
}
.notice { background: #fff6e5; border: 1px solid #f0d49a; border-radius: 12px; padding: 12px; color: #6a4b00; }
.slot.empty { cursor: default; border-style: solid; border-color: var(--line); background: #f1f5f2; color: #9aa9a0; font-size: 1.2rem; }
.pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.pick .ghost { padding: 12px 6px; font-size: .9rem; }
.ghost:disabled { opacity: .45; cursor: default; }
.option { border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-top: 14px; background: #fcfefc; }
.option .kind { font-weight: 700; color: var(--green-d); margin-bottom: 8px; }
.option .product { margin-top: 12px; padding-top: 12px; }
.tabs { display: flex; gap: 6px; margin-top: 8px; }
.tabs button { padding: 5px 12px; border-radius: 99px; border: 1px solid var(--green); background: #fff; color: var(--green-d); font-size: .85rem; cursor: pointer; }
.tabs button[aria-pressed="true"] { background: var(--green); color: #fff; }
.actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.actions .more { margin-top: 6px; }
.quote { display: inline-block; padding: 12px 20px; border-radius: 12px; border: 2px solid var(--green); color: var(--green-d); font-weight: 700; text-decoration: none; background: #fff; }
.quote-box { margin-top: 16px; padding: 14px; border-radius: 12px; background: var(--green-l); text-align: center; }
.quote-box:empty { display: none; }
.quote-box p, .quote-box span { display: block; margin: 0 0 10px; font-weight: 600; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 18px 16px 28px; }
#restart { margin: 18px 0; }

@media (min-width: 640px) {
  .types { grid-template-columns: repeat(4, 1fr); }
  .photos { max-width: 420px; }
}

.diagram { max-width: 300px; margin: 4px auto 10px; }
.diagram svg { display: block; width: 100%; height: auto; }
.diagram .floor { fill: var(--green-l); stroke: #9dbba8; stroke-width: 1.5; }
.diagram .edge, .diagram .hid { fill: none; stroke: #6f8a78; stroke-width: 2; stroke-linejoin: round; }
.diagram .hid { stroke-dasharray: 4 4; stroke-width: 1.5; opacity: .7; }
.diagram .dm path { fill: none; stroke: #8a9a90; stroke-width: 2; stroke-linecap: round; }
.diagram .dm text { font: 700 11px system-ui, sans-serif; letter-spacing: .06em; fill: #8a9a90; }
.diagram .dm.on path { stroke: var(--green); }
.diagram .dm.on text { fill: var(--green); }
.dimsline { font: .8rem ui-monospace, monospace; color: var(--muted); }
.total { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); font-weight: 700; color: var(--green-d); text-align: right; }

.tips { margin: 10px 0 4px; border: 1px solid var(--line); border-radius: 12px; background: var(--green-l); }
.tips summary { padding: 11px 14px; font-weight: 600; font-size: .92rem; cursor: pointer; color: var(--green-d); }
.tips-body { display: grid; grid-template-columns: minmax(0, 190px) 1fr; gap: 12px; align-items: center; padding: 4px 14px 14px; }
.tips-body svg { width: 100%; height: auto; }
.tips-body ul { margin: 0; padding-left: 1.1rem; font-size: .88rem; display: grid; gap: 4px; }
.tips-body .room { fill: #fff; stroke: #9dbba8; stroke-width: 2; }
.tips-body .spot { fill: #bfe3cb; stroke: var(--green); stroke-width: 1.5; stroke-dasharray: 4 3; }
.tips-body .cone { fill: rgba(31,107,58,.18); stroke: var(--green); stroke-width: 1.2; }
.tips-body .cam { fill: var(--green); }
.tips-body .t { font: 700 9px system-ui, sans-serif; fill: var(--green-d); letter-spacing: .04em; }
@media (max-width: 420px) { .tips-body { grid-template-columns: 1fr; } .tips-body svg { max-width: 220px; margin: 0 auto; } }

.type { position: relative; }
.type[aria-pressed="true"]::after { content: "✓"; position: absolute; top: 8px; right: 10px; font-weight: 800; color: var(--green); }
.shot .dl { display: block; width: 100%; padding: 12px; border: 0; border-top: 1px solid var(--line); background: var(--green); color: #fff; font-weight: 700; font-size: .95rem; cursor: pointer; }
.shot .dl:hover { background: var(--green-d); }

.aviso { margin: 4px 0 12px; padding: 12px 14px; border-radius: 12px; background: #fff8e6; border: 1px solid #f0d49a; font-size: .9rem; color: #5b4300; }
.aviso p { margin: 0 0 10px; }
.indoor { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.indoor input { width: 22px; height: 22px; flex: none; accent-color: var(--green); }
.type:disabled { opacity: .4; cursor: not-allowed; }

.dims { grid-template-columns: 1fr 1fr; }
.diagram .plan { font: 600 9px system-ui, sans-serif; letter-spacing: .06em; fill: #7d8f84; }

/* Recuadros de foto: botones que se marcan al tocarlos */
button.slot { padding: 0; font: inherit; font-size: 1.5rem; font-weight: 600; color: var(--green-d); -webkit-appearance: none; appearance: none; }
.slot.empty { cursor: pointer; border-style: dashed; border-color: #9dbba8; background: var(--green-l); color: var(--green-d); }
.slot.active { background: var(--green); border: 2px solid var(--green-d); color: #fff; }
.slot:not(.empty).active { box-shadow: 0 0 0 3px var(--green); }
.slot .x { display: flex; align-items: center; justify-content: center; cursor: pointer; }
.chooser { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; padding: 12px; border: 2px solid var(--green); border-radius: 12px; background: #fff; }
.chooser .hint { grid-column: 1 / -1; margin: 0; font-weight: 600; color: var(--green-d); }
.chooser .ghost { padding: 14px 6px; font-size: .92rem; }
.slot:not(.empty) { border-style: solid; border-color: var(--green-d); }

/* Recuadros de tipo: imagen de fondo con el nombre encima (las imágenes van en public/img/) */
.types .type { display: flex; align-items: flex-end; min-height: 0; aspect-ratio: 4 / 3; padding: 0; overflow: hidden; border: 3px solid transparent; color: #fff;
  background: #2f4a3a center / cover no-repeat; }
.types .type::before { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(8,20,12,.78) 0%, rgba(8,20,12,.12) 62%); }
.types .type .tt { position: relative; z-index: 1; display: block; padding: 10px 12px; font-size: 1rem; font-weight: 800; line-height: 1.2; color: #fff; text-align: left; text-shadow: 0 1px 3px rgba(0,0,0,.5); }
.types .t-torre { background-image: url(img/torre.jpg); }
.types .t-nft   { background-image: url(img/nft.jpg); }
.types .t-cama  { background-image: url(img/cama.jpg); }
.types .t-mesa  { background-image: url(img/mesa.jpg); }
.types .type[aria-pressed="true"] { border-color: var(--green); background-color: var(--green); }
.types .type[aria-pressed="true"]::before { background: linear-gradient(to top, rgba(21,77,41,.9) 0%, rgba(31,107,58,.28) 70%); }
.types .type[aria-pressed="true"]::after { content: "✓"; top: 8px; right: 8px; z-index: 2; display: flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%; background: var(--green); color: #fff; font-size: 1rem; }
.types .type:disabled { filter: grayscale(1); }

/* Aviso de exteriores / interior: compacto, debajo de las medidas */
.aviso { margin: 12px 0 2px; padding: 7px 10px; font-size: .72rem; line-height: 1.35; }
.aviso p { margin: 0 0 6px; }
.indoor { gap: 8px; font-weight: 500; }
.indoor input { width: 16px; height: 16px; }

/* ===== Pasos del formulario ===== */
.paso { margin-top: 20px; }
.paso-cab { display: flex; gap: 10px; align-items: flex-start; }
.paso-cab h3 { margin: 3px 0 0; font-size: 1.02rem; line-height: 1.25; font-weight: 800; }
.paso-cab h3 .hint { font-weight: 400; }
.paso-cab .num { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--green); color: #fff; font-weight: 800; font-size: .95rem; }
.paso-cab .pill { display: none; }
.paso-body { margin-top: 4px; }
.paso-body > .lbl:first-child { margin-top: 10px; }
.hero h1 { font-size: 1.7rem; }

/* Pasos en línea de tiempo: círculos numerados unidos por una línea vertical */
.paso { margin-left: 13px; padding-left: 24px; border-left: 2px solid #bcd3c3; padding-bottom: 6px; }
.paso:last-child { border-left-color: transparent; }
.paso-cab { margin-left: -39px; }
.paso-body { margin-top: 6px; }
.paso-cab .pill { display: none; }

/* Título: dos renglones centrados, mayúsculas, muy bold, misma tipografía del encabezado */
.hero h1.titulo { margin: 6px 0 16px; text-align: center; text-transform: uppercase; font-weight: 900; font-size: 1.55rem; line-height: 1.12; letter-spacing: .015em; }
.hero h1.titulo span { display: block; }

/* Casilla de palomita siempre visible en los recuadros de tipo (vacía = sin elegir; verde con ✓ = elegido) */
.types .type::after { content: ""; position: absolute; top: 8px; right: 8px; z-index: 2; display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border-radius: 7px; background: rgba(255, 255, 255, .92); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
  color: #fff; font-size: 1rem; font-weight: 800; }
.types .type[aria-pressed="true"]::after { content: "✓"; background: var(--green); border-color: #fff; border-radius: 7px; }
.types .type:disabled::after { display: none; }

/* Más aire entre el recuadro amarillo y las fotos */
.aviso { margin: 12px 0 18px; }

/* Imágenes más claras: degradado suave solo en la franja del texto; casilla más chica y pegada a la esquina */
.types .type::before { background: linear-gradient(to top, rgba(8, 20, 12, .62) 0%, rgba(8, 20, 12, 0) 42%); }
.types .type[aria-pressed="true"]::before { background: linear-gradient(to top, rgba(21, 77, 41, .72) 0%, rgba(21, 77, 41, 0) 42%); }
.types .type .tt { text-shadow: 0 1px 4px rgba(0, 0, 0, .75), 0 0 2px rgba(0, 0, 0, .6); }
.types .type::after { top: 5px; right: 5px; width: 19px; height: 19px; border-radius: 5px; border-width: 1.5px; font-size: .75rem; }
.types .type[aria-pressed="true"]::after { border-radius: 5px; }

.hero h1.titulo .titulo-img { display: block; width: 100%; height: auto; margin: 0 auto; mix-blend-mode: multiply; }
/* La imagen del título se funde con el fondo: bordes difuminados (sin marco visible) */
.hero h1.titulo .titulo-img {
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 7%, #000 93%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 9%, #000 91%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent 0, #000 7%, #000 93%, transparent 100%), linear-gradient(to bottom, transparent 0, #000 9%, #000 91%, transparent 100%);
  mask-composite: intersect;
}

/* "Cómo tomar la foto": amarillo, para que se note */
.tips { background: #fff3c2; border: 1.5px solid #ecd069; }
.tips summary { color: #5b4300; }
.tips-body ul, .tips-body li { color: #4d3b00; }

/* Plano del piso: beige suave */
.diagram .floor { fill: #f3ead7; stroke: #d6c4a0; }
.diagram .plan { fill: #9a875f; }

/* "Cómo tomar la foto": exactamente el mismo amarillo del aviso de exteriores */
.tips { background: #fff8e6; border: 1px solid #f0d49a; }
.tips summary { color: #5b4300; }
.tips-body ul, .tips-body li { color: #5b4300; }

/* Plano del piso: vuelve al verde de los recuadros de fotos y aprovecha todo el ancho */
.diagram { max-width: 340px; margin: 6px auto 8px; }
.diagram .floor { fill: var(--green-l); stroke: #9dbba8; stroke-width: 1.5; }
.diagram .plan { fill: #7d8f84; font-size: 10px; }
.diagram .dm text { font-size: 12px; }

/* El atributo hidden debe ganar siempre (el botón de instalar se veía aunque estuviera oculto) */
[hidden] { display: none !important; }

/* Hoja de ayuda para instalar la app */
.sheet-bg { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-end; background: rgba(8, 20, 12, .5); }
.sheet { width: 100%; max-width: 520px; margin: 0 auto; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; background: #fff; }
.sheet h2 { margin: 0 0 8px; font-size: 1.15rem; }
.sheet ol { margin: 10px 0 4px; padding-left: 1.3rem; display: grid; gap: 8px; }
.sheet .primary { margin-top: 14px; }
