:root {
  --bg: #04060c;
  --panel: rgba(12, 15, 26, 0.86);
  --panel-solid: #0c0f1a;
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #eef1f8;
  --muted: #8b93a7;
  --accent: #7c5cff;
  --accent-2: #ff3d8b;
  --ok: #27d3a2;
  --warn: #ffb547;
  --danger: #ff5a6a;
  --radius: 14px;
  --panel-w: 420px;
  font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  color: var(--text);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); }
button { font: inherit; color: inherit; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#scene.pov { cursor: grab; }
#scene.grabbing { cursor: grabbing; }
#labels { position: fixed; inset: 0; pointer-events: none; }
#vignette {
  position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity 1.2s;
  background: radial-gradient(ellipse at 40% 45%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}
body:has(#panel[data-mode="pov"]) #vignette,
body:has(#panel[data-mode="checkout"]) #vignette,
body:has(#panel[data-mode="done"]) #vignette { opacity: 1; }

/* ─────────── Top bar */
.topbar {
  position: fixed; top: 0; left: 0; right: calc(var(--panel-w) + 24px);
  display: flex; align-items: center; gap: 28px; padding: 18px 24px;
  background: linear-gradient(180deg, rgba(4, 6, 12, 0.85), rgba(4, 6, 12, 0));
  pointer-events: none; z-index: 5;
}
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: baseline; gap: 8px; }
.logo { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 22px; letter-spacing: -0.02em; }
.logo i { color: var(--accent-2); font-style: normal; }
.logo.big { font-size: 40px; }
.brand-sub { font-size: 11px; text-transform: uppercase; letter-spacing: 0.2em; color: var(--muted); }
.event { border-left: 1px solid var(--line-2); padding-left: 24px; min-width: 0; }
.event-title { font-family: 'Space Grotesk', sans-serif; font-weight: 700; font-size: 17px; text-transform: uppercase; letter-spacing: 0.04em; }
.event-meta { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.step { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.step .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; border: 1px solid var(--line-2); font-size: 11px; font-weight: 600; }
.step.active { color: var(--text); }
.step.active .dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.25); }
.step.done .dot { background: rgba(39, 211, 162, 0.15); border-color: var(--ok); color: var(--ok); }
.stepper .sep { width: 18px; height: 1px; background: var(--line-2); }

/* ─────────── Panel */
#panel {
  position: fixed; top: 16px; right: 16px; bottom: 16px; width: var(--panel-w);
  background: var(--panel); backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid var(--line); border-radius: 20px; overflow-y: auto; z-index: 6;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
  scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.15) transparent;
}
#panel:empty { display: none; }
.panel-inner { padding: 22px 22px 26px; display: flex; flex-direction: column; gap: 14px; animation: fadeUp 0.35s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.panel-head h2 { font-family: 'Space Grotesk', sans-serif; font-size: 24px; line-height: 1.15; margin: 4px 0 6px; letter-spacing: -0.01em; display: flex; align-items: center; gap: 10px; }
.panel-head p { margin: 0; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--accent); font-weight: 600; }
.eyebrow.row { display: flex; justify-content: space-between; align-items: center; }
.muted { color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.small { font-size: 12px; }
.center { text-align: center; }
.foot { margin: 4px 0 0; }
.credit { font-size: 11px; opacity: 0.7; }
.credit a { color: inherit; }

.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; box-shadow: 0 0 10px currentColor; }
.swatch.lg { width: 14px; height: 14px; border-radius: 4px; }

.qty { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,0.02); }
.qty-label { font-weight: 600; font-size: 14px; }
.qty-ctl { display: flex; align-items: center; gap: 12px; }
.qty-ctl span { min-width: 18px; text-align: center; font-weight: 700; font-size: 18px; font-family: 'Space Grotesk'; }
.qty-ctl button { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(255,255,255,0.04); cursor: pointer; font-size: 18px; }
.qty-ctl button:hover:not(:disabled) { background: rgba(255,255,255,0.1); }
.qty-ctl button:disabled { opacity: 0.35; cursor: default; }

.cat-list { display: flex; flex-direction: column; gap: 8px; }
.cat { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255,255,255,0.02); overflow: hidden; transition: border-color 0.2s; }
.cat:hover, .cat.open { border-color: var(--line-2); }
.cat-row { width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: none; border: 0; cursor: pointer; text-align: left; }
.cat-row .swatch { align-self: flex-start; margin-top: 4px; }
.cat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.cat-name { font-weight: 600; font-size: 14px; }
.cat-sub { font-size: 12px; color: var(--muted); }
.cat-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.price { font-family: 'Space Grotesk'; font-weight: 700; font-size: 15px; white-space: nowrap; }
.chev { color: var(--muted); width: 14px; text-align: center; font-size: 16px; }
.tag { font-size: 11px; color: var(--muted); white-space: nowrap; }
.tag.low { color: var(--warn); font-weight: 600; }
.tag.sold { color: var(--danger); font-weight: 600; }
.avail { margin-top: 4px; }
.avail-bar { height: 4px; border-radius: 3px; background: rgba(255,255,255,0.07); overflow: hidden; }
.avail-bar span { display: block; height: 100%; border-radius: 3px; opacity: 0.9; }

.sec-list { border-top: 1px solid var(--line); padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.sec-row { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; background: none; border: 0; cursor: pointer; text-align: left; }
.sec-row:hover { background: rgba(255,255,255,0.05); }
.sec-num { font-family: 'Space Grotesk'; font-weight: 700; font-size: 14px; width: 34px; height: 30px; display: grid; place-items: center; border-radius: 8px; background: rgba(255,255,255,0.06); }
.sec-main { flex: 1; min-width: 0; font-size: 12.5px; color: #c9cfdd; }
.sec-side { text-align: right; }

.back { align-self: flex-start; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; font-size: 13px; }
.back:hover { color: var(--text); }

.stats, .metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stats > div, .metrics > div { padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,0.04); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.k { font-size: 11px; color: var(--muted); }
.v { font-family: 'Space Grotesk'; font-weight: 700; font-size: 16px; }
.v small { font-size: 11px; color: var(--muted); font-weight: 500; }

.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.legend i.sold { background: #2a2e3a; }
.legend i.mine { background: #fff; box-shadow: 0 0 8px #fff; }

.pick-hint { font-size: 13px; padding: 10px 12px; border-radius: 12px; background: rgba(124, 92, 255, 0.12); border: 1px solid rgba(124, 92, 255, 0.35); color: #d9d1ff; }
.seat-list { display: flex; flex-direction: column; gap: 6px; }
.seat-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,0.03); animation: fadeUp 0.25s ease both; }
.seat-badge { width: 42px; height: 38px; border-radius: 9px; background: #fff; color: #0b0d14; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 10px; font-weight: 600; line-height: 1; }
.seat-badge b { font-size: 15px; font-family: 'Space Grotesk'; }
.seat-main { flex: 1; font-size: 13.5px; font-weight: 600; display: flex; flex-direction: column; }
.seat-main small { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.x { width: 26px; height: 26px; border-radius: 8px; border: 1px solid var(--line-2); background: none; cursor: pointer; color: var(--muted); }
.x:hover { color: var(--text); background: rgba(255,255,255,0.06); }

.sum-line { display: flex; justify-content: space-between; align-items: baseline; font-size: 14px; padding: 4px 2px; color: var(--muted); }
.sum-line strong { color: var(--text); font-family: 'Space Grotesk'; font-size: 18px; }
.sum-line.big strong { font-size: 22px; }

.cta {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 15px 18px; border: 0; border-radius: 14px; cursor: pointer;
  background: linear-gradient(120deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: 0 10px 30px rgba(124, 92, 255, 0.35); transition: transform 0.15s, box-shadow 0.15s, opacity 0.2s;
}
.cta:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 14px 34px rgba(124, 92, 255, 0.5); }
.cta:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }
.cta span { font-size: 18px; }
.ghost { width: 100%; padding: 12px 16px; border-radius: 12px; border: 1px solid var(--line-2); background: rgba(255,255,255,0.03); cursor: pointer; font-weight: 600; font-size: 13.5px; }
.ghost:hover { background: rgba(255,255,255,0.08); }

.quality { display: flex; justify-content: space-between; align-items: center; font-size: 13px; color: var(--muted); padding: 2px 2px; }
.stars { color: #ffd166; letter-spacing: 2px; font-size: 16px; }
.stars i { color: rgba(255,255,255,0.15); font-style: normal; }
.pov-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.chip { padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line-2); background: none; cursor: pointer; font-size: 12px; }
.chip.on { background: #fff; color: #0b0d14; border-color: #fff; font-weight: 600; }
.hint-box { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: rgba(255,255,255,0.04); font-size: 12.5px; color: var(--muted); }

/* ─────────── Checkout */
.timer { font-family: 'Space Grotesk'; font-size: 13px; padding: 4px 10px; border-radius: 999px; background: rgba(39, 211, 162, 0.12); color: var(--ok); letter-spacing: 0.04em; }
.timer.warn { background: rgba(255, 90, 106, 0.15); color: var(--danger); }
.ticket-sum { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; background: rgba(255,255,255,0.02); }
.ev { display: flex; gap: 12px; align-items: center; padding-bottom: 10px; border-bottom: 1px dashed var(--line-2); margin-bottom: 2px; }
.ev-art { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-family: 'Space Grotesk'; font-weight: 700; background: linear-gradient(135deg, var(--accent), var(--accent-2)); flex: none; }
.li { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.li.muted { color: var(--muted); }
.li.total { font-weight: 700; font-size: 16px; padding-top: 8px; border-top: 1px solid var(--line); font-family: 'Space Grotesk'; }
form { display: flex; flex-direction: column; gap: 12px; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
legend { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.f { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
input, select {
  width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: rgba(255,255,255,0.04);
  color: var(--text); font: inherit; font-size: 14px; outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
select option { background: var(--panel-solid); }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.25); }
input.bad { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(255, 90, 106, 0.18); }
.pay-methods { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pay-methods label { position: relative; }
.pay-methods input { position: absolute; opacity: 0; }
.pay-methods span { display: block; text-align: center; padding: 10px; border-radius: 10px; border: 1px solid var(--line-2); cursor: pointer; font-size: 13px; font-weight: 600; }
.pay-methods input:checked + span { border-color: var(--accent); background: rgba(124, 92, 255, 0.14); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.check input { width: 16px; height: 16px; margin-top: 1px; accent-color: var(--accent); }
.check.bad span { color: var(--danger); }
.form-error { color: var(--danger); font-size: 12.5px; min-height: 0; }
.form-error:empty { display: none; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; animation: rot 0.7s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ─────────── Éxito */
.success { text-align: center; display: flex; flex-direction: column; align-items: center; }
.success h2 { justify-content: center; }
.ok-ico { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; background: rgba(39, 211, 162, 0.15); color: var(--ok); box-shadow: 0 0 0 8px rgba(39, 211, 162, 0.07); margin-bottom: 6px; }
.tickets { display: flex; flex-direction: column; gap: 10px; }
.tk { border-radius: 16px; overflow: hidden; background: #f4f5f9; color: #0b0d14; }
.tk-top { display: flex; align-items: center; gap: 8px; padding: 10px 14px; background: #0b0d14; color: #fff; font-family: 'Space Grotesk'; text-transform: uppercase; font-size: 13px; }
.tk-top .muted { margin-left: auto; text-transform: none; }
.tk-body { display: flex; gap: 14px; padding: 14px; align-items: center; }
.tk-body canvas { width: 96px; height: 96px; border-radius: 6px; flex: none; }
.tk-info .k { color: #59607a; }
.tk-info .v { font-size: 17px; margin: 2px 0 6px; }
.tk-info .muted { color: #59607a; }

/* ─────────── Etiquetas 3D */
.chip3d {
  pointer-events: auto; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 3px 7px; border-radius: 7px;
  background: rgba(8, 10, 18, 0.78); border: 1px solid color-mix(in srgb, var(--c) 70%, transparent);
  color: #fff; font-size: 10.5px; font-family: 'Space Grotesk'; letter-spacing: 0.02em; white-space: nowrap;
  box-shadow: 0 0 14px color-mix(in srgb, var(--c) 35%, transparent); transition: transform 0.15s;
}
.chip3d:hover { transform: scale(1.12); background: var(--c); color: #0b0d14; }
.chip3d span { opacity: 0.8; font-weight: 500; }

/* ─────────── Tooltip, HUD, toast */
#tooltip {
  position: fixed; left: 0; top: 0; z-index: 9; pointer-events: none; opacity: 0; transition: opacity 0.12s;
  min-width: 200px; max-width: 280px; padding: 10px 12px; border-radius: 12px; background: rgba(10, 12, 22, 0.94);
  border: 1px solid var(--line-2); box-shadow: 0 12px 30px rgba(0,0,0,0.5); font-size: 12.5px;
}
#tooltip.on { opacity: 1; }
.tt-h { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; }
.tt-s { color: var(--muted); margin: 3px 0 8px; }
.tt-r { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); margin-top: 4px; }
.tt-r b { color: var(--text); font-family: 'Space Grotesk'; font-size: 14px; }
.tt-cta { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); color: #b9a8ff; font-size: 11.5px; }

#hud {
  position: fixed; bottom: 22px; left: calc((100% - var(--panel-w) - 32px) / 2); transform: translateX(-50%) translateY(10px); z-index: 4;
  padding: 9px 16px; border-radius: 999px; background: rgba(8, 10, 18, 0.72); border: 1px solid var(--line); backdrop-filter: blur(10px);
  font-size: 12.5px; color: var(--muted); opacity: 0; transition: opacity 0.4s, transform 0.4s; pointer-events: none; white-space: nowrap;
}
#hud.on { opacity: 1; transform: translateX(-50%); }
#hud b { color: var(--text); font-weight: 600; }
.live { display: inline-flex; align-items: center; gap: 6px; color: #fff; font-weight: 700; font-size: 11px; letter-spacing: 0.1em; margin-right: 8px; }
.live::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 10px var(--accent-2); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

#toast {
  position: fixed; top: 84px; left: calc((100% - var(--panel-w) - 32px) / 2); transform: translate(-50%, -10px); z-index: 10;
  padding: 11px 16px; border-radius: 12px; background: #1a1e2c; border: 1px solid var(--line-2); font-size: 13px; opacity: 0; transition: 0.3s; pointer-events: none; max-width: 90vw;
}
#toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ─────────── Loader */
#loader { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, #121633, var(--bg) 70%); transition: opacity 0.8s, visibility 0.8s; }
#loader.done { opacity: 0; visibility: hidden; }
.loader-box { text-align: center; width: min(360px, 80vw); }
.loader-title { font-family: 'Space Grotesk'; font-size: 20px; font-weight: 600; margin-top: 18px; }
.loader-sub { color: var(--muted); font-size: 13px; margin: 4px 0 18px; }
.load-track { height: 4px; border-radius: 4px; background: rgba(255,255,255,0.08); overflow: hidden; }
#load-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.2s; }
#load-pct { margin-top: 10px; font-size: 12px; color: var(--muted); }

/* ─────────── Mobile: el panel pasa a hoja inferior */
@media (max-width: 860px) {
  :root { --panel-w: 0px; }
  .topbar { right: 0; padding: 12px 14px; gap: 12px; flex-wrap: wrap; }
  .event { border: 0; padding-left: 0; }
  .event-meta { display: none; }
  .stepper { width: 100%; margin-left: 0; }
  .step .lbl { display: none; }
  #panel { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: 46vh; border-radius: 18px; }
  #hud, #toast { left: 50%; }
  #hud { bottom: calc(46vh + 18px); }
}
