@import url("https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css");

@font-face {
  font-family: "Moderna";
  src: url("/memera/public/fonts/Moderna_.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg-a: #000D1D;
  --bg-b: #22d3ee26;
  --bg-c: #ea580c3b;
  --bg-d: #043249;
  --bg-trivia: #28180e;
  --bg-trivia-danger: #280e0e;
  --bg-discover: #001921;
  --card: rgba(10, 10, 20, 0.82);
  --article-padding: clamp(16px, 3vw, 28px);
  --text: #f8fafc;
  --muted: #cbd5e1;
  --focus: #facc15;
  --ok: #10b981;
  --transition-speed: 1.8s;
}

[data-theme="light"] {
  --bg-a: #f0f4f8;
  --bg-b: #22d3ee18;
  --bg-c: #ea580c18;
  --bg-d: #e0f2fe;
  --bg-trivia: #fef3c7;
  --bg-trivia-danger: #fee2e2;
  --bg-discover: #e0f2fe;
  --card: rgba(255, 255, 255, 0.92);
  --text: #0f172a;
  --muted: #64748b;
  --focus: #ca8a04;
  --ok: #059669;
  --ew-bg: #ffffff;
  --ew-surface: #ffffff;
  --ew-text: #0f172a;
  --ew-text-secondary: #475569;
  --ew-text-muted: #64748b;
  --ew-border: #e2e8f0;
  --ew-nav-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

* {
  box-sizing: border-box;
}


html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
}

.site-brand {
  font-family: "Moderna", "Trebuchet MS", "Segoe UI", sans-serif;
  letter-spacing: 0.06em;
  background: none !important;
  text-shadow: 1px 1px 6px #000;
  border-width: 0 !important;
  margin-right: auto;
}

.header-nav .btn.site-brand {
  font-size: 2rem;
  text-transform: lowercase;
  font-weight: 100;
}

/* Botões e textos sobre fundos escuros — mesmo no light mode */
.option-btn, .btn, .panel button,
.survival-hero h2,
.survival-hero p,
.survival-hero .hero-actions .btn {
  color: #f8fafc !important;
}

html {
  background: var(--bg-a);
  transition: background var(--transition-speed, 1.8s) ease-in;
}

body {
  background: radial-gradient(circle at 15% 20%, var(--bg-c), transparent 30%),
    radial-gradient(circle at 80% 70%, var(--bg-b), transparent 35%);
}

/* ── Mild glitch when 15% < stability ≤ 35% ── */
@keyframes glitch-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.92; }
}

html.trivia-unstable .quiz-shell::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  background: rgba(255, 120, 0, 0.015);
  animation: glitch-pulse 3s ease-in-out infinite;
}

html.trivia-unstable .card {
  animation: glitch-wobble 0.6s ease-in-out infinite;
}

@keyframes glitch-wobble {
  0%, 100% { transform: translate(0); }
  25% { transform: translate(-0.5px, 0.5px); }
  75% { transform: translate(0.5px, -0.5px); }
}

html.trivia-unstable .card h2 {
  animation: glitch-subtle-flicker 3s infinite;
}

@keyframes glitch-subtle-flicker {
  0%, 100% { opacity: 1; }
  4% { opacity: 0.85; }
  6% { opacity: 1; }
}

/* ── Intense glitch when stability ≤ 15% ── */
@keyframes glitch-bg {
  0%, 100% { transform: translate(0); }
  20%, 60% { transform: translate(-1px, 1px); }
  40%, 80% { transform: translate(1px, -1px); }
}

html.trivia-danger .quiz-shell::before,
html.trivia-danger .quiz-shell::after,
html.trivia-danger .shell::before,
html.trivia-danger .shell::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

html.trivia-danger .quiz-shell::before,
html.trivia-danger .shell::before {
  background: rgba(255, 0, 0, 0.03);
  animation: glitch-slice-top 0.3s infinite;
}

html.trivia-danger .quiz-shell::after,
html.trivia-danger .shell::after {
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(255, 255, 255, 0.03) 2px,
      rgba(255, 255, 255, 0.03) 4px
    ),
    rgba(0, 100, 255, 0.03);
  animation: glitch-slice-bottom 0.3s infinite;
}

@keyframes glitch-slice-top {
  0%, 100% {
    clip-path: polygon(0 0, 100% 0, 100% 25%, 0 25%);
    transform: translate(3px, 0);
  }
  50% {
    clip-path: polygon(0 50%, 100% 50%, 100% 75%, 0 75%);
    transform: translate(-3px, 0);
  }
}

@keyframes glitch-slice-bottom {
  0%, 100% {
    clip-path: polygon(0 50%, 100% 50%, 100% 75%, 0 75%);
    transform: translate(-2px, 0);
  }
  50% {
    clip-path: polygon(0 75%, 100% 75%, 100% 100%, 0 100%);
    transform: translate(2px, 0);
  }
}

html.trivia-danger .quiz-shell {
  position: relative;
}

/* Glitch shake on the card — stops on game over */
html.trivia-danger .card,
html.trivia-danger .hero-card {
  animation: glitch-shake 0.12s infinite;
}

html.game-over .card {
  animation: none;
}

@keyframes glitch-shake {
  0%, 100% { transform: translate(0); }
  10% { transform: translate(-1px, 1px); }
  20% { transform: translate(1px, -1px); }
  30% { transform: translate(-1px, 1px); }
  40% { transform: translate(1px, -1px); }
  50% { transform: translate(-1px, 0); }
  60% { transform: translate(1px, 1px); }
  70% { transform: translate(-1px, -1px); }
  80% { transform: translate(1px, 1px); }
  90% { transform: translate(-1px, 1px); }
}

/* Glitch text flicker on the question */
html.trivia-danger .card h2 {
  animation: glitch-text-flicker 3s infinite;
}

@keyframes glitch-text-flicker {
  0%, 100% { opacity: 1; }
  3% { opacity: 0.3; }
  4% { opacity: 0.8; }
  5% { opacity: 0.4; }
  6% { opacity: 1; }
  50% { opacity: 1; }
  53% { opacity: 0.5; }
  54% { opacity: 0.9; }
  55% { opacity: 0.3; }
  56% { opacity: 1; }
}

html.trivia body {
  background: radial-gradient(circle at 15% 20%, var(--bg-d), transparent 30%), radial-gradient(circle at 80% 70%, var(--bg-b), transparent 35%);
}

/* ── Streak-based visual intensification ── */

/* 4a. Transições aceleradas com streak */
.card,
.quiz-shell,
.shell,
#progress-bar {
  transition-duration: var(--transition-speed, 2s) !important;
}

#stat-streak-value {
  transform: scale(1.25);
}

/* 4c. Heartbeat — pulso no card */
@keyframes heartbeat-1 { 0%,100%{transform:scale(1)} 30%{transform:scale(1.005)} }
@keyframes heartbeat-2 { 0%,100%{transform:scale(1)} 30%{transform:scale(1.01)} }
@keyframes heartbeat-3 { 0%,100%{transform:scale(1)} 30%{transform:scale(1.015)} }
@keyframes heartbeat-4 { 0%,100%{transform:scale(1)} 30%{transform:scale(1.02)} }
@keyframes heartbeat-max { 0%,100%{transform:scale(1)} 30%{transform:scale(1.025)} }

.card.heartbeat-1 { animation: heartbeat-1 0.6s ease-out; }
.card.heartbeat-2 { animation: heartbeat-2 0.48s ease-out; }
.card.heartbeat-3 { animation: heartbeat-3 0.42s ease-out; }
.card.heartbeat-4 { animation: heartbeat-4 0.36s ease-out; }
.card.heartbeat-max { animation: heartbeat-max 0.3s ease-out; }

/* ── Custom scrollbar do card e modais ── */
.card::-webkit-scrollbar,
.modal-content::-webkit-scrollbar,
.gameover-overlay::-webkit-scrollbar {
  width: 5px;
}
.card::-webkit-scrollbar-track,
.modal-content::-webkit-scrollbar-track,
.gameover-overlay::-webkit-scrollbar-track {
  background: rgba(255,255,255,0.03);
  border-radius: 4px;
}
.card::-webkit-scrollbar-thumb,
.modal-content::-webkit-scrollbar-thumb,
.gameover-overlay::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.10);
  border-radius: 4px;
}
.card::-webkit-scrollbar-thumb:hover,
.modal-content::-webkit-scrollbar-thumb:hover,
.gameover-overlay::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.18);
}

/* 5a. Cursor glow — o próprio elemento é criado via JS */

/* 5b. Ressonância do viewport */
@keyframes resonance-drift {
  0%,100%{transform:translateY(0)}
  50%{transform:translateY(-1px)}
}
html.resonance-1 .quiz-shell,
html.resonance-1 .shell { animation: resonance-drift 4.2s ease-in-out infinite; }
html.resonance-2 .quiz-shell,
html.resonance-2 .shell { animation: resonance-drift 3.6s ease-in-out infinite; }
html.resonance-3 .quiz-shell,
html.resonance-3 .shell { animation: resonance-drift 3s ease-in-out infinite; }
html.resonance-4 .quiz-shell,
html.resonance-4 .shell { animation: resonance-drift 2.4s ease-in-out infinite; }
html.resonance-5 .quiz-shell,
html.resonance-5 .shell { animation: resonance-drift 1.8s ease-in-out infinite; }

/* 5c. Tipografia reativa */
html.type-1 h2 { letter-spacing: 0.02em; }
html.type-2 h2 { letter-spacing: 0.04em; font-weight: 500; }
html.type-3 h2 { letter-spacing: 0.06em; font-weight: 500; }
html.type-4 h2 { letter-spacing: 0.08em; font-weight: 400; }
html.type-5 h2 { letter-spacing: 0.1em; font-weight: 400; }
html.type-1 .option-btn span { letter-spacing: 0.01em; }
html.type-2 .option-btn span { letter-spacing: 0.02em; }
html.type-3 .option-btn span { letter-spacing: 0.03em; }
html.type-4 .option-btn span { letter-spacing: 0.04em; }
html.type-5 .option-btn span { letter-spacing: 0.05em; }

/* Card glow: classes servem apenas como chave para o JS aplicar box-shadow dinâmico */
.card.glow-1,
.card.glow-2,
.card.glow-3,
.card.glow-max {
  transition: box-shadow 0.3s ease;
}

/* Saturação/brightness do body conforme streak */
html.streak-1 body { filter: saturate(1.10) brightness(1.02); }
html.streak-2 body { filter: saturate(1.20) brightness(1.04); }
html.streak-3 body { filter: saturate(1.30) brightness(1.06); }
html.streak-max body { filter: saturate(1.40) brightness(1.08); }
html.streak-0 body { filter: none; }

/* Glitch reverso: momento de "estabilidade" no acerto */
html.stabilizing .quiz-shell::before,
html.stabilizing .quiz-shell::after,
html.stabilizing .shell::before,
html.stabilizing .shell::after {
  animation: none !important;
  opacity: 0 !important;
}
html.stabilizing .card,
html.stabilizing .hero-card {
  animation: none !important;
}
html.stabilizing .card h2 {
  animation: none !important;
  opacity: 1 !important;
}

.app-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  z-index: 1001;
}

.app-header:has(.header-menu.open) {
  background: rgba(2, 6, 23, 0.95);
}

.header-nav {
  width: min(900px, 100%);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.language-switcher select {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(2, 6, 23, 0.7);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.language-switcher select:hover,
.language-switcher select:focus {
  background: rgba(15, 23, 42, 0.9);
  outline: 2px solid var(--focus);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.nav-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.app-header .btn {
  padding: 10px 14px;
  font-size: 0.9rem;
}

/* ── Header buttons (hamburger, pause) ── */
.header-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text);
  padding: 9px 10px;
  z-index: 25;
  border-radius: 10px;
  transition: background 0.18s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.header-btn:hover,
.header-btn:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  outline: none;
}

.hamburger-btn {
  display: none;
  font-size: 1.5rem;
}

.hamburger-btn[aria-expanded="true"] i::before {
  content: "\f00d"; /* fa-xmark */
}

.header-pause-btn {
  font-size: 1.2rem;
}

html.paused .header-pause-btn {
  color: #15fa2d;
}

.header-menu {
  display: contents;
}

.screen {
  width: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* Pattern overlay para incursões — drift controlado por background-drift.js */
html::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: var(--bg-pattern, none);
  background-repeat: repeat;
  background-position:
    var(--pattern-offset-x, 0px)
    var(--pattern-offset-y, 0px);
  background-size: 512px 512px;
  opacity: 0.025;
  pointer-events: none;
  z-index: 0;
}

.shell,
.quiz-shell {
  width: min(720px, 100%);
  display: flex;
  flex-direction: column;
  gap: 0;
  padding-top: 88px;
  flex: 1;
  position: relative;
  z-index: 2; /* acima do reality-fracture-overlay (z-index: 1) */
}

.quiz-shell > .progress {
  flex-shrink: 0;
}

.quiz-shell > #card {
  margin: auto 0;
  display: flex;
  min-height: 45vh;
  flex-direction: column;
  justify-content: center;
  box-shadow: 0 3px 9px rgba(0, 0, 0, 0.25);
  background: radial-gradient(ellipse at top left,  rgb(255 255 255 / 5%) 0%,  var(--card) 50%);
  border: 1px solid #000;
  will-change: transform, background;
  backface-visibility: hidden;
  transform: perspective(20vmax) rotateX(0deg) translateZ(0);
  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1),
              background 0.3s ease;
}

.quiz-shell > #card.scoring {
  transform: perspective(20vmax) rotateX(1deg) translateZ(0);
}
.quiz-shell > #card.failing {
  transform: perspective(20vmax) rotateX(-1deg) translateZ(0);
}

/* ── Card feedback via classes (zero styles inline) ── */
.quiz-shell > #card.card-correct {
  background: rgb(0 118 107 / 50%);
}
.quiz-shell > #card.card-wrong {
  background: rgb(118 13 0 / 50%);
}

/* ── Botão feedback via classes ── */
.option-btn.btn-correct {
  background: rgb(0 118 107 / 50%);
}
.option-btn.btn-wrong {
  background: rgb(118 13 0 / 50%);
}
.option-btn.btn-highlight {
  font-weight: 700;
}

/* ── Score stats (combo + fragmentos) dentro do kicker ── */
.score-stats {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  margin-left: auto;
}
.score-stats .survival-stat {
  background: rgba(0,0,0,0.3);
  border-radius: 8px;
  padding: 2px 8px;
  font-size: 1.5em;
  white-space: nowrap;
}
.survival-stat .icon { font-size: 16px; }
.survival-stat .value { font-weight: 700; }

.hero-card,
.card,
.panel {
  background: var(--card);
  border: 1px solid rgb(255 255 255 / 3%);
  border-radius: 22px;
  padding: calc(var(--article-padding) / 2) var(--article-padding) var(--article-padding) var(--article-padding);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  min-height: 0;
  align-content: start;
}

.hero-card {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Mascote Crono: portrait acima, landscape à direita ── */
.crono-mascot {
  order: -1;
  text-align: center;
  flex: 0 0 auto;
}
.crono-mascot img {
  display: inline-block;
  max-width: 100px;
  height: auto;
}

@media (orientation: landscape) {
  .hero-card {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .crono-content {
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    gap: 16px;
  }
  .crono-mascot {
    order: 0;
    margin-left: auto;
    text-align: right;
  }
  .crono-mascot img {
    max-width: 120px;
  }
  /* Itens após o crono ocupam largura total (abaixo da fileira imagem+texto) */
  .crono-mascot ~ * {
    flex: 0 0 100%;
  }
}

.screen-compare .hero-card {
  padding: clamp(20px, 3vw, 32px);
  border-radius: 28px;
}

.hero-actions {
  margin-top: 1em;
}

.discovery-grid {  
  gap: 16px;
  display: flex;
  flex-direction: column;
}

.landing-action-group {
    text-align: center;
}

.landing-daily-preview {
  width: 100%;
}

.landing-preview-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  width: 100%;
  align-items: start;
}

.preview-card {
  width: 100%;
  max-width: 100%;
  min-height: 0;
  align-content: start;
  padding: clamp(18px, 2vw, 28px);
}

.preview-action {
  width: 100%;
  justify-content: center;
  min-width: 0;
}

.btn-secondary {
  background: rgba(15, 23, 42, 0.56);
  border-color: rgba(255, 255, 255, 0.12);
  color: var(--text);
}

.btn-secondary:hover {
  background: rgba(15, 23, 42, 0.8);
}

.hero-features {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  width: 100%;
}

.feature-card {
  display: grid;
  gap: 10px;
  align-items: start;
  min-height: 0;
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.feature-card strong {
  font-size: 1rem;
  line-height: 1.35;
}

.feature-card p {
  line-height: 1.55;
  color: #d6e2f1;
}

.hero-note {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
  font-size: 0.96rem;
  text-align: center;
  max-width: 100%;
}

.kicker {
  letter-spacing: 0.1em;
  font-size: 15px;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 1em;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

h1,
h2 {
  margin: 0;
  line-height: 1.1;
}

p {
  margin: 0;
  color: #e2e8f0;
}

.progress {
  width: 100%;
  height: max(16px, env(safe-area-inset-top));
  border-radius: 99px;
  position: relative;
  overflow: hidden;
}

html.timing-out .progress {
  background: rgb(0 0 0 / 25%);
}

#progress-bar {
  width: 0;
  height: 100%;
  transition: width 180ms ease;
  position: relative;
  margin-right: auto;
  z-index: 1;
}

/* ── Status overlay on progress bar ── */
.status-label {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 15px;
  font-weight: 300;
  color: transparent;
  text-shadow: 0 0 0 white, 0 0 2px black;
  z-index: 2;
  line-height: 150%;
  pointer-events: none;
  letter-spacing: 0.05em;
}

/* ── Top progress bar (outside quiz-shell, above header) ── */
.top-progress {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100vw;
  border-radius: 0;
  z-index: 1002;
  flex-shrink: 0;
  height: max(16px, env(safe-area-inset-top));
  margin: 0;
  justify-content: center;
  display: flex;
}

/* ── Fragments counter in header ── */

.pause-btn {
  border-width: 0;
  background: transparent;
  cursor: pointer;
  color: #ffffff;
}
html:not(.paused) .pause-btn {
  font-size: 1.5rem;
  padding: 8px 10px 10px 10px;
}
html.paused .pause-btn {
  color: #15fa2d;
  background: rgba(250,204,21,0.08);
  border-radius: 12px;
}
html.paused .progress {
  opacity: 0.35;
}

html.menu-open .progress {
  opacity: 0.675;
  background: rgb(0 0 0);
}
html.paused .option-btn:not(:disabled) {
  opacity: 0.5;
  pointer-events: none;
}
html.paused .option-btn:disabled {
  opacity: 0.3;
}
html.paused #progress-bar { animation-play-state: paused !important; }

html.paused .option-list button span, html.paused h2 {
  filter: blur(6px);
  opacity: 0.25;
}

/* ── Pause Overlay ── */
.pause-overlay {
  display: none;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5000;
  background: rgba(0, 0, 0, 0.6);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 22px;
}

.pause-overlay.visible {
  display: flex;
}

.pause-icon {
  font-size: 64px;
  -webkit-user-select: none;
  user-select: none;
}

/* ── Crystal pop animation ── */
@keyframes fragments-pop {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-18px) scale(1.4); }
}

@keyframes ghost-popup {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-20px); }
}

/* ── Trivia frisson vibration ── */
@keyframes trivia-vibe {
  0%, 100% { transform: translateX(0) translateY(1px); }
  25% { transform: translateX(-1px); }
  50% { transform: translateX(0) translateY(-1px); }
  75% { transform: translateX(1px); }
}

.trivia #progress-bar {
  animation: trivia-vibe 0.06s infinite;
}

.trivia-2 #progress-bar {
  animation-duration: 0.06s;
}
.trivia-3 #progress-bar {
  animation-duration: 0.12s;
}
.trivia-4 #progress-bar {
  animation-duration: 0.18s;
}

/* ── Timing-out: barra vermelha pulsando nos últimos 10s ── */
@keyframes timeout-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(239, 68, 68, 0.4); }
  50%      { box-shadow: 0 0 20px rgba(239, 68, 68, 0.8); }
}

.progress-bar-timeout {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(to right, #bd0046, #910505);
  animation: timeout-pulse 0.6s ease-in-out infinite;
  transition: width 0.12s linear;
  border-radius: 0;
}

.card {
  min-height: 0;
  display: grid;
  gap: 14px;
  align-content: start;
  transition: background 0.3s ease, transform 0.3s ease;
}

.card.pressing {
  transform: scale(0.98);
}

.collections-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  margin-top: 10px;
}

.screen-compare .collection-card {
  padding: clamp(20px, 2.5vw, 30px);
  border-radius: 26px;
  margin: 0;
}

.screen-compare .compare-card {
  border-radius: 26px;
}

.site-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.site-brand-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: contain;
  filter: drop-shadow(0 0 0.5rem rgba(0, 25, 60, 0.5));
}

.compare-card {
  position: relative;
  border: 1px solid rgba(250, 204, 21, 0.2);
  background: rgba(14, 165, 233, 0.08);
  border-radius: 26px;
  padding: var(--article-padding);
  margin-bottom: 18px;
  margin-top: 6px;
}

.compare-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.compare-card-icon {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  padding: 6px;
}

.compare-score {
  margin: 0.75rem 0 0;
  font-size: 0.95rem;
  color: var(--text);
}

.compare-score strong {
  color: #facc15;
}

.quiz-panel, .quiz-loading {
  min-height: 0;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 12px;
  padding: 24px 16px;
}

.quiz-loading::before {
  content: "";
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, 0.18);
  border-top-color: rgba(255, 255, 255, 0.88);
  animation: spin 1.2s linear infinite;
}

.quiz-panel p, .quiz-loading p {
  font-size: 1.1rem;
  opacity: 0.9;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.option-list {
  display: grid;
  gap: 10px;
}

#quiz-card {
  touch-action: pan-y;
}

.quiz-shell {
  padding-bottom: 24px;
}

.quiz-image {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

#stat-fragment-container {
  background: rgba(15, 23, 42, 0.66);
}

.option-btn,
.btn,
.panel button {
  border: 1px solid rgba(255,255,255,0.025);
  background: rgba(15, 23, 42, 0.66);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  text-align: left;
  position: relative;
  overflow: hidden;
  z-index: 0;
}

.btn,
.panel button {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.option-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25em;
  min-height: 56px;
  justify-content: flex-start;
}

.option-btn.loading {
  cursor: progress;
  border-color: rgb(255 255 255 / 5%);
  color: var(--text);
  overflow: hidden;
}

.option-btn.loading::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.05);
  z-index: 0;
}

.option-btn.loading::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.1) 40%, rgba(255,255,255,0) 100%);
  transform: translateX(-100%);
  animation: pulse-slide 0.6s ease-in-out infinite;
  opacity: 1;
  z-index: 1;
  pointer-events: none;
  will-change: transform;
}

@keyframes pulse-slide {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

.option-btn.active,
.option-btn:hover,
.btn-primary,
.panel button:hover {
  background: linear-gradient(120deg, #0ea5e9, #f97316);
  border-color: transparent;
}

/* Durante answering, só o botão clicado (.active) fica aceso;
   os demais não respondem a hover até o feedback aparecer */
html.answering .option-btn {
  pointer-events: none;
}

/* Subtle flash on answered option (gosto/descoberta) */
.option-btn.flash-ok {
  animation: option-flash 0.6s ease-out;
}
@keyframes option-flash {
  0% { box-shadow: 0 0 0 0 rgba(201, 248, 255, 0.6); }
  50% { box-shadow: 0 0 0 8px rgba(110, 231, 183, 0); }
  100% { box-shadow: 0 0 0 0 rgba(110, 231, 183, 0); }
}

.actions-row {
  display: flex;
  justify-content: flex-start;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.back-btn {
  border-radius: 999px;
  padding: 10px 16px;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  width: auto;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.back-btn.hidden {
  display: none;
}

.btn {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn i,
.option-btn i,
.panel-actions button i,
.fa-solid,
.fa-regular,
.fa-brands,
.svg-inline--fa {
  margin-right: 0.5rem;
  display: inline-flex;
  align-items: center;
}

.btn-label {
  display: inline;
}

.btn i:last-child,
.option-btn i:last-child,
.panel-actions button i:last-child,
.fa-solid:last-child,
.fa-regular:last-child,
.fa-brands:last-child,
.svg-inline--fa:last-child {
  margin-right: 0;
}


.btn-admin {
  background: linear-gradient(120deg, #facc15, #fb7185);
  border-color: transparent;
  color: #020617;
}

.btn-admin:hover {
  transform: translateY(-1px);
}

.panel {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 10;
}

.panel.hidden {
  display: none;
}

.panel-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

textarea {
  width: 100%;
  min-height: 84px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(2, 6, 23, 0.8);
  color: var(--text);
  padding: 10px;
}

.hint {
  text-align: center;
  color: var(--muted);
  font-size: 15px;
  padding: 0 10px 10px;
  gap: 10px;
}

.result-insights {
  display: grid;
  gap: 16px;
}

.share-card-options {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
  align-items: center;
}

.share-card-options label {
  font-size: 0.95rem;
  color: var(--muted);
}

.share-card-options select {
  min-width: 180px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 10px 12px;
}

.share-card-image-container {
  max-width: 560px;
  width: 100%;
  margin-top: 1rem;
}

.share-card-image-preview {
  width: 100%;
  height: auto;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 18px 40px rgba(0,0,0,0.14);
  background: var(--surface);
}

.result-hero-grid {
  display: grid;
  gap: 24px;
}

.result-hero-main {
  display: grid;
  gap: 16px;
}

.result-panel {
  display: grid;
  gap: 14px;
}

.result-card {
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(255, 255, 255, 0.12);
}

.result-card.highlight {
  background: linear-gradient(180deg, rgba(14, 165, 233, 0.24), rgba(249, 115, 22, 0.16));
  border-color: rgba(255, 255, 255, 0.2);
}

.result-card.compact {
  padding: 18px 16px;
}

.result-section {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.48s ease, transform 0.48s ease;
}

.result-section.revealed {
  opacity: 1;
  transform: translateY(0);
}

.profile-signature {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.timeline-highlights {
  margin: 8px 0 0;
  padding-left: 1.25rem;
  list-style: disc;
}

.timeline-highlights li {
  margin-bottom: 0.45rem;
}

.result-lead {
  font-size: 1.05rem;
  opacity: 0.95;
  line-height: 1.6;
}

.result-copy {
  opacity: 0.85;
  line-height: 1.7;
}

.result-featured {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text);
  font-weight: 600;
}

.text-muted {
  color: var(--muted);
}

.reset-section.muted {
  margin-top: 12px;
  opacity: 0.55;
  transition: opacity 0.18s;
  font-size: 0.85rem;
}

.reset-section.muted[open],
.reset-section.muted:hover {
  opacity: 1;
}

.reset-section summary {
  cursor: pointer;
  padding: 8px 0;
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.reset-confirm {
  margin-top: 8px;
  display: grid;
  gap: 10px;
}

.btn-danger {
  border-color: rgba(239, 68, 68, 0.4) !important;
  color: #fca5a5 !important;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.15) !important;
}

.reset-card .btn-reset {
  justify-content: center;
  width: 100%;
}

/* ── Session Results ── */
.session-results .results-summary {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.result-badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
}

.result-correct { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; }
.result-wrong   { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }
.result-total   { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }

.results-details {
  margin-top: 12px;
}

.results-details summary {
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--muted);
  padding: 8px 0;
}

.results-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.result-item {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.04);
}

.result-item-wrong { border-color: rgba(239, 68, 68, 0.3); }

.result-question {
  font-weight: 600;
  margin: 0 0 6px;
}

.wrong-answer { color: #fca5a5; }
.correct-answer { color: #6ee7b7; font-weight: 600; }

.share-callout {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 20px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.share-callout h2 {
  margin: 0 0 8px;
  display: flex;
  gap: 0.5rem;
  align-items: center;
  font-size: 1rem;
}

  .share-link-bar,
  .analytics-row-values {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
  }

  .share-link-bar {
    margin-top: 12px;
  }

  .share-url {
    flex: 1 1 100%;
    min-width: 0;
    padding: 12px 14px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
  }

  .copy-button {
    padding: 0.85rem 1rem;
    border-radius: 999px;
    background: rgba(59, 130, 246, 0.95);
    color: #fff;
    border: none;
    cursor: pointer;
    font-weight: 600;
  }

  .analytics-summary {
    display: grid;
    gap: 16px;
    margin-top: 24px;
  }

  .analytics-grid {
    display: grid;
    gap: 16px;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }

  .analytics-panel {
    padding: 18px 20px;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(7, 12, 34, 0.72);
  }

  .analytics-panel h2 {
    margin: 8px 0 0;
    font-size: 1.75rem;
  }

  .analytics-providers {
    margin-top: 2rem;
  }

  .analytics-providers h2 {
    margin-bottom: 12px;
  }

  .analytics-trends {
    margin-top: 2rem;
  }

  .analytics-row {
    padding: 16px 18px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
    display: grid;
    gap: 10px;
  }

  .analytics-row-title {
    font-weight: 700;
  }

  .analytics-row-values span {
    font-size: 0.95rem;
    color: var(--muted);
  }

  .analytics-hero {
    display: grid;
    gap: 20px;
  }

  .analytics-hero-main {
    display: grid;
    gap: 12px;
  }

  .share-card {
    margin: 18px 0;
    padding: 18px;
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.12);
  }

@media (max-width: 680px), (orientation: portrait) {
  html {
    font-size: 15px;
  }

  .app-header {
    padding: 10px 12px;
  }

  .header-nav {
    gap: 8px;
  }

  .app-header .btn {
    padding: 9px 10px;
    font-size: 0.85rem;
  }

  .btn-label {
    display: none;
  }

  .btn.site-brand span {
    display: none;
  }

  .app-header .btn i {
    margin-right: 0;
  }

  .header-controls {
    gap: 8px;
  }

  .header-nav {
    align-items: center;
  }

  /* Hamburger menu */
  .hamburger-btn {
    display: flex;
  }

  .header-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(2, 6, 23, 0.95);
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    padding: 12px 16px 16px;
    z-index: 24;
  }

  .header-menu.open {
    display: block;
  }

  .header-menu .header-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }

  .header-menu .language-switcher select {
    width: 100%;
  }

  .header-menu .nav-links {
    flex-direction: column;
    gap: 4px;
  }

  .header-menu .nav-links .btn {
    width: 100%;
    justify-content: flex-start;
  }

  .header-menu .btn-label {
    display: inline;
  }



  .quiz-shell {
    padding-top: 72px;
    padding-bottom: 16px;
  }

  .hint {
    font-size: 15px;
    padding: 0 8px 8px;
    line-height: 1.4;
  }

  .panel {
    left: 10px;
    right: 10px;
    bottom: 10px;
  }
}

.timeline-bar span,
.timeline-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, rgba(56, 189, 248, 0.9), rgba(59, 130, 246, 0.9));
}

.timeline-pill,
.graph-card {
  padding: 18px 20px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.04);
}

.history-timeline {
  display: grid;
  gap: 16px;
  margin: 1rem 0 1.5rem;
}

.result-graph {
  margin: 1.5rem 0;
}

@media (min-width: 900px) {
  .result-hero-grid {
    grid-template-columns: 1.35fr 0.85fr;
    align-items: start;
  }
}

.tag,
.mini-card {
  border-radius: 999px;
  border: 1px solid rgb(255 255 255 / 3%);
  background: rgba(2, 6, 23, 0.45);
  color: var(--text);
}

.tag {
  padding: 8px 12px;
  font-size: 0.9rem;
  cursor: pointer;
}

.tag .cat-icon {
  width: 18px;
  height: 18px;
  vertical-align: middle;
  margin-right: 4px;
  object-fit: contain;
}

.mini-card {
  min-width: 120px;
  padding: 10px 12px;
}

.mini-card p {
  font-size: 0.78rem;
  color: var(--muted);
}

.mini-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1.05rem;
}

input {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(2, 6, 23, 0.7);
  color: var(--text);
  padding: 12px;
}

.stack {
  display: grid;
  gap: 14px;
}

.stack input,
.stack select,
.stack textarea {
  width: 100%;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (min-width: 900px) {
  .shell,
  .quiz-shell {
    width: min(900px, 100%);
  }
}

/* ── Incursion Hub ── */
.hub-filters { margin-bottom: 16px; }

.incursions-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.incursion-card {
  background: var(--card);
  border: 1px solid rgb(255 255 255 / 3%);
  border-radius: 22px;
  padding: 0;
  display: flex;
  flex-direction: column;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  transition: border-color 0.18s;
}

.incursion-card:hover { border-color: var(--accent, #0ea5e9); }

.card-link {
    color: white;
    text-decoration: none !important;
    display: flex;
    flex-wrap: wrap;
    flex-direction: column-reverse;
    padding: clamp(12px, 3vw, 20px);
    min-height: 120px;
    align-items: end;
    height: 100%;
    align-content: end;
}

/* Card com background-image */
.incursion-card.has-bg {
  background-size: cover;
  background-position: center;
  position: relative;
  isolation: isolate;
  border-width: 0;
}
.inc-card-bg-overlay {
  position: absolute;
  inset: 0;
  border-radius: 22px;
  background: linear-gradient(rgba(0,0,0,.25), rgba(0,0,0,.4) 20px, rgba(0,0,0,.65) calc(100% - 20px), rgba(0,0,0,.8));
  z-index: 0;
  pointer-events: none;
}
.incursion-card.has-bg > *:not(.inc-card-bg-overlay) {
  position: relative;
  z-index: 1;
}

.incursion-card.completed {
  opacity: 0.7;
  border-color: rgba(16, 185, 129, 0.25);
}
.incursion-card.completed .inc-card-title {
  text-decoration: line-through;
  text-decoration-color: rgba(16, 185, 129, 0.4);
}
.incursion-card.completed:hover {
  border-color: rgba(16, 185, 129, 0.5);
}

.incursion-card.failed {
  opacity: 0.7;
  border-color: rgba(239, 68, 68, 0.25);
}
.incursion-card.failed .inc-card-title {
  text-decoration: line-through;
  text-decoration-color: rgba(239, 68, 68, 0.4);
}
.incursion-card.failed:hover {
  border-color: rgba(239, 68, 68, 0.5);
}

.inc-card-check {
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 1.2rem;
  color: var(--ok, #10b981);
  font-weight: 700;
  background: rgba(16, 185, 129, 0.12);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.inc-card-header {
  position: relative;
  display: flex;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.inc-card-icon { font-size: 2rem; }

.inc-card-date {
  font-size: 0.75rem;
  color: var(--muted, #94a3b8);
  opacity: 0.7;
}

.inc-card-badge {
  font-size: 0.8rem;
  color: #ffd700;
  background: rgba(255, 215, 0, 0.1);
  padding: 4px 10px;
  border-radius: 12px;
}

.inc-card-title { margin: 0 0 8px; font-size: 1.1rem; text-shadow: -1px -1px 3px #ffffff99, 2px 2px 3px black; }
.inc-card-questions { color: var(--muted); font-size: 0.85rem; margin-bottom: 16px; }
.inc-card-footer { display: flex; justify-content: space-between; align-items: center; margin-top: auto; }
.inc-card-played { color: var(--muted); font-size: 0.8rem; }
.inc-card-years { color: #fbbf24; font-size: 0.75rem; font-weight: 600; background: rgba(0,0,0,0.3); padding: 1px 6px; border-radius: 6px; white-space: nowrap; }

.filter-btn {
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}

.filter-btn.active {
  background: linear-gradient(120deg, #0ea5e9, #f97316);
  border-color: transparent;
  color: #fff;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 60px 20px;
  grid-column: 1 / -1;
}

/* ── Incursion Gameplay (reusa quiz-shell do discovery) ── */

.quiz-shell {
  position: relative;
  z-index: 2; /* acima do reality-fracture-overlay */
}
.modal-overlay {
  position: relative;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  border-radius: 22px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}
.modal-content {
  text-align: center;
  padding: clamp(16px, 3vw, 28px);
  border-radius: 22px;
  max-width: 100%;
  width: 100%;
  box-sizing: border-box;
}
.victory-content { background: linear-gradient(135deg, #1a1a2e, #16213e); border: 2px solid var(--ok, #4caf50); }
.failure-content { background: linear-gradient(135deg, #2e1a1a, #3e1616); border: 2px solid #f44336; }
.victory-icon { font-size: 4rem; margin-bottom: 16px; }
.failure-icon { font-size: 4rem; margin-bottom: 16px; }

.badge-display { margin: 24px 0; padding: 20px; background: rgba(255,255,255,0.05); border-radius: 12px; }
.badge-icon { font-size: 3rem; display: block; margin-bottom: 8px; }
.badge-name { font-size: 1.3rem; font-weight: bold; color: #ffd700; }

/* ── Game over overlay (absolute dentro do card position:relative) ── */
.gameover-content {
  text-align: center;
  padding: 32px 16px;
  overflow: hidden auto;
  max-height: 100%;
}

.card.gameover-active {
  min-height: 75vh !important;
}

.gameover-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 1000;
  border-radius: 22px;
  background: rgba(10,10,20,0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  overflow-y: auto;
}

/* ── Game over stats grid ── */
.gameover-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  max-width: 100%;
  margin: 12px auto;
}
.gameover-stat {
  background: rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 8px;
}
.gameover-stat .stat-label {
  font-size: 10px;
  opacity: 0.7;
}
.gameover-stat .stat-value {
  font-size: 20px;
  font-weight: 700;
}

.victory-actions { margin-top: 24px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.failure-hint { color: var(--muted); font-size: 0.85rem; margin-top: 8px; }

.round-transition {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  border-radius: 22px;
  box-sizing: border-box;
}
.round-transition-content { text-align: center; }
.round-transition-content h2 { font-size: 2.5rem; margin-bottom: 8px; color: #ffd700; }
.round-transition-content p { font-size: 1.1rem; color: var(--muted); }

/* ── Fragment Balance in Header ── */
.fragment-balance {
  font-size: 15px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 12px;
  background: rgba(250,204,21,0.08);
  border-width: 0;
  color: #15fa2d;
  white-space: nowrap;
}

.difficulty-bar-footer {
  display: flex;
  justify-content: center;
  position: fixed;
  height: max(16px, env(safe-area-inset-top));
  bottom: 0;
  border-radius: 9px 9px 0 0;
  overflow: hidden;
}
.difficulty-bar-footer > span {
  z-index: 1;
  position: relative;
  display: inline-flex;
  padding: 0 8px;
  height: max(16px, env(safe-area-inset-top));
}
.stat-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  transition: width 0.5s ease;
  z-index: 0;
  pointer-events: none;
}
.difficulty-dots {
  display: flex;
  gap: 3px;
  align-items: center;
}
.difficulty-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
}
.difficulty-dot.active {
  background: #ffffffb3;
  box-shadow: 0 0 6px rgba(255, 255, 254, 0.34);
}

/* ── Item Bar (Game Footer) ── */
.item-bar {
  display: flex;
  padding: 0;
  justify-content: center;
  flex-wrap: wrap;
  position: absolute;
  bottom: 0;
  height: 0;
  width: calc(100% - 2 * var(--article-padding));
  z-index: 100;
}
.item-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 0;
  border: 1px solid rgba(255,255,255,0.01);
  background: rgba(255,255,255,0.12);
  color: #888;
  font-size: 15px;
  cursor: not-allowed;
  transition: all 0.18s ease;
  opacity: 0.5;
  filter: grayscale(50%);
}
.item-btn:first-child {
  border-bottom-left-radius: 10px;
}
.item-btn:last-child {
  border-bottom-right-radius: 10px;
}
.item-btn.has-item {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(255,255,255,0.025);
  cursor: pointer;
  opacity: 1;
}
.item-btn.has-item:hover {
  background: rgba(255,255,255,0.3);
  transform: translateY(-1px);
}
.item-btn.has-item:active {
  transform: translateY(0);
}
.item-btn.anchor-active {
  background: linear-gradient(135deg, rgb(22 250 21 / 93%), rgb(167 250 21 / 57%));
  border-color: rgb(128 250 21 / 73%);
  box-shadow: 0 0 14px rgb(250 204 21 / 18%), inset 0 0 14px rgb(250 204 21 / 6%);
  color: #fef9c3;
}
.item-btn.anchor-active:hover {
  background: linear-gradient(135deg, rgb(22 250 21 / 100%), rgb(167 250 21 / 75%));
}
.item-btn.prism-active {
  background: linear-gradient(135deg, rgb(139 92 246 / 40%), rgb(139 92 246 / 16%));
  border-color: rgb(139 92 246 / 35%);
  box-shadow: 0 0 14px rgb(139 92 246 / 18%), inset 0 0 14px rgb(139 92 246 / 6%);
  color: #e9d5ff;
}
.item-btn.prism-active:hover {
  background: linear-gradient(135deg, rgb(139 92 246 / 60%), rgb(139 92 246 / 24%));
}
.item-icon { font-size: 16px; }
.item-img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: block;
}
.fragment-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
  display: inline-block;
  vertical-align: middle;
}
.item-qty {
  font-size: 15px;
  opacity: 0.7;
  font-weight: 700;
  min-width: 14px;
  text-align: center;
}
.item-btn.shop-btn {  
  cursor: pointer;
  background: linear-gradient(to right, rgb(255 255 255 / 20%), rgba(255, 255, 255, 0.12));
}
.item-btn.shop-btn:hover {
  background: rgba(251,191,36,0.25);
  transform: translateY(-1px);
}
.shop-icon {
  font-size: 18px;
  line-height: 1;
}

/* ── Item Toast ── */
.item-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10,10,20,0.92);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 600;
  color: #6ee7b7;
  z-index: 10001;
  animation: item-toast-in 0.3s ease, item-toast-out 0.3s ease 1.8s forwards;
  pointer-events: none;
  text-align: center;
  max-width: 90vw;
}
@keyframes item-toast-in {
  from { opacity: 0; transform: translateX(-50%) translateY(10px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}
@keyframes item-toast-out {
  from { opacity: 1; }
  to { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* ── Primordial Modal ── */
.primordial-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20000;
  animation: fade-in 0.3s ease;
}
.primordial-modal {
  background: linear-gradient(135deg, #1a0a2e, #2e1a3e);
  border: 2px solid rgba(168,85,247,0.4);
  border-radius: 22px;
  padding: 32px 24px;
  max-width: 380px;
  width: 90%;
  text-align: center;
  animation: modal-pop 0.3s ease;
}
.primordial-icon { font-size: 48px; margin-bottom: 12px; }
.primordial-modal h3 {
  margin: 0 0 12px;
  font-size: 18px;
  color: #c084fc;
  letter-spacing: 1px;
}
.primordial-modal p {
  opacity: 0.7;
  margin: 0 0 24px;
  font-size: 15px;
  line-height: 1.5;
}
.primordial-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.primordial-actions .btn {
  padding: 10px 24px;
  font-size: 15px;
  font-weight: 600;
  min-width: 100px;
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes modal-pop {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* ── Shop unavailable state ── */
.shop-card.unavailable {
  opacity: 0.55;
  filter: grayscale(0.5);
}
.shop-card.unavailable::before {
  opacity: 0.3;
}
.shop-availability-note {
  font-size: 15px;
  color: #fca5a5;
  margin: 0 0 8px;
  font-style: italic;
  text-align: center;
  padding: 4px 8px;
  background: rgba(252,165,165,0.08);
  border-radius: 6px;
}

/* ── Inline Shop (Loja durante a partida) ── */
.inline-shop-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 30000;
  opacity: 0;
  transition: opacity 0.25s ease;
  padding: 16px;
}
.inline-shop-overlay.open {
  opacity: 1;
}
.inline-shop-modal {
  background: linear-gradient(160deg, #0f0f1e, #1a1a2e);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 18px;
  max-width: 520px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 20px;
  box-shadow: 0 0 60px rgba(0,0,0,0.5), 0 0 30px rgba(251,191,36,0.06);
  transform: scale(0.92);
  transition: transform 0.25s ease;
}
.inline-shop-overlay.open .inline-shop-modal {
  transform: scale(1);
}
.inline-shop-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  position: relative;
}
.inline-shop-header h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  color: #fbbf24;
  flex: 1;
}
.inline-shop-balance {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.06);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  color: #6ee7b7;
}
.inline-shop-balance-value {
  min-width: 20px;
  text-align: center;
}
.inline-shop-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.4);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
  transition: all 0.15s ease;
}
.inline-shop-close:hover {
  color: #fff;
  background: rgba(255,255,255,0.1);
}
.inline-shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}
.shop-item-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  transition: all 0.15s ease;
}
.shop-item-card:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.1);
}
.shop-item-unavailable {
  opacity: 0.5;
}
.shop-item-icon-wrap {
  font-size: 32px;
  line-height: 1;
}
.shop-item-img {
  width: 32px !important;
  height: 32px !important;
}
.shop-item-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}
.shop-item-name {
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
}
.shop-item-desc {
  font-size: 11px;
  opacity: 0.55;
  line-height: 1.4;
}
.shop-item-price {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: 13px;
  font-weight: 600;
  color: #6ee7b7;
  margin-top: 2px;
}
.shop-rarity {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 4px;
}
.shop-rarity-common {
  color: #94a3b8;
  background: rgba(148,163,184,0.12);
}
.shop-rarity-rare {
  color: #fbbf24;
  background: rgba(251,191,36,0.12);
}
.shop-buy-btn {
  font-size: 12px !important;
  padding: 6px 16px !important;
  width: 100%;
  border-radius: 8px !important;
}
.shop-buy-btn.btn-disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.shop-unavailable-label {
  font-size: 10px;
  opacity: 0.35;
  font-style: italic;
}
.inline-shop-notice {
  margin: 14px 0 0;
  font-size: 11px;
  opacity: 0.4;
  text-align: center;
  line-height: 1.5;
}

/* Responsivo: mobile */
@media (max-width: 480px) {
  .inline-shop-modal {
    padding: 14px;
    max-height: 90vh;
    border-radius: 14px;
  }
  .inline-shop-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .shop-item-card {
    padding: 10px 8px;
  }
  .shop-item-icon-wrap {
    font-size: 26px;
  }
  .shop-item-img {
    width: 26px !important;
    height: 26px !important;
  }
  .shop-item-name {
    font-size: 11px;
  }
  .shop-item-desc {
    display: none;
  }
  .shop-item-price {
    font-size: 11px;
  }
  .shop-buy-btn {
    font-size: 11px !important;
    padding: 5px 10px !important;
  }
  .inline-shop-notice {
    font-size: 10px;
  }
}

/* ── Ghost popup (reused from survival) ── */
@keyframes ghost-popup {
  0% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-30px); }
}

/* ══════════════════════════════════════════════
   Reality Fracture Overlay
   Fraturas progressivas na realidade conforme
   a estabilidade cai de 100 → 0.
   ══════════════════════════════════════════════ */

#reality-fracture-overlay {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

/* Vinheta de cantos — escurece bordas como em Resident Evil */
#fracture-vignette,
#stability-vignette {
  pointer-events: none;
  transition: opacity var(--transition-speed, 1.8s) ease;
}

/* Cada grupo de fraturas transiciona suavemente */
.fracture-group {
  will-change: opacity;
  transition: opacity var(--transition-speed, 1.8s) ease;
}

/* Crescimento das trincas via stroke-dashoffset */
.fracture-layer-1 path,
.fracture-layer-2 path,
.fracture-layer-3 path {
  will-change: stroke-dashoffset;
  transition: stroke-dashoffset 0.6s ease;
}

/* Fragmentos deslocados */
.fracture-layer-4 polygon {
  will-change: transform;
  transition: transform var(--transition-speed, 1.8s) ease;
}

/* ── Estabilizando: reduz fraturas momentaneamente ── */
html.stabilizing #reality-fracture-overlay .fracture-group,
html.stabilizing #fracture-vignette,
html.stabilizing #stability-vignette {
  transition: opacity 0.3s ease !important;
}
html.stabilizing .fracture-layer-1 {
  opacity: 0.15 !important;
}
html.stabilizing .fracture-layer-2 {
  opacity: 0.1 !important;
}
html.stabilizing .fracture-layer-3 {
  opacity: 0.05 !important;
}
html.stabilizing .fracture-layer-4 {
  opacity: 0 !important;
}
html.stabilizing #fracture-vignette,
html.stabilizing #stability-vignette {
  opacity: 0 !important;
}

/* ── Game over: fraturas escurecem e congelam gradualmente ── */
html.game-over #reality-fracture-overlay .fracture-group,
html.game-over #fracture-vignette,
html.game-over #stability-vignette {
  transition: opacity 0.8s ease, filter 0.8s ease !important;
  filter: grayscale(0.6) brightness(0.7);
}

/* ── Pausa: reduz visibilidade das fraturas (mais sutil que o blur da UI) ── */
html.paused .fracture-group,
html.paused #fracture-vignette,
html.paused #stability-vignette {
  opacity: 0.5 !important;
  filter: grayscale(0.3);
  transition: opacity 0.3s ease !important;
}

/* ══════════════════════════════════════════════
   Temporal Collapse — Glass Breakdown Effect
   ══════════════════════════════════════════════ */

/* Overlay principal — cobre a tela toda, pointer-events:none */

.temporal-collapse-shard-layer,
.temporal-collapse-dust-layer {
  pointer-events: none;
  position: fixed;
  inset: 0;
  overflow: hidden;
}

/* Ghost popup para coleta de fragmentos */
@keyframes ghost-popup {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-40px) scale(1.3);
  }
}

/* ── Colapso: flash branco sobre o card ── */
html.game-over-collapse #card {
  animation: collapseShake 0.4s ease-in-out;
}

@keyframes collapseShake {
  0%   { transform: translate(0); }
  10%  { transform: translate(-5px, 3px); }
  20%  { transform: translate(6px, -2px); }
  30%  { transform: translate(-7px, 1px); }
  40%  { transform: translate(4px, -4px); }
  50%  { transform: translate(-3px, 4px); }
  60%  { transform: translate(2px, -3px); }
  100% { transform: translate(0); }
}

/* ═══════════════════════════════════════════
   EROSÃO — Deterioração Progressiva da UI
   ═══════════════════════════════════════════
   Estados adicionais entre unstable e danger:
     trivia-eroding  (49%–25%) — dessaturação, fade sutil
     trivia-fading   (24%–10%) — elementos desaparecem, neve
     trivia-void      (9%–1%)  — apagamento, branco, ruído
   ═══════════════════════════════════════════ */

/* ── Erosion: 49%–25% — dessaturação, fade sutil ── */
@keyframes erosion-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.88; filter: saturate(0.7); }
}

html.trivia-eroding body {
  filter: saturate(0.75) brightness(0.95);
  transition: filter 1.2s ease;
}

html.trivia-eroding .card {
  animation: erosion-pulse 4s ease-in-out infinite;
}

html.trivia-eroding .card h2 {
  animation: glitch-subtle-flicker 2.5s infinite;
  opacity: 0.92;
}

html.trivia-eroding .option-btn {
  transition: opacity 0.6s ease, filter 1.2s ease;
}

/* ── Fading: 24%–10% — elementos desaparecendo, neve ── */
@keyframes snowfall {
  0% { transform: translateY(-10vh) translateX(0); opacity: 0; }
  10% { opacity: 0.6; }
  90% { opacity: 0.3; }
  100% { transform: translateY(110vh) translateX(20px); opacity: 0; }
}

html.trivia-fading .quiz-shell::before {
  content: '' !important;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9998;
  background: radial-gradient(circle at 50% 50%, transparent 30%, rgba(255,255,255,0.02) 70%);
  animation: glitch-pulse 2s ease-in-out infinite;
}

html.trivia-fading body {
  filter: saturate(0.5) brightness(0.9) blur(0.3px);
  transition: filter 1.8s ease;
}

html.trivia-fading .card {
  animation: glitch-wobble 0.4s ease-in-out infinite;
}

html.trivia-fading .card h2 {
  animation: glitch-text-flicker 2s infinite;
  opacity: 0.8;
}

html.trivia-fading .option-btn {
  opacity: 0.85;
  filter: saturate(0.6);
}

html.trivia-fading #stat-streak,
html.trivia-fading #stat-fragments {
  opacity: 0.7;
  transition: opacity 1s ease;
}

/* ── Void: 9%–1% — apagamento, ruído branco ── */
@keyframes void-static {
  0%, 100% { opacity: 0.03; }
  50% { opacity: 0.08; }
}

html.trivia-void .quiz-shell::before {
  content: '' !important;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9998;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 1px,
      rgba(255,255,255,0.04) 1px,
      rgba(255,255,255,0.04) 2px
    );
  animation: void-static 0.8s ease-in-out infinite;
}

html.trivia-void .quiz-shell::after {
  content: '' !important;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9998;
  background: radial-gradient(ellipse at center, transparent 40%, rgba(255,255,255,0.04) 100%);
}

html.trivia-void body {
  filter: saturate(0.25) brightness(0.7) blur(0.5px);
  transition: filter 1.8s ease;
}

html.trivia-void .card {
  animation: glitch-shake 0.08s infinite;
  opacity: 0.7;
}

html.trivia-void .card h2 {
  animation: glitch-text-flicker 1.2s infinite;
  opacity: 0.5;
}

html.trivia-void .option-btn {
  opacity: 0.6;
  filter: saturate(0.3);
  transition: opacity 0.6s ease, filter 1.2s ease;
}

html.trivia-void #stat-streak,
html.trivia-void #stat-fragments,
html.trivia-void #stat-fragment-container,
html.trivia-void #difficulty-dots,
html.trivia-void #question-kicker {
  opacity: 0.4;
  transition: opacity 1.2s ease;
}

html.trivia-void #stability-display {
  filter: brightness(0.5) saturate(0.3);
}

/* ── Micro-fracture: efeito rápido de trinca ao errar ── */
/* Aplicado no .option-btn: shake + dessaturação */
/* Rachaduras visuais são geradas via SVG inline (temporal-collapse.js) */
@keyframes microFracture {
  0% {
    filter: brightness(1) saturate(1);
    transform: translate(0);
  }
  5% {
    filter: brightness(1.8) saturate(0.3);
    transform: translate(0);
  }
  10% {
    filter: brightness(1.3) saturate(0.6);
    transform: translate(-2px, 1px);
  }
  20% {
    transform: translate(2px, -1px);
  }
  30% {
    transform: translate(-1px, 1px);
  }
  50% {
    filter: brightness(1) saturate(0.85);
    transform: translate(0);
  }
  100% {
    filter: brightness(1) saturate(1);
    transform: translate(0);
  }
}

.option-btn.micro-fracture {
  animation: microFracture 0.6s ease-out forwards;
}

/* ── Magic Flame (combo glow no fragment-counter) ── */
.fragment-counter.magic-flame {
  text-shadow: 0 -2px 32px #b84dff;
  animation: 0.6s ease-in-out 0s infinite alternate none running magicGlow, 1.8s linear 0s infinite normal none running magicHue;
}

@keyframes magicGlow {
  0% {
      transform: translateY(0);
      text-shadow:
          0 -4px 26px #b84dff;
  }

  100% {
      transform: translateY(-1px);
      text-shadow:
          0 -8px 44px #ff5cff;
  }
}

@keyframes magicHue {
  from {
      filter: hue-rotate(0deg);
  }
  to {
      filter: hue-rotate(360deg);
  }
}
