:root {
  color-scheme: dark;
  --ink: #f6f2ed;
  --muted: #a9b2c5;
  --panel: #121d32;
  --panel-2: #19263d;
  --line: #71809e;
  --bg: #080d18;
  --accent: #ff5c76;
  --accent-dark: #b93753;
  --focus: #9be7ff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 20% 10%, rgba(72, 84, 116, 0.24), transparent 32rem),
    linear-gradient(145deg, #090d16, #111827 55%, #070b12);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
}

button { font: inherit; }

button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.prototype-shell {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(15rem, 23rem) minmax(20rem, 27rem);
  align-items: center;
  justify-content: center;
  gap: clamp(2rem, 6vw, 7rem);
  padding: 2rem;
}

.prototype-note {
  max-width: 23rem;
  color: var(--muted);
  line-height: 1.6;
}

.prototype-note span {
  display: block;
  color: var(--ink);
  font: 700 0.82rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.13em;
}

.prototype-note p { margin: 0.9rem 0 0; }

.phone {
  width: min(100%, 27rem);
  height: min(90svh, 54rem);
  min-height: 40rem;
  padding: 0.75rem;
  border: 1px solid #697389;
  border-radius: 2.7rem;
  background: #03060c;
  box-shadow: var(--shadow), inset 0 0 0 3px #1e2634;
}

.safe-area {
  height: 100%;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  border-radius: 2rem;
  background: var(--bg);
  position: relative;
}

.safe-area::before {
  content: "";
  width: 8rem;
  height: 1.35rem;
  border-radius: 0 0 0.9rem 0.9rem;
  background: #03060c;
  position: absolute;
  top: 0;
  left: 50%;
  translate: -50% 0;
  z-index: 5;
}

.game-header,
.game-footer {
  min-height: 3.6rem;
  display: grid;
  grid-template-columns: 3rem 1fr 3rem;
  align-items: center;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid rgba(113, 128, 158, 0.35);
  background: rgba(8, 13, 24, 0.94);
  z-index: 3;
}

.game-header.is-loading { visibility: hidden; }

.game-footer {
  min-height: 3.25rem;
  grid-template-columns: 1fr auto;
  border-top: 1px solid rgba(113, 128, 158, 0.35);
  border-bottom: 0;
}

.brand-mini {
  text-align: center;
  font: 900 0.78rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.07em;
}

.brand-mini span,
.logo-title span { color: var(--accent); }

.icon-button,
.text-button {
  min-width: 2.65rem;
  min-height: 2.65rem;
  border: 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
}

.icon-button { font-size: 1.25rem; }

.text-button {
  min-width: auto;
  color: var(--muted);
  font: 700 0.74rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}

.is-hidden { visibility: hidden !important; pointer-events: none !important; }

.game {
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  background:
    radial-gradient(circle at 85% 15%, rgba(109, 125, 158, 0.12), transparent 12rem),
    linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px),
    var(--bg);
  background-size: auto, 16px 16px, 16px 16px, auto;
}

.screen {
  min-height: 100%;
  padding: 1.15rem 1.15rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.85rem;
  opacity: 0;
  transform: translateY(5px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.screen.is-visible { opacity: 1; transform: none; }

.screen h1 {
  margin: 0;
  text-align: center;
  font: 900 clamp(1.25rem, 4vw, 1.7rem)/1.1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.01em;
}

.eyebrow,
.level-pill {
  align-self: center;
  padding: 0.4rem 0.7rem;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--panel);
  font: 800 0.72rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.level-pill { border-radius: 0.2rem; }

.scene {
  min-height: 9rem;
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  border: 1px solid var(--line);
  background: linear-gradient(150deg, #26334a, #101a2b);
  text-align: center;
}

.scene-grid {
  position: absolute;
  inset: 0;
  opacity: 0.18;
  background:
    linear-gradient(90deg, transparent 49%, #fff 50%, transparent 51%),
    linear-gradient(transparent 49%, #fff 50%, transparent 51%);
  background-size: 22px 22px;
}

.scene > *:not(.scene-grid) { position: relative; }

.scene--art {
  margin: 0;
  padding: 0;
  background: #0c1525;
  border-color: #8291ad;
  box-shadow: 0 0 0 3px rgba(8, 13, 24, 0.75), 0 8px 22px rgba(0, 0, 0, 0.32);
}

.scene--art img {
  width: 100%;
  height: 100%;
  min-height: inherit;
  display: block;
  object-fit: cover;
  image-rendering: auto;
}

.scene-caption {
  position: absolute !important;
  right: 0.45rem;
  bottom: 0.4rem;
  padding: 0.28rem 0.4rem;
  color: rgba(255, 255, 255, 0.76);
  background: rgba(5, 9, 20, 0.72);
  font: 700 0.55rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.08em;
}

.scene strong {
  max-width: 18rem;
  font: 700 0.95rem/1.35 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.scene-label,
.scene-note {
  color: var(--muted);
  font: 700 0.62rem/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.1em;
}

.scene-note { letter-spacing: 0; }
.scene--hero { min-height: 13rem; }
.scene--large { min-height: 15rem; }
.scene--compact { min-height: 8rem; }
.scene--photo { min-height: 16rem; border: 0.65rem solid #e8e4dc; color: #111827; background: #aab2c1; transform: rotate(-1.2deg); }
.scene--photo.scene--art { padding: 0; }
.scene--proposal { min-height: 18rem; }
.scene--night { background: linear-gradient(155deg, #1a2944, #090f1d); }

.logo-title {
  font-size: clamp(2.6rem, 12vw, 4.6rem) !important;
  line-height: 0.82 !important;
  letter-spacing: -0.08em !important;
  text-shadow: 4px 4px 0 #27334a;
}

.subtitle,
.microcopy {
  margin: 0;
  text-align: center;
  color: var(--muted);
  line-height: 1.45;
}

.microcopy { font-size: 0.78rem; }

.copy { color: #e6e8ee; line-height: 1.55; }
.copy p { margin: 0; }
.copy p + p { margin-top: 0.7rem; }
.compact-copy { text-align: center; font-size: 0.92rem; }

.dialog-card,
.question-card,
.feedback {
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 1rem;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.2);
}

.dialog-card h1 { margin: 0.8rem 0; }
.memory-card {
  display: grid;
  gap: 1rem;
  text-align: center;
}
.memory-card .eyebrow {
  display: block;
  width: fit-content;
  margin: 0 auto;
  line-height: 1.25;
}
.memory-card .copy { margin-top: 0.1rem; }
.question-card h1 { font-size: 1.08rem; line-height: 1.35; }

.screen-actions { display: grid; gap: 0.65rem; }

.primary-button,
.secondary-button {
  width: 100%;
  min-height: 3.2rem;
  border: 2px solid var(--line);
  padding: 0.75rem 1rem;
  color: var(--ink);
  background: var(--panel-2);
  box-shadow: 4px 4px 0 #050914;
  cursor: pointer;
  font: 800 0.82rem/1.25 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.03em;
  transition: transform 120ms ease, filter 120ms ease;
}

.primary-button { border-color: #ff8da0; background: var(--accent-dark); }
.primary-button:hover:not(:disabled), .secondary-button:hover { filter: brightness(1.15); transform: translateY(-1px); }
.primary-button:active:not(:disabled), .secondary-button:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 #050914; }
.primary-button:disabled { cursor: not-allowed; opacity: 0.34; }

.choice-list { display: grid; gap: 0.55rem; }

.choice-button {
  min-height: 3rem;
  display: grid;
  grid-template-columns: 2.3rem 1fr;
  align-items: center;
  gap: 0.7rem;
  border: 1px solid var(--line);
  padding: 0.45rem 0.65rem;
  color: var(--ink);
  background: #101a2b;
  text-align: left;
  cursor: pointer;
}

.choice-button.is-selected { border-color: var(--accent); background: #2a1b2a; }

.choice-index {
  display: grid;
  place-items: center;
  min-height: 2rem;
  border: 1px solid currentColor;
  font: 800 0.85rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.feedback { border-color: var(--accent); }
.feedback span { color: #ff9aad; font: 800 0.68rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.08em; }
.feedback p { margin: 0.45rem 0 0; line-height: 1.4; }

.map-board {
  min-height: 18rem;
  position: relative;
  border: 1px solid var(--line);
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 50%, transparent 0 34%, #506078 35% 37%, transparent 38%),
    linear-gradient(135deg, #1c2a41, #27374c 50%, #101a2c);
}

.map-board::after {
  content: "MAPA ESQUEMÁTICO";
  position: absolute;
  right: 0.6rem;
  bottom: 0.5rem;
  color: rgba(255,255,255,0.35);
  font: 700 0.58rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.map-board--art {
  background-position: center;
  background-size: cover;
  box-shadow: inset 0 0 0 3px rgba(5, 9, 20, 0.46);
}

.map-pin {
  position: absolute;
  left: var(--x);
  top: var(--y);
  translate: -50% -50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  border: 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font: 700 0.65rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-shadow: 0 1px 2px #000;
}

.map-pin span { width: 1.25rem; height: 1.25rem; border: 3px solid #cbd2df; border-radius: 50%; background: var(--panel); }
.map-pin.is-selected span { border-color: var(--accent); background: var(--accent); box-shadow: 0 0 0 5px rgba(255,92,118,0.18); }

.room-board { border: 1px solid var(--line); padding: 0.75rem; background: #172339; }
.room-label { display: block; margin-bottom: 0.7rem; color: var(--muted); text-align: center; font: 700 0.6rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: 0.08em; }
.treasure-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.55rem; }

.room-board--art {
  min-height: 18rem;
  position: relative;
  padding: 0;
  overflow: hidden;
  background-position: center;
  background-size: cover;
  box-shadow: inset 0 0 0 3px rgba(5, 9, 20, 0.38);
}

.room-board--art .room-label {
  position: absolute;
  top: 0.45rem;
  left: 50%;
  translate: -50% 0;
  z-index: 2;
  width: max-content;
  max-width: calc(100% - 1rem);
  padding: 0.35rem 0.5rem;
  background: rgba(5, 9, 20, 0.78);
}

.room-board--art .treasure-grid {
  position: absolute;
  inset: 0;
  display: block;
}

.treasure {
  min-height: 9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 1px dashed var(--line);
  color: var(--ink);
  background: #0d1627;
  cursor: pointer;
  text-align: center;
  padding: 0.5rem;
  font-size: 0.76rem;
}

.treasure.is-found { border-style: solid; border-color: var(--accent); background: #2a1b2a; }
.treasure-icon { font: 900 2rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.treasure small { color: var(--muted); font: 700 0.58rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.treasure--hotspot {
  min-height: 0;
  width: 3.25rem;
  height: 3.25rem;
  position: absolute;
  left: var(--x);
  top: var(--y);
  translate: -50% -50%;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  animation: none;
}
.treasure--hotspot .treasure-icon { opacity: 0; font-size: 1rem; }
.treasure--hotspot .treasure-name {
  position: absolute;
  left: 50%;
  top: calc(100% + 0.35rem);
  translate: -50% 0;
  width: max-content;
  max-width: 7rem;
  padding: 0.25rem 0.35rem;
  color: #fff;
  background: rgba(8, 17, 31, 0.88);
  font: 700 0.58rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.treasure--hotspot .treasure-name:empty { display: none; }
.treasure--hotspot.is-hint {
  border-color: rgba(255, 255, 255, 0.85);
  background: rgba(8, 17, 31, 0.48);
  box-shadow: 0 0 0 4px rgba(242, 78, 106, 0.22);
  animation: hotspot 1.1s ease-in-out infinite alternate;
}
.treasure--hotspot.is-hint .treasure-icon { opacity: 1; }
.treasure--hotspot.is-found {
  color: #fff;
  border-color: var(--accent);
  background: rgba(169, 47, 75, 0.88);
  box-shadow: 0 0 0 3px rgba(242, 78, 106, 0.16);
  animation: none;
}
.treasure--hotspot.is-found .treasure-icon { opacity: 1; }
.hunt-status { text-align: center; color: var(--muted); font: 800 0.72rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; }

.treasure-memory-screen { justify-content: center; }

.narrative-screen { justify-content: center; }
.emotional-copy { font-size: 1.02rem; text-align: center; }
.proposal-copy { text-align: center; }
.proposal-copy h1 { margin-top: 1rem; color: #fff; font-size: 1.45rem; }

.centered-screen { justify-content: center; }
.manual-icon { width: 3rem; height: 3rem; display: grid; place-items: center; margin: 0 auto; border: 2px solid var(--accent); color: var(--accent); font: 900 1.4rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; }

.pause-screen {
  text-align: center;
  background:
    radial-gradient(circle at 50% 40%, rgba(242, 78, 106, 0.15), transparent 15rem),
    linear-gradient(#0b1322, #050914);
}
.pause-symbol {
  color: var(--accent);
  font-size: 4.5rem;
  filter: drop-shadow(0 0 18px rgba(242, 78, 106, 0.4));
  animation: pulse 1.1s ease-in-out infinite alternate;
}
.pause-card { display: grid; gap: 1rem; }
.pause-card .eyebrow { display: block; width: fit-content; margin: 0 auto; }
.pause-card p:last-child { font-size: 1.3rem; color: #fff; }

.epilogue-screen { justify-content: center; }
.epilogue-copy { display: grid; gap: 0.7rem; text-align: center; }
.epilogue-copy h1 { color: #fff; }

.celebration { display: flex; justify-content: space-around; color: var(--accent); font-size: 1.4rem; animation: bob 1.1s ease-in-out infinite alternate; }

.timeline { list-style: none; display: grid; gap: 0.6rem; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 2.7rem 1fr; align-items: center; gap: 0.7rem; border: 1px solid var(--line); padding: 0.65rem; background: var(--panel); }
.timeline li > span { display: grid; place-items: center; min-height: 2.5rem; color: var(--accent); border: 1px solid var(--accent); font: 900 0.82rem/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.timeline strong, .timeline small { display: block; }
.timeline strong { font-size: 0.88rem; }
.timeline small { margin-top: 0.25rem; color: var(--muted); }

.hearts { display: flex; gap: 0.3rem; }
.heart { color: #4d596e; font-size: 1.18rem; }
.heart.is-full { color: var(--accent); filter: drop-shadow(0 0 4px rgba(255,92,118,0.4)); }

.loading-screen { align-items: center; justify-content: center; text-align: center; }
.loading-screen p { color: var(--muted); }
.loading-heart { color: var(--accent); font-size: 4rem; animation: pulse 700ms ease-in-out infinite alternate; }
.loading-bar { width: min(14rem, 80%); height: 0.65rem; border: 1px solid var(--line); padding: 2px; }
.loading-bar span { display: block; width: 100%; height: 100%; background: var(--accent); transform-origin: left; animation: load 1s ease-out both; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  translate: -50% 1rem;
  z-index: 10;
  padding: 0.75rem 1rem;
  border: 1px solid #ff8da0;
  background: #381a28;
  color: #fff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  font: 800 0.72rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.05em;
  transition: opacity 160ms ease, translate 160ms ease;
}

.toast.is-visible { opacity: 1; translate: -50% 0; }

@keyframes pulse { to { transform: scale(1.15); } }
@keyframes load { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes bob { to { transform: translateY(-0.25rem); } }
@keyframes hotspot { to { box-shadow: 0 0 0 8px rgba(242, 78, 106, 0.1), 0 3px 8px rgba(0, 0, 0, 0.45); } }

@media (max-width: 760px) {
  body { background: var(--bg); }
  .prototype-shell { display: block; min-height: 100svh; padding: 0; }
  .prototype-note { display: none; }
  .phone { width: 100%; height: 100svh; min-height: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none; }
  .safe-area { border-radius: 0; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  .safe-area::before { display: none; }
  .screen { padding-inline: 1rem; }
}

@media (max-height: 740px) and (min-width: 761px) {
  .phone { height: 96svh; min-height: 34rem; }
  .scene--hero, .scene--large, .scene--proposal { min-height: 11rem; }
  .screen { gap: 0.65rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
