/* =====================================================================
   CASA-MUSEO 3D · interfaz sobre la escena
   ===================================================================== */
:root {
  --lino: #EEE7DA; --papel: #F6F2EA; --nogal: #241A13; --nogal2: #30241B;
  --oro: #B8914F; --oroclaro: #D9BD86; --moriche: #33443A; --arcilla: #8E4F32;
  --tinta: #2E2621; --gris: #6F6258;
  --vidrio: rgba(36, 26, 19, .62);
  --serif: 'Cormorant Garamond', Georgia, serif;
  --sans: 'Jost', system-ui, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; overflow: hidden; background: var(--nogal); color: var(--lino); font-family: var(--sans); font-weight: 300; }
#escena { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; outline: none; }
#escena.arrastrando { cursor: grabbing; }
#escena.sobre-objeto { cursor: pointer; }
[hidden] { display: none !important; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--oroclaro); outline-offset: 3px; }

/* Botones */
.boton { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 0; border-radius: 999px;
  min-height: 40px; padding: .55rem 1.05rem; font: 400 .875rem/1 var(--sans); text-decoration: none; cursor: pointer;
  transition: background .2s cubic-bezier(.2,.7,.2,1), color .2s, border-color .2s, transform .15s, box-shadow .2s; }
.boton:active { transform: scale(0.97); }
.boton-vidrio { background: var(--vidrio); color: var(--lino); border: 1px solid rgba(238,231,218,.25); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.boton-vidrio:hover { border-color: var(--oroclaro); color: var(--oroclaro); box-shadow: 0 4px 14px rgba(0,0,0,.25); }
.boton-claro { background: var(--lino); color: var(--nogal); }
.boton-claro:hover { background: var(--oroclaro); }
.boton-oscuro { background: var(--tinta); color: var(--lino); }
.boton-oscuro:hover { background: var(--arcilla); }
.boton-borde { background: transparent; color: var(--tinta); border: 1px solid rgba(46,38,33,.3); }
.boton-borde:hover { border-color: var(--oro); color: var(--arcilla); }
.cerrar { position: absolute; top: .6rem; right: .8rem; width: 44px; height: 44px; min-width: 44px; min-height: 44px; border: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; background: rgba(0,0,0,.08); color: inherit; font-size: 1.7rem; line-height: 1; cursor: pointer; opacity: .75; transition: opacity .2s, background .2s, transform .15s; }
.cerrar:hover { opacity: 1; background: rgba(0,0,0,.15); transform: scale(1.06); }
.cerrar:active { transform: scale(0.94); }

/* Control de clima segmentado */
.control-clima { display: inline-flex; align-items: center; background: var(--vidrio); border: 1px solid rgba(238,231,218,.22); border-radius: 999px;
  padding: 3px; gap: 2px; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.control-clima .boton { min-height: 34px; padding: .4rem .75rem; font-size: .82rem; background: transparent; border: 1px solid transparent; color: rgba(238,231,218,.85); }
.control-clima .boton:hover { color: var(--oroclaro); border-color: rgba(217,189,134,.3); }
.control-clima .boton.activo { background: rgba(184,145,79,.38); border-color: var(--oro); color: #fff; font-weight: 500; box-shadow: 0 0 10px rgba(184,145,79,.3); }


/* Carga */
.carga, .aviso { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.2rem; background: radial-gradient(ellipse at 50% 40%, #3a2a1d, var(--nogal) 70%); text-align: center; padding: 24px; transition: opacity .9s; }
.carga.oculta { opacity: 0; pointer-events: none; }
.carga-firma { width: min(220px, 50vw); height: auto; }
.carga-texto { font: italic 400 1.35rem var(--serif); color: var(--oroclaro); }
.carga-barra { width: min(260px, 60vw); height: 2px; background: rgba(238,231,218,.15); overflow: hidden; }
.carga-barra span { display: block; height: 100%; width: 0; background: var(--oroclaro); transition: width .3s; }
.aviso h1 { font: 500 2rem var(--serif); }
.aviso p { max-width: 34rem; line-height: 1.6; color: rgba(238,231,218,.8); }

/* Barra superior */
.barra-sup { position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 18px 14px; pointer-events: none;
  background: linear-gradient(180deg, rgba(20,13,8,.7), rgba(20,13,8,.25) 70%, transparent); }
.barra-sup > * { pointer-events: auto; }
.marca { display: flex; align-items: center; gap: .7rem; text-decoration: none; }
.marca img { height: 38px; width: auto; filter: drop-shadow(0 1px 3px rgba(0,0,0,.5)); }
.marca span { font: italic 400 1.15rem var(--serif); color: var(--oroclaro); text-shadow: 0 1px 4px rgba(0,0,0,.5); }
.barra-acciones { display: flex; gap: 8px; justify-content: flex-end; }
.corto { display: none; }

/* Plano */
.plano { position: fixed; z-index: 30; top: calc(70px + env(safe-area-inset-top)); right: 18px; width: min(340px, calc(100vw - 36px));
  max-height: calc(100vh - 190px); overflow: auto; background: rgba(36,26,19,.92); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(217,189,134,.25); border-radius: 18px; padding: 18px 18px 10px; }
.plano-cab { display: flex; align-items: baseline; justify-content: space-between; }
.plano h2 { font: 500 1.5rem var(--serif); }
.plano h3 { margin: 14px 0 6px; font: italic 400 1.05rem var(--serif); color: var(--oroclaro); border-top: 1px solid rgba(217,189,134,.3); padding-top: 10px; }
.plano ul { list-style: none; }
.plano li button { width: 100%; text-align: left; background: none; border: 0; color: var(--lino); font: 300 .92rem/1.35 var(--sans);
  padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.plano li button:hover, .plano li button[aria-current="true"] { background: rgba(217,189,134,.14); color: var(--oroclaro); }

/* Ficha */
.ficha { position: fixed; z-index: 25; right: 18px; bottom: 112px; width: min(380px, calc(100vw - 36px)); max-height: calc(100vh - 220px); overflow: auto;
  background: rgba(246,242,234,.96); color: var(--tinta); border-radius: 18px; padding: 22px 22px 18px;
  box-shadow: 0 20px 50px -15px rgba(0,0,0,.6); animation: subir .35s cubic-bezier(.2,.7,.2,1); }
@keyframes subir { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.ficha-sup { font: italic 400 1rem var(--serif); color: var(--oro); }
.ficha h2 { margin-top: 2px; font: 500 1.9rem/1.05 var(--serif); padding-right: 1.5rem; }
.ficha-detalle { margin-top: .4rem; font-size: .85rem; color: var(--gris); }
.ficha-texto { margin-top: .8rem; font: italic 400 1.12rem/1.4 var(--serif); }
.ficha-texto:empty { display: none; }
.ficha-acciones { margin-top: 1rem; display: flex; flex-wrap: wrap; gap: 8px; }
.ficha .cerrar { color: var(--tinta); }

/* Panel del autor */
.autor { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(20,13,8,.55); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.autor-caja { position: relative; width: min(760px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--papel); color: var(--tinta);
  border-radius: 22px; padding: 30px clamp(20px, 4vw, 40px) 26px; animation: subir .4s cubic-bezier(.2,.7,.2,1); }
.autor .cerrar { color: var(--tinta); }
.autor-firma { height: 56px; width: auto; }
.autor h2 { margin-top: 8px; font: 500 clamp(1.9rem, 4vw, 2.6rem)/1.05 var(--serif); }
.autor-sub { margin-top: 4px; color: var(--gris); font-size: .92rem; }
.autor-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; margin-top: 22px; }
.autor-cols h3 { font: italic 500 1.25rem var(--serif); color: var(--arcilla); border-top: 1px solid var(--oro); padding-top: 10px; }
.autor-cols p { margin-top: 8px; font-size: .92rem; line-height: 1.6; color: rgba(46,38,33,.85); }
.autor-links { margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.autor-links a { font: 400 1.1rem var(--serif); text-decoration: underline; text-decoration-color: rgba(184,145,79,.6); text-underline-offset: 4px; }
.autor-links a:hover { color: var(--arcilla); }
.autor-pie { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 10px; }

/* Recorrido guiado */
.guia { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 0 16px calc(18px + env(safe-area-inset-bottom)); pointer-events: none;
  background: linear-gradient(0deg, rgba(20,13,8,.55), transparent); }
.guia > * { pointer-events: auto; }
.ayuda { font-size: .8rem; color: rgba(238,231,218,.85); text-shadow: 0 1px 3px rgba(0,0,0,.6); text-align: center; transition: opacity 1s; }
.ayuda.oculta { opacity: 0; }
.guia-barra { display: flex; align-items: center; gap: 10px; background: var(--vidrio); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(238,231,218,.2); border-radius: 999px; padding: 6px; max-width: 100%; }
.guia-flecha { width: 46px; height: 46px; flex: none; border-radius: 50%; border: 0; background: var(--lino); color: var(--nogal);
  font: 400 1.9rem/1 var(--serif); cursor: pointer; transition: background .2s; }
.guia-flecha:hover { background: var(--oroclaro); }
.guia-flecha:disabled { opacity: .35; cursor: default; }
.guia-texto { display: flex; flex-direction: column; align-items: center; min-width: 0; width: min(360px, 56vw); text-align: center; }
.guia-texto span { font-size: .72rem; letter-spacing: .04em; color: var(--oroclaro); }
.guia-texto strong { font: 500 1.15rem/1.15 var(--serif); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }

/* Boleto de Entrada al Museo */
.modal-ticket { position: fixed; inset: 0; z-index: 55; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(18, 12, 8, 0.75); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: fadeInTicket 0.35s ease; }
@keyframes fadeInTicket { from { opacity: 0; } to { opacity: 1; } }

.ticket-envoltorio { position: relative; max-width: 660px; width: 100%; }
.ticket-caja { position: relative; display: flex; background: var(--papel); color: var(--tinta); border-radius: 20px;
  box-shadow: 0 25px 60px -15px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(184, 145, 79, 0.35); overflow: hidden;
  animation: subirTicket 0.45s cubic-bezier(0.18, 0.89, 0.32, 1.25); transition: transform 0.4s ease, opacity 0.35s ease; }
@keyframes subirTicket {
  from { opacity: 0; transform: scale(0.92) translateY(24px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}
.ticket-caja.picado { transform: scale(0.96) translateY(-8px); opacity: 0; }

.ticket-cuerpo { flex: 1; padding: 26px 22px 22px 26px; display: flex; flex-direction: column; justify-content: space-between; }
.ticket-cab { display: flex; align-items: center; gap: 14px; border-bottom: 1px dashed rgba(184, 145, 79, 0.35); padding-bottom: 14px; }
.ticket-firma { height: 42px; width: auto; }
.ticket-titulos { display: flex; flex-direction: column; }
.ticket-etiqueta { font-size: 0.7rem; font-weight: 500; letter-spacing: 0.12em; text-transform: uppercase; color: var(--oro); }
.ticket-titulos h2 { font: 600 1.5rem/1.1 var(--serif); color: var(--tinta); letter-spacing: 0.02em; }
.ticket-sub { font-size: 0.8rem; color: var(--gris); }

.ticket-datos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 16px 0; }
.ticket-col { display: flex; flex-direction: column; gap: 2px; }
.ticket-lbl { font-size: 0.66rem; letter-spacing: 0.08em; font-weight: 500; color: var(--gris); text-transform: uppercase; }
.ticket-valor { font-size: 0.86rem; color: var(--tinta); font-weight: 400; }
.ticket-num { font-family: 'Courier New', Courier, monospace; font-size: 1.15rem; font-weight: 700; color: var(--arcilla); letter-spacing: 0.05em; }

.ticket-pie-cuerpo { border-top: 1px dashed rgba(184, 145, 79, 0.35); padding-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.ticket-lema { font-size: 0.92rem; color: var(--oro); text-align: left; }
.ticket-acciones { display: flex; flex-wrap: wrap; gap: 10px; }
.ticket-btn-entrar { background: var(--tinta); color: var(--lino); font-weight: 500; padding: 0.65rem 1.3rem; border-radius: 999px; box-shadow: 0 4px 14px rgba(36, 26, 19, 0.3); }
.ticket-btn-entrar:hover { background: var(--arcilla); color: #fff; transform: translateY(-1px); }

/* Separador troquelado */
.ticket-separador { position: relative; width: 20px; display: flex; flex-direction: column; align-items: center; justify-content: space-between; }
.ticket-muesca { position: absolute; width: 22px; height: 22px; background: rgba(18, 12, 8, 0.75); border-radius: 50%; left: 50%; transform: translateX(-50%); z-index: 2; box-shadow: inset 0 0 0 1px rgba(184, 145, 79, 0.35); }
.ticket-muesca.top { top: -11px; }
.ticket-muesca.bottom { bottom: -11px; }
.ticket-linea { height: 100%; width: 0; border-left: 2px dashed rgba(184, 145, 79, 0.4); }

/* Talón de control (Stub) */
.ticket-talon { width: 140px; background: rgba(238, 231, 218, 0.55); border-left: 1px solid rgba(184, 145, 79, 0.2); padding: 22px 14px;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center; }
.ticket-sello { display: grid; place-items: center; width: 68px; height: 68px; border: 2px dashed var(--arcilla); border-radius: 50%; padding: 2px; transform: rotate(-12deg); opacity: 0.88; }
.sello-circulo { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%; border: 1px solid var(--arcilla); border-radius: 50%; color: var(--arcilla); }
.sello-texto { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.1em; }
.sello-sub { font-size: 0.48rem; letter-spacing: 0.05em; }

.ticket-barcode { display: flex; align-items: stretch; justify-content: center; gap: 2px; height: 36px; width: 100%; padding: 0 4px; }
.barcode-line { background: var(--tinta); opacity: 0.8; height: 100%; }
.w-1 { width: 1px; } .w-2 { width: 2px; } .w-3 { width: 3px; } .w-4 { width: 4px; }
.ticket-talon-num { font-family: 'Courier New', Courier, monospace; font-size: 0.78rem; font-weight: 700; color: var(--tinta); letter-spacing: 0.05em; }
.ticket-cerrar { top: 8px; right: 8px; color: var(--tinta); }

@media (max-width: 640px) {
  .barra-sup { padding: calc(10px + env(safe-area-inset-top)) 12px 10px; gap: 8px; }
  .marca span { display: none; }
  .marca img { height: 28px; }
  .largo { display: none; } .corto { display: inline; }

  .barra-acciones {
    gap: 4px;
    max-width: calc(100vw - 48px);
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    padding: 2px 0;
  }
  .barra-acciones::-webkit-scrollbar { display: none; }

  .control-clima { padding: 2px; gap: 1px; }
  .control-clima .btn-txt { display: none; }
  .control-clima .boton { min-height: 36px; padding: .35rem .55rem; font-size: .95rem; }

  .barra-acciones .boton { min-height: 36px; padding: .4rem .65rem; font-size: .78rem; gap: .25rem; }
  .barra-acciones .boton .btn-icono { font-size: .9rem; }

  .ficha { left: 12px; right: 12px; width: auto; bottom: 104px; max-height: 48vh; padding: 18px 18px 14px; border-radius: 16px; }
  .ficha h2 { font-size: 1.55rem; }
  .autor-cols { grid-template-columns: 1fr; gap: 16px; }
  .plano { right: 12px; left: 12px; width: auto; border-radius: 16px; max-height: calc(100vh - 160px); }

  .guia-barra { gap: 6px; padding: 4px; }
  .guia-flecha { width: 42px; height: 42px; font-size: 1.6rem; }
  .guia-texto { width: min(280px, 58vw); }
  .guia-texto strong { font-size: 1.05rem; }

  /* Adaptación móvil del boleto */
  .ticket-caja { flex-direction: column; border-radius: 18px; max-height: calc(100vh - 40px); overflow-y: auto; }
  .ticket-cuerpo { padding: 18px 16px 14px; }
  .ticket-cab { gap: 10px; padding-bottom: 10px; }
  .ticket-firma { height: 34px; }
  .ticket-titulos h2 { font-size: 1.25rem; }
  .ticket-datos { grid-template-columns: 1fr; gap: 8px; margin: 10px 0; }
  .ticket-separador { width: 100%; height: 16px; flex-direction: row; }
  .ticket-muesca.top { left: -11px; top: 50%; transform: translateY(-50%); }
  .ticket-muesca.bottom { left: auto; right: -11px; top: 50%; transform: translateY(-50%); }
  .ticket-linea { width: 100%; height: 0; border-left: 0; border-top: 2px dashed rgba(184, 145, 79, 0.4); }
  .ticket-talon { width: 100%; flex-direction: row; padding: 12px 16px; border-left: 0; border-top: 1px solid rgba(184, 145, 79, 0.2); }
  .ticket-sello { width: 50px; height: 50px; }
  .sello-texto { font-size: 0.54rem; }
  .ticket-barcode { height: 26px; max-width: 110px; }
}
@media (prefers-reduced-motion: reduce) { .ficha, .autor-caja, .ticket-caja { animation: none; } }

