/* Farol Turbo: Mare de Sucata
 * Paleta costeira luminosa (Ria Formosa / Atlantico), alto contraste para projetor a 6 m.
 * Zero fontes externas / CDNs. Transicoes sempre explicitas.
 */

/* 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: #2B4C5E;
  --paper: #FAFBF9;
  --surface: #EDF5F8;
  --surface-strong: #DCEBF0;
  --line: #BDD4DE;
  --coral: #D9462B;
  --coral-dark: #A9301A;
  --amber: #F4A71D;
  --amber-soft: #FFF4CC;
  --amber-dark: #9B5F00;
  --teal: #0E7C94;
  --teal-dark: #085164;
  --mint: #1FB59A;
  --mint-soft: #DBF8F1;
  --ok: #137A55;
  --ok-bg: #D6F5E8;
  --warn: #9E3E14;
  --warn-bg: #FDECE2;
  --focus: #F4A71D;

  --font-main: "Segoe UI", "Trebuchet MS", Verdana, system-ui, -apple-system, sans-serif;
  --font-display: "Trebuchet MS", "Segoe UI", Verdana, system-ui, sans-serif;

  /* Escala controlada (legivel a 6 m no projetor) */
  --text-sm: clamp(0.92rem, 1.15vw, 1.05rem);
  --text-body: clamp(1.05rem, 1.35vw, 1.22rem);
  --text-lg: clamp(1.42rem, 2.3vw, 2.05rem);
  --radius: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

/* Fonte escolar com 'a' e 'g' de um so andar e 'l'/'I' distintos */
body[data-font="school"] {
  --font-main: "Andika", "Century Gothic", "Comic Sans MS", "Chalkboard SE", Verdana, sans-serif;
  --font-display: "Andika", "Century Gothic", "Comic Sans MS", "Chalkboard SE", Verdana, sans-serif;
}

/* Modo Alto Contraste (inspirado em 065.md / UDL) */
body[data-contrast="high"] {
  --ink: #000000;
  --ink-muted: #111111;
  --paper: #FFFFFF;
  --surface: #F2F2F2;
  --surface-strong: #E0E0E0;
  --line: #000000;
  --coral: #B81D00;
  --coral-dark: #7A1200;
  --teal: #004E66;
  --teal-dark: #002F3E;
  --amber-soft: #FFF08A;
  --ok: #005A32;
  --ok-bg: #D9F9E6;
  --warn: #8A1C00;
  --warn-bg: #FFE3D6;
  --focus: #0055FF;
}

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

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  font-family: var(--font-main);
  color: var(--ink);
  background: #084E68;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

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

button {
  font-family: inherit;
  color: inherit;
  cursor: pointer;
}

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

[hidden] {
  display: none !important;
}

/* ===================== ECRA INICIAL ===================== */
.screen-title {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: linear-gradient(
    to bottom,
    #1470AD 0%,
    #1E88C9 36%,
    #6CCBF0 60%,
    #D4F2FA 68%,
    #084E68 68%,
    #084E68 100%
  );
}

html.has-hd-bg body:not([data-contrast="high"]):not([data-theme="espaco"]):not([data-theme="polar"]) .screen-title {
  background-image:
    url("assets/bg-farol-title.webp"),
    linear-gradient(to bottom, #1470AD 0%, #1E88C9 36%, #6CCBF0 60%, #D4F2FA 68%, #084E68 68%, #084E68 100%);
  background-size: cover, 100% 100%;
  background-position: center 53%, center;
  background-repeat: no-repeat;
}

html.has-hd-bg body:not([data-contrast="high"]):not([data-theme="espaco"]):not([data-theme="polar"]) .sea-svg .vec-sky-sea,
html.has-hd-bg body:not([data-contrast="high"]):not([data-theme="espaco"]):not([data-theme="polar"]) .sea-svg .sea-waves {
  display: none;
}

/* Temas de cenario: Observatorio Espacial & Base Polar */
body[data-theme="espaco"] .screen-title {
  background: linear-gradient(to bottom, #070C1F 0%, #14224D 52%, #24366B 68%, #080E24 68%, #080E24 100%);
}
body[data-theme="espaco"] .arena-wrap {
  background: linear-gradient(to bottom, #0B122B 0%, #172757 25%, #2B3E78 43.6%, #7CE8FF 43.6%, #7CE8FF 44.5%, #132048 44.5%, #0D1736 72%, #080E24 100%);
}
body[data-theme="espaco"] .top-bar {
  background: #0B132B;
  border-bottom-color: #7CE8FF;
}
body[data-theme="espaco"] .command-deck {
  background: linear-gradient(180deg, #101A3B 0%, #1A2852 100%);
}
body[data-theme="espaco"] .title-logo {
  color: #1D4D9B;
}
body[data-theme="espaco"] .title-sub {
  color: #243763;
}

body[data-theme="polar"] .screen-title {
  background: linear-gradient(to bottom, #112A47 0%, #24537A 48%, #7CC2DA 68%, #09314A 68%, #09314A 100%);
}
body[data-theme="polar"] .arena-wrap {
  background: linear-gradient(to bottom, #163559 0%, #2A5E84 25%, #7CC2DA 43.6%, #D8F8FF 43.6%, #D8F8FF 44.5%, #1D7496 44.5%, #114F6E 72%, #09314A 100%);
}
body[data-theme="polar"] .top-bar {
  background: #10324A;
  border-bottom-color: #52F2C2;
}
body[data-theme="polar"] .command-deck {
  background: linear-gradient(180deg, #163C54 0%, #1E506E 100%);
}
body[data-theme="polar"] .title-logo {
  color: #126A8C;
}
body[data-theme="polar"] .title-sub {
  color: #154A63;
}

body[data-contrast="high"][data-theme="espaco"] .top-bar,
body[data-contrast="high"][data-theme="polar"] .top-bar,
body[data-contrast="high"][data-theme="espaco"] .command-deck,
body[data-contrast="high"][data-theme="polar"] .command-deck {
  background: #000000;
  border-color: #FFFFFF;
}

body[data-contrast="high"] .stage-speech,
body[data-contrast="high"] .summary-ritual,
body[data-contrast="high"] .dock-synergy {
  background: #FFFFFF;
  border-color: #000000;
  color: #000000;
}

body[data-contrast="high"] .stage-speech-speaker {
  background: #000000;
  color: #FFFFFF;
}

.title-stage {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.title-stage .sea-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.title-overlay {
  position: relative;
  z-index: 2;
  width: min(540px, 92vw);
  margin: 12px;
}

.title-card {
  background: rgba(250, 251, 249, 0.95);
  border: 4px solid var(--ink);
  border-radius: 22px;
  padding: clamp(18px, 2.8vw, 30px);
  box-shadow: 0 12px 0 rgba(14, 36, 51, 0.28), 0 24px 44px rgba(4, 30, 44, 0.32);
  text-align: center;
}

.title-logo {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.8rem, 6vw, 4.3rem);
  font-weight: 900;
  line-height: 0.98;
  letter-spacing: -0.03em;
  color: var(--coral);
  text-shadow: 0 3px 0 rgba(14, 36, 51, 0.14);
}

.title-sub {
  margin: 6px 0 0;
  font-size: var(--text-lg);
  font-weight: 800;
  color: var(--teal-dark);
}

.title-lead {
  margin: 10px auto 16px;
  font-size: var(--text-body);
  color: var(--ink-muted);
  max-width: 38ch;
  line-height: 1.38;
}

.pack-notice {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 2px solid var(--teal);
  background: var(--mint-soft);
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 700;
}

.pack-notice.is-error {
  border-color: var(--coral);
  background: var(--warn-bg);
  color: var(--warn);
}

.title-controls {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin-bottom: 16px;
}

.control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.control-label {
  font-size: var(--text-body);
  font-weight: 800;
  color: var(--ink);
  min-width: 86px;
  text-align: left;
}

/* Controlo segmentado ligado (sem parede de botoes soltos) */
.segmented {
  display: inline-flex;
  background: var(--surface-strong);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  padding: 3px;
  gap: 2px;
  flex: 1;
}

.seg-btn {
  flex: 1;
  min-height: 44px;
  padding: 6px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: var(--text-sm);
  font-weight: 800;
  color: var(--ink);
  transition: background-color 150ms var(--ease), color 150ms var(--ease), transform 120ms var(--ease);
  white-space: nowrap;
}

.seg-btn:hover:not(.is-selected) {
  background: rgba(255, 255, 255, 0.65);
}

.seg-btn.is-selected {
  background: var(--teal);
  color: #FFFFFF;
  box-shadow: 0 2px 0 rgba(14, 36, 51, 0.25);
}

.seg-btn-hot.is-selected {
  background: var(--coral);
  color: #FFFFFF;
}

.segmented-compact {
  flex: 0 0 auto;
  padding: 2px;
  border-width: 2px;
}

.segmented-compact .seg-btn {
  min-height: 38px;
  padding: 4px 10px;
}

/* Botao primario tatil */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 58px;
  padding: 12px 28px;
  border: 3px solid var(--ink);
  border-radius: 15px;
  background: var(--coral);
  color: #FFFFFF;
  font-size: clamp(1.2rem, 1.8vw, 1.48rem);
  font-weight: 900;
  box-shadow: 0 6px 0 var(--ink);
  transition: transform 130ms var(--ease), box-shadow 130ms var(--ease), background-color 150ms ease;
}

.btn-primary:hover {
  background: #E75034;
  transform: translateY(-2px);
  box-shadow: 0 8px 0 var(--ink);
}

.btn-primary:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 var(--ink);
}

.btn-start {
  width: 100%;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 10px 20px;
  border: 2.5px solid var(--ink);
  border-radius: 13px;
  background: var(--paper);
  color: var(--ink);
  font-size: var(--text-body);
  font-weight: 800;
  box-shadow: 0 4px 0 var(--ink);
  transition: transform 130ms var(--ease), box-shadow 130ms var(--ease), background-color 150ms ease;
}

.btn-secondary:hover {
  background: var(--surface);
  transform: translateY(-1px);
}

.btn-secondary:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--ink);
}

.key-hint {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 7px;
  background: rgba(14, 36, 51, 0.28);
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  font-family: inherit;
  font-size: 0.78em;
  font-weight: 800;
}

.key-mini {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  border-radius: 5px;
  background: rgba(14, 36, 51, 0.14);
  font-family: inherit;
  font-size: 0.8em;
  font-weight: 800;
}

.seg-btn.is-selected .key-mini {
  background: rgba(255, 255, 255, 0.25);
}

.title-utility {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 2px solid var(--line);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px 10px;
}

.util-link {
  border: 0;
  background: transparent;
  padding: 5px 3px;
  min-height: 36px;
  font-size: clamp(0.8rem, 0.98vw, 0.9rem);
  font-weight: 700;
  color: var(--teal-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}

.util-link:hover {
  color: var(--coral-dark);
}

/* ===================== ECRA DE JOGO (SINGLE-VIEWPORT 16:9) ===================== */
.screen-play {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100dvh;
  background: var(--paper);
  overflow: hidden;
}

.top-bar {
  flex: 0 0 auto;
  min-height: 48px;
  padding: 4px clamp(12px, 2vw, 24px);
  background: var(--ink);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 3px solid #061520;
}

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

.brand-mark {
  width: 16px;
  height: 26px;
  border-radius: 4px 4px 2px 2px;
  background: repeating-linear-gradient(
    to bottom,
    #FFD147 0 6px,
    #D9462B 6px 13px,
    #FAFBF9 13px 19px,
    #D9462B 19px 26px
  );
  border: 1.5px solid #FFFFFF;
}

.brand-name {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 1.5vw, 1.32rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.wave-readout {
  font-size: var(--text-sm);
  font-weight: 800;
  color: #FFE680;
  margin-left: 6px;
  white-space: nowrap;
}

.wave-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wave-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  border: 1.5px solid rgba(255, 255, 255, 0.55);
}

.wave-dot.is-done {
  background: var(--mint);
  border-color: #FFFFFF;
}

.wave-dot.is-current {
  background: #FFD147;
  border-color: #FFFFFF;
  transform: scale(1.22);
}

.wave-dot.is-boss {
  border-radius: 3px;
}

.top-bar .segmented {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.45);
}

.top-bar .seg-btn {
  color: #EAF6FA;
}

.top-bar .seg-btn:hover:not(.is-selected) {
  background: rgba(255, 255, 255, 0.18);
}

.top-bar .seg-btn.is-selected {
  background: #FFD147;
  color: #0E2433;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 42px;
  min-height: 40px;
  padding: 6px 11px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: #FFFFFF;
  font-size: var(--text-sm);
  font-weight: 700;
  transition: background-color 140ms ease, transform 110ms var(--ease);
  white-space: nowrap;
}

.icon-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.22);
}

.icon-btn:active:not(:disabled) {
  transform: scale(0.96);
}

.icon-btn:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.icon-btn-accent {
  background: var(--coral);
  border-color: #FF8E77;
}

.icon-btn-accent:hover:not(:disabled) {
  background: #E85438;
}

.icon-btn-home {
  text-decoration: none;
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.45);
}

.icon-btn.is-active-toggle {
  background: rgba(244, 167, 29, 0.25);
  border-color: #FFD147;
  color: #FFE680;
}

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

.util-home {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  font-weight: 900;
}

/* ===================== PALCO MARITIMO (54% PROPORCAO DE JOGO) ===================== */
.arena-wrap {
  position: relative;
  flex: 0 0 calc((100dvh - 57px) * 0.54);
  min-height: 200px;
  max-height: none;
  /* Gradiente continuo alinhado com o horizonte do SVG (170 / 390 = 43.6%) */
  background: linear-gradient(
    to bottom,
    #1E88C9 0%,
    #6CCBF0 24.4%,
    #D4F2FA 43.6%,
    #A2ECF5 43.6%,
    #A2ECF5 44.6%,
    #1EA4B8 44.6%,
    #0E7C94 71%,
    #084E68 100%
  );
  border-bottom: 4px solid var(--ink);
  overflow: hidden;
}

html.has-hd-bg body:not([data-contrast="high"]):not([data-theme="espaco"]):not([data-theme="polar"]) .arena-wrap {
  /* Panorama 2560x585 sem costuras laterais com horizonte travado exatamente a 170/390 = 43.59% */
  background-image:
    url("assets/bg-farol-ria.webp"),
    linear-gradient(to bottom, #1E88C9 0%, #6CCBF0 24.4%, #D4F2FA 43.6%, #A2ECF5 43.6%, #A2ECF5 44.6%, #1EA4B8 44.6%, #0E7C94 71%, #084E68 100%);
  background-size: cover, 100% 100%;
  background-position: center 43.59%, center;
  background-repeat: no-repeat;
}

.play-stage {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.play-stage .sea-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.arena-hud-left {
  position: absolute;
  top: 8px;
  left: 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  z-index: 4;
  pointer-events: none;
}

@media (max-width: 1040px) {
  .arena-hud-left {
    flex-direction: row;
    flex-wrap: wrap;
    left: 25%;
  }
}

.hud-meter {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: 10px;
  background: rgba(14, 36, 51, 0.88);
  border: 2px solid #FFFFFF;
  color: #FFFFFF;
  font-size: var(--text-sm);
  font-weight: 700;
}

.hud-meter strong {
  font-size: 1.15em;
  font-weight: 900;
  color: #A8F0FF;
}

.hud-combo.is-hot {
  background: #8F2B00;
  border-color: #FFD147;
}

.hud-combo.is-hot strong {
  color: #FFE680;
}

.boss-hud {
  position: absolute;
  top: 10px;
  right: 16px;
  width: min(380px, 44vw);
  padding: 8px 14px;
  border-radius: 12px;
  background: rgba(14, 36, 51, 0.92);
  border: 2.5px solid #FFD147;
  color: #FFFFFF;
  z-index: 4;
}

.boss-hud-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: var(--text-sm);
  margin-bottom: 5px;
}

.boss-hud-head strong {
  color: #FFE680;
  font-weight: 900;
}

.boss-bar-track {
  width: 100%;
  height: 14px;
  border-radius: 7px;
  background: #09202D;
  border: 1.5px solid rgba(255, 255, 255, 0.35);
  overflow: hidden;
}

.boss-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #D9462B, #F4A71D);
  transition: width 260ms var(--ease);
}

.boss-hud.is-phase2 {
  border-color: #7CE8FF;
  box-shadow: 0 0 0 3px rgba(124, 232, 255, 0.32);
}

.boss-phase-pill {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 99px;
  background: #7CE8FF;
  color: #0E2433;
  font-size: 0.74rem;
  font-weight: 900;
  vertical-align: middle;
}

/* Balao BD de 1 linha no palco (gancho narrativo, sinergia, Fase 2 do Chefe) */
.stage-speech {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  max-width: min(820px, calc(100% - 340px));
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-radius: 14px;
  background: rgba(255, 253, 245, 0.96);
  border: 3px solid var(--ink);
  box-shadow: 0 5px 0 rgba(14, 36, 51, 0.28);
  color: var(--ink);
  font-size: clamp(0.84rem, 1.05vw, 0.96rem);
  font-weight: 800;
  line-height: 1.25;
}

@media (max-width: 1040px) {
  .stage-speech {
    top: auto;
    bottom: 8px;
    max-width: calc(100% - 28px);
  }
}

.stage-speech-speaker {
  flex: 0 0 auto;
  padding: 2px 8px;
  border-radius: 99px;
  background: var(--coral);
  color: #FFFFFF;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.stage-speech.is-synergy .stage-speech-speaker {
  background: #B26A00;
}

.stage-speech.is-boss .stage-speech-speaker {
  background: #0E2433;
  color: #7CE8FF;
}

.stage-speech-text {
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage-speech-close {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--ink);
  background: var(--surface);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 900;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.stage-speech-close:hover {
  background: #FFE680;
}

/* Badge compacto de sinergia ativa na doca de modulos */
.dock-synergy {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 99px;
  border: 2px solid var(--ink);
  background: #FFD147;
  color: var(--ink);
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 2px 0 rgba(14, 36, 51, 0.22);
}

.dock-synergy-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--coral);
  border: 1.5px solid var(--ink);
}

@keyframes synergyPulseOut {
  0% { transform: scale(0.75); opacity: 0.95; }
  100% { transform: scale(2.8); opacity: 0; }
}

.vfx-synergy-ring {
  transform-box: fill-box;
  transform-origin: center;
  animation: synergyPulseOut 520ms ease-out forwards;
}

.slate-banner {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 10px 20px;
  border-radius: 14px;
  background: #0E2433;
  border: 3px solid #FFD147;
  color: #FFFFFF;
  font-size: var(--text-body);
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

.slate-banner strong {
  color: #FFE680;
  font-size: 1.35em;
}

.slate-stop {
  min-height: 36px;
  padding: 4px 12px;
  border-radius: 8px;
  border: 2px solid #0E2433;
  background: #FFD147;
  color: #0E2433;
  font-weight: 900;
}

/* Animacoes SVG do palco */
.lh-module {
  opacity: 0;
  transform: scale(0.4);
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity 220ms var(--ease), transform 300ms var(--ease);
  pointer-events: none;
}

.lh-module.is-installed {
  opacity: 1;
  transform: scale(1);
}

.lh-module.just-installed {
  animation: boltPop 480ms var(--ease);
}

.enemy-unit {
  cursor: pointer;
  transition: transform 280ms var(--ease);
}

.enemy-unit:hover .enemy-sprite {
  filter: brightness(1.08);
}

.enemy-unit.is-hit .enemy-sprite {
  animation: hitRecoil 240ms var(--ease);
}

.arena-wrap.is-shaking {
  animation: screenShake 220ms ease-out;
}

.lighthouse-beam {
  transform-origin: 168px 94px;
  animation: beamSweep 9s ease-in-out infinite;
}

.turbine-spin {
  animation: spinSlow 5.5s linear infinite;
}

.boss-prop {
  animation: spinSlow 2.2s linear infinite;
}

@keyframes reticlePulse {
  0%, 100% { opacity: 0.95; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(1.045); }
}

.target-reticle {
  animation: reticlePulse 1.6s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.danger-ring,
.boss-rage-aura {
  animation: reticlePulse 1.05s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center;
}

.vfx-beam {
  animation: beamFade 360ms ease-out forwards;
}

.vfx-float {
  animation: floatUp 740ms var(--ease) forwards;
}

.vfx-spark {
  animation: sparkFly 400ms var(--ease) forwards;
}

@keyframes beamSweep {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(7deg); }
}

@keyframes spinSlow {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes boltPop {
  0% { transform: scale(0.2) rotate(-18deg); opacity: 0; }
  65% { transform: scale(1.25) rotate(5deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes hitRecoil {
  0% { transform: translateX(0); filter: brightness(2); }
  40% { transform: translateX(18px); }
  100% { transform: translateX(0); filter: brightness(1); }
}

@keyframes screenShake {
  0%, 100% { transform: translate(0, 0); }
  25% { transform: translate(-5px, 3px); }
  55% { transform: translate(5px, -2px); }
  80% { transform: translate(-3px, 1px); }
}

@keyframes beamFade {
  0% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0) scale(0.85); }
  30% { opacity: 1; transform: translateY(-18px) scale(1.12); }
  100% { opacity: 0; transform: translateY(-54px) scale(1); }
}

@keyframes sparkFly {
  0% { opacity: 1; transform: translate(0, 0) scale(1); }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.2); }
}

/* ===================== CONSOLA NAUTICA DO FAROLEIRO ===================== */
.command-deck {
  flex: 1 1 0;
  min-height: 0;
  background:
    radial-gradient(circle at 50% 0%, #17465E 0%, #0E2B3B 62%, #091D29 100%);
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: clamp(6px, 0.9vh, 14px) clamp(12px, 2.2vw, 28px);
  overflow: hidden;
}

.deck-inner {
  position: relative;
  width: min(1180px, 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(5px, 0.78vh, 10px);
  padding: clamp(6px, 0.95vh, 13px) clamp(12px, 1.8vw, 22px);
  border-radius: 18px;
  background: linear-gradient(180deg, #16394B 0%, #102B3A 100%);
  border: 3px solid #0E2433;
  box-shadow:
    inset 0 0 0 2px rgba(201, 142, 39, 0.72),
    0 6px 18px rgba(0, 0, 0, 0.28);
  min-height: 0;
}

.azulejo-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  pointer-events: none;
  opacity: 0.92;
  z-index: 2;
}
.az-tl { top: -8px; left: -8px; }
.az-tr { top: -8px; right: -8px; }
.az-bl { bottom: -8px; left: -8px; }
.az-br { bottom: -8px; right: -8px; }

.challenge-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
}

.challenge-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  min-width: 0;
}

.challenge-kind {
  font-size: clamp(0.84rem, 1.02vw, 0.98rem);
  font-weight: 900;
  color: #FFE680;
  letter-spacing: 0.01em;
}

.challenge-target {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(14, 124, 148, 0.36);
  border: 1.5px solid #6CCBF0;
  color: #EAF9FF;
  font-size: clamp(0.78rem, 0.95vw, 0.9rem);
  font-weight: 800;
  white-space: nowrap;
}

.challenge-target.is-armored {
  background: rgba(201, 142, 39, 0.3);
  border-color: #FFD147;
  color: #FFF4CC;
}

.target-mini-svg {
  display: block;
  flex: 0 0 auto;
}

.challenge-prompt {
  font-size: clamp(0.92rem, 1.15vw, 1.08rem);
  font-weight: 700;
  color: #F4FAFC;
}

.tactical-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.command-deck .segmented {
  background: rgba(7, 22, 31, 0.55);
  border-color: rgba(201, 142, 39, 0.72);
}

.command-deck .seg-btn {
  min-height: clamp(32px, 4.3vh, 40px);
  padding: 4px 10px;
  font-size: clamp(0.82rem, 1vw, 0.94rem);
  color: #EAF6FA;
}

.command-deck .seg-btn.is-selected {
  background: var(--teal);
  color: #FFFFFF;
}

.command-deck .seg-btn-hot.is-selected {
  background: var(--coral);
  color: #FFFFFF;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: clamp(32px, 4.3vh, 40px);
  padding: 4px 11px;
  border: 2px solid #C98E27;
  border-radius: 10px;
  background: #FDF8E6;
  color: var(--ink);
  font-size: clamp(0.82rem, 1vw, 0.94rem);
  font-weight: 800;
  transition: background-color 140ms ease, transform 110ms var(--ease);
}

.tool-btn:hover:not(:disabled) {
  background: #FFF2C2;
}

.tool-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tool-btn-scout {
  background: var(--amber-soft);
  border-color: #FFD147;
}

.tool-btn-scout:hover:not(:disabled) {
  background: #FFE799;
}

.challenge-stage {
  flex: 1 1 auto;
  min-height: clamp(54px, 8.8vh, 102px);
  max-height: clamp(82px, 13.5vh, 138px);
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 10px 22px;
  padding: clamp(5px, 0.8vh, 10px) 16px;
  background: #FDF8E6;
  border: 3px solid #0E2433;
  box-shadow: inset 0 0 0 2px rgba(201, 142, 39, 0.55);
  border-radius: 14px;
  overflow: hidden;
}

.ch-display {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3.6vw, 3.2rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  color: var(--ink);
  line-height: 1.06;
  text-align: center;
}

.ch-display.is-sub {
  font-size: clamp(1.42rem, 2.6vw, 2.25rem);
}

.ch-display.is-long {
  font-size: clamp(0.98rem, 1.6vw, 1.38rem);
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -0.01em;
  max-width: 960px;
}

.frac-bar-svg {
  width: clamp(190px, 24vw, 290px);
  height: auto;
  max-height: clamp(42px, 7.6vh, 66px);
  display: block;
}

.frac-wheel-svg {
  width: clamp(52px, 8.6vh, 88px);
  height: clamp(52px, 8.6vh, 88px);
  display: block;
}

.ch-scaffold {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-left: 2px solid #C98E27;
}

.scaffold-svg {
  max-height: clamp(48px, 8vh, 82px);
  width: auto;
}

.cmp-bars {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 176px;
}

.cmp-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.84rem;
  font-weight: 800;
}

.cmp-bar-lbl {
  width: 34px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cmp-bar-track {
  flex: 1;
  height: 10px;
  background: #E2EEF2;
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  overflow: hidden;
}

.cmp-bar-fill {
  display: block;
  height: 100%;
  background: var(--mint);
}

/* Faixa de pista / feedback */
.feedback-strip {
  min-height: clamp(30px, 4.2vh, 40px);
  padding: 4px 12px;
  border-radius: 10px;
  border: 2px solid rgba(201, 142, 39, 0.55);
  background: rgba(253, 248, 230, 0.94);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: clamp(0.84rem, 1.05vw, 0.98rem);
  font-weight: 700;
  color: var(--ink);
  transition: background-color 160ms ease, border-color 160ms ease;
}

.feedback-strip.is-hint {
  background: var(--amber-soft);
  border-color: var(--amber);
  color: #4D2D00;
}

.feedback-strip.is-ok {
  background: var(--ok-bg);
  border-color: var(--ok);
  color: #08422C;
}

.feedback-strip.is-warn {
  background: var(--warn-bg);
  border-color: var(--coral);
  color: #5C1907;
}

.fb-icon {
  font-size: 1.15em;
  font-weight: 900;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
}

.fb-text {
  flex: 1;
  line-height: 1.22;
}

.btn-continue {
  min-height: 32px;
  padding: 4px 12px;
  border: 2px solid var(--ink);
  border-radius: 9px;
  background: var(--teal);
  color: #FFFFFF;
  font-size: clamp(0.82rem, 1vw, 0.94rem);
  font-weight: 800;
  white-space: nowrap;
}

/* Grelha de botoes de telegrafo nautico (1 linha de 4 botoes em >= 1024px) */
.answers-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(7px, 1vw, 13px);
}

.answers-grid.is-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ans-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: clamp(48px, 7.2vh, 74px);
  padding: 6px 12px 6px 64px;
  border: 3px solid var(--ink);
  border-radius: 13px;
  background: #FDF8E6;
  color: var(--ink);
  font-size: clamp(1.22rem, 2.05vw, 1.9rem);
  font-weight: 900;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 4px 0 #091822, inset 0 1px 0 rgba(255, 255, 255, 0.85);
  transition: transform 120ms var(--ease), box-shadow 120ms var(--ease), background-color 140ms ease, opacity 160ms ease;
}

.answers-grid.is-three .ans-btn {
  font-size: clamp(1.06rem, 1.65vw, 1.48rem);
}

.ans-btn.is-long-opt {
  font-size: clamp(0.86rem, 1.15vw, 1.08rem);
  font-weight: 800;
  padding-left: 58px;
}

.ans-btn:hover:not(:disabled) {
  background: #FFF2C2;
  transform: translateY(-2px);
  box-shadow: 0 6px 0 #091822;
}

.ans-btn:active:not(:disabled) {
  transform: translateY(3px);
  box-shadow: 0 2px 0 #091822;
}

.ans-key {
  position: absolute;
  left: 8px;
  min-width: 46px;
  height: 32px;
  padding: 0 6px;
  gap: 4px;
  border-radius: 8px;
  background: var(--ink);
  color: #FFE680;
  border: 1.5px solid #C98E27;
  font-size: 0.92rem;
  font-weight: 900;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: -0.01em;
}

.ans-shape {
  font-size: 0.84em;
  line-height: 1;
}

.ans-btn.is-wrong {
  background: #DCE4E8;
  color: #5A6B75;
  border-color: #6B7F8B;
  box-shadow: none;
  transform: translateY(3px);
  opacity: 0.7;
  text-decoration: line-through;
  cursor: not-allowed;
}

.ans-btn.is-wrong .ans-key {
  background: var(--coral);
  color: #FFFFFF;
  border-color: var(--coral-dark);
}

.ans-btn.is-eliminated {
  background: #E8EFF2;
  color: #6F828D;
  border-style: dashed;
  border-color: #8BA0AC;
  box-shadow: none;
  opacity: 0.52;
  cursor: not-allowed;
}

.ans-btn.is-correct {
  background: var(--ok-bg);
  border-color: var(--ok);
  color: #063825;
  box-shadow: 0 4px 0 var(--ok);
}

.ans-btn.is-correct .ans-key {
  background: var(--ok);
  color: #FFFFFF;
  border-color: #063825;
}

.ans-btn.is-wobble {
  animation: wobbleX 280ms ease-out;
}

@keyframes wobbleX {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  55% { transform: translateX(7px); }
  80% { transform: translateX(-4px); }
}

/* Barra compacta dos modulos instalados */
.modules-dock {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 3px;
  border-top: 1.5px solid rgba(201, 142, 39, 0.42);
  font-size: clamp(0.78rem, 0.96vw, 0.9rem);
  min-height: 24px;
  line-height: 1.2;
}

.dock-label {
  font-weight: 900;
  color: #FFE680;
  white-space: nowrap;
}

.dock-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
}

.dock-empty {
  color: #CBE2EC;
  font-weight: 600;
}

.dock-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 800;
  color: #FFFFFF;
}

.dock-item svg {
  width: 20px;
  height: 20px;
}

/* Override limpo de Alto Contraste para a Consola Nautica */
body[data-contrast="high"] .command-deck {
  background: #FFFFFF;
}

body[data-contrast="high"] .deck-inner {
  background: #FFFFFF;
  border: 3px solid #000000;
  box-shadow: none;
}

body[data-contrast="high"] .azulejo-corner {
  display: none;
}

body[data-contrast="high"] .challenge-kind,
body[data-contrast="high"] .challenge-prompt,
body[data-contrast="high"] .dock-label,
body[data-contrast="high"] .dock-empty,
body[data-contrast="high"] .dock-item {
  color: #000000;
}

body[data-contrast="high"] .challenge-target {
  background: #FFF08A;
  border: 2px solid #000000;
  color: #000000;
}

body[data-contrast="high"] .command-deck .segmented {
  background: #FFFFFF;
  border-color: #000000;
}

body[data-contrast="high"] .command-deck .seg-btn {
  color: #000000;
}

body[data-contrast="high"] .command-deck .seg-btn.is-selected {
  background: #000000;
  color: #FFFFFF;
}

body[data-contrast="high"] .challenge-stage,
body[data-contrast="high"] .ans-btn,
body[data-contrast="high"] .tool-btn,
body[data-contrast="high"] .feedback-strip {
  background: #FFFFFF;
  border-color: #000000;
  box-shadow: none;
  color: #000000;
}

body[data-contrast="high"] .ans-key {
  background: #000000;
  color: #FFFFFF;
  border-color: #000000;
}

body[data-contrast="high"] .modules-dock {
  border-top-color: #000000;
}

/* ===================== MODAIS (DRAFT / RESUMO / AJUDA) ===================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(8, 28, 40, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  overflow-y: auto;
}

.modal-panel {
  width: min(1040px, 100%);
  margin: auto;
  background: var(--paper);
  border: 4px solid var(--ink);
  border-radius: 22px;
  padding: clamp(20px, 3vw, 34px);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.42);
  animation: modalIn 220ms var(--ease);
}

.modal-help {
  width: min(620px, 100%);
}

.modal-summary {
  width: min(920px, 100%);
  padding: clamp(12px, 1.8vw, 22px);
}

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

.modal-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 2.8vw, 2.3rem);
  font-weight: 900;
  color: var(--ink);
  text-align: center;
}

.modal-sub {
  margin: 6px 0 20px;
  font-size: var(--text-body);
  color: var(--ink-muted);
  text-align: center;
  font-weight: 600;
}

/* Cartas Roguelike 1 de 3 */
.draft-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.draft-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 18px 22px;
  border: 3.5px solid var(--ink);
  border-radius: 18px;
  background: #FFFFFF;
  box-shadow: 0 7px 0 var(--ink);
  transition: transform 150ms var(--ease), box-shadow 150ms var(--ease), background-color 150ms ease;
}

.draft-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 13px 0 var(--ink);
  background: #F4FBFC;
}

.draft-card.rarity-rara {
  border-color: #0E7C94;
  background: linear-gradient(180deg, #F0FBF9 0%, #FFFFFF 58%);
}

.draft-card.rarity-dourada {
  border-color: #B26A00;
  background: linear-gradient(180deg, #FFF7D6 0%, #FFFFFF 58%);
}

.draft-key {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--ink);
  color: #FFFFFF;
  font-size: 1.05rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.draft-rarity {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--ink-muted);
  margin-bottom: 10px;
}

.rarity-rara .draft-rarity { color: #0A6353; }
.rarity-dourada .draft-rarity { color: #8A4F00; }

.draft-art {
  width: 88px;
  height: 88px;
  margin: 4px 0 12px;
}

.draft-art svg {
  width: 100%;
  height: 100%;
}

.draft-name {
  margin: 0;
  font-size: clamp(1.2rem, 1.8vw, 1.48rem);
  font-weight: 900;
  color: var(--ink);
}

.draft-tag {
  margin: 4px 0 10px;
  font-size: var(--text-sm);
  font-weight: 800;
  color: var(--teal-dark);
}

.draft-desc {
  margin: 0;
  font-size: var(--text-body);
  line-height: 1.38;
  color: var(--ink-muted);
  font-weight: 600;
}

.draft-synergy {
  margin-top: 12px;
  font-size: 0.92rem;
  font-weight: 900;
  color: #8A4F00;
}

/* Resumo da turma */
.summary-head {
  text-align: center;
}

.summary-medal {
  width: 40px;
  height: 40px;
  margin: 0 auto 4px;
  border-radius: 50%;
  background: #FFD147;
  border: 2.5px solid var(--ink);
  color: var(--ink);
  font-size: 1.35rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-summary .modal-title {
  font-size: clamp(1.32rem, 2.15vw, 1.82rem);
}

.modal-summary .modal-sub {
  margin: 2px 0 8px;
  font-size: var(--text-sm);
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 8px 0 10px;
  padding: 8px 10px;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 12px;
  text-align: center;
}

.stat-val {
  display: block;
  font-size: clamp(1.25rem, 1.9vw, 1.6rem);
  font-weight: 900;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.stat-lbl {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--ink-muted);
}

.summary-cols {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 16px;
  margin-bottom: 10px;
}

.summary-block h3 {
  margin: 0 0 7px;
  font-size: var(--text-sm);
  font-weight: 900;
  color: var(--ink);
}

.domain-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dom-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dom-head {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
  font-weight: 800;
}

.dom-track {
  height: 12px;
  border-radius: 6px;
  background: var(--surface-strong);
  border: 1.5px solid var(--ink);
  overflow: hidden;
}

.dom-fill {
  height: 100%;
  background: var(--mint);
}

.build-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.build-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-sm);
  font-weight: 700;
}

.build-row svg {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
}

.summary-diagnostic {
  margin-bottom: 10px;
  padding: 8px 12px;
  background: #FFF9EB;
  border: 2px solid #B26A00;
  border-radius: 12px;
}

.summary-diagnostic.is-neutral {
  background: var(--surface);
  border-color: var(--line);
}

.summary-diagnostic h3 {
  margin: 0 0 5px;
  font-size: 0.88rem;
  font-weight: 900;
  color: var(--ink);
}

.diag-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.diag-item {
  font-size: 0.84rem;
  line-height: 1.28;
  color: var(--ink);
}

.diag-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-weight: 800;
}

.diag-count {
  padding: 1px 7px;
  border-radius: 99px;
  border: 1.5px solid var(--ink);
  background: #FFFFFF;
  font-size: 0.8rem;
  font-weight: 900;
  white-space: nowrap;
}

.diag-rx {
  margin: 2px 0 0;
  color: var(--ink-muted);
  font-weight: 600;
}

.summary-ritual {
  margin-bottom: 10px;
  padding: 9px 13px;
  background: #EEF8FC;
  border: 2.5px solid var(--teal-dark);
  border-radius: 12px;
}

.summary-ritual-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.summary-ritual-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 900;
  color: var(--teal-dark);
}

.summary-ritual-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  border: 1.5px solid var(--ink);
  background: #FFFFFF;
  color: var(--ink);
  font-size: 0.76rem;
  font-weight: 900;
}

.summary-ritual-q {
  margin: 0 0 3px;
  font-size: 0.92rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--ink);
}

.summary-ritual-tip {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.summary-aquario {
  margin-bottom: 10px;
  padding: 7px 12px;
  background: #ECFAFC;
  border: 2px solid var(--teal-dark);
  border-radius: 12px;
}

.aquario-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
}

.aquario-label {
  font-size: var(--text-sm);
  font-weight: 800;
  color: var(--ink);
}

.reward-code {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 8px;
  border: 2px solid var(--ink);
  background: #FFFFFF;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.08rem;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.btn-copy {
  min-height: 36px;
  padding: 4px 12px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--teal);
  color: #FFFFFF;
  font-size: 0.86rem;
  font-weight: 800;
  transition: background-color 140ms ease, transform 110ms var(--ease);
}

.btn-copy:hover {
  background: var(--teal-dark);
}

.btn-copy.is-copied {
  background: var(--ok);
}

.aquario-note {
  margin: 5px 0 0;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.summary-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 10px;
}

.modal-summary .summary-actions .btn-primary,
.modal-summary .summary-actions .btn-secondary {
  min-height: 44px;
  padding: 7px 15px;
  font-size: 0.96rem;
  box-shadow: 0 3px 0 var(--ink);
  white-space: nowrap;
}

/* Folha dedicada A4 oculta no ecra */
.print-cards-sheet {
  display: none;
}

.help-list {
  margin: 16px 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: var(--text-body);
  font-weight: 600;
}

.help-list kbd {
  display: inline-block;
  min-width: 28px;
  padding: 2px 8px;
  margin-right: 4px;
  text-align: center;
  border: 2px solid var(--ink);
  border-radius: 6px;
  background: var(--surface);
  font-family: inherit;
  font-weight: 900;
}

.help-note {
  margin: 12px 0 20px;
  font-size: var(--text-sm);
  color: var(--ink-muted);
}

/* ===================== RESPONSIVO (TABLET E MOBILE) ===================== */
@media (max-width: 1180px) {
  .top-bar .btn-txt { display: none; }
  .top-right { gap: 6px; }
}

@media (max-width: 1023px) {
  .answers-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .challenge-stage {
    flex-wrap: wrap;
    max-height: none;
  }
  .command-deck {
    overflow-y: auto;
  }
}

@media (max-width: 960px) {
  .btn-txt { display: none; }
  .wave-dots { display: none; }
  .draft-grid { grid-template-columns: 1fr; }
  .summary-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .summary-cols { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .screen-play {
    height: auto;
    min-height: 100dvh;
    overflow-y: auto;
  }
  .top-bar {
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 6px;
  }
  .top-center {
    order: 3;
    width: 100%;
    justify-content: center;
  }
  .arena-wrap {
    flex: 0 0 auto;
    height: max(35dvh, 210px);
    min-height: 200px;
  }
  .arena-hud-left {
    left: 8px;
    top: 6px;
    gap: 5px;
  }
  .hud-meter {
    padding: 4px 8px;
    font-size: 0.82rem;
  }
  .boss-hud {
    width: calc(100% - 24px);
    top: auto;
    bottom: 8px;
    right: 12px;
  }
  .stage-speech {
    top: auto;
    bottom: 8px;
    left: 10px;
    right: 10px;
    transform: none;
    max-width: none;
    font-size: 0.8rem;
    padding: 6px 10px;
  }
  .command-deck {
    flex: 1 0 auto;
    padding: 10px;
    overflow: visible;
  }
  .deck-inner {
    padding: 14px 14px;
  }
  .challenge-bar {
    padding: 7px 14px 0;
  }
  .azulejo-corner {
    width: 14px;
    height: 14px;
  }
  .az-tl { top: 3px; left: 3px; }
  .az-tr { top: 3px; right: 3px; }
  .az-bl { bottom: 3px; left: 3px; }
  .az-br { bottom: 3px; right: 3px; }
  .control-row {
    flex-direction: column;
    align-items: stretch;
    gap: 5px;
  }
  .answers-grid,
  .answers-grid.is-three {
    grid-template-columns: 1fr;
  }
  .ch-scaffold {
    border-left: 0;
    border-top: 2px solid #C98E27;
    padding-top: 8px;
  }
}

/* ===================== ACESSIBILIDADE DE MOVIMENTO ===================== */
@media (prefers-reduced-motion: reduce) {
  .lighthouse-beam,
  .turbine-spin,
  .boss-prop,
  .target-reticle,
  .danger-ring,
  .boss-rage-aura,
  .lh-module.just-installed,
  .enemy-unit.is-hit .enemy-sprite,
  .arena-wrap.is-shaking,
  .ans-btn.is-wobble,
  .modal-panel {
    animation: none !important;
  }
  .vfx-spark,
  .vfx-synergy-ring {
    display: none;
  }
  * {
    transition-duration: 0.01ms !important;
  }
}

/* ===================== IMPRESSAO A4 PRETO-E-BRANCO (a4-print-design) ===================== */
@media print {
  @page {
    size: A4 portrait;
    margin: 14mm 12mm 14mm 18mm;
  }
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
  html, body {
    height: auto !important;
    overflow: visible !important;
    background: #FFFFFF !important;
    color: #0F172A !important;
  }
  .screen-title,
  .screen-play,
  #draftModal,
  #helpModal,
  .no-print {
    display: none !important;
  }
  h1, h2, h3 {
    break-after: avoid !important;
    page-break-after: avoid !important;
  }
  p {
    orphans: 3;
    widows: 3;
  }

  /* Modo 1: Resumo cooperativo A4 */
  body[data-print="summary"] #tactileCardsSheet {
    display: none !important;
  }
  body[data-print="summary"] #summaryModal {
    position: static !important;
    inset: auto !important;
    background: #FFFFFF !important;
    padding: 0 !important;
    display: block !important;
    overflow: visible !important;
  }
  .modal-panel {
    box-shadow: none !important;
    border: 2px solid #0F172A !important;
    border-radius: 10px !important;
    width: 100% !important;
    max-width: none !important;
    padding: 10mm !important;
    background: #FFFFFF !important;
    animation: none !important;
  }
  .summary-stats,
  .summary-block,
  .summary-diagnostic,
  .summary-ritual,
  .summary-aquario,
  .dom-row,
  .diag-item,
  .build-row {
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
  .summary-stats,
  .summary-diagnostic,
  .summary-ritual,
  .summary-aquario,
  .dom-track,
  .reward-code {
    background: #FFFFFF !important;
    border: 1.5px solid #0F172A !important;
  }
  .summary-ritual-title,
  .summary-ritual-q,
  .summary-ritual-tip {
    color: #0F172A !important;
  }
  .dom-fill {
    background: #0F172A !important;
  }
  .summary-medal {
    background: #FFFFFF !important;
    border: 2px solid #0F172A !important;
  }
  .diag-rx,
  .aquario-note,
  .modal-sub,
  .stat-lbl {
    color: #1E293B !important;
  }

  /* Modo 2: Folha dedicada de 4 Cartoes Tateis A4 P&B (1 pagina exata) */
  body[data-print="cards"] #summaryModal {
    display: none !important;
  }
  body[data-print="cards"] #tactileCardsSheet {
    display: flex !important;
    flex-direction: column !important;
    justify-content: space-between !important;
    width: 100% !important;
    height: 262mm !important;
    max-height: 266mm !important;
    background: #FFFFFF !important;
    color: #0F172A !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
  .cards-sheet-head {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-bottom: 3mm;
    border-bottom: 1.5pt solid #0F172A;
    font-size: 10.5pt;
    line-height: 1.25;
  }
  .cards-sheet-head span {
    font-size: 8.8pt;
    color: #334155 !important;
  }
  .cards-sheet-grid {
    flex: 1 1 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: 1fr 1fr;
    gap: 5mm;
    padding: 4mm 0;
  }
  .tactile-card {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5mm;
    border: 1.5pt dashed #475569 !important;
    background: #FFFFFF !important;
    break-inside: avoid !important;
    page-break-inside: avoid !important;
  }
  .tc-inner {
    width: 100%;
    height: 100%;
    border: 3pt solid #0F172A !important;
    border-radius: 5mm;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4mm;
    background: #FFFFFF !important;
  }
  .tc-svg {
    width: 36mm;
    height: 33mm;
    display: block;
    break-inside: avoid !important;
  }
  .tc-num {
    font-size: 64pt;
    font-weight: 900;
    line-height: 0.92;
    color: #0F172A !important;
    font-variant-numeric: tabular-nums;
  }
  .tc-word {
    font-size: 11pt;
    font-weight: 800;
    letter-spacing: 0.14em;
    color: #0F172A !important;
  }
  .tc-corner {
    position: absolute;
    font-size: 11pt;
    font-weight: 900;
    color: #0F172A !important;
    background: #FFFFFF !important;
    padding: 0 2mm;
    line-height: 1.2;
  }
  .tc-tl { top: 7mm; left: 7.5mm; }
  .tc-tr { top: 7mm; right: 7.5mm; }
  .tc-bl { bottom: 7mm; left: 7.5mm; }
  .tc-br { bottom: 7mm; right: 7.5mm; }
  .cards-sheet-foot {
    text-align: center;
    font-size: 8.5pt;
    color: #334155 !important;
    border-top: 1pt solid #475569;
    padding-top: 2mm;
  }
}
