/* ============================================================
   1 ANO DE AMIZADE — mobile-first stylesheet
   Base = mobile. Media queries (min-width) apenas AUMENTAM/refinam.
   ============================================================ */

:root {
  --bg: #0e0d0b;
  --bg-2: #17140f;
  --panel: #1d1a14;
  --text: #f5f1e8;
  --muted: #a39a89;
  --accent: #ffb703;
  --accent-2: #2dd4bf;
  --pink: #ff6b9d;
  --gold: #ffd166;
  --ok: #4dff9e;
  --radius: 14px;
  --pad: clamp(16px, 5vw, 32px);
  --maxw: 480px;
  --font: "Courier New", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  width: 100%;
  overflow-x: hidden;
}

body { min-height: 100svh; display: flex; flex-direction: column; }

#app {
  position: relative;
  width: 100%;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--pad);
}

/* ---------- HUD (discreto, sem barra de fase — a navegação é livre pelo mapa) ---------- */
#hud {
  position: fixed;
  top: 14px; left: 14px; right: 14px;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}
#hud.visible { display: flex; }
#hud > * { pointer-events: auto; }

.hud-xp {
  font-size: 12px;
  color: var(--gold);
  font-weight: bold;
  white-space: nowrap;
  background: rgba(14,13,11,0.8);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 6px 12px;
  backdrop-filter: blur(4px);
}

#mute-btn {
  background: rgba(14,13,11,0.8);
  border: 1px solid rgba(255,255,255,0.15);
  color: var(--text);
  border-radius: 8px;
  width: 34px; height: 34px;
  font-size: 14px;
  flex-shrink: 0;
  backdrop-filter: blur(4px);
}

/* ---------- Screens ---------- */
.screen {
  display: none;
  width: 100%;
  max-width: var(--maxw);
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 18px;
  animation: fadeSlideIn .5s ease both;
}
.screen.active { display: flex; }

@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: 0.5px; }
h1 { font-size: clamp(20px, 6vw, 28px); }
h2 { font-size: clamp(17px, 5vw, 22px); color: var(--accent-2); }
p { margin: 0; line-height: 1.6; color: var(--muted); font-size: clamp(14px, 4vw, 16px); }
.big-emoji { font-size: clamp(48px, 16vw, 72px); line-height: 1; }

.block-banner {
  font-size: 8px;
  letter-spacing: 2px;
  color: var(--accent-2);
  opacity: 0.5;
  line-height: 1.4;
  white-space: pre;
  overflow: hidden;
  width: 100%;
}

.tag { font-size: 11px; letter-spacing: 3px; text-transform: uppercase; color: var(--muted); }

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  font-size: clamp(14px, 4vw, 16px);
  font-weight: 700;
  padding: 16px 28px;
  border-radius: 10px;
  min-height: 52px;
  width: 100%;
  max-width: 320px;
  transition: transform .15s ease, box-shadow .15s ease, opacity .15s ease;
  touch-action: manipulation;
}
.btn:active { transform: scale(0.96); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; box-shadow: none; }
.btn:disabled:active { transform: none; }

.btn-primary {
  background: var(--accent);
  color: #241800;
  box-shadow: 0 4px 0 #b98300, 0 8px 20px rgba(255,183,3,0.25);
}
.btn-primary:active { box-shadow: 0 2px 0 #b98300; }

.btn-secondary { background: transparent; color: var(--text); border: 1px solid rgba(255,255,255,0.2); }
.btn-ghost { background: var(--panel); color: var(--accent-2); border: 1px solid rgba(45,212,191,0.25); }

.btn-row { display: flex; flex-direction: column; gap: 12px; width: 100%; align-items: center; }

/* ---------- Panel ---------- */
.panel {
  width: 100%;
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: clamp(18px, 6vw, 28px);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* ---------- Scan lines (Cap. 1) ---------- */
.scan-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  opacity: 0;
  color: var(--muted);
  animation: scanIn .4s ease forwards;
}
.scan-line .mark { color: var(--ok); font-weight: bold; width: 18px; flex-shrink: 0; }
@keyframes scanIn { to { opacity: 1; } }

/* ---------- Quiz ---------- */
.quiz-options { display: flex; flex-direction: column; gap: 10px; width: 100%; }
.quiz-opt {
  background: var(--panel);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--text);
  border-radius: 10px;
  padding: 14px 16px;
  font-family: var(--font);
  font-size: clamp(14px, 4vw, 15px);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  min-height: 48px;
}
.quiz-opt:active { border-color: var(--accent-2); }
.quiz-opt .bullet { color: var(--accent-2); }

/* ---------- Baú / arrastar chave ---------- */
.chest-arena {
  position: relative;
  width: 100%;
  height: 240px;
  background: radial-gradient(circle at 50% 100%, #2a1f0a 0%, var(--bg-2) 70%);
  border-radius: var(--radius);
  border: 1px solid rgba(255,255,255,0.06);
  overflow: hidden;
  touch-action: none;
  user-select: none;
}
.chest-emoji {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: clamp(64px, 20vw, 90px);
  transition: transform .3s ease, filter .3s ease;
}
.chest-emoji.unlocking { animation: chestShake .4s ease; }
.chest-emoji.opened { transform: translateX(-50%) scale(1.15); filter: drop-shadow(0 0 16px var(--gold)); }
@keyframes chestShake {
  0%, 100% { transform: translateX(-50%) rotate(0deg); }
  25% { transform: translateX(-50%) rotate(-6deg); }
  75% { transform: translateX(-50%) rotate(6deg); }
}
.key-drag {
  position: absolute;
  top: 20px;
  left: 20px;
  font-size: clamp(38px, 11vw, 50px);
  cursor: grab;
  touch-action: none;
  filter: drop-shadow(0 4px 6px rgba(0,0,0,0.4));
  z-index: 5;
}
.key-drag.dragging { cursor: grabbing; }
.dropzone-hint {
  position: absolute;
  top: 16px;
  right: 16px;
  font-size: 10px;
  color: var(--muted);
  text-align: right;
  max-width: 100px;
}

/* ---------- Encontrar o detalhe (emoji grid) ---------- */
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  width: 100%;
}
.emoji-tile {
  background: var(--panel);
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 12px 2px;
  font-size: clamp(22px, 7vw, 28px);
  cursor: pointer;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.emoji-tile:active { transform: scale(0.94); }
.emoji-tile.wrong-shake { animation: chestShake .3s ease; }
.emoji-tile.found { border-color: var(--gold); box-shadow: 0 0 14px rgba(255,209,102,0.4); }

/* ---------- Barras de análise (Cap. Consultório) ---------- */
.stat-row { width: 100%; display: flex; flex-direction: column; gap: 4px; text-align: left; }
.stat-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.stat-label b { color: var(--text); }
.stat-bar { width: 100%; height: 10px; background: rgba(255,255,255,0.08); border-radius: 6px; overflow: hidden; }
.stat-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: 6px; transition: width 1.1s cubic-bezier(.2,.8,.2,1); }

@keyframes popIn { from { opacity: 0; transform: scale(0.6); } to { opacity: 1; transform: scale(1); } }

/* ---------- Mapa do Museu (hub não-linear) ---------- */
.museum-header { display: flex; flex-direction: column; gap: 6px; align-items: center; }
.visited-count { font-size: 12px; color: var(--accent-2); }

.door-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  width: 100%;
}
.door-tile {
  position: relative;
  background: var(--panel);
  border: 2px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 18px 8px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  min-height: 108px;
  color: var(--text);
}
.door-tile .door-icon { font-size: clamp(30px, 9vw, 38px); }
.door-tile .door-name { font-size: 12px; font-weight: bold; text-align: center; }
.door-tile .door-status { font-size: 9px; color: var(--muted); letter-spacing: 0.5px; text-transform: uppercase; }
.door-tile:active { transform: scale(0.96); }
.door-tile.visited { border-color: var(--ok); }
.door-tile.visited .door-status { color: var(--ok); }
.door-tile.locked { opacity: 0.45; cursor: not-allowed; }
.door-tile.unlockable {
  border-color: var(--gold);
  animation: doorGlow 1.4s ease-in-out infinite;
}
.door-tile.unlockable .door-status { color: var(--gold); }
@keyframes doorGlow {
  0%, 100% { box-shadow: 0 0 6px rgba(255,209,102,0.15); }
  50% { box-shadow: 0 0 18px rgba(255,209,102,0.5); }
}
.door-badge {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 13px;
}

/* ---------- Sala (modal em tela cheia) ---------- */
.room-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: none;
  align-items: center;
  justify-content: center;
  padding: var(--pad);
  background: var(--bg);
  overflow-y: auto;
}
.room-modal.open { display: flex; animation: fadeSlideIn .35s ease both; }
.room-inner {
  width: 100%;
  max-width: var(--maxw);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 18px;
  margin: auto;
}
.room-eyebrow { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }

/* ---------- Typing text ---------- */
.typing-text { font-size: clamp(15px, 4.5vw, 18px); min-height: 3em; white-space: pre-wrap; color: var(--text); }
.typing-cursor::after { content: "▌"; animation: blink 1s step-start infinite; color: var(--accent-2); }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Foto dela ---------- */
.photo-frame {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: 3px solid var(--gold);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--panel);
  font-size: 48px;
  box-shadow: 0 0 24px rgba(255,209,102,0.35);
}
.photo-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- Boot ---------- */
.loading-bar { width: 100%; max-width: 260px; height: 14px; background: rgba(255,255,255,0.08); border-radius: 8px; overflow: hidden; border: 1px solid rgba(255,255,255,0.1); }
.loading-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .3s ease; }

/* ---------- Toast ---------- */
#toast-container {
  position: fixed;
  top: 60px; left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(90vw, 320px);
  pointer-events: none;
}
.toast {
  background: var(--panel);
  border: 1px solid var(--gold);
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--gold);
  display: flex;
  align-items: center;
  gap: 8px;
  animation: toastIn .3s ease, toastOut .3s ease 2.6s forwards;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

/* ---------- Floating points ---------- */
.xp-float {
  position: fixed;
  z-index: 90;
  font-size: 13px;
  font-weight: bold;
  color: var(--gold);
  pointer-events: none;
  animation: xpFloat 0.9s ease forwards;
}
@keyframes xpFloat { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-36px); } }

/* ---------- Confetti ---------- */
#confetti-canvas { position: fixed; inset: 0; z-index: 80; pointer-events: none; width: 100%; height: 100%; }

/* ---------- Créditos ---------- */
.credits-list { display: flex; flex-direction: column; gap: 16px; width: 100%; }
.credit-row { display: flex; flex-direction: column; gap: 2px; opacity: 0; animation: popIn .5s ease forwards; }
.credit-role { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.credit-name { font-size: 16px; color: var(--accent-2); }

/* ---------- Achievements ---------- */
.ach-list { display: flex; flex-direction: column; gap: 8px; width: 100%; text-align: left; }
.ach-item { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); background: var(--panel); border-radius: 8px; padding: 10px 12px; }
.ach-item.unlocked { color: var(--gold); }

/* ============================================================
   TABLET / DESKTOP — refinamentos apenas
   ============================================================ */
@media (min-width: 640px) {
  :root { --maxw: 560px; }
  .chest-arena { height: 280px; }
}
@media (min-width: 1024px) {
  :root { --maxw: 620px; }
  #app { padding: 40px; }
  .btn:hover { transform: translateY(-2px); }
  .quiz-opt:hover { border-color: var(--accent-2); }
  .emoji-tile:hover { border-color: var(--accent-2); }
  .door-tile:not(.locked):hover { border-color: var(--accent-2); transform: translateY(-2px); }
}
@media (max-height: 700px) { .screen { gap: 12px; } }
