:root {
  --fondo: #f1efea;
  --tinta: #141414;
  --tenue: #6d6a64;
  --linea: rgba(20, 20, 20, .12);
  --vidrio: rgba(250, 249, 246, .86);
  --acento: #141414;
  --fuente: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #d9d6d0; color: var(--tinta); font-family: var(--fuente); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
#escena, #escena canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

/* botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .55em; border: 1px solid var(--tinta); background: transparent; padding: .95em 1.6em; border-radius: 999px; font-size: 15px; letter-spacing: .02em; transition: background .2s, color .2s, transform .15s; }
.btn:hover { transform: translateY(-1px); }
.btn-primario { background: var(--tinta); color: #fff; }
.btn-primario:hover { background: #333; }
.btn-vr svg { width: 22px; height: 22px; }
.btn-vr:not(.hud-btn):hover { background: var(--tinta); color: #fff; }
.btn-secundario { padding: .7em 1.2em; font-size: 14px; }
.enlace { background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; color: var(--tenue); font-size: 14px; margin-top: 18px; }

/* carga */
#carga { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: var(--fondo); transition: opacity .6s ease, visibility .6s; }
#carga.listo { opacity: 0; visibility: hidden; }
.carga-caja { width: min(320px, 80vw); text-align: center; }
.marca { font-size: 13px; letter-spacing: .32em; text-transform: uppercase; margin: 0 0 22px; }
.carga-pista { height: 2px; background: var(--linea); overflow: hidden; }
#cargaBarra { height: 100%; width: 8%; background: var(--tinta); transition: width .4s ease; }
.carga-txt { font-size: 12px; color: var(--tenue); margin-top: 14px; }

/* inicio */
#inicio { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 24px; background: linear-gradient(180deg, rgba(241, 239, 234, .55), rgba(241, 239, 234, .85)); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.inicio-caja { max-width: 620px; text-align: center; }
.sobre { font-size: 12px; letter-spacing: .32em; text-transform: uppercase; color: var(--tenue); margin: 0 0 14px; }
#inicio h1 { font-weight: 300; font-size: clamp(34px, 6vw, 64px); letter-spacing: .02em; line-height: 1.05; margin: 0 0 18px; }
.sub { font-size: 17px; line-height: 1.55; color: #3b3935; margin: 0 auto 30px; max-width: 46ch; }
.botones { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.ayuda { margin-top: 30px; display: flex; flex-wrap: wrap; gap: 10px 22px; justify-content: center; font-size: 13px; color: var(--tenue); }
kbd { font-family: inherit; font-size: 11px; border: 1px solid var(--linea); border-bottom-width: 2px; border-radius: 5px; padding: 2px 6px; margin-right: 3px; background: #fff; color: var(--tinta); }
.aviso { margin-top: 18px; font-size: 13px; color: #8a5a00; }
.solo-tactil { display: none; }
body.tactil .solo-pc { display: none; }
body.tactil .solo-tactil { display: flex; }

#pausa { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; background: rgba(20, 20, 20, .18); }

/* HUD */
.hud { position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; pointer-events: none; padding-top: max(16px, env(safe-area-inset-top)); }
.hud > * { pointer-events: auto; }
.hud-nombre { font-size: 12px; letter-spacing: .3em; text-transform: uppercase; background: var(--vidrio); padding: 8px 14px; border-radius: 999px; backdrop-filter: blur(8px); }
.hud-acciones { display: flex; gap: 8px; align-items: center; }
.hud-btn { display: inline-flex; align-items: center; gap: 8px; border: 0; background: var(--vidrio); backdrop-filter: blur(8px); padding: 9px 14px; border-radius: 999px; font-size: 13px; }
.hud-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.hud-btn:hover { background: #fff; }
.hud-carga { font-size: 12px; color: var(--tenue); background: var(--vidrio); padding: 8px 12px; border-radius: 999px; }

#mira { position: fixed; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px 0 0 -3px; border-radius: 50%; background: rgba(255, 255, 255, .9); box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); z-index: 15; display: none; pointer-events: none; }
body.bloqueado #mira { display: block; }
#pista { position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%); z-index: 15; background: var(--vidrio); backdrop-filter: blur(8px); padding: 10px 18px; border-radius: 14px; text-align: center; pointer-events: none; display: grid; gap: 2px; min-width: 200px; }
#pista b { font-weight: 600; font-size: 14px; }
#pista span { font-size: 13px; color: var(--tenue); }
#pista small { font-size: 11px; color: var(--tenue); margin-top: 3px; letter-spacing: .04em; }

/* joystick táctil */
#joystick { display: none; position: fixed; left: 26px; bottom: 30px; width: 124px; height: 124px; border-radius: 50%; z-index: 16; background: rgba(250, 249, 246, .35); border: 1px solid rgba(255, 255, 255, .7); backdrop-filter: blur(4px); touch-action: none; padding-bottom: env(safe-area-inset-bottom); }
#perilla { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; border-radius: 50%; background: rgba(255, 255, 255, .92); box-shadow: 0 2px 10px rgba(0, 0, 0, .15); }
body.tactil #joystick { display: block; }
body.tactil #pista small { display: none; }

/* ficha */
#ficha { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; }
#fichaFondo { position: absolute; inset: 0; background: rgba(15, 15, 15, .55); backdrop-filter: blur(3px); }
.ficha-caja { position: relative; width: min(1100px, 100%); max-height: calc(100vh - 40px); background: var(--fondo); border-radius: 6px; display: grid; grid-template-columns: 1.35fr 1fr; overflow: hidden; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); animation: aparecer .25s ease; }
@keyframes aparecer { from { opacity: 0; transform: translateY(8px); } }
.ficha-img { background: #e6e3dd; display: grid; place-items: center; padding: 34px; min-height: 0; }
.ficha-img img { max-width: 100%; max-height: calc(100vh - 110px); object-fit: contain; box-shadow: 0 10px 30px rgba(0, 0, 0, .18); }
.ficha-info { padding: 46px 40px 32px; overflow: auto; display: flex; flex-direction: column; }
.ficha-artista { font-size: 12px; letter-spacing: .26em; text-transform: uppercase; color: var(--tenue); margin: 0 0 10px; }
.ficha-info h2 { font-weight: 400; font-size: 30px; line-height: 1.15; margin: 0 0 12px; font-style: italic; }
.ficha-datos { color: #3b3935; font-size: 15px; margin: 0 0 16px; line-height: 1.5; }
.ficha-estado { margin: 0 0 18px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
#fichaEstado { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; padding: 5px 10px; border-radius: 999px; background: #e3efe7; color: #23613f; }
#fichaEstado[data-estado="vendida"] { background: #f6e1e1; color: #a12226; }
#fichaEstado[data-estado="reservada"] { background: #f7ecd6; color: #8a5a00; }
#fichaEstado[data-estado="no_venta"] { background: #e8e6e1; color: #555; }
#fichaPrecio { font-size: 18px; font-weight: 600; }
.ficha-desc { font-size: 15px; line-height: 1.65; color: #2b2a27; white-space: pre-line; margin: 0 0 18px; }
.ficha-contacto { font-size: 14px; color: var(--tenue); border-top: 1px solid var(--linea); padding-top: 14px; white-space: pre-line; }
.ficha-nav { margin-top: auto; display: flex; justify-content: space-between; align-items: center; border-top: 1px solid var(--linea); padding-top: 16px; font-size: 13px; color: var(--tenue); }
.ficha-nav button { background: none; border: 0; padding: 6px 0; font-size: 14px; }
.ficha-nav button:hover { text-decoration: underline; }
#fichaIr { margin-top: 14px; align-self: flex-start; }
.cerrar { position: absolute; top: 10px; right: 12px; width: 40px; height: 40px; border: 0; background: transparent; font-size: 28px; line-height: 1; border-radius: 50%; z-index: 2; }
.cerrar:hover { background: rgba(0, 0, 0, .06); }

/* listado */
#lista { position: fixed; top: 0; right: 0; bottom: 0; width: min(420px, 100%); z-index: 55; background: var(--fondo); box-shadow: -20px 0 60px rgba(0, 0, 0, .2); display: flex; flex-direction: column; animation: deslizar .25s ease; }
@keyframes deslizar { from { transform: translateX(30px); opacity: 0; } }
.lista-cab { position: relative; padding: 22px 22px 8px; }
.lista-cab h2 { font-weight: 400; font-size: 20px; margin: 0; }
.lista-cab .cerrar { top: 14px; }
#listaBuscar { margin: 10px 22px 12px; padding: 11px 14px; border: 1px solid var(--linea); border-radius: 10px; background: #fff; font: inherit; font-size: 14px; }
#listaObras { list-style: none; margin: 0; padding: 0 12px 20px; overflow: auto; }
#listaObras button { width: 100%; display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: center; text-align: left; background: none; border: 0; padding: 10px; border-radius: 10px; }
#listaObras button:hover { background: rgba(0, 0, 0, .05); }
#listaObras img { width: 64px; height: 64px; object-fit: cover; border-radius: 4px; background: #ddd; }
#listaObras b { display: block; font-weight: 500; font-size: 14px; }
#listaObras small { color: var(--tenue); font-size: 13px; }
#listaObras em { font-style: normal; font-size: 12px; color: var(--tenue); }

body.en-vr .hud, body.en-vr #pista { display: none; }

@media (max-width: 760px) {
  .ficha-caja { grid-template-columns: 1fr; overflow: auto; }
  .ficha-img { padding: 20px; }
  .ficha-img img { max-height: 46vh; }
  .ficha-info { padding: 26px 22px 22px; overflow: visible; }
  .ficha-info h2 { font-size: 24px; }
  .hud-nombre { max-width: 52vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hud-btn span { display: none; }
}
