:root {
  --brand: #d97706;
  --bg: #000;
  --fg: #fff;
  --muted: rgba(255, 255, 255, .65);
  --panel: #121212;
  --line: rgba(255, 255, 255, .12);
  --bar: 58px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; background: #0b0b0b; color: var(--fg); font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* En escritorio, el "teléfono" va centrado */
#app { position: relative; height: 100dvh; max-width: 480px; margin: 0 auto; overflow: hidden; background: var(--bg); }

/* ---------- Feed ---------- */
#feed {
  height: 100%; overflow-y: scroll; scroll-snap-type: y mandatory; overscroll-behavior: contain;
  scrollbar-width: none; outline: none;
}
#feed::-webkit-scrollbar { display: none; }
.slide { position: relative; height: 100dvh; scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden; background: #111; }
.slide video, .slide .poster, .slide .noimg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.slide .poster { transition: opacity .25s; }
.slide.playing .poster { opacity: 0; }
.slide .noimg { display: grid; place-items: center; font-size: 96px; background: radial-gradient(circle at 50% 40%, #3b2a12, #0d0d0d); }
.slide::after { content: ""; position: absolute; inset: auto 0 0 0; height: 55%; background: linear-gradient(transparent, rgba(0, 0, 0, .78)); pointer-events: none; }

.info { position: absolute; left: 14px; right: 84px; bottom: calc(var(--bar) + 18px); z-index: 2; text-shadow: 0 1px 8px rgba(0, 0, 0, .6); }
.info .cat { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .04em; padding: 2px 9px; border-radius: 99px; background: rgba(217, 119, 6, .9); margin-bottom: 8px; }
.info h2 { font-size: 22px; line-height: 1.15; }
.info .price { font-size: 20px; font-weight: 800; margin: 4px 0; }
.info .price s { font-size: 14px; font-weight: 500; opacity: .7; margin-left: 6px; }
.info p { font-size: 14px; color: rgba(255, 255, 255, .9); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.info .more { margin-top: 6px; font-size: 13px; font-weight: 700; text-decoration: underline; }

.rail { position: absolute; right: 8px; bottom: calc(var(--bar) + 24px); z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.rail button { display: grid; justify-items: center; gap: 2px; font-size: 12px; font-weight: 600; text-shadow: 0 1px 6px rgba(0, 0, 0, .7); }
.rail .ic { width: 46px; height: 46px; border-radius: 50%; background: rgba(0, 0, 0, .38); backdrop-filter: blur(6px); display: grid; place-items: center; }
.rail svg { width: 26px; height: 26px; fill: #fff; transition: transform .15s; }
.rail .like.on svg { fill: #ff2d55; animation: pop .35s; }
.rail .order .ic { background: var(--brand); }
@keyframes pop { 40% { transform: scale(1.35); } }

.heart-burst { position: absolute; z-index: 3; width: 110px; height: 110px; margin: -55px 0 0 -55px; fill: #ff2d55; pointer-events: none; animation: burst .8s forwards; }
@keyframes burst { 0% { transform: scale(.3); opacity: 0; } 25% { transform: scale(1.1); opacity: 1; } 100% { transform: scale(1.4) translateY(-30px); opacity: 0; } }

/* ---------- Barra superior y inferior ---------- */
#topbar { position: absolute; top: 0; left: 0; right: 0; z-index: 10; padding: calc(env(safe-area-inset-top) + 8px) 0 24px; background: linear-gradient(rgba(0, 0, 0, .55), transparent); pointer-events: none; }
#tabs { display: flex; gap: 6px; overflow-x: auto; padding: 0 12px; scrollbar-width: none; pointer-events: auto; }
#tabs::-webkit-scrollbar { display: none; }
#tabs button, .chips button { flex: none; padding: 6px 14px; border-radius: 99px; font-weight: 600; font-size: 14px; color: rgba(255, 255, 255, .75); text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
#tabs button.on { color: #fff; background: rgba(255, 255, 255, .18); box-shadow: inset 0 -2px 0 var(--brand); }

#bottombar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 10; height: calc(var(--bar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); display: flex; background: rgba(0, 0, 0, .9); border-top: 1px solid var(--line); }
#bottombar button { flex: 1; font-weight: 700; color: var(--muted); }
#bottombar button.on { color: #fff; box-shadow: inset 0 2px 0 var(--brand); }

#bottombar .badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; margin-left: 5px; padding: 0 5px; border-radius: 9px; background: var(--brand); color: #fff; font-size: 12px; font-weight: 800; vertical-align: 1px; }

/* ---------- Vistas (menú y perfil) ---------- */
.view { position: absolute; inset: 0 0 calc(var(--bar) + env(safe-area-inset-bottom)); z-index: 5; overflow-y: auto; padding: calc(env(safe-area-inset-top) + 14px) 12px 24px; background: var(--bg); }
.view h2 { font-size: 22px; margin-bottom: 10px; }
.view h3 { margin: 18px 0 10px; font-size: 16px; }
.chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 10px; scrollbar-width: none; }
.chips button { background: #1c1c1c; }
.chips button.on { background: var(--brand); color: #fff; }

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.tile { position: relative; aspect-ratio: 9 / 16; overflow: hidden; background: #181818; border-radius: 4px; text-align: left; }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile .noimg { height: 100%; display: grid; place-items: center; font-size: 40px; }
.tile .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 6px 6px; font-size: 12px; font-weight: 700; line-height: 1.2; background: linear-gradient(transparent, rgba(0, 0, 0, .85)); }
.tile .cap small { display: block; color: #ffc470; font-size: 12px; }
.empty { grid-column: 1 / -1; padding: 24px; text-align: center; color: var(--muted); }

.profile-head { text-align: center; display: grid; justify-items: center; gap: 4px; }
.profile-head img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; border: 3px solid var(--brand); }
.profile-head h2 { margin: 6px 0 0; }
#p-handle { color: var(--muted); }
#p-bio { font-weight: 600; }
.stats { display: flex; gap: 28px; margin: 10px 0; }
.stats div { display: grid; }
.stats b { font-size: 18px; }
.stats span, .muted { color: var(--muted); font-size: 13px; }
.profile-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.btn { padding: 9px 16px; border-radius: 8px; background: #262626; font-weight: 700; font-size: 14px; border: 0; }
.btn.primary { background: var(--brand); }
.btn.block { display: block; width: 100%; text-align: center; padding: 13px; font-size: 16px; }

/* ---------- Hoja inferior ---------- */
.sheet { position: absolute; inset: 0; z-index: 30; display: flex; align-items: flex-end; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); }
.sheet-body { position: relative; width: 100%; max-height: 86dvh; overflow-y: auto; background: var(--panel); border-radius: 18px 18px 0 0; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); animation: up .22s ease-out; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-x { position: absolute; top: 8px; right: 12px; font-size: 30px; line-height: 1; color: var(--muted); }
.sheet h3 { font-size: 20px; margin: 0 28px 4px 0; }
.sheet .desc { color: var(--muted); margin-bottom: 10px; }
.group { margin: 14px 0; }
.group h4 { font-size: 14px; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.opt { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.opt input { width: 20px; height: 20px; accent-color: var(--brand); }
.opt span:nth-child(2) { flex: 1; }
.qty { display: flex; align-items: center; justify-content: center; gap: 18px; margin: 14px 0; }
.qty button { width: 40px; height: 40px; border-radius: 50%; background: #262626; font-size: 22px; font-weight: 700; }
.qty b { min-width: 24px; text-align: center; font-size: 18px; }
.line { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.line small { display: block; color: var(--muted); }
.line .rm { color: #ff6b6b; font-size: 13px; }
.total { display: flex; justify-content: space-between; font-size: 18px; font-weight: 800; margin: 14px 0; }

#toast { position: absolute; z-index: 40; left: 50%; bottom: calc(var(--bar) + 20px); transform: translate(-50%, 20px); background: #fff; color: #000; padding: 9px 16px; border-radius: 99px; font-weight: 600; font-size: 14px; opacity: 0; pointer-events: none; transition: .25s; white-space: nowrap; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 481px) {
  #app { box-shadow: 0 0 0 1px #222, 0 20px 80px rgba(0, 0, 0, .8); }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  #feed { scroll-behavior: auto; }
}
