/* =========================================================
   AI STORY SAGA — tema "visual novel de luxo"
   dark cinematic premium · carmim + violeta + âmbar
   ========================================================= */

/* ===================== RESET & BASE ===================== */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* Accents */
  --accent: #e94560;
  --accent-2: #ff6b81;
  --accent-deep: #c91840;
  --accent-violet: #7b5cff;
  --accent-amber: #f5a524;

  /* Superfícies */
  --bg-0: #06060c;
  --bg-1: #0b0b16;
  --bg-2: #14142a;

  /* Texto */
  --text: #f5f6fb;
  --muted: rgba(245, 246, 251, 0.64);
  --muted-2: rgba(245, 246, 251, 0.58);

  /* Painéis */
  --panel: rgba(255, 255, 255, 0.045);
  --panel-strong: rgba(255, 255, 255, 0.075);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.17);

  --header-height: 74px;

  /* Formas & movimento */
  --radius: 20px;
  --radius-sm: 13px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);

  /* Tipografia */
  --font-display: "Cinzel", "Playfair Display", Georgia, "Times New Roman", serif;
  --font-ui: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  /* Sombras */
  --glow-accent: 0 20px 50px rgba(233, 69, 96, 0.34);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(1200px 760px at 8% -12%, rgba(233, 69, 96, 0.22), transparent 60%),
    radial-gradient(1000px 720px at 102% -4%, rgba(123, 92, 255, 0.18), transparent 58%),
    radial-gradient(900px 700px at 60% 110%, rgba(245, 165, 36, 0.07), transparent 60%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* -------- Atmosfera: vinheta + grão -------- */
.vignette {
  position: fixed; inset: 0; z-index: 60; pointer-events: none;
  background: radial-gradient(130% 95% at 50% -5%, transparent 55%, rgba(0, 0, 0, 0.38) 100%);
}
.grain {
  position: fixed; inset: 0; z-index: 61; pointer-events: none;
  opacity: 0.05; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
}

/* -------- Barra de progresso global (body.is-loading) -------- */
.loadbar {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 300;
  background: linear-gradient(90deg, var(--accent), var(--accent-violet), var(--accent-amber), var(--accent));
  background-size: 200% 100%;
  transform: scaleX(0); transform-origin: left center;
  opacity: 0; transition: opacity 0.3s var(--ease-soft);
  pointer-events: none;
}
body.is-loading .loadbar {
  opacity: 1;
  animation: loadbar 1.2s var(--ease-soft) infinite;
}
@keyframes loadbar {
  0%   { transform: scaleX(0); }
  55%  { transform: scaleX(0.82); }
  100% { transform: scaleX(1); }
}

/* -------- Scrollbar -------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg-0); }
::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  border-radius: 8px; border: 2px solid var(--bg-0);
}
::-webkit-scrollbar-thumb:hover { background: var(--accent-2); }

/* -------- Acessibilidade: foco visível -------- */
:where(button, a, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
  border-radius: 10px;
}
:where(input, select, textarea):focus-visible { border-radius: var(--radius-sm); }

/* Cards de história são focáveis por teclado (role="button") */
.story-card:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
  border-radius: var(--radius);
}

/* Skip link: oculto até receber foco (compensa o cabeçalho fixo de 74px) */
.skip-link { position: absolute; left: -9999px; top: 0; z-index: 999; }
.skip-link:focus {
  left: 12px; top: 12px;
  padding: 10px 16px;
  background: #111119; color: #fff;
  border-radius: 8px; text-decoration: none;
}

/* ===================== LOADING ===================== */
.loading-overlay {
  position: fixed; inset: 0;
  background:
    radial-gradient(700px 520px at 50% 40%, rgba(233, 69, 96, 0.16), transparent 70%),
    linear-gradient(160deg, var(--bg-1), var(--bg-0));
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s var(--ease);
}
.loading-content { text-align: center; display: flex; flex-direction: column; align-items: center; }
.loading-mark {
  width: 62px; height: 62px; border-radius: 18px; margin-bottom: 26px;
  display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 22px; letter-spacing: 1px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent-2), var(--accent-deep));
  box-shadow: 0 14px 40px rgba(233, 69, 96, 0.5);
  animation: pulseMark 2.2s var(--ease-soft) infinite;
}
@keyframes pulseMark {
  0%, 100% { transform: scale(1); box-shadow: 0 14px 40px rgba(233, 69, 96, 0.45); }
  50%      { transform: scale(1.05); box-shadow: 0 18px 54px rgba(233, 69, 96, 0.7); }
}
.loading-content p {
  color: var(--muted); letter-spacing: 3px; text-transform: uppercase;
  font-size: 11.5px; font-weight: 600;
}
.spinner {
  width: 54px; height: 54px; margin: 0 0 22px;
  border: 3px solid rgba(233, 69, 96, 0.18);
  border-top-color: var(--accent);
  border-right-color: var(--accent-violet);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===================== HEADER ===================== */
.header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-height);
  padding: 0 40px;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(9, 9, 16, 0.68);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-bottom: 1px solid var(--border);
  z-index: 200;
}
.header::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(233, 69, 96, 0.55), rgba(123, 92, 255, 0.45), transparent);
}
.logo { display: flex; align-items: center; gap: 12px; }
.logo-mark {
  width: 36px; height: 36px; border-radius: 11px;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700; font-size: 14px; letter-spacing: 0.5px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  box-shadow: 0 8px 20px rgba(233, 69, 96, 0.48);
}
.logo-text {
  font-family: var(--font-display);
  font-size: 15px; font-weight: 700; letter-spacing: 3px;
  text-transform: uppercase;
  background: linear-gradient(90deg, #fff, var(--accent-2));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.nav-links { display: flex; gap: 8px; }
.nav-btn {
  padding: 10px 20px; border-radius: 11px;
  font-family: var(--font-ui);
  font-size: 13px; font-weight: 700; letter-spacing: 0.6px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: color 0.35s var(--ease), background 0.35s var(--ease),
              border-color 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.nav-btn:hover { color: #fff; background: var(--panel); border-color: var(--border); }
.nav-btn.active {
  color: #fff;
  /* carmim escurecido: texto branco com contraste WCAG AA (>= 4.5:1) */
  background: linear-gradient(135deg, #cf2947 0%, #a1102f 100%);
  border-color: rgba(255, 107, 129, 0.5);
  box-shadow: 0 6px 20px rgba(233, 69, 96, 0.42);
}

/* ===================== LAYOUT / SCREENS ===================== */
.main { margin-top: var(--header-height); min-height: calc(100vh - var(--header-height)); position: relative; z-index: 5; }
.container { max-width: 1360px; margin: 0 auto; padding: 40px 24px 90px; }

.screen { display: none; }
.screen.active { display: block; animation: screenIn 0.55s var(--ease); }
@keyframes screenIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ===================== HERO (2 colunas) ===================== */
.hero { position: relative; padding: 72px 24px 20px; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(560px 420px at 22% 30%, rgba(233, 69, 96, 0.18), transparent 70%),
    radial-gradient(520px 460px at 88% 18%, rgba(123, 92, 255, 0.16), transparent 70%);
}
.hero-grid {
  position: relative; z-index: 2;
  max-width: 1360px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.82fr);
  gap: 60px; align-items: center;
}
.hero-copy { min-width: 0; }
.hero-eyebrow {
  display: inline-block; margin-bottom: 20px;
  padding: 7px 16px; border-radius: 999px;
  font-size: 11px; font-weight: 700; letter-spacing: 2.6px; text-transform: uppercase;
  color: var(--accent-2);
  background: rgba(233, 69, 96, 0.10);
  border: 1px solid rgba(233, 69, 96, 0.35);
  box-shadow: 0 0 24px rgba(233, 69, 96, 0.18) inset;
}
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(36px, 5.2vw, 68px);
  font-weight: 700; letter-spacing: 0.5px; line-height: 1.02;
  background: linear-gradient(118deg, #fff 18%, #ffe3ea 52%, var(--accent-2) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-subtitle {
  max-width: 560px; margin: 22px 0 0;
  font-size: 16.5px; line-height: 1.7; color: var(--muted);
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 32px; }
.hero-cta .btn-primary { width: auto; }
.hero-meta {
  display: flex; flex-wrap: wrap; gap: 14px 30px;
  margin-top: 34px; padding-top: 24px;
  list-style: none; border-top: 1px solid var(--border);
  font-size: 13px; color: var(--muted-2);
}
.hero-meta li strong {
  display: block; margin-bottom: 3px;
  font-family: var(--font-display);
  font-size: 17px; font-weight: 700; letter-spacing: 0.5px; color: var(--text);
}

/* -------- Frame de arte retrato (destaque de personagem) -------- */
.hero-visual { display: flex; justify-content: center; }
.hero-art-frame {
  position: relative; width: 100%; max-width: 400px;
  aspect-ratio: 768 / 1376;
  border-radius: 26px; overflow: hidden;
  border: 1px solid var(--border-strong);
  box-shadow:
    0 44px 90px rgba(0, 0, 0, 0.62),
    0 0 0 1px rgba(233, 69, 96, 0.28),
    0 0 70px rgba(233, 69, 96, 0.26);
  transition: transform 0.7s var(--ease), box-shadow 0.7s var(--ease);
}
.hero-art-frame:hover {
  transform: translateY(-8px) scale(1.01);
  box-shadow:
    0 54px 110px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(255, 107, 129, 0.4),
    0 0 90px rgba(233, 69, 96, 0.36);
}
.hero-art { width: 100%; height: 100%; object-fit: cover; object-position: center top; display: block; }
.hero-art-frame.is-fallback { background: linear-gradient(135deg,#2a2140,#14141f); }
.hero-art-frame::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(180deg, rgba(6, 6, 12, 0.05) 0%, transparent 30%, rgba(6, 6, 12, 0.92) 100%);
}
.hero-rating {
  position: absolute; top: 16px; right: 16px; z-index: 3;
  padding: 6px 12px; border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: 1px;
  color: #fff; background: rgba(10, 10, 18, 0.62);
  border: 1px solid rgba(255, 107, 129, 0.55);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.hero-art-caption {
  position: absolute; left: 22px; right: 22px; bottom: 22px; z-index: 3;
  display: flex; flex-direction: column; gap: 4px;
}
.hero-art-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: 2.4px; text-transform: uppercase;
  color: var(--accent-2);
}
.hero-art-name {
  font-family: var(--font-display);
  font-size: 22px; font-weight: 700; letter-spacing: 0.6px; color: #fff;
}

/* -------- Cabeçalho de seção -------- */
.section-title { margin-top: 66px; margin-bottom: 6px; }
.section-title h2 {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.6vw, 30px); font-weight: 700; letter-spacing: 0.5px; color: #fff;
}
#libraryTitle { scroll-margin-top: calc(var(--header-height) + 20px); }
.section-title p { margin-top: 8px; font-size: 14px; color: var(--muted); }

/* -------- "Como funciona" (3 passos) -------- */
.how-it-works {
  margin-top: 24px;
  padding: 46px 40px;
  border-radius: 26px;
  background:
    radial-gradient(700px 400px at 12% 0%, rgba(233, 69, 96, 0.12), transparent 65%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.how-title {
  margin-top: 14px;
  font-family: var(--font-display);
  font-size: clamp(22px, 2.6vw, 30px); font-weight: 700; letter-spacing: 0.5px; color: #fff;
}
.how-steps {
  list-style: none;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px;
  margin-top: 34px;
}
.how-step {
  position: relative;
  padding: 26px 22px 24px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease), box-shadow 0.4s var(--ease);
}
.how-step:hover {
  transform: translateY(-6px);
  border-color: rgba(233, 69, 96, 0.5);
  box-shadow: 0 22px 46px rgba(233, 69, 96, 0.22);
}
.how-num {
  display: grid; place-items: center;
  width: 46px; height: 46px; margin-bottom: 18px; border-radius: 14px;
  font-family: var(--font-display); font-size: 20px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, #cf2947 0%, #a1102f 100%);
  box-shadow: 0 10px 26px rgba(233, 69, 96, 0.42);
}
.how-step:nth-child(2) .how-num { background: linear-gradient(135deg, #5b3fd6 0%, #3f26b0 100%); box-shadow: 0 10px 26px rgba(123, 92, 255, 0.42); }
.how-step:nth-child(3) .how-num { background: linear-gradient(135deg, #a06a00 0%, #7d5200 100%); box-shadow: 0 10px 26px rgba(245, 165, 36, 0.4); }
.how-step h3 {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 700; letter-spacing: 0.3px; color: #fff; margin-bottom: 9px;
}
.how-step p { font-size: 13.5px; line-height: 1.62; color: var(--muted); }

/* -------- Reveal progressivo por scroll -------- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  will-change: opacity, transform;
}
.reveal.is-visible { opacity: 1; transform: none; }
.reveal:nth-child(2) { transition-delay: 0.08s; }
.reveal:nth-child(3) { transition-delay: 0.16s; }

.page-head { position: relative; text-align: center; margin-bottom: 38px; }
.page-head h1 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 44px); font-weight: 700; letter-spacing: 0.5px;
}
.page-head .hero-subtitle { margin: 12px auto 0; text-align: center; }
.page-head .hero-eyebrow { margin-bottom: 14px; }

/* ===================== STORY GRID ===================== */
.story-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 28px;
  margin-top: 34px;
}
.story-card {
  position: relative;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: transform 0.5s var(--ease), border-color 0.4s var(--ease), box-shadow 0.5s var(--ease);
}
.story-card:hover {
  transform: translateY(-12px);
  border-color: rgba(233, 69, 96, 0.6);
  box-shadow: 0 34px 70px rgba(233, 69, 96, 0.3), 0 0 0 1px rgba(233, 69, 96, 0.24);
}
/* Cover retrato 896:1200 — arte posicionada no topo */
.story-image {
  position: relative;
  aspect-ratio: 896 / 1200;
  background-size: cover;
  background-position: center 18%;
  transition: transform 0.7s var(--ease);
}
.story-card:hover .story-image { transform: scale(1.06); }
.story-image::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(6, 6, 12, 0.12) 0%, rgba(6, 6, 12, 0.35) 52%, rgba(6, 6, 12, 0.96) 100%);
}
.story-genre {
  position: absolute; top: 14px; left: 14px; z-index: 2;
  padding: 6px 13px; border-radius: 999px;
  font-size: 10px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase;
  color: #fff;
  background: rgba(233, 69, 96, 0.85);
  border: 1px solid rgba(255, 107, 129, 0.55);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.45);
}
.story-rating {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  padding: 5px 11px; border-radius: 999px;
  font-size: 10.5px; font-weight: 800; letter-spacing: 0.8px;
  color: #fff;
  background: rgba(10, 10, 18, 0.66);
  border: 1px solid rgba(255, 255, 255, 0.24);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.story-info {
  display: flex; flex-direction: column; flex: 1;
  padding: 22px 22px 24px;
  margin-top: -46px; position: relative; z-index: 2;
}
.story-info h3 {
  font-family: var(--font-display);
  font-size: 19px; font-weight: 700; line-height: 1.3; margin-bottom: 10px; color: #fff;
  text-shadow: 0 6px 22px rgba(0, 0, 0, 0.6);
}
.story-desc { font-size: 13.5px; line-height: 1.62; color: var(--muted); margin-bottom: 18px; }
.story-tags { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.story-tags span {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.4px;
  color: var(--accent-2);
  background: rgba(233, 69, 96, 0.10);
  border: 1px solid rgba(233, 69, 96, 0.28);
  padding: 4px 11px; border-radius: 999px;
}
.story-info .btn-primary { margin-top: auto; }
/* CTA do card: span não-focável (o card inteiro é a superfície interativa) */
.card-cta {
  display: block; width: 100%; text-align: center;
  margin-top: auto;
  pointer-events: none;
}
.story-card:hover .card-cta {
  box-shadow: 0 18px 38px rgba(233, 69, 96, 0.52);
  transform: translateY(-2px);
}
/* Fallback de capa: gradiente carmim/violeta quando a imagem falha */
.story-image.is-fallback {
  background-image:
    radial-gradient(120% 90% at 20% 10%, rgba(233, 69, 96, 0.55), transparent 60%),
    radial-gradient(120% 90% at 85% 90%, rgba(123, 92, 255, 0.5), transparent 62%),
    linear-gradient(160deg, #2a0f1c, #160b2e) !important;
}

/* ===================== BOTÕES ===================== */
.btn-primary, .btn-secondary {
  font-family: var(--font-ui); cursor: pointer;
  border-radius: 12px; font-weight: 700; letter-spacing: 0.4px;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease), background 0.3s var(--ease), border-color 0.3s var(--ease);
}
.btn-primary {
  width: 100%; padding: 14px 22px; font-size: 14.5px;
  color: #fff; border: none;
  /* carmim escurecido: garante contraste WCAG AA (>= 4.5:1) para texto branco */
  background: linear-gradient(135deg, #cf2947 0%, #a1102f 100%);
  box-shadow: 0 10px 26px rgba(233, 69, 96, 0.32);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 18px 38px rgba(233, 69, 96, 0.52); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.7; cursor: default; transform: none; }
.btn-secondary {
  padding: 14px 26px; font-size: 14px;
  color: var(--text); background: var(--panel-strong); border: 1px solid var(--border-strong);
}
.btn-secondary:hover { background: rgba(255, 255, 255, 0.12); border-color: var(--accent); }

/* ===================== SETTINGS ===================== */
.ollama-badge {
  display: inline-flex; align-items: center; gap: 8px;
  margin: 18px auto 0; padding: 8px 16px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.6px;
  color: #7dffc4;
  background: rgba(45, 212, 145, 0.10);
  border: 1px solid rgba(45, 212, 145, 0.4);
}
.ollama-badge::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: #2dd491; box-shadow: 0 0 12px #2dd491;
}
.settings-panel {
  max-width: 940px; margin: 0 auto;
  padding: 42px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: 26px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.4);
}
.settings-section { position: relative; padding: 0 0 34px 20px; margin-bottom: 34px; border-bottom: 1px solid var(--border); }
.settings-section:last-of-type { border-bottom: none; }
.settings-section::before {
  content: ""; position: absolute; left: 0; top: 2px; bottom: 34px; width: 3px; border-radius: 3px;
  background: linear-gradient(180deg, var(--accent-2), transparent);
  opacity: 0.75;
}
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.section-head h2 {
  display: flex; align-items: center; gap: 11px;
  font-family: var(--font-display);
  font-size: 18px; font-weight: 700; letter-spacing: 0.4px; color: #fff;
}
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; box-shadow: 0 0 14px currentColor; }
.dot-text { color: var(--accent-2); background: var(--accent-2); }
.dot-image { color: var(--accent-violet); background: var(--accent-violet); }
.dot-video { color: #35d6c4; background: #35d6c4; }
.section-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn-test {
  padding: 9px 16px; border-radius: 10px; cursor: pointer;
  font-family: var(--font-ui);
  font-size: 12px; font-weight: 700; letter-spacing: 0.5px;
  color: var(--muted);
  background: var(--panel-strong);
  border: 1px solid var(--border);
  transition: color 0.3s var(--ease), border-color 0.3s var(--ease), background 0.3s var(--ease);
}
.btn-test:hover { color: #fff; border-color: var(--accent); background: rgba(233, 69, 96, 0.14); }
.test-status { font-size: 12px; font-weight: 600; letter-spacing: 0.3px; color: var(--muted-2); max-width: 280px; }
.test-status.ok { color: #63e6a6; }
.test-status.fail { color: #ff8093; }
.test-status.testing { color: var(--accent-amber); animation: blink 1.2s ease-in-out infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px 20px; }
.form-group { display: flex; flex-direction: column; }
.form-group label {
  margin-bottom: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--muted-2);
}
.form-group select,
.form-group input {
  width: 100%; padding: 13px 16px; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14px; color: var(--text);
  background: rgba(0, 0, 0, 0.34);
  border: 1px solid var(--border);
  transition: border-color 0.3s var(--ease), background 0.3s var(--ease), box-shadow 0.3s var(--ease);
  appearance: none;
}
.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23ff6b81' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center;
  padding-right: 40px; cursor: pointer;
}
.form-group select:hover,
.form-group input:hover { border-color: var(--border-strong); }
.form-group select:focus,
.form-group input:focus {
  outline: none; border-color: var(--accent);
  background: rgba(0, 0, 0, 0.48);
  box-shadow: 0 0 0 4px rgba(233, 69, 96, 0.14);
}
.form-group select option { background: #12121f; color: #fff; }
.form-group input::placeholder { color: var(--muted-2); }
.settings-actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 6px; }
.settings-actions .btn-primary { width: auto; padding: 14px 30px; }

/* ===================== GAME ===================== */
.game-layout {
  display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(0, 1fr);
  gap: 32px;
  min-height: calc(100vh - 190px);
}
.media-section { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

/* -------- Seletor de modo com miniaturas -------- */
.mode-toggle { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mode-btn {
  position: relative; padding: 0;
  aspect-ratio: 896 / 1200;
  border-radius: 16px; overflow: hidden; cursor: pointer;
  background: #0a0a14;
  border: 1px solid var(--border);
  transition: border-color 0.35s var(--ease), box-shadow 0.35s var(--ease), transform 0.35s var(--ease);
}
.mode-btn:hover { transform: translateY(-4px); border-color: var(--border-strong); }
.mode-thumb {
  position: absolute; inset: 0; z-index: 0;
  background-color: #1b1b28;
  background-size: cover; background-position: center 22%;
  filter: saturate(0.8) brightness(0.68);
  transition: transform 0.6s var(--ease), filter 0.4s var(--ease);
}
.mode-thumb.is-fallback { background-image: linear-gradient(135deg,#2a2140,#14141f) !important; }
.mode-btn:hover .mode-thumb { transform: scale(1.07); filter: saturate(1) brightness(0.86); }
.mode-btn::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, transparent 30%, rgba(6, 6, 12, 0.94) 100%);
}
.mode-label {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 11px 8px; text-align: center;
  font-size: 12.5px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--muted);
  transition: color 0.3s var(--ease);
}
.mode-btn.active {
  border-color: rgba(233, 69, 96, 0.62);
  box-shadow: 0 16px 36px rgba(233, 69, 96, 0.34);
}
.mode-btn.active .mode-thumb { filter: saturate(1.06) brightness(0.98); }
.mode-btn.active .mode-label { color: #fff; }
.mode-btn.active::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px; z-index: 3;
  background: linear-gradient(90deg, var(--accent-2), var(--accent-violet));
}

/* -------- Display de mídia (paisagem) -------- */
.media-display {
  position: relative; flex: 1; min-height: 340px;
  border-radius: var(--radius); overflow: hidden;
  background: rgba(0, 0, 0, 0.42);
  border: 1px solid var(--border);
  box-shadow: inset 0 0 70px rgba(0, 0, 0, 0.55), 0 24px 60px rgba(0, 0, 0, 0.4);
}
.media-content {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background-size: cover; background-position: center;
  background-color: #05050a;
}
.media-img { width: 100%; height: 100%; object-fit: cover; display: block; animation: fadeIn 0.6s var(--ease); }
.media-img:focus-visible { outline: 3px solid var(--accent-2); outline-offset: -3px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.media-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  width: 100%; height: 100%; color: var(--muted);
  background:
    linear-gradient(100deg, rgba(255, 255, 255, 0.02) 30%, rgba(255, 255, 255, 0.07) 50%, rgba(255, 255, 255, 0.02) 70%),
    rgba(0, 0, 0, 0.35);
  background-size: 220% 100%, 100% 100%;
  animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { from { background-position: 200% 0, 0 0; } to { background-position: -80% 0, 0 0; } }
.media-loading .spinner { width: 44px; height: 44px; border-width: 3px; margin: 0; }
.media-loading p { font-size: 13px; letter-spacing: 1.2px; text-transform: uppercase; }
.media-placeholder {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  color: var(--muted-2); text-align: center; padding: 24px;
  background: radial-gradient(circle at 50% 40%, rgba(233, 69, 96, 0.10), transparent 70%);
}
.media-placeholder svg { color: rgba(233, 69, 96, 0.45); }
.media-placeholder p { font-size: 13px; letter-spacing: 0.6px; }

/* -------- Galeria de imagens / regenerar -------- */
.regenerar-btn { align-self: flex-start; }
.regenerar-btn[hidden] { display: none; }

/* P&B garantido no modo doujin (sobrevive em tela cheia e nas miniaturas) */
.media-content.is-doujin .media-img { filter: grayscale(1) contrast(1.2); }
.zoom-modal.is-doujin .zoom-img { filter: grayscale(1) contrast(1.2); }
.gallery-thumb.is-doujin .gallery-thumb-img { filter: grayscale(1) contrast(1.2); }

.gallery-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%;
  color: #fff; cursor: pointer;
  background: rgba(6, 6, 12, 0.62);
  border: 1px solid var(--border-strong);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}
.gallery-nav[hidden] { display: none; }
.gallery-nav:hover { background: rgba(233, 69, 96, 0.28); border-color: var(--accent); }
.gallery-nav-prev { left: 14px; }
.gallery-nav-next { right: 14px; }

.gallery-thumbs {
  position: absolute; left: 0; right: 0; bottom: 12px; z-index: 3;
  display: flex; gap: 8px; justify-content: center;
  flex-wrap: nowrap; max-height: 48px; overflow-x: auto; overflow-y: hidden;
  padding: 0 56px; pointer-events: none;
  scrollbar-width: thin;
}
.gallery-thumbs[hidden] { display: none; }
.gallery-thumb {
  pointer-events: auto; flex: 0 0 auto;
  width: 56px; height: 40px; padding: 0; overflow: hidden; cursor: pointer;
  border-radius: 8px; border: 2px solid transparent;
  background-color: #0a0a14; background-size: cover; background-position: center;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
  opacity: 0.72;
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease), opacity 0.3s var(--ease);
}
.gallery-thumb:hover { opacity: 1; transform: translateY(-2px); }
.gallery-thumb.active { opacity: 1; border-color: var(--accent-2); }
.gallery-thumb-img { width: 100%; height: 100%; object-fit: cover; display: block; }

.gallery-counter {
  position: absolute; top: 12px; right: 14px; z-index: 3;
  padding: 4px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.6px;
  color: var(--text);
  background: rgba(6, 6, 12, 0.66);
  border: 1px solid var(--border);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.gallery-counter[hidden] { display: none; }

/* -------- Modal de zoom (tela cheia) -------- */
.zoom-modal {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  background: rgba(3, 3, 8, 0.94);
  opacity: 0; transition: opacity 0.28s var(--ease);
}
.zoom-modal[hidden] { display: none; }
.zoom-modal.is-open { opacity: 1; }

.zoom-viewport {
  position: relative; width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  touch-action: none; cursor: default; overflow: hidden;
}
.zoom-img {
  width: 100%; height: 100%; object-fit: contain;
  transform-origin: center center;
  user-select: none; -webkit-user-select: none; -webkit-user-drag: none;
  transition: transform 0.18s var(--ease);
  will-change: transform;
}
.zoom-img.is-dragging { cursor: grabbing; transition: none; }

.zoom-toolbar {
  position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 2;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 999px;
  background: rgba(20, 20, 34, 0.9);
  border: 1px solid var(--border-strong);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.zoom-toolbar button {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 38px; height: 38px; padding: 0 12px; cursor: pointer;
  border-radius: 999px; font-size: 15px; font-weight: 700;
  color: var(--text); background: var(--panel-strong);
  border: 1px solid var(--border);
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}
.zoom-toolbar button:hover { background: rgba(233, 69, 96, 0.22); border-color: var(--accent); }
.zoom-level { min-width: 52px; text-align: center; font-size: 13px; font-weight: 700; color: var(--muted); }
.zoom-reset { font-size: 13px; }
.zoom-close {
  position: absolute; top: 20px; right: 20px; z-index: 2;
  width: 44px; height: 44px; border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; background: rgba(20, 20, 34, 0.9);
  border: 1px solid var(--border-strong);
  font-size: 18px; line-height: 1;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease);
}
.zoom-close:hover { background: rgba(233, 69, 96, 0.28); border-color: var(--accent); }

/* -------- Painel de narrativa -------- */
.story-section {
  display: flex; flex-direction: column; gap: 22px; min-width: 0;
  padding: 26px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.story-header {
  position: sticky; top: 88px; z-index: 6;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 0 16px; margin: -4px 0 0;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(11, 11, 22, 0.92), rgba(11, 11, 22, 0.72));
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.story-header h2 {
  font-family: var(--font-display);
  font-size: 21px; font-weight: 700; line-height: 1.25; color: #fff;
}
.mode-indicator {
  flex-shrink: 0; padding: 7px 15px; border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--accent-2);
  background: rgba(233, 69, 96, 0.12);
  border: 1px solid rgba(233, 69, 96, 0.32);
}
.story-text-content {
  flex: 1; padding-right: 10px;
  max-width: 68ch;
  font-size: 16.5px; line-height: 1.9; letter-spacing: 0.1px;
  color: rgba(245, 246, 251, 0.9);
}
.story-text-content p { margin-bottom: 18px; animation: fadeUp 0.5s var(--ease); }
.turn-block { margin-bottom: 28px; }
.turn-block:last-child { margin-bottom: 0; }
/* Estado vazio amigável quando a história não pôde ser carregada */
.turn-block.is-empty { opacity: 0.82; font-style: italic; }
/* Drop cap apenas no primeiro parágrafo da primeira cena (o .story-loading é removido antes) */
#storyText > .turn-block:first-of-type > p:first-child::first-letter {
  font-family: var(--font-display);
  font-size: 2.4em; line-height: 0.9; float: left;
  padding: 4px 10px 0 0;
  color: var(--accent-2);
}
/* Placeholder transitório enquanto a primeira cena é carregada */
.story-loading {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 20px;
  font-size: 13px; font-weight: 700; letter-spacing: 1.6px; text-transform: uppercase;
  color: var(--muted-2);
  animation: blink 1.4s ease-in-out infinite;
}
.story-loading::before {
  content: ""; width: 16px; height: 16px; flex: 0 0 auto;
  border: 2px solid rgba(233, 69, 96, 0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
.turn-block p:last-child { margin-bottom: 0; }
.turn-choice {
  margin: 0 0 12px;
  padding: 10px 16px;
  font-size: 14.5px; font-style: italic; font-weight: 600; line-height: 1.5;
  color: var(--accent-2);
  background: rgba(233, 69, 96, 0.08);
  border-left: 3px solid var(--accent);
  border-radius: 0 10px 10px 0;
  animation: fadeUp 0.5s var(--ease);
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

/* -------- Escolhas numeradas -------- */
.choices-container { counter-reset: choice; display: flex; flex-direction: column; gap: 12px; }
.choice-btn {
  position: relative;
  display: flex; align-items: flex-start; gap: 14px;
  width: 100%; padding: 16px 20px; border-radius: var(--radius-sm); cursor: pointer;
  font-family: var(--font-ui); font-size: 14.5px; font-weight: 600; line-height: 1.45; text-align: left;
  color: var(--text);
  background: var(--panel-strong);
  border: 1px solid var(--border-strong);
  transition: transform 0.35s var(--ease), color 0.3s var(--ease),
              border-color 0.3s var(--ease), background 0.3s var(--ease), box-shadow 0.35s var(--ease);
}
.choice-btn::before {
  counter-increment: choice; content: counter(choice);
  flex: 0 0 auto; width: 28px; height: 28px; border-radius: 9px;
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 800;
  color: #fff;
  background: linear-gradient(135deg, #cf2947 0%, #a1102f 100%);
  box-shadow: 0 6px 16px rgba(233, 69, 96, 0.4);
  transition: box-shadow 0.3s var(--ease), transform 0.3s var(--ease);
}
.choice-btn:hover {
  transform: translateX(7px);
  color: #fff;
  border-color: var(--accent);
  background: rgba(233, 69, 96, 0.14);
  box-shadow: -6px 0 24px rgba(233, 69, 96, 0.2);
}
.choice-btn:hover::before { transform: scale(1.08); box-shadow: 0 8px 22px rgba(233, 69, 96, 0.6); }
.choice-btn:disabled { cursor: default; }
.choices-hint { font-size: 12px; color: var(--muted-2); letter-spacing: 0.3px; }
.choices-hint kbd {
  display: inline-block; min-width: 18px; padding: 1px 5px; margin: 0 1px;
  font-family: var(--font-ui); font-size: 11px; font-weight: 700; text-align: center;
  color: var(--text); background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-strong); border-radius: 5px;
}

/* ===================== BOTÃO VOLTAR ===================== */
.back-btn {
  position: fixed; bottom: 30px; right: 30px;
  width: 56px; height: 56px; border-radius: 50%;
  display: none; align-items: center; justify-content: center;
  cursor: pointer; color: #fff;
  background: linear-gradient(135deg, #cf2947 0%, #a1102f 100%);
  border: 1px solid rgba(255, 107, 129, 0.5);
  box-shadow: 0 12px 30px rgba(233, 69, 96, 0.45);
  z-index: 150;
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.back-btn:hover { transform: scale(1.08); box-shadow: 0 16px 40px rgba(233, 69, 96, 0.62); }

/* ===================== TOAST ===================== */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translate(-50%, 24px);
  max-width: 90vw; padding: 13px 22px; border-radius: 12px;
  font-size: 13.5px; font-weight: 600; letter-spacing: 0.3px;
  color: #fff;
  background: rgba(20, 20, 34, 0.95);
  border: 1px solid var(--border-strong);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0; pointer-events: none;
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
  z-index: 400;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast-error { border-color: rgba(255, 128, 147, 0.6); }
.toast-success { border-color: rgba(99, 230, 166, 0.55); }

/* ===================== RATING SYSTEM ===================== */
/* Star Rating Component */
.rating-stars {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.rating-stars .star {
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--border);
  transition: color 0.2s var(--ease), transform 0.15s var(--ease);
  user-select: none;
}
.rating-stars .star:hover {
  transform: scale(1.2);
}
.rating-stars .star.filled {
  color: var(--accent-amber);
}
.rating-stars .star svg {
  width: 100%;
  height: 100%;
}
.rating-stars .star:not(.filled):hover {
  color: var(--accent-amber);
}
.rating-stars.readonly .star {
  cursor: default;
  pointer-events: none;
}

/* Like/Dislike Component */
.rating-like-dislike {
  display: inline-flex;
  gap: 8px;
  align-items: center;
}
.rating-like-dislike .btn-rate {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.5px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  transition: all 0.25s var(--ease);
}
.rating-like-dislike .btn-rate:hover {
  border-color: var(--accent);
  color: var(--text);
  background: rgba(233, 69, 96, 0.14);
}
.rating-like-dislike .btn-rate.active.like {
  background: linear-gradient(135deg, #cf2947 0%, #a1102f 100%);
  border-color: rgba(255, 107, 129, 0.5);
  color: #fff;
  box-shadow: 0 6px 18px rgba(233, 69, 96, 0.4);
}
.rating-like-dislike .btn-rate.active.dislike {
  background: linear-gradient(135deg, #1a3a5c 0%, #0d2238 100%);
  border-color: rgba(100, 180, 255, 0.5);
  color: #64b4ff;
  box-shadow: 0 6px 18px rgba(100, 180, 255, 0.3);
}
.rating-like-dislike .btn-rate svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* Rating Display (read-only summary) */
.rating-display {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.rating-display .avg-score {
  color: var(--accent-amber);
  font-family: var(--font-display);
  font-size: 14px;
}
.rating-display .count {
  color: var(--muted-2);
}

/* Rating container for images in gallery */
.image-rating {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 12px;
  background: rgba(6, 6, 12, 0.85);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  min-width: 200px;
  max-width: 280px;
}
.image-rating[hidden] { display: none; }

/* Rating container for story text blocks */
.text-rating {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
  padding: 16px 20px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  border: 1px solid var(--border);
}
.text-rating .rating-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted-2);
}

/* Floating rating badge on images (top-right) */
.rating-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  color: #fff;
  background: rgba(10, 10, 18, 0.75);
  border: 1px solid rgba(245, 165, 36, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.rating-badge.low {
  background: rgba(20, 20, 30, 0.85);
  border-color: rgba(255, 100, 100, 0.5);
  color: #ff8888;
}
.rating-badge svg {
  width: 14px;
  height: 14px;
}

/* ===================== RESPONSIVO ===================== */
@media (max-width: 1024px) {
  .hero-grid { grid-template-columns: 1fr; gap: 44px; text-align: center; }
  .hero-copy { display: flex; flex-direction: column; align-items: center; }
  .hero-subtitle { margin-inline: auto; }
  .hero-cta { justify-content: center; }
  .hero-meta { justify-content: center; text-align: center; }
  .hero-art-frame { max-width: 320px; }
  .game-layout { grid-template-columns: 1fr; min-height: 0; }
  .media-display { min-height: 320px; }
  .story-header { position: static; }
}

@media (max-width: 768px) {
  :root { --header-height: 64px; }
  .header { padding: 0 16px; }
  .logo-text { font-size: 13px; letter-spacing: 2px; }
  .nav-btn { padding: 9px 14px; font-size: 12px; }
  .container { padding: 26px 16px 100px; }
  .hero { padding: 42px 16px 8px; }
  .section-title { margin-top: 44px; }
  .story-grid { grid-template-columns: 1fr; gap: 22px; margin-top: 26px; }
  .how-it-works { padding: 30px 20px; }
  .how-steps { grid-template-columns: 1fr; gap: 18px; margin-top: 26px; }
  .settings-panel { padding: 26px 18px; }
  .settings-section { padding-left: 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .settings-actions { flex-direction: column; align-items: stretch; }
  .settings-actions .btn-primary { width: 100%; }
  .back-btn { bottom: 20px; right: 20px; width: 50px; height: 50px; }
}

@media (max-width: 520px) {
  .hero-meta { gap: 12px 20px; }
  .hero-cta { width: 100%; }
  .hero-cta .btn-primary, .hero-cta .btn-secondary { width: 100%; }
  .mode-toggle { gap: 8px; }
  .mode-label { font-size: 11px; letter-spacing: 1px; }
}

/* ===================== MOVIMENTO REDUZIDO ===================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  /* Spinner estático como anel completo (evita arco congelado) */
  .spinner { animation: none !important; border-color: var(--accent-violet); border-top-color: var(--accent); border-right-color: var(--accent); }
  .story-card:hover, .hero-art-frame:hover, .choice-btn:hover, .mode-btn:hover { transform: none; }
  .story-card:hover .story-image, .mode-btn:hover .mode-thumb { transform: none; }
  /* Desativa a revelação progressiva: conteúdo visível de imediato */
  .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
}

/* ===================== CONTROLES DO JOGO (salvar/carregar/reiniciar, ação livre, status) ===================== */
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.story-header { flex-wrap: wrap; }
.story-header h2 { min-width: 0; overflow-wrap: anywhere; }
.story-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.btn-chip {
  padding: 7px 13px; border-radius: 999px; cursor: pointer;
  font-family: var(--font-ui); font-size: 12px; font-weight: 700; letter-spacing: 0.4px;
  color: var(--text); background: var(--panel-strong); border: 1px solid var(--border-strong);
  transition: background 0.25s var(--ease), border-color 0.25s var(--ease);
}
.btn-chip:hover:not(:disabled) { background: rgba(255, 255, 255, 0.12); border-color: var(--accent); }
.btn-chip:disabled { opacity: 0.5; cursor: default; }
.btn-chip[hidden] { display: none; }
.btn-chip-danger:hover:not(:disabled) { border-color: #ff8093; color: #ffd3da; }
.degraded-banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  font-size: 13px; line-height: 1.5; color: #ffe3b0;
  background: rgba(245, 165, 36, 0.1); border: 1px solid rgba(245, 165, 36, 0.4);
}
.degraded-banner[hidden] { display: none; }
.degraded-banner-text { flex: 1 1 240px; min-width: 0; }
.custom-action-form { display: flex; gap: 10px; flex-wrap: wrap; }
.custom-action-input {
  flex: 1 1 220px; min-width: 0; padding: 13px 16px; border-radius: var(--radius-sm);
  font-family: var(--font-ui); font-size: 14px; color: var(--text);
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border-strong);
}
.custom-action-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.25); }
.custom-action-btn { flex: 0 0 auto; padding: 12px 20px; }
.custom-action-btn:disabled, .custom-action-input:disabled { opacity: 0.55; cursor: default; }
.story-save-badge {
  position: absolute; left: 12px; bottom: 12px; padding: 4px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 800; letter-spacing: 0.5px; color: #0b0b16; background: #63e6a6;
}
.story-save-badge[hidden] { display: none; }
.hero-art-frame[role="button"] { cursor: pointer; }
.status-modal {
  position: fixed; inset: 0; z-index: 350; display: grid; place-items: center; padding: 16px;
  background: rgba(4, 4, 10, 0.72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.status-modal[hidden] { display: none; }
.status-modal-card {
  width: min(520px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  padding: 22px; border-radius: var(--radius);
  background: #12121f; border: 1px solid var(--border-strong); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.status-modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.status-modal-head h2 { font-family: var(--font-display); font-size: 18px; color: #fff; }
.status-close-btn {
  width: 36px; height: 36px; border-radius: 10px; cursor: pointer; font-size: 16px;
  color: var(--text); background: var(--panel-strong); border: 1px solid var(--border-strong);
}
.status-modal-body { display: flex; flex-direction: column; gap: 14px; }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; }
.status-row-stack { flex-direction: column; align-items: stretch; }
.status-label { color: var(--muted); }
.status-muted { color: var(--muted); font-size: 13px; }
.status-saves-ctrl { display: flex; align-items: center; gap: 10px; }
.status-select {
  padding: 8px 12px; border-radius: 10px; font-family: var(--font-ui); font-size: 13px;
  color: var(--text); background: #1b1b2c; border: 1px solid var(--border-strong);
}
.status-action-btn { width: 100%; }
.status-divider { border: 0; border-top: 1px solid var(--border); margin: 2px 0; }
.story-section { gap: 18px; min-width: 0; }
@media (max-width: 520px) {
  .nav-btn { padding: 8px 10px; font-size: 11.5px; }
  .logo-text { display: none; }
  .custom-action-btn { width: 100%; }
}
