/* ============================================================
   HOSPITAL SEGURO · NR-1 — estética cozy/pixel RPG
   ============================================================ */

:root {
  --ink: #24313a;
  --ink-soft: #51616b;
  --paper: #f6f1e5;
  --teal: #31535c;
  --teal-soft: #dce7e4;
  --accent: #e0685a;
  --accent-deep: #c25045;
  --gold: #d9a32c;
  --brand: oklch(54.1% 0.222 314.9);
  --shadow: 0 18px 40px -12px rgb(36 49 58 / 0.35);
  --radius: 18px;
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--paper);
  overflow: hidden;
}

kbd {
  font-family: var(--mono);
  background: #fff;
  border: 1px solid #d5cbb5;
  border-bottom-width: 3px;
  border-radius: 6px;
  padding: 2px 7px;
  font-size: 0.8em;
}

/* ============ TELAS ============ */

.screen { position: fixed; inset: 0; }

.intro-card {
  text-align: center;
  background: var(--paper);
  border-radius: 28px;
  padding: 48px 56px;
  max-width: 520px;
  box-shadow: var(--shadow);
  border: 3px solid #fff;
  animation: pop 0.5s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes pop {
  from { transform: scale(0.92) translateY(12px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.brand {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.8rem;
  letter-spacing: 0.28em;
  color: var(--brand);
  margin-bottom: 18px;
}
.brand span { font-weight: 800; }

.intro-card h1 {
  font-size: clamp(2.2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.05;
}

.intro-text {
  color: var(--ink-soft);
  line-height: 1.6;
  margin-bottom: 26px;
}

/* final */
.final {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #fff6e0, #ffe9c4);
}
.final .intro-card { max-width: 560px; }
.final-stat { margin-top: 14px; font-size: 1.2rem; font-weight: 700; color: var(--ink); }
.final-stat.xp { color: var(--gold); }
.final .intro-text { font-size: 1.05rem; }

/* ============ BOTÕES ============ */

.btn {
  font-family: var(--font);
  font-weight: 800;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  padding: 12px 22px;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
  color: #fff;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: default; }

.btn-primary {
  background: var(--brand);
  box-shadow: 0 6px 0 -2px color-mix(in srgb, var(--brand) 55%, black);
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.06);
}

.btn-ghost {
  background: transparent;
  color: var(--teal);
  border: 2px solid var(--teal-soft);
}
.btn-ghost:hover { background: var(--teal-soft); }

.btn-danger {
  background: var(--accent);
  box-shadow: 0 6px 0 -2px color-mix(in srgb, var(--accent) 60%, black);
}

.btn-big { font-size: 1.1rem; padding: 16px 34px; border-radius: 16px; }
.mt { margin-top: 14px; }
.btn-block { width: 100%; }

/* ============ GAME ============ */

.game { background: #c9d8d4; }

.hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 12px 20px;
  background: linear-gradient(to bottom, rgb(49 83 92 / 0.9), rgb(49 83 92 / 0.55));
  backdrop-filter: blur(4px);
  color: #fff;
}

.hud-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  line-height: 1.15;
}
.hud-brand b { letter-spacing: 0.3em; font-size: 0.9rem; }
.hud-cross {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  background: var(--accent);
  border-radius: 9px;
  font-weight: 800;
  font-size: 1.2rem;
  color: #fff;
}

.hud-progress {
  margin-left: auto;
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: #e9f0ee;
}
.hud-progress strong { font-size: 1rem; color: #fff; }

.hud-right { display: flex; align-items: center; gap: 12px; }

.hud-xp {
  font-weight: 800;
  font-size: 0.95rem;
  background: rgb(255 255 255 / 0.16);
  padding: 7px 14px;
  border-radius: 999px;
}

.icon-button {
  background: transparent;
  color: #fff;
  border: 2px solid rgb(255 255 255 / 0.5);
  border-radius: 10px;
  font-size: 1.2rem;
  width: 42px; height: 42px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.icon-button:hover { background: rgb(255 255 255 / 0.2); }

.music-button {
  font-size: 1.1rem;
  border-radius: 50%;
  transition: background 0.12s ease, opacity 0.12s ease, transform 0.12s ease;
}
.music-button:hover { transform: scale(1.08); }
.music-button.muted {
  opacity: 0.55;
  color: #ffe3dc;
  border-color: var(--accent);
}
.music-button.muted span {
  font-size: 0.9rem;
}

.game-viewport {
  position: fixed;
  inset: 64px 0 0 0;
  overflow: hidden;
  cursor: pointer;
}

.hospital-map {
  width: 100%;
  height: 100%;
  display: block;
}

.bottom-hint {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 20px;
  background: linear-gradient(to top, rgb(49 83 92 / 0.9), transparent);
  color: #e9f0ee;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  pointer-events: none;
}
.bottom-hint .keys { font-family: var(--mono); }

/* prompt */
.interaction-prompt {
  position: fixed;
  left: 50%;
  bottom: 56px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--paper);
  color: var(--ink);
  border-radius: 14px;
  padding: 10px 18px;
  box-shadow: var(--shadow);
  border: 2px solid #fff;
  font-weight: 700;
  font-size: 0.95rem;
  animation: pop 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  z-index: 15;
}
.interaction-prompt kbd {
  background: var(--teal);
  color: #fff;
  border: none;
  padding: 4px 10px;
}

/* ============ NPC ============ */

.npc { pointer-events: none; }
.npc-done { opacity: 1; }
.npc-done::after {
  content: '';
  position: absolute;
}

/* badge numérico sobre o NPC */
.npc-badge .badge-ring {
  stroke: #f6f1e5;
  opacity: 0.9;
}
.npc-badge .badge-dot {
  fill: #d9a32c;
  stroke: #8a6a1f;
  stroke-width: 2;
}
.npc-badge .badge-num {
  fill: #fff;
  font-family: var(--font);
  font-weight: 800;
  font-size: 17px;
}

/* bloqueado: cinza com cadeado */
.npc-badge.badge-locked .badge-dot {
  fill: #5d707a;
  stroke: #3a4850;
}
.npc-badge.badge-locked .badge-num {
  fill: #cdd8dc;
  font-size: 13px;
}

/* concluído: verde com check */
.npc-badge.badge-done .badge-dot {
  fill: #4e9a72;
  stroke: #2e7d5b;
}
.npc-badge.badge-done .badge-num {
  font-size: 15px;
}

/* atual (próxima aula): brilho pulsante para guiar */
.npc-badge.badge-current .badge-dot {
  fill: #ffb648;
  stroke: #8a6a1f;
}
.npc-badge.badge-current .badge-ring {
  stroke: #ffd88a;
  opacity: 1;
  animation: badgePulse 1.6s ease-in-out infinite;
}
@keyframes badgePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.35); opacity: 0.55; }
}

/* seta flutuante sobre o NPC da próxima aula */
.npc-pointer {
  transform-origin: 0 -92px;
}
@keyframes pointerBob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

/* ============ MENU ============ */

.side-menu {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(360px, 88vw);
  z-index: 40;
  background: var(--paper);
  padding: 24px;
  box-shadow: -18px 0 40px -12px rgb(36 49 58 / 0.4);
  transform: translateX(100%);
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
  overflow-y: auto;
  border-left: 3px solid #fff;
}
.side-menu.open { transform: translateX(0); }

.menu-eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.24em;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 6px;
}
.side-menu h2 { font-size: 1.5rem; font-weight: 800; margin-bottom: 16px; }

.menu-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}
.menu-stat {
  background: #fff;
  border: 2px solid var(--teal-soft);
  border-radius: 14px;
  padding: 12px;
  text-align: center;
}
.menu-stat span { display: block; font-size: 0.72rem; color: var(--ink-soft); letter-spacing: 0.08em; }
.menu-stat strong { font-size: 1.1rem; color: var(--teal); }

.journey-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }

.journey-item {
  display: flex;
  gap: 12px;
  align-items: center;
  background: #fff;
  border: 2px solid var(--teal-soft);
  border-radius: 12px;
  padding: 10px 14px;
}
.journey-item.locked { opacity: 0.6; }
.journey-item.done { border-color: var(--teal); background: #eef5f3; }
.journey-icon { font-size: 1.15rem; }
.journey-text { line-height: 1.25; }
.journey-text strong { font-size: 0.86rem; display: block; }
.journey-text small { font-size: 0.76rem; color: var(--ink-soft); }

.menu-actions { display: flex; flex-direction: column; gap: 8px; }
.menu-link {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  border: 2px solid var(--teal-soft);
  border-radius: 12px;
  padding: 12px 14px;
  font-family: var(--font);
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--ink);
  cursor: pointer;
}
.menu-link:hover { background: var(--teal-soft); }
.menu-link.danger { color: var(--accent-deep); }
.menu-link span { font-size: 1.1rem; }

.close-button {
  position: absolute;
  top: 14px; right: 14px;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--ink-soft);
  cursor: pointer;
  width: 36px; height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
}
.close-button:hover { background: #eee; }

/* ============ MODAL ============ */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgb(24 33 38 / 0.55);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal {
  position: relative;
  background: var(--paper);
  border-radius: 22px;
  width: min(680px, 96vw);
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  border: 3px solid #fff;
  animation: pop 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-body { padding: 28px 28px 8px; }
.modal-footer {
  padding: 8px 28px 26px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.lesson-head { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.lesson-icon { font-size: 2.2rem; }
.lesson-step {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  color: var(--accent);
  font-weight: 500;
}
.lesson-title { font-size: 1.5rem; font-weight: 800; line-height: 1.2; }

.lesson-video {
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 16px;
  border: 3px solid var(--teal-soft);
}
.lesson-video iframe { display: block; }

.lesson-desc {
  color: var(--ink-soft);
  line-height: 1.6;
  font-size: 0.98rem;
}

/* diálogo */
.dialog-title { font-weight: 800; font-size: 1.1rem; margin-bottom: 10px; }
.dialog-line { color: var(--ink-soft); line-height: 1.55; margin-bottom: 6px; }

/* ajuda */
.help h2 { font-size: 1.3rem; margin-bottom: 14px; }
.help p { margin-bottom: 10px; line-height: 1.5; color: var(--ink-soft); }
.help kbd { margin-right: 4px; }

/* ============ ATIVIDADES ============ */

.activity-intro {
  font-size: 1.02rem;
  line-height: 1.55;
  color: var(--ink);
  margin-bottom: 16px;
}

.hazard-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.hazard-grid.bio { grid-template-columns: repeat(4, 1fr); }

.hazard-item {
  background: #fff;
  border: 2px solid var(--teal-soft);
  border-radius: 14px;
  padding: 16px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.hazard-item:hover { transform: translateY(-2px); box-shadow: 0 6px 16px -6px rgb(36 49 58 / 0.25); }
.hazard-item.correct { background: #e7f6ee; border-color: #4e9a72; }
.hazard-item.wrong { background: #fdecec; border-color: var(--accent); }
.hazard-item.done { cursor: default; }
.hazard-icon { font-size: 1.8rem; }

.activity-score { font-weight: 700; color: var(--teal); margin-bottom: 12px; }

.activity-feedback { font-size: 0.95rem; line-height: 1.5; }
.fb-good { color: #2e7d5b; font-weight: 600; display: block; margin-bottom: 6px; }
.fb-neutral { color: var(--ink-soft); display: block; margin-bottom: 6px; }

.activity-complete {
  margin-top: 14px;
  background: #fff8e0;
  border: 2px solid var(--gold);
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 700;
  color: #7a5c14;
}

/* emergência */
.emergency-banner {
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.1em;
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  text-align: center;
}

.emergency-opts { display: flex; flex-direction: column; gap: 10px; }

.emergency-opt {
  text-align: left;
  background: #fff;
  border: 2px solid var(--teal-soft);
  border-radius: 12px;
  padding: 14px 16px;
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.12s ease, background 0.12s ease;
}
.emergency-opt:hover:not(:disabled) { background: var(--teal-soft); }
.emergency-opt:disabled { cursor: default; }
.emergency-opt.correct { background: #e7f6ee; border-color: #4e9a72; }
.emergency-opt.wrong { background: #fdecec; border-color: var(--accent); }

.emergency-explain {
  margin-top: 12px;
  background: #eaf2f0;
  border-radius: 12px;
  padding: 12px 16px;
  color: var(--ink);
  line-height: 1.55;
  font-size: 0.94rem;
}
.emergency-explain.serious {
  background: #f0ede6;
  border-left: 4px solid var(--teal);
}

.activity-serious { max-width: 640px; }
.activity-question { font-weight: 700; margin: 8px 0 14px; }

/* ============ TOAST ============ */

.toast {
  position: fixed;
  left: 50%;
  bottom: 30px;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: #fff;
  padding: 14px 22px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 60;
  max-width: 90vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: #2e7d5b; }
.toast.info { background: var(--teal); }

/* ============ RESPONSIVO ============ */

@media (max-width: 820px) {
  .hud-progress { display: none; }
  .intro-card { padding: 36px 28px; }
  .hazard-grid, .hazard-grid.bio { grid-template-columns: repeat(2, 1fr); }
  .modal-body { padding: 22px 18px 6px; }
  .modal-footer { padding: 6px 18px 20px; flex-direction: column-reverse; }
  .modal-footer .btn { width: 100%; }
  .lesson-video iframe { height: 220px; }
  .bottom-hint .keys { display: none; }
}
