/* Muro delle locandine — stile "Carta & inchiostro" (logica in app.js, invariata) */
html, body { height: 100%; overflow: hidden; }

/* ---------- Barra in basso: switch + info ---------- */
.switch-bar {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  z-index: 10; display: flex; align-items: center; gap: 10px;
}
.switch {
  position: relative; display: flex; align-items: center; gap: 2px;
  background: var(--paper); border: 1px solid var(--ink); border-radius: 999px;
  padding: 4px; box-shadow: 0 14px 34px rgba(20, 18, 16, .22);
}
.switch-thumb {
  position: absolute; top: 4px; left: 4px;
  width: calc(50% - 4px); height: calc(100% - 8px);
  background: var(--ink); border-radius: 999px;
  transition: transform .5s var(--ease);
  pointer-events: none;
}
.switch.right .switch-thumb { transform: translateX(100%); }
.tab {
  position: relative; z-index: 1; flex: 1;
  background: transparent; color: var(--ink); border: none; border-radius: 999px;
  padding: 11px 26px; cursor: pointer; white-space: nowrap;
  font: 600 11px/1.2 var(--sans); letter-spacing: .16em; text-transform: uppercase;
  transition: color .35s var(--ease);
}
.tab:hover { color: var(--red); }
.tab.active, .tab.active:hover { color: var(--paper); }

@media (max-width: 760px), (hover: none) {
  .switch-bar { bottom: 70px; width: min(94vw, 520px); }
  .switch { flex: 1; }
  .tab { padding: 15px 10px; font-size: 10.5px; letter-spacing: .1em; white-space: normal; text-align: center; }
}

/* ---------- Muro ---------- */
#viewport {
  position: absolute; inset: 0; cursor: grab; overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 40%, rgba(255, 255, 255, .35) 0%, rgba(255, 255, 255, 0) 60%),
    var(--paper);
}
#viewport.grabbing { cursor: grabbing; }

#world {
  position: absolute; top: 0; left: 0; width: 0; height: 0;
  transform-origin: 0 0; will-change: transform;
}

@keyframes cellIn {
  from { opacity: 0; scale: .9; }
  to   { opacity: 1; scale: 1; }
}
.cell {
  position: absolute; overflow: hidden; cursor: pointer;
  background: var(--paper-2);
  border: 1px solid rgba(20, 18, 16, .35);
  box-shadow: 0 2px 0 rgba(20, 18, 16, .06), 0 10px 22px rgba(20, 18, 16, .14);
  transition: box-shadow .25s var(--ease), border-color .25s;
  will-change: transform;
  animation: cellIn .7s var(--ease) both;
}
.cell img {
  width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none;
  opacity: 0; transition: opacity .4s;
}
.cell img.loaded { opacity: 1; }
.cell:hover { z-index: 2; border-color: var(--ink); box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px var(--red), 0 24px 44px rgba(20, 18, 16, .3); }

/* ---------- Tutorial ---------- */
#tutorial {
  position: fixed; inset: 0; z-index: 15;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none; transition: opacity .4s ease;
}
#tutorial.fade { opacity: 0; }
.tut-step {
  position: absolute; display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 26px 34px; background: var(--paper); border: 1px solid var(--ink);
  box-shadow: 0 24px 60px rgba(20, 18, 16, .25);
  opacity: 0; transform: translateY(8px);
  transition: opacity .35s ease, transform .35s var(--ease); pointer-events: none;
}
.tut-step.show { opacity: 1; transform: none; }
.tut-label { font-family: var(--serif); font-style: italic; font-size: 19px; color: var(--ink); text-align: center; }
.tut-anim { position: relative; width: 140px; height: 76px; display: flex; align-items: center; justify-content: center; }
.tut-hand { position: absolute; font-size: 40px; animation: dragMove 1.8s ease-in-out infinite; filter: grayscale(1) contrast(1.2); }
@keyframes dragMove { 0%, 100% { transform: translateX(-40px); } 50% { transform: translateX(40px); } }
.tut-finger { position: absolute; font-size: 20px; color: var(--red); }
.tut-finger-a { animation: pinchA 1.8s ease-in-out infinite; }
.tut-finger-b { animation: pinchB 1.8s ease-in-out infinite; }
@keyframes pinchA { 0%, 100% { transform: translateX(-10px); } 50% { transform: translateX(-40px); } }
@keyframes pinchB { 0%, 100% { transform: translateX(10px); } 50% { transform: translateX(40px); } }
.tut-tap { width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--red); animation: tapPulse 1.4s ease-out infinite; }
@keyframes tapPulse { 0% { transform: scale(.7); opacity: 1; } 60% { transform: scale(1.4); opacity: .3; } 100% { transform: scale(1.7); opacity: 0; } }

/* ---------- Locandina ingrandita ---------- */
#panel {
  position: fixed; inset: 0; z-index: 20;
  background: rgba(20, 18, 16, .82);
  display: flex; align-items: center; justify-content: center;
  padding: 40px; opacity: 1; transition: opacity .25s ease;
}
#panel.hidden { opacity: 0; pointer-events: none; }
.panel-card {
  position: relative; max-width: 95vw; max-height: 95vh;
  transform: none; transition: transform .35s var(--ease);
}
#panel.hidden .panel-card { transform: translateY(12px) scale(.97); }
#panelClose {
  position: fixed; top: 16px; right: 16px; z-index: 2;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--paper); border: 1px solid var(--ink); color: var(--ink);
  font-size: 24px; line-height: 1; cursor: pointer;
  transition: transform .3s var(--ease), background .2s, color .2s;
}
#panelClose:hover { background: var(--ink); color: var(--paper); transform: rotate(90deg); }
#panelImg { display: flex; align-items: center; justify-content: center; }
#panelImg img {
  max-width: 92vw; max-height: 90vh; object-fit: contain; display: block;
  background: var(--paper); padding: 10px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}
