/* styles.css — tótem vertical 1080×1920 con la paleta de Kamino. */

:root {
  --bg: #d9d2c8;
  --surface: #f6f0e7;
  --raised: #fff8ef;
  --ink: #1f2428;
  --navy: #1a2b5f;
  --ochre: #8a6728;
  --ochre-deep: #6e4e16;
  --rust: #91311b;
  --muted: #4a453f;
  --line: rgba(61, 51, 36, 0.16);
  --charcoal: #30343b;
  --olive: #2f6b45;
  --gold: #e4cd9a;
  --on-navy: #f6f0e7;
  --serif: Georgia, "Iowan Old Style", Palatino, "Palatino Linotype", serif;
  --sans: "Segoe UI", -apple-system, BlinkMacSystemFont, sans-serif;
  --header: 148px;
  --footer: 124px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--navy);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  touch-action: manipulation;
}
button, input { font: inherit; color: inherit; }
button {
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
img { display: block; max-width: 100%; }
h1, h2, h3, p { margin: 0; }
[hidden] { display: none !important; }
button:focus-visible, a:focus-visible {
  outline: 4px solid var(--ochre);
  outline-offset: 4px;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#totem {
  position: absolute;
  width: 1080px;
  height: 1920px;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  user-select: none;
}

.top, .sponsors { background: var(--surface); }
.top {
  height: var(--header);
  flex: 0 0 var(--header);
  display: grid;
  grid-template-columns: 108px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 16px 22px 14px;
  border-bottom: 1px solid var(--line);
}
.logo { height: 86px; width: auto; margin: 0 auto; }
.icon-btn {
  width: 92px;
  height: 92px;
  border-radius: 16px;
  background: var(--raised);
  color: var(--navy);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
}
.icon-btn .ico { width: 42px; height: 42px; }
#back.is-away { visibility: hidden; pointer-events: none; }
.tools { display: flex; align-items: center; gap: 10px; }
.langs {
  display: flex;
  gap: 8px;
}
.langs button {
  min-width: 84px;
  min-height: 84px;
  padding: 0 12px;
  border-radius: 14px;
  border: 2px solid transparent;
  background: var(--raised);
  color: var(--navy);
  font-size: 28px;
  font-weight: 750;
  letter-spacing: 0.04em;
}
.langs button[aria-pressed="true"] {
  background: var(--navy);
  color: var(--on-navy);
}

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 28px 36px 24px;
}
.screen[hidden] { display: none !important; }

.sponsors {
  height: var(--footer);
  flex: 0 0 var(--footer);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 12px 24px;
  border-top: 1px solid var(--line);
}
.sponsors img { height: 68px; width: auto; max-width: 210px; object-fit: contain; }
.sponsors img.sefarad { height: 78px; max-width: 92px; }

h1 {
  font-family: var(--serif);
  font-size: 64px;
  line-height: 1.05;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -1px;
}
.eyebrow {
  font-size: 22px;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ochre-deep);
}
.lead {
  font-size: 32px;
  line-height: 1.35;
  color: var(--muted);
}
.gold { color: var(--ochre); }

.primary, .secondary, .choice, .cta {
  min-height: 92px;
  border-radius: 16px;
  padding: 16px 22px;
  font-size: 32px;
  font-weight: 700;
  line-height: 1.2;
}
.primary {
  background: var(--charcoal);
  color: #fff;
}
.secondary {
  background: transparent;
  color: var(--navy);
  border: 2px solid rgba(26, 43, 95, 0.28);
}
.choice {
  width: 100%;
  text-align: left;
  background: var(--surface);
  color: var(--navy);
  border: 2px solid var(--line);
}
.choice:active, .primary:active, .secondary:active, .cta:active, .card:active, .key:active {
  transform: scale(0.985);
}
.primary:disabled, .choice:disabled {
  opacity: 1;
  background: #e4ddd2;
  color: #3a342c;
  border: 2px solid #c9c0b2;
}
h1:focus { outline: none; }

/* Bienvenida */
#screen-atract {
  padding: 0;
  background: var(--navy);
}
.map-hit {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  position: relative;
  color: var(--on-navy);
  overflow: hidden;
}
.route-svg { width: 100%; height: 100%; display: block; }
.town-label {
  font-family: var(--sans);
  font-size: 26px;
  font-weight: 700;
  fill: var(--gold);
}
.pulse-dot { transform-box: fill-box; transform-origin: center; animation: glow 3.6s ease-in-out infinite; }
.traveler { fill: var(--gold); }
@keyframes glow {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}
.atract-copy {
  flex: 0 0 auto;
  background: var(--surface);
  padding: 32px 48px 36px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.atract-copy h1 { font-size: 58px; }
.cta {
  margin-top: 8px;
  background: var(--navy);
  color: var(--on-navy);
  font-size: 36px;
}

/* Menú */
#screen-menu { gap: 18px; }
#screen-menu h1 { font-size: 56px; }
.menu-list {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.card {
  flex: 1 1 0;
  min-height: 150px;
  display: grid;
  grid-template-columns: 108px 1fr auto;
  gap: 16px;
  align-items: center;
  text-align: left;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  position: relative;
}
.card-icon {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--raised);
  color: var(--ochre-deep);
}
.card-icon .ico { width: 56px; height: 56px; }
.card h2 {
  font-family: var(--serif);
  font-size: 36px;
  color: var(--navy);
  line-height: 1.1;
}
.card p { margin-top: 6px; font-size: 26px; line-height: 1.25; color: var(--muted); }
.card-meta { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.time {
  font-size: 22px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ochre-deep);
}
.badge {
  font-size: 20px;
  font-weight: 750;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  background: var(--olive);
  border-radius: 999px;
  padding: 4px 10px;
}
.play-pill {
  min-width: 148px;
  min-height: 88px;
  padding: 0 16px;
  border-radius: 14px;
  background: var(--charcoal);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 750;
}
.menu-links { display: grid; grid-template-columns: 1.4fr 1fr; gap: 12px; }
.menu-links button { min-height: 88px; font-size: 28px; }

/* Ruta, final y juegos */
.screen-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.screen-head h1 { font-size: 52px; }
.grow { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; gap: 14px; }
.row-actions { display: flex; gap: 12px; }
.row-actions > * { flex: 1 1 0; }

.place-list { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.place {
  min-height: 92px;
  border-radius: 14px;
  background: var(--surface);
  border: 2px solid var(--line);
  color: var(--navy);
  font-size: 28px;
  font-weight: 750;
  padding: 10px 12px;
}
.place[aria-pressed="true"] {
  background: var(--navy);
  color: var(--on-navy);
  border-color: var(--navy);
}
.fact {
  background: var(--surface);
  border-radius: 18px;
  border-left: 8px solid var(--ochre);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fact h2 { font-family: var(--serif); font-size: 40px; color: var(--navy); }
.fact p, .story { font-size: 30px; line-height: 1.35; color: var(--ink); }
.step {
  font-size: 26px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ochre-deep);
}
.town-art {
  width: 100%;
  height: 380px;
  border-radius: 18px;
  overflow: hidden;
  background: #d7c4a4;
}
.town-art svg { width: 100%; height: 100%; display: block; }
.choices { display: flex; flex-direction: column; gap: 12px; }
.album {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-height: 0;
}
.memory {
  background: var(--surface);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
}
.memory .ico { width: 48px; height: 48px; color: var(--ochre-deep); flex: 0 0 auto; }
.memory strong { display: block; font-size: 28px; color: var(--navy); }
.memory span { font-size: 22px; color: var(--muted); }

/* Maleta */
.suitcase {
  min-height: 210px;
  border-radius: 22px;
  border: 3px dashed rgba(26, 43, 95, 0.35);
  background: var(--surface);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px;
  align-content: flex-start;
}
.suitcase.is-over { border-color: var(--navy); background: #efe4d2; }
.slot {
  min-width: 180px;
  min-height: 88px;
  padding: 8px 12px;
  border-radius: 14px;
  background: var(--raised);
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 26px;
  font-weight: 700;
  border: 1px solid var(--line);
}
.tray {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.item {
  min-height: 128px;
  border-radius: 16px;
  background: var(--surface);
  border: 2px solid var(--line);
  color: var(--navy);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 24px;
  font-weight: 700;
  padding: 8px;
}
.item .ico { width: 44px; height: 44px; color: var(--ochre-deep); }
.item.is-packed { opacity: 0.35; }
.ghost {
  position: absolute;
  z-index: 6;
  width: 160px;
  min-height: 88px;
  margin-left: -80px;
  margin-top: -44px;
  pointer-events: none;
  border-radius: 16px;
  background: var(--navy);
  color: var(--on-navy);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 24px;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(17, 28, 48, 0.25);
}
.counter { font-family: var(--serif); font-size: 40px; color: var(--navy); }

/* Memory */
.board {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: 1fr 1fr;
  gap: 14px;
}
.flip {
  min-height: 0;
  perspective: 900px;
}
.flip-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 0.45s ease-in-out;
}
.flip.is-up .flip-inner, .flip.is-matched .flip-inner { transform: rotateY(180deg); }
.face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 12px;
  font-family: var(--serif);
  font-size: 36px;
  font-weight: 700;
}
.face.front {
  background: var(--navy);
  color: var(--gold);
  border: 2px solid rgba(228, 205, 154, 0.4);
}
.face.back {
  background: var(--surface);
  color: var(--navy);
  transform: rotateY(180deg);
  border: 2px solid var(--line);
  flex-direction: column;
  gap: 8px;
}
.face.back small { font-family: var(--sans); font-size: 22px; font-weight: 750; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ochre-deep); }
.flip.is-matched .face.back { background: #e5efe4; border-color: var(--olive); }

/* Busca y encuentra */
.scene {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  border-radius: 18px;
  overflow: hidden;
  background: #d7c4a4;
}
.scene svg { width: 100%; height: 100%; display: block; }
.spot {
  position: absolute;
  width: 96px;
  height: 96px;
  margin: -48px 0 0 -48px;
  border-radius: 50%;
  color: var(--navy);
  background: rgba(246, 240, 231, 0.28);
  border: 2px solid rgba(26, 43, 95, 0.18);
  display: grid;
  place-items: center;
}
.spot .ico { width: 42px; height: 42px; opacity: 0.55; }
.spot.is-found {
  background: var(--surface);
  border-color: var(--olive);
  color: var(--olive);
}
.spot.is-found .ico { opacity: 1; }
.spot.is-hint {
  animation: hint 1.2s ease-in-out 2;
  background: rgba(228, 205, 154, 0.85);
}
@keyframes hint {
  50% { transform: scale(1.08); }
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 64px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--navy);
  font-size: 24px;
  font-weight: 700;
  border: 1px solid var(--line);
}
.chip.is-found { background: var(--olive); color: #fff; border-color: var(--olive); }

/* Postal */
#screen-g5 { gap: 12px; padding-top: 20px; }
.learned { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.learned li {
  background: var(--surface);
  border-left: 8px solid var(--ochre);
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 28px;
  line-height: 1.3;
  color: var(--ink);
}
.postal-wrap {
  height: 390px;
  border-radius: 16px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
}
#postal-canvas { width: auto; height: 100%; max-width: 100%; }
.fields { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.field {
  min-height: 92px;
  text-align: left;
  border-radius: 14px;
  border: 2px solid var(--line);
  background: var(--surface);
  padding: 10px 14px;
  color: var(--navy);
}
.field small { display: block; font-size: 20px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ochre-deep); font-weight: 750; }
.field strong {
  display: block;
  margin-top: 4px;
  font-size: 30px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.field.is-on { border-color: var(--navy); box-shadow: inset 0 0 0 2px var(--navy); }
.pickers { display: flex; flex-direction: column; gap: 8px; }
.picker { display: flex; gap: 8px; }
.picker button {
  flex: 1 1 0;
  min-height: 72px;
  border-radius: 12px;
  background: var(--surface);
  border: 2px solid var(--line);
  color: var(--navy);
  font-size: 22px;
  font-weight: 750;
  padding: 6px;
}
.picker button[aria-pressed="true"] { background: var(--navy); color: var(--on-navy); border-color: var(--navy); }
.kb {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.kb-row { display: flex; gap: 8px; }
.key {
  flex: 1 1 0;
  min-height: 80px;
  border-radius: 12px;
  background: var(--surface);
  color: var(--navy);
  font-size: 30px;
  font-weight: 700;
  border: 1px solid var(--line);
}
.key.wide { flex: 1.7 1 0; font-size: 24px; }
.g5-actions { display: grid; grid-template-columns: 1.3fr 1fr 0.9fr; gap: 10px; }
.g5-actions button { min-height: 88px; font-size: 28px; }

.overlay {
  position: absolute;
  inset: 0;
  z-index: 8;
  background: rgba(17, 28, 48, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
}
.overlay-card {
  width: min(820px, 100%);
  background: var(--surface);
  border-radius: 24px;
  padding: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  text-align: center;
}
.overlay-card h2 { font-family: var(--serif); font-size: 48px; color: var(--navy); }
.overlay-card p { font-size: 28px; color: var(--muted); }
#qr-canvas { width: 420px; height: 420px; background: #fff; border-radius: 12px; }

#live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.ico { width: 40px; height: 40px; display: block; }

@media (prefers-reduced-motion: reduce) {
  .pulse-dot, .spot.is-hint, .flip-inner { animation: none !important; transition: none !important; }
  .traveler { display: none; }
}
