/* ==========================================================================
   Planta Lógica 2.0 — Detetives do Tempo (Estúdio Ligne Claire + A4 P&B)
   Zero fontes externas/CDNs. Transições explícitas (sem transições genéricas).
   ========================================================================== */

/* Andika v27 — SIL Open Font License 1.1 (SIL International) · 100% offline */
@font-face {
  font-family: "Andika";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../assets/fonts/andika-regular.woff2") format("woff2");
}
@font-face {
  font-family: "Andika";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../assets/fonts/andika-bold.woff2") format("woff2");
}

:root {
  --ink: #0e2433;
  --ink-muted: #2c4c5e;
  --paper: #fafbf9;
  --parchment: #fdf8e6;
  --surface: #eef6f9;
  --teal: #0c7489;
  --teal-dark: #074f5e;
  --brass: #c98e27;
  --amber: #f4a71d;
  --amber-soft: #fff4d1;
  --ok: #0e704d;
  --ok-soft: #dbf4ea;
  --err: #c93d24;
  --err-soft: #fdebe7;
  --focus: #f4a71d;
  --font-main: "Segoe UI", "Trebuchet MS", Verdana, system-ui, -apple-system, sans-serif;
}

body[data-font="school"] {
  --font-main: "Andika", "Century Gothic", "Comic Sans MS", "Chalkboard SE", Verdana, sans-serif;
}

body[data-contrast="high"] {
  --ink: #000000;
  --ink-muted: #111111;
  --paper: #ffffff;
  --parchment: #ffffff;
  --surface: #f4f4f4;
  --teal: #004e66;
  --teal-dark: #002f3e;
  --brass: #000000;
  --ok: #005a32;
  --ok-soft: #d9f9e6;
  --err: #9e1c00;
  --err-soft: #ffe3d6;
  --focus: #0055ff;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-padding-top: 60px;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-main);
  color: var(--ink);
  background: linear-gradient(180deg, #dff1f7 0%, #f5f7f2 100%);
  -webkit-font-smoothing: antialiased;
}

body[data-contrast="high"] {
  background: #ffffff;
}

.hidden,
[hidden] {
  display: none !important;
}

.tnum {
  font-variant-numeric: tabular-nums;
}

button,
a {
  font-family: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ===================== BARRA SUPERIOR ===================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 25;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 7px 14px;
  background: #0e2e3f;
  border-bottom: 3px solid var(--brass);
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(14, 36, 51, 0.22);
}

.top-left,
.top-right {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.brand-compass {
  display: block;
  flex: 0 0 auto;
}

.brand-text {
  display: flex;
  align-items: baseline;
  gap: 7px;
  line-height: 1.1;
}

.brand-text strong {
  font-size: 0.98rem;
  font-weight: 900;
  letter-spacing: -0.01em;
}

.brand-text small {
  font-size: 0.78rem;
  font-weight: 700;
  color: #bae6fd;
}

.bar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 38px;
  min-height: 36px;
  padding: 4px 10px;
  border-radius: 9px;
  border: 1.5px solid rgba(255, 255, 255, 0.34);
  background: #17465c;
  color: #ffffff;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 800;
  white-space: nowrap;
  transition: background-color 140ms ease, border-color 140ms ease, transform 110ms ease;
}

.bar-btn:hover {
  background: #1f5c78;
  border-color: #ffd24a;
}

.bar-btn:active {
  transform: scale(0.97);
}

.bar-btn.is-active-toggle {
  background: rgba(244, 167, 29, 0.28);
  border-color: #ffd24a;
  color: #ffe680;
}

.bar-atlas {
  background: #fdf8e6;
  color: #0e2433;
  border-color: #c98e27;
}

.bar-atlas:hover {
  background: #fff2c2;
  border-color: #ffd24a;
}

.bar-weekly {
  background: #fff4d1;
  color: #0e2433;
  border-color: #f4a71d;
}

.bar-weekly:hover {
  background: #ffe394;
  border-color: #ffffff;
}

.bar-weekly.is-active-weekly {
  background: #ffd147;
  color: #0e2433;
  border-color: #ffffff;
  box-shadow: 0 0 0 2px rgba(255, 209, 71, 0.4);
}

.bar-weekly.is-done-weekly,
.btn-weekly-inline.is-done-weekly {
  border-color: var(--ok);
}

.bar-svg,
.inline-svg {
  display: block;
  flex: 0 0 auto;
}

/* ===================== SHELL PRINCIPAL ===================== */
.fp-shell {
  max-width: 1180px;
  margin: 12px auto 20px;
  padding: 14px 16px 16px;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-top: 5px solid var(--teal);
  border-radius: 18px;
  box-shadow: 0 6px 0 rgba(14, 36, 51, 0.12);
}

.fp-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  margin-bottom: 10px;
}

.fp-head-left,
.fp-head-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.case-nav {
  display: inline-flex;
  align-items: center;
  border: 2px solid var(--ink);
  border-radius: 10px;
  background: var(--parchment);
  overflow: hidden;
}

.nav-arrow {
  min-width: 32px;
  min-height: 32px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
  padding: 0 8px;
  transition: background-color 120ms ease;
}

.nav-arrow:hover {
  background: #fde68a;
}

.case-badge {
  padding: 0 8px;
  font-size: 0.78rem;
  font-weight: 900;
  color: var(--teal-dark);
  border-left: 1.5px solid rgba(14, 36, 51, 0.2);
  border-right: 1.5px solid rgba(14, 36, 51, 0.2);
}

.fp-title {
  margin: 0;
  font-size: clamp(1.06rem, 1.8vw, 1.32rem);
  font-weight: 900;
  color: var(--ink);
  line-height: 1.18;
}

.size-pill {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1.5px solid var(--ink);
  background: var(--surface);
  font-size: 0.76rem;
  font-weight: 900;
}

.done-stamp {
  padding: 2px 9px;
  border-radius: 999px;
  border: 2px solid var(--ok);
  background: var(--ok-soft);
  color: var(--ok);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.01em;
}

.fp-compass {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #ffffff;
  border: 2px solid var(--ink);
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--ink);
}

.fp-mystery {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 12px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: #def2f6;
  border: 2px solid var(--teal);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.38;
  color: var(--ink);
}

.mystery-svg {
  flex: 0 0 auto;
  margin-top: 1px;
}

.fp-mystery-label {
  color: var(--teal-dark);
  font-weight: 900;
}

/* ===================== BARRA DE FERRAMENTAS ===================== */
.fp-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 12px;
}

.toolbar-chars,
.toolbar-actions,
.chars-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.toolbar-lbl {
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ink-muted);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 38px;
  padding: 5px 11px;
  border-radius: 10px;
  border: 2px solid var(--ink);
  background: #ffffff;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: 0 2px 0 rgba(14, 36, 51, 0.16);
  transition: background-color 130ms ease, border-color 130ms ease, transform 100ms ease;
}

.btn:hover:not(:disabled) {
  background: var(--surface);
  border-color: var(--teal);
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
}

.btn-ok {
  background: var(--ok);
  color: #ffffff;
  border-color: var(--ink);
}

.btn-ok:hover:not(:disabled) {
  background: #095439;
  border-color: var(--ink);
}

.btn-atlas-inline {
  background: var(--parchment);
  border-color: var(--brass);
}

.btn-atlas-inline:hover:not(:disabled) {
  background: #fff2c2;
  border-color: var(--ink);
}

.btn-weekly-inline {
  background: #fff4d1;
  border-color: #d9820b;
  color: var(--ink);
}

.btn-weekly-inline:hover:not(:disabled) {
  background: #ffe394;
  border-color: var(--ink);
}

.btn-weekly-inline.is-active-weekly {
  background: #ffd147;
  border-color: var(--ink);
  box-shadow: 0 0 0 2.5px rgba(244, 167, 29, 0.4);
}

.btn-tool.is-active {
  background: var(--teal);
  color: #ffffff;
  border-color: var(--ink);
  box-shadow: 0 0 0 2.5px rgba(12, 116, 137, 0.32);
}

.btn-tool.is-active-cross {
  background: #334155;
  color: #ffffff;
  border-color: var(--ink);
  box-shadow: 0 0 0 2.5px rgba(51, 65, 85, 0.3);
}

.cross-glyph {
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1;
}

/* Botões de personagens com medalhão SVG Ligne Claire */
.fp-char-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 3px 10px 3px 5px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: #ffffff;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: 0 2px 0 var(--ink);
  transition: background-color 130ms ease, transform 100ms ease, box-shadow 130ms ease;
}

.fp-char-btn:hover {
  background: var(--surface);
}

.fp-char-btn.active {
  background: #ffd147;
  color: #0e2433;
  box-shadow: 0 0 0 3px rgba(244, 167, 29, 0.45), 0 2px 0 var(--ink);
}

.fp-char-btn.placed {
  background: var(--surface);
  border-style: dashed;
  border-color: var(--teal);
}

.fp-char-btn.placed.active {
  background: #ffe07d;
  border-style: solid;
  border-color: var(--ink);
}

.fp-medallion-svg {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  display: block;
}

.char-sigla {
  font-size: 0.72rem;
  font-weight: 900;
  padding: 1px 4px;
  border-radius: 5px;
  background: rgba(14, 36, 51, 0.1);
}

/* ===================== LAYOUT PRINCIPAL (2 COLUNAS) ===================== */
.fp-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1.08fr) minmax(300px, 0.92fr);
  gap: 16px;
  align-items: start;
}

@media (max-width: 900px) {
  .fp-layout {
    grid-template-columns: 1fr;
  }
}

/* Moldura do tabuleiro com indicadores cardeais CT4 nas 4 bordas */
.fp-board-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 26px;
  border-radius: 16px;
  background: #edf5f8;
  border: 2px solid #9dc0cf;
}

.edge-compass {
  position: absolute;
  font-size: 0.72rem;
  font-weight: 900;
  padding: 1px 7px;
  border-radius: 999px;
  color: var(--ink-muted);
  background: rgba(255, 255, 255, 0.85);
  border: 1.5px solid rgba(14, 36, 51, 0.25);
  pointer-events: none;
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease, transform 180ms ease;
}

.edge-n { top: 3px; left: 50%; transform: translateX(-50%); }
.edge-s { bottom: 3px; left: 50%; transform: translateX(-50%); }
.edge-w { left: 3px; top: 50%; transform: translateY(-50%); }
.edge-e { right: 3px; top: 50%; transform: translateY(-50%); }

.edge-compass.is-lit {
  background: #ffd147;
  color: #0e2433;
  border-color: #0e2433;
  box-shadow: 0 2px 6px rgba(201, 142, 39, 0.45);
}

.fp-grid-wrap {
  width: 100%;
  overflow-x: auto;
}

.fp-board {
  display: grid;
  gap: 0;
  background: #ffffff;
  color: #0e2433;
  padding: 10px;
  border-radius: 14px;
  border: 2.5px solid var(--ink);
  box-shadow: 0 5px 0 rgba(14, 36, 51, 0.14);
  width: fit-content;
  margin: 0 auto;
}

.fp-coord {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  font-size: 0.84rem;
  color: var(--ink);
  min-width: 26px;
  min-height: 26px;
}

.fp-cell {
  position: relative;
  width: 84px;
  height: 82px;
  background-color: var(--fp-room-bg, #ffffff);
  color: var(--ink);
  border: 1px dashed #94a3b8;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 3px 2px;
  text-align: center;
  border-radius: 0;
  user-select: none;
  -webkit-touch-callout: none;
  transition: box-shadow 130ms ease, filter 130ms ease, background-color 130ms ease;
}

.fp-cell.fp-room-0 { --fp-room-bg: #eaf4ff; }
.fp-cell.fp-room-1 { --fp-room-bg: #fef7de; }
.fp-cell.fp-room-2 { --fp-room-bg: #e8faef; }
.fp-cell.fp-room-3 { --fp-room-bg: #fcecf5; }
.fp-cell.fp-room-4 { --fp-room-bg: #f2eeff; }
.fp-cell.fp-room-5 { --fp-room-bg: #ffefe5; }

.fp-board.n5 .fp-cell { width: 88px; height: 74px; padding: 2px 2px; }
.fp-board.n6 .fp-cell { width: 78px; height: 68px; padding: 2px 2px; }

.fp-cell:hover:not(.blocked) {
  filter: brightness(0.96);
  box-shadow: inset 0 0 0 2px #0c7489;
}

.fp-cell.blocked {
  background-color: var(--fp-room-bg, #f1f5f9);
  background-image: repeating-linear-gradient(
    45deg,
    rgba(15, 23, 42, 0.04),
    rgba(15, 23, 42, 0.04) 5px,
    rgba(15, 23, 42, 0.13) 5px,
    rgba(15, 23, 42, 0.13) 10px
  );
  cursor: not-allowed;
}

.fp-cell.wall-n { border-top: 3.5px solid #0e2433; }
.fp-cell.wall-s { border-bottom: 3.5px solid #0e2433; }
.fp-cell.wall-w { border-left: 3.5px solid #0e2433; }
.fp-cell.wall-e { border-right: 3.5px solid #0e2433; }

.fp-cell.win-n::after,
.fp-cell.win-s::after,
.fp-cell.win-w::after,
.fp-cell.win-e::after {
  content: '▭';
  position: absolute;
  z-index: 3;
  font-size: 0.8rem;
  font-weight: 900;
  background: #bae6fd;
  color: #0369a1;
  line-height: 1;
  padding: 1px 3px;
  border: 2px solid #0284c7;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.38);
}

.fp-cell.win-n::after { top: -11px; left: 50%; transform: translateX(-50%); }
.fp-cell.win-s::after { bottom: -11px; left: 50%; transform: translateX(-50%); }
.fp-cell.win-w::after { left: -12px; top: 50%; transform: translateY(-50%); }
.fp-cell.win-e::after { right: -12px; top: 50%; transform: translateY(-50%); }

.fp-cell.win-n .fp-room-tag { margin-top: 5px; }
.fp-cell.win-s .fp-furn-tag { margin-bottom: 5px; }

/* Realces da Lupa de Pistas CT4 (suaves, sem spoiler!) */
.fp-cell.hl-room {
  box-shadow: inset 0 0 0 3px rgba(12, 116, 137, 0.72);
}

.fp-cell.hl-furn .fp-furn-tag {
  background: #ffe07d;
  border-radius: 5px;
  padding: 1px 3px;
  box-shadow: 0 0 0 1.5px #b45309;
}

.fp-cell.hl-win::after {
  background: #ffd147;
  color: #0e2433;
  border-color: #0e2433;
}

.fp-cell.hl-corner {
  box-shadow: inset 0 0 0 2.5px #d97706;
}

.fp-cell.conflict {
  background-color: #fee2e2 !important;
  box-shadow: inset 0 0 0 3px #dc2626 !important;
}

.fp-room-tag {
  font-size: 0.56rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #475569;
  align-self: flex-start;
  line-height: 1;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fp-room-tag.is-room-name {
  color: #0e2433;
  font-weight: 900;
  font-size: 0.52rem;
  letter-spacing: -0.015em;
}

.fp-board.n6 .fp-room-tag.is-room-name {
  font-size: 0.48rem;
}

/* Peão colocado com medalhão SVG Ligne Claire */
.fp-token {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 2px 6px 2px 2px;
  border-radius: 999px;
  background: #0e2e3f;
  color: #ffffff;
  border: 1.5px solid #ffd24a;
  font-size: 0.68rem;
  font-weight: 900;
  max-width: 98%;
  overflow: hidden;
  white-space: nowrap;
  z-index: 2;
}

.fp-token .fp-medallion-svg {
  width: 20px;
  height: 20px;
}

.fp-board.n5 .fp-token { font-size: 0.56rem; letter-spacing: -0.02em; gap: 2px; padding: 1.5px 4px 1.5px 1.5px; }
.fp-board.n5 .fp-token .fp-medallion-svg { width: 15px; height: 15px; }
.fp-cell.win-w .fp-token { margin-left: 5px; max-width: calc(100% - 6px); }
.fp-cell.win-e .fp-token { margin-right: 5px; max-width: calc(100% - 6px); }
.fp-board.n6 .fp-token { font-size: 0.51rem; letter-spacing: -0.025em; gap: 1.5px; padding: 1px 3px 1px 1.5px; }
.fp-board.n6 .fp-token .fp-medallion-svg { width: 13px; height: 13px; }

.fp-token-txt {
  overflow: hidden;
  text-overflow: ellipsis;
}

.fp-cell.conflict .fp-token {
  background: #b91c1c;
  border-color: #ffffff;
}

/* Modo Lápis Duplo: × e grelha 2×2 de hipóteses (LE?, PA?) */
.fp-pencil-mark {
  font-size: 1.35rem;
  font-weight: 900;
  color: #64748b;
  line-height: 1;
}

.fp-notes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px;
  width: 94%;
  align-items: center;
  justify-items: center;
}

.fp-note-chip {
  display: inline-block;
  padding: 0 3px;
  border-radius: 4px;
  background: rgba(255, 244, 209, 0.95);
  border: 1px solid #c98e27;
  color: #0e2433;
  font-size: 0.56rem;
  font-weight: 900;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.fp-board.n6 .fp-note-chip {
  font-size: 0.5rem;
  padding: 0 2px;
}

/* Mobiliário vista de topo (22 SVGs) */
.fp-furn-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 0.58rem;
  font-weight: 700;
  color: #0e2433;
  line-height: 1.05;
  letter-spacing: -0.015em;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
}

.fp-furn-tag > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fp-furn-svg {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  display: block;
}

.fp-board.n5 .fp-furn-svg { width: 11px; height: 11px; }
.fp-board.n6 .fp-furn-svg { width: 10px; height: 10px; }

/* Feedback e Curiosidade */
.fp-feedback {
  margin-top: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 2px solid #8cb2c3;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink);
  line-height: 1.4;
}

.fp-feedback.ok {
  background: var(--ok-soft);
  border-color: var(--ok);
  color: #064e3b;
}

.fp-feedback.err {
  background: var(--err-soft);
  border-color: var(--err);
  color: #7a1200;
}

.fp-win-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.fp-reward-code {
  padding: 2px 8px;
  border-radius: 6px;
  background: #ffffff;
  border: 1.5px solid var(--ok);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.96rem;
  font-weight: 900;
  color: var(--ink);
  user-select: text;
}

.fp-curiosity {
  margin-top: 8px;
  padding: 8px 11px;
  border-radius: 10px;
  background: var(--amber-soft);
  border: 2px solid #d9820b;
  color: #451a03;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.44;
}

.fp-curiosity strong {
  color: #78350f;
  font-weight: 900;
}

/* ===================== PAINEL DE PISTAS INTERATIVAS (CT4) ===================== */
.fp-clues {
  background: #ffffff;
  border: 2px solid var(--ink);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 4px 0 rgba(14, 36, 51, 0.08);
}

.clues-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.clues-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.clues-head h2 {
  margin: 0;
  font-size: 0.98rem;
  font-weight: 900;
  color: var(--teal-dark);
}

.btn-clear-lens {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1.5px solid var(--teal);
  background: #def2f6;
  color: var(--teal-dark);
  font-size: 0.74rem;
  font-weight: 800;
}

.clues-hint {
  margin: 0 0 8px;
  font-size: 0.76rem;
  color: var(--ink-muted);
  font-weight: 600;
}

.fp-clues-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 6px;
}

.fp-clue-item {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: stretch;
  gap: 6px;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  background: #fafcfd;
  padding: 4px 6px;
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.fp-clue-item.is-active {
  background: #def2f6;
  border-color: var(--teal);
  box-shadow: 0 0 0 2px rgba(12, 116, 137, 0.22);
}

.fp-clue-item.is-checked {
  background: #f3faf6;
  border-color: #86efac;
}

.fp-clue-item.is-checked .clue-text {
  text-decoration: line-through;
  color: #4b6572;
}

.fp-clue-item.is-error-clue {
  background: #fff4d1;
  border: 2px solid #d97706;
  animation: cluePulse 1.15s ease-in-out 3;
}

@keyframes cluePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.45); }
  50% { box-shadow: 0 0 0 5px rgba(217, 119, 6, 0.16); }
}

.clue-check {
  width: 28px;
  min-height: 28px;
  align-self: center;
  border-radius: 7px;
  border: 2px solid var(--ink);
  background: #ffffff;
  color: var(--ink);
  font-size: 0.85rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background-color 120ms ease, color 120ms ease;
}

.clue-check[aria-pressed="true"] {
  background: var(--ok);
  border-color: var(--ok);
  color: #ffffff;
}

.clue-body {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  text-align: left;
  background: transparent;
  border: 0;
  padding: 3px 4px;
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.34;
  color: var(--ink);
}

.clue-num {
  flex: 0 0 auto;
  min-width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #0e2e3f;
  color: #ffd24a;
  font-size: 0.72rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}

.clue-err-tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: #c93d24;
  color: #ffffff;
  font-size: 0.7rem;
  font-weight: 900;
}

.fp-rules-box {
  margin-top: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--surface);
  border: 1.5px solid #8cb2c3;
  font-size: 0.78rem;
  line-height: 1.4;
  color: #1e3c4d;
  display: grid;
  gap: 4px;
}

@media screen {
  body {
    padding-bottom: 56px;
  }
}

.fp-rules-box code {
  background: #def2f6;
  color: var(--teal-dark);
  padding: 0 4px;
  border-radius: 4px;
  font-weight: 800;
}

.fp-rules-compass {
  font-weight: 800;
  color: var(--teal-dark);
}

.fp-win-chip {
  display: inline-block;
  background: #bae6fd;
  color: #0369a1;
  border: 1.5px solid #0284c7;
  border-radius: 3px;
  padding: 0 3px;
  font-weight: 900;
  line-height: 1.1;
}

/* ===================== MODAL ATLAS INTERATIVO ===================== */
.atlas-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(14, 36, 51, 0.74);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
  overflow-y: auto;
}

.atlas-panel {
  width: min(980px, 100%);
  max-height: 94dvh;
  overflow-y: auto;
  background: var(--parchment);
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 14px 16px 16px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.4);
}

.atlas-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.atlas-head h2 {
  margin: 0;
  font-size: 1.18rem;
  font-weight: 900;
  color: var(--ink);
}

.atlas-sub {
  margin: 2px 0 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.atlas-close {
  min-width: 38px;
  min-height: 38px;
  border-radius: 10px;
  border: 2px solid var(--ink);
  background: #ffffff;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
}

.atlas-close:hover {
  background: #fdebe7;
}

.atlas-map-wrap {
  width: 100%;
  margin-bottom: 12px;
}

.atlas-svg {
  width: 100%;
  height: auto;
  display: block;
}

.atlas-pin {
  cursor: pointer;
}

.atlas-pin:hover .pin-dot {
  transform: scale(1.18);
}

.pin-dot {
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 130ms ease;
}

.atlas-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.atlas-tab {
  min-height: 36px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 2px solid var(--ink);
  background: #ffffff;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 800;
}

.atlas-tab.is-active {
  background: #0e2e3f;
  color: #ffd24a;
}

.atlas-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 8px;
}

.atlas-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-height: 54px;
  padding: 8px 10px;
  border-radius: 11px;
  border: 2px solid var(--ink);
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  transition: background-color 130ms ease, transform 110ms ease;
}

.atlas-card:hover {
  background: #eef6f9;
  transform: translateY(-1px);
}

.atlas-card.is-current {
  background: #fff4d1;
  border-color: #c98e27;
  box-shadow: 0 0 0 2px rgba(201, 142, 39, 0.35);
}

.atlas-card.is-done {
  border-color: var(--ok);
}

.atlas-card-top {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 0.72rem;
  font-weight: 900;
  color: var(--teal-dark);
}

.atlas-card-title {
  font-size: 0.84rem;
  font-weight: 900;
  line-height: 1.2;
}

.atlas-stamp-pill {
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  border: 1.2px solid var(--ok);
  font-size: 0.68rem;
  font-weight: 900;
}

/* ===================== MODAL CENA DE REVELAÇÃO LIGNE CLAIRE ===================== */
.reveal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(14, 36, 51, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow-y: auto;
}

.reveal-panel {
  width: min(620px, 100%);
  max-height: 94dvh;
  overflow-y: auto;
  background: var(--parchment);
  border: 3px solid var(--ink);
  border-radius: 18px;
  padding: 14px 16px 16px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
}

.reveal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.reveal-stamp {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--ok-soft);
  border: 1.8px solid var(--ok);
  color: var(--ok);
  font-size: 0.74rem;
  font-weight: 900;
  margin-bottom: 3px;
}

.reveal-title {
  margin: 0;
  font-size: clamp(1.08rem, 2vw, 1.32rem);
  font-weight: 900;
  color: var(--ink);
  line-height: 1.2;
}

.reveal-art {
  width: 100%;
  margin-bottom: 10px;
}

.revelation-svg {
  width: 100%;
  height: auto;
  display: block;
}

.reveal-speech {
  margin: 0 0 9px;
  padding: 8px 12px;
  border-radius: 12px;
  background: #ffffff;
  border: 2.2px solid var(--ink);
  box-shadow: 0 3px 0 rgba(14, 36, 51, 0.16);
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.34;
}

.reveal-curiosity {
  margin: 0 0 8px;
  padding: 8px 11px;
  border-radius: 10px;
  background: var(--amber-soft);
  border: 2px solid #d9820b;
  color: #451a03;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.4;
}

.reveal-curiosity strong {
  color: #78350f;
  font-weight: 900;
}

.reveal-hook {
  margin: 0 0 12px;
  padding: 7px 11px;
  border-radius: 10px;
  background: #def2f6;
  border: 1.8px solid var(--teal);
  color: var(--teal-dark);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.32;
}

.reveal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

/* ===================== ALTO CONTRASTE ===================== */
body[data-contrast="high"] .topbar {
  background: #000000;
  border-bottom-color: #ffffff;
}

body[data-contrast="high"] .fp-shell,
body[data-contrast="high"] .fp-board-frame,
body[data-contrast="high"] .fp-clues,
body[data-contrast="high"] .fp-mystery,
body[data-contrast="high"] .fp-rules-box,
body[data-contrast="high"] .atlas-panel,
body[data-contrast="high"] .reveal-panel,
body[data-contrast="high"] .reveal-speech,
body[data-contrast="high"] .reveal-curiosity,
body[data-contrast="high"] .reveal-hook {
  background: #ffffff;
  border-color: #000000;
  color: #000000;
  box-shadow: none;
}

body[data-contrast="high"] .revelation-svg {
  filter: contrast(1.22);
}

body[data-contrast="high"] .fp-cell {
  background-color: #ffffff;
  border-color: #333333;
}

body[data-contrast="high"] .fp-char-btn.active {
  background: #000000;
  color: #ffffff;
}

/* ===================== RESPONSIVO MÓVEL (390×844) ===================== */
@media (max-width: 680px) {
  .topbar {
    padding: 6px 8px;
    gap: 5px;
  }
  .btn-lbl,
  .brand-text small {
    display: none;
  }
  .bar-btn {
    min-width: 34px;
    padding: 4px 8px;
    font-size: 0.76rem;
  }
  .fp-shell {
    margin: 6px;
    padding: 10px 9px;
    border-radius: 14px;
  }
  .fp-board-frame {
    padding: 18px 14px;
  }
  .fp-board {
    padding: 5px;
  }
  .fp-coord {
    min-width: 18px;
    min-height: 18px;
    font-size: 0.72rem;
  }
  .fp-cell {
    width: 68px;
    height: 68px;
  }
  .fp-board.n5 .fp-cell {
    width: 56px;
    height: 58px;
    padding: 1.5px;
  }
  .fp-board.n6 .fp-cell {
    width: 48px;
    height: 52px;
    padding: 1px;
  }
  .fp-board.n5 .fp-room-tag.is-room-name,
  .fp-board.n6 .fp-room-tag.is-room-name {
    font-size: 0.42rem;
  }
  .fp-board.n5 .fp-furn-tag,
  .fp-board.n6 .fp-furn-tag {
    font-size: 0.42rem;
  }
  .fp-board.n5 .fp-furn-svg { width: 9px; height: 9px; }
  .fp-board.n6 .fp-furn-svg { width: 8px; height: 8px; }
  .fp-board.n5 .fp-token-txt,
  .fp-board.n6 .fp-token-txt {
    font-size: 0.52rem;
  }
  .fp-board.n5 .fp-token .fp-medallion-svg { width: 15px; height: 15px; }
  .fp-board.n6 .fp-token .fp-medallion-svg { width: 14px; height: 14px; }
  .atlas-panel {
    padding: 10px;
  }
  .atlas-cards {
    grid-template-columns: 1fr;
  }
}

/* ===================== ACESSIBILIDADE DE MOVIMENTO ===================== */
@media (prefers-reduced-motion: reduce) {
  .fp-clue-item.is-error-clue {
    animation: none !important;
  }
  * {
    transition-duration: 0.01ms !important;
  }
}

/* ===================== IMPRESSÃO A4 PRETO-E-BRANCO (a4-print-design) ===================== */
.print-only-head {
  display: none;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 14mm 12mm 14mm 18mm;
  }
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  html,
  body {
    background: #ffffff !important;
    color: #0f172a !important;
    min-height: 0 !important;
  }
  .no-print,
  .topbar,
  .fp-toolbar,
  .atlas-backdrop,
  .reveal-backdrop {
    display: none !important;
  }
  .print-only-head {
    display: block !important;
    margin-bottom: 4mm;
    padding-bottom: 3mm;
    border-bottom: 1.5pt solid #0f172a;
    break-after: avoid !important;
    page-break-after: avoid !important;
  }
  .print-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 8px;
    font-size: 10.5pt;
    margin-bottom: 2mm;
  }
  .print-fields {
    font-size: 9pt;
    font-weight: 600;
  }
  .print-objective {
    margin: 0 0 2.5mm;
    font-size: 9pt;
    font-weight: 700;
  }
  .print-chars-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 5px 12px;
    font-size: 8.5pt;
    font-weight: 800;
  }
  .print-char-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 1px 6px 1px 2px;
    border: 1pt solid #0f172a;
    border-radius: 999px;
    background: #ffffff !important;
  }
  .print-char-chip svg {
    width: 16px;
    height: 16px;
  }
  h1, h2, h3 {
    break-after: avoid !important;
    page-break-after: avoid !important;
  }
  .fp-shell {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: #ffffff !important;
  }
  .fp-head {
    margin-bottom: 2mm;
  }
  .fp-title {
    font-size: 13pt;
  }
  .fp-mystery {
    background: #ffffff !important;
    border: 1.2pt solid #0f172a !important;
    color: #0f172a !important;
    font-size: 9.2pt;
    padding: 5px 8px;
    margin-bottom: 3mm;
    break-inside: avoid !important;
  }
  .fp-layout {
    grid-template-columns: 1fr !important;
    gap: 4mm !important;
  }
  .fp-board-frame {
    background: #ffffff !important;
    border: 1pt solid #475569 !important;
    padding: 14px 18px !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
  .fp-board,
  .fp-clues,
  .fp-rules-box,
  .fp-curiosity {
    background: #ffffff !important;
    color: #0f172a !important;
    border-color: #0f172a !important;
    box-shadow: none !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
  .fp-cell {
    background-color: #ffffff !important;
    box-shadow: none !important;
  }
  .fp-cell.win-n::after,
  .fp-cell.win-s::after,
  .fp-cell.win-w::after,
  .fp-cell.win-e::after,
  .fp-win-chip,
  .fp-token,
  .fp-note-chip,
  .clue-num,
  .edge-compass {
    background: #ffffff !important;
    color: #0f172a !important;
    border: 1pt solid #0f172a !important;
    box-shadow: none !important;
  }
  .fp-clue-item {
    background: #ffffff !important;
    border: 0.8pt solid #475569 !important;
    break-inside: avoid !important;
  }
  .fp-furn-svg *,
  .fp-medallion-svg * {
    stroke: #0f172a !important;
  }
  .fp-medallion-svg circle:first-child {
    fill: #ffffff !important;
  }
  .fp-feedback:not(.ok) {
    display: none !important;
  }
}
