:root {
  --bg: #ecebe8; --surface: #fff; --ink: #1d1f1b; --muted: #6b6f68; --line: #dcdad5;
  --brand: #7fb35a; --brand-ink: #1f3a10; --brand-soft: #e6f1dc; --danger: #c0392b;
  --shadow: 0 8px 30px rgba(0,0,0,.18);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #17181a; --surface: #222426; --ink: #eceae4; --muted: #9a9d96; --line: #34373a; --brand-soft: #25331c; --brand-ink: #d6efc2; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; display: flex; flex-direction: column; overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .hot:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* barra superior */
.top { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: var(--surface); border-bottom: 1px solid var(--line); z-index: 20; }
.brand { white-space: nowrap; font-size: 16px; display: flex; align-items: center; gap: 10px; }
.brand .logo { height: 34px; width: auto; display: block; background: #fff; border-radius: 6px; }
.brand .btxt { display: flex; flex-direction: column; line-height: 1.15; } .brand span { color: var(--muted); font-size: 11.5px; }
@media (max-width: 760px) { .brand .btxt span { display: none; } .brand .logo { height: 28px; } }
.sections { display: flex; gap: 6px; overflow-x: auto; flex: 1; scrollbar-width: none; }
.sections button { white-space: nowrap; border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 5px 12px; font-size: 13px; }
.sections button.on { background: var(--brand-soft); border-color: var(--brand); color: var(--brand-ink); font-weight: 600; }
.search { position: relative; }
.search input { width: 230px; padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); }
.results { position: absolute; right: 0; top: 40px; width: 340px; max-height: 60vh; overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.results button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.results button:hover { background: var(--brand-soft); } .results small { color: var(--muted); display: block; }
.ghost { border: 1px solid var(--line); background: transparent; border-radius: 10px; padding: 7px 11px; }
.cart { border: 0; background: var(--brand); color: #10230a; font-weight: 700; border-radius: 10px; padding: 8px 14px; white-space: nowrap; }
.cart span { background: #10230a; color: #fff; border-radius: 999px; padding: 1px 8px; margin-left: 6px; font-size: 12px; }

/* escenario */
.stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 10px 54px 34px; }
.spread { display: flex; height: 100%; max-width: 100%; box-shadow: var(--shadow); background: #fff; }
.page { position: relative; height: 100%; aspect-ratio: var(--page-ar, 612 / 992.126); background: #fff; flex: none; }
.previewbar { background: #fff3c4; color: #5c4600; text-align: center; font-size: 13px; padding: 6px 10px; border-bottom: 1px solid #e6d58a; }
.page img { display: block; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 64px; border: 0; border-radius: 10px; background: var(--surface); box-shadow: 0 2px 8px rgba(0,0,0,.2); font-size: 28px; z-index: 5; }
.nav.prev { left: 8px; } .nav.next { right: 8px; } .nav:disabled { opacity: .3; cursor: default; }
.pager { position: absolute; bottom: 6px; left: 0; right: 0; text-align: center; color: var(--muted); font-size: 12px; pointer-events: none; }

/* zonas interactivas sobre la página */
.hot { position: absolute; border: 0; background: transparent; padding: 0; border-radius: 6px; }
.hot.swatch { border-radius: 8px; transition: background .15s, box-shadow .15s; }
.hot.swatch:hover { background: rgba(127,179,90,.22); box-shadow: 0 0 0 2px var(--brand); }
.hot.swatch.on { box-shadow: 0 0 0 2.5px var(--brand); background: rgba(127,179,90,.18); }
.hot.photo { background: transparent; }
.hot.photo:hover { background: rgba(127,179,90,.06); }
.hot.photo .tag { position: absolute; right: 10px; bottom: 10px; background: var(--brand); color: #10230a; font-weight: 700; font-size: 13px; padding: 8px 14px; border-radius: 999px; box-shadow: 0 2px 10px rgba(0,0,0,.3); opacity: .92; }
.hot.price { background: transparent; }
.hot.price:hover { background: rgba(127,179,90,.12); box-shadow: inset 0 0 0 2px var(--brand); }
.pulse::after { content: ""; position: absolute; inset: -4px; border-radius: 10px; border: 2px solid var(--brand); opacity: 0; animation: pulse 1.6s ease-out 3; pointer-events: none; }
@keyframes pulse { from { opacity: .9; transform: scale(1); } to { opacity: 0; transform: scale(1.35); } }

/* panel de producto */
.panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); background: var(--surface); box-shadow: var(--shadow); z-index: 40; display: flex; flex-direction: column; }
.panel header, .drawer header { padding: 14px 16px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.panel h2, .drawer h2 { margin: 0; font-size: 18px; } .panel .sub { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.x { margin-left: auto; border: 0; background: none; font-size: 24px; line-height: 1; padding: 0 4px; color: var(--muted); }
.body { padding: 14px 16px; overflow: auto; flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 4px 10px 4px 5px; font-size: 12.5px; }
.chip i { width: 20px; height: 20px; border-radius: 50%; border: 1px solid rgba(0,0,0,.25); display: inline-block; }
.chip.on { border-color: var(--brand); background: var(--brand-soft); font-weight: 600; }
.sizes { width: 100%; border-collapse: collapse; }
.sizes th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 500; padding: 4px 0; }
.sizes td { padding: 6px 0; border-top: 1px solid var(--line); vertical-align: middle; }
.sizes .price { font-variant-numeric: tabular-nums; }
.sizes .pl { font-size: 13px; color: var(--muted); padding: 1px 7px; margin: 1px 0; border-radius: 6px; width: fit-content; }
.sizes .pl.on { background: var(--brand-soft); color: var(--brand-ink); font-weight: 700; box-shadow: inset 0 0 0 1px var(--brand); }
.sizes .pl.on::before { content: "✓ "; }
.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.qty button { border: 0; background: var(--bg); width: 34px; height: 34px; font-size: 18px; }
.qty input { width: 48px; height: 34px; border: 0; text-align: center; background: var(--surface); color: var(--ink); font-size: 15px; -moz-appearance: textfield; }
.qty input::-webkit-inner-spin-button { display: none; }
.foot { border-top: 1px solid var(--line); padding: 12px 16px; background: var(--surface); }
.foot .row { display: flex; justify-content: space-between; margin-bottom: 8px; }
.primary { width: 100%; border: 0; background: var(--brand); color: #10230a; font-weight: 700; padding: 12px; border-radius: 12px; font-size: 15px; }
.primary:disabled { opacity: .45; cursor: not-allowed; }
.secondary { border: 1px solid var(--line); background: transparent; border-radius: 12px; padding: 10px 14px; }
.tier { background: var(--brand-soft); color: var(--brand-ink); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; margin-bottom: 12px; }
.note { color: var(--muted); font-size: 12px; margin-top: 10px; }

/* carrito */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); background: var(--surface); box-shadow: var(--shadow); z-index: 50; display: flex; flex-direction: column; }
.line { display: grid; grid-template-columns: 22px 1fr auto; gap: 4px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); align-items: center; }
.line i { width: 20px; height: 20px; border-radius: 50%; border: 1px solid rgba(0,0,0,.25); }
.line .t small { color: var(--muted); display: block; }
.line .amt { text-align: right; font-variant-numeric: tabular-nums; }
.line .qty { grid-column: 2; justify-self: start; } .line .rm { grid-column: 3; justify-self: end; border: 0; background: none; color: var(--danger); font-size: 12.5px; }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.tot { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; } .tot.big { font-size: 17px; font-weight: 700; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 14px; }
.sheet { background: var(--surface); border-radius: 16px; width: min(560px, 100%); max-height: 94vh; overflow: auto; padding: 18px; box-shadow: var(--shadow); }
.sheet h2 { margin: 0 0 4px; } .form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.form label { display: flex; flex-direction: column; font-size: 12.5px; color: var(--muted); gap: 3px; } .form .full { grid-column: 1 / -1; }
.form input, .form textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; }
.form input:invalid:not(:placeholder-shown) { border-color: var(--danger); }
.err { color: var(--danger); font-size: 13px; }
.ok-box { text-align: center; padding: 14px 4px; } .folio { font-size: 24px; font-weight: 800; letter-spacing: .5px; margin: 6px 0; }

/* mosaico */
.grid { position: fixed; inset: 53px 0 0 0; background: var(--bg); z-index: 30; overflow: auto; padding: 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 12px; align-content: start; }
.grid button { border: 2px solid transparent; background: #fff; padding: 0; border-radius: 6px; overflow: hidden; position: relative; }
.grid button:hover { border-color: var(--brand); } .grid img { width: 100%; display: block; aspect-ratio: var(--page-ar, 612 / 992); object-fit: cover; }
.grid span { position: absolute; left: 0; bottom: 0; background: rgba(0,0,0,.65); color: #fff; font-size: 11px; padding: 1px 6px; }

/* recorrido guiado */
.tour { position: fixed; inset: 0; z-index: 90; }
.tour.center { background: rgba(0,0,0,.6); }
.tour-hole { position: fixed; border-radius: 14px; border: 2px dashed #fff; box-shadow: 0 0 0 100vmax rgba(0,0,0,.62); pointer-events: none; transition: left .25s, top .25s, width .25s, height .25s; }
.tour-bubble { position: fixed; background: #fff; color: #1d1f1b; border-radius: 14px; padding: 14px 16px 12px; box-shadow: 0 10px 40px rgba(0,0,0,.4); font-size: 15px; line-height: 1.4; }
.tour.center .tour-bubble { transform: translate(-50%, -50%); }
.tour-bubble h3 { margin: 0 0 4px; font-size: 17px; } .tour-bubble p { margin: 0; }
.tour-bubble::after { content: ""; position: absolute; left: var(--ax, 50%); width: 16px; height: 16px; background: #fff; transform: translateX(-50%) rotate(45deg); display: none; }
.tour-bubble.up::after { display: block; top: -7px; } .tour-bubble.down::after { display: block; bottom: -7px; }
.tour-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; } .tour-actions .count { margin-left: auto; margin-right: auto; font-size: 12px; color: #6b6f68; }
.tour-actions .link { border: 0; background: none; padding: 4px 2px; font-weight: 700; color: #6b3fb0; text-decoration: underline; font-size: 15px; }
.tour-actions .link.muted { color: #6b6f68; font-weight: 500; font-size: 13.5px; text-decoration: none; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #10230a; color: #fff; padding: 10px 16px; border-radius: 999px; z-index: 80; box-shadow: var(--shadow); }

@media (max-width: 760px) {
  .top { flex-wrap: wrap; gap: 8px; } .sections { order: 5; flex-basis: 100%; } .search { flex: 1; } .search input { width: 100%; } .results { width: calc(100vw - 28px); }
  .stage { padding: 6px 6px 28px; } .nav { width: 32px; height: 52px; } .nav.prev { left: 2px; } .nav.next { right: 2px; }
  .panel { top: auto; height: 78vh; width: 100vw; border-radius: 18px 18px 0 0; }
  .form { grid-template-columns: 1fr; } .grid { inset: 96px 0 0 0; }
}
