/* =====================================================================
   O último baile do Solar Valadares — estilos
   Paleta NCC + tokens temáticos (noite, pergaminho, vela, bronze)
   ===================================================================== */
:root {
  --primary-color: #4A4C9C;
  --primary-light: #6B6DB8;
  --primary-dark: #2E3066;
  --success-color: #2E7D32;
  --danger-color: #C62828;
  --warning-color: #F57C00;
  --info-color: #0277BD;
  --admin-button-color: #4DB6AC;
  --admin-button-hover: #26A69A;
  --text-dark: #1A1A1A;
  --text-light: #FFFFFF;
  --text-gray: #666666;
  --bg-light: #F5F5F5;
  --bg-white: #FFFFFF;
  --border-light: #ddd;
  --shadow: 0 4px 6px rgba(0,0,0,0.1);
  --radius: 8px;

  /* temáticos */
  --night: #1B1327;
  --night-deep: #140D1F;
  --surface: #241A34;
  --surface-2: #2E2442;
  --line: rgba(232, 221, 196, 0.10);
  --line-strong: rgba(232, 221, 196, 0.18);
  --bone: #EEE8DA;
  --bone-dim: #A7A197;
  --bone-faint: #6F6A62;
  --parchment: #E8DDC4;
  --parchment-dark: #D6C7A6;
  --ink: #2B2219;
  --ink-soft: #5B4D3D;
  --candle: #FFB547;
  --pumpkin: var(--warning-color);
  --bronze: #B08A55;
  --stone: #2A2A2E;

  --font-serif: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--night);
  background-image:
    radial-gradient(1200px 720px at 78% -8%, rgba(138, 82, 214, 0.30), transparent 60%),
    radial-gradient(1000px 620px at 102% 110%, rgba(245, 130, 26, 0.20), transparent 55%),
    radial-gradient(820px 520px at -8% 108%, rgba(120, 64, 190, 0.20), transparent 60%),
    linear-gradient(180deg, #1E1530, #150E23 70%, #120B1D);
  background-attachment: fixed;
  color: var(--bone);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  padding-bottom: var(--safe-bottom);
}
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--primary-light); }
:focus-visible { outline: 2px solid var(--primary-light); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.noscript { text-align: center; padding: 40px; }
.tnum { font-variant-numeric: tabular-nums; }

/* ---------- névoa de fundo ---------- */
.fog { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.fog span {
  position: absolute; left: -50%; width: 200%; height: 45vh; bottom: -12vh;
  background: radial-gradient(closest-side, rgba(200, 196, 220, 0.07), transparent 70%);
  filter: blur(20px);
  animation: fog 60s linear infinite;
}
.fog span:nth-child(2) { bottom: -20vh; animation-duration: 90s; animation-direction: reverse; opacity: .7; }
@keyframes fog { from { transform: translateX(0); } to { transform: translateX(25%); } }
#app { position: relative; z-index: 1; min-height: 100vh; }

/* ---------- decorações de Halloween (fantasmas + abóboras) ---------- */
.decor { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.decor .jack {
  position: absolute; bottom: -10px; height: auto;
  filter: drop-shadow(0 -4px 26px rgba(255, 150, 40, .75)) drop-shadow(0 0 60px rgba(255, 120, 20, .5));
  animation: jack-flicker 3.4s ease-in-out infinite;
}
.decor .pk-left { left: -14px; width: clamp(140px, 17vw, 230px); transform: rotate(-5deg); opacity: .95; }
.decor .pk-right { right: -12px; width: clamp(108px, 13vw, 180px); transform: rotate(4deg); opacity: .9; animation-delay: -1.6s; }
@keyframes jack-flicker { 0%, 100% { opacity: .95; } 46% { opacity: .95; } 50% { opacity: .7; } 55% { opacity: .9; } 70% { opacity: .82; } }

.decor .ghost {
  position: absolute; width: 60px; height: auto; opacity: .3;
  filter: drop-shadow(0 0 16px rgba(224, 218, 255, .5));
  animation: ghost-float 18s ease-in-out infinite;
}
.decor .g1 { top: 13%; left: 7%; }
.decor .g2 { top: 32%; right: 9%; width: 46px; opacity: .24; animation-duration: 23s; animation-delay: -7s; }
.decor .g3 { bottom: 22%; left: 15%; width: 52px; opacity: .22; animation-duration: 27s; animation-delay: -13s; }
@keyframes ghost-float { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-28px) rotate(2deg); } }

/* lua crescente */
.decor .moon-decor {
  position: absolute; top: 76px; right: 4%; width: clamp(48px, 6vw, 80px); height: auto; opacity: .9;
  filter: drop-shadow(0 0 24px rgba(246, 238, 219, .45));
}

/* teias de aranha nos cantos de cima */
.decor .web { position: absolute; top: 0; width: clamp(96px, 11.5vw, 160px); height: auto; opacity: .72; }
.decor .web-tl { left: 0; }
.decor .web-tr { right: 0; transform: scaleX(-1); }

/* aranha pendurada */
.decor .spider {
  position: absolute; top: 0; left: 5%; width: 40px; height: auto; opacity: .72;
  filter: drop-shadow(0 3px 5px rgba(0, 0, 0, .45));
  transform-origin: 50% 0; animation: spider-bob 6s ease-in-out infinite;
}
@keyframes spider-bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(12px) rotate(1.6deg); } }

/* morcegos voando */
.decor .bat-decor {
  position: absolute; left: 0; width: 52px; height: auto; opacity: .95;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .45));
  animation: bat-fly 26s linear infinite;
}
.decor .bat-decor .wings { fill: #9C8FC6; transform-origin: 50% 42%; animation: bat-flap .34s ease-in-out infinite alternate; }
.decor .bat1 { top: 15%; }
.decor .bat2 { top: 30%; width: 42px; opacity: .82; animation-duration: 33s; animation-delay: -11s; }
.decor .bat3 { top: 9%; width: 46px; opacity: .88; animation-duration: 30s; animation-delay: -19s; }
@keyframes bat-flap { from { transform: scaleX(1); } to { transform: scaleX(.55); } }
@keyframes bat-fly {
  0% { transform: translate(-12vw, 0); }
  50% { transform: translate(52vw, -4vh); }
  100% { transform: translate(116vw, 1vh); }
}

@media (max-width: 560px) {
  .decor .g1, .decor .g3 { display: none; }
  .decor .pk-left { width: 128px; opacity: .85; }
  .decor .pk-right { width: 100px; opacity: .8; }
  .decor .spider, .decor .bat3 { display: none; }
  .decor .web { width: 88px; opacity: .58; }
  .decor .moon-decor { width: 44px; top: 68px; }
}
@media (prefers-reduced-motion: reduce) {
  .decor .jack, .decor .ghost, .decor .spider, .decor .bat-decor, .decor .bat-decor .wings { animation: none; }
}

/* brilho de abóbora nos cabeçalhos internos */
.hero, .admin-head, .chapter-head { position: relative; }
.hero::before, .admin-head::before, .chapter-head::before {
  content: ""; position: absolute; z-index: 0; pointer-events: none;
  left: -32px; top: -46px; width: min(460px, 78%); height: 190px;
  background: radial-gradient(closest-side, rgba(245, 130, 26, 0.28), rgba(245, 124, 0, 0.08) 55%, transparent 76%);
  filter: blur(6px);
  animation: head-glow 5s ease-in-out infinite;
}
.hero > *, .admin-head > *, .chapter-head > * { position: relative; z-index: 1; }
.hero h1, .admin-head h1, .chapter h2 { text-shadow: 0 0 26px rgba(245, 140, 40, 0.32); }
@keyframes head-glow { 0%, 100% { opacity: 1; } 50% { opacity: .72; } }
@media (prefers-reduced-motion: reduce) { .hero::before, .admin-head::before, .chapter-head::before { animation: none; } }

/* ---------- boot ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.boot-moon { width: 44px; height: 44px; border-radius: 50%; box-shadow: inset -10px -4px 0 0 var(--parchment); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------- botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius);
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--bone);
  font-weight: 500; font-size: 14px; cursor: pointer; white-space: nowrap;
  transition: background .15s, border-color .15s, transform .08s, opacity .15s;
}
.btn:hover { background: #2A2933; border-color: rgba(232,221,196,.28); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--primary-color); border-color: var(--primary-color); color: var(--text-light); }
.btn-primary:hover { background: var(--primary-light); border-color: var(--primary-light); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--bone-dim); }
.btn-ghost:hover { background: rgba(255,255,255,.05); color: var(--bone); border-color: transparent; }
.btn-danger { background: transparent; border-color: rgba(198,40,40,.5); color: #EF9A9A; }
.btn-danger:hover { background: rgba(198,40,40,.15); border-color: var(--danger-color); }
.btn-danger-solid { background: var(--danger-color); border-color: var(--danger-color); color: #fff; }
.btn-danger-solid:hover { background: #D32F2F; }
.btn-admin { background: var(--admin-button-color); border-color: var(--admin-button-color); color: #0E2A27; }
.btn-admin:hover { background: var(--admin-button-hover); border-color: var(--admin-button-hover); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; }
.btn-icon { width: 36px; padding: 0; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn .spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- campos ---------- */
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; color: var(--bone-dim); font-weight: 500; }
.input {
  width: 100%; height: 44px; padding: 0 14px; border-radius: var(--radius);
  background: var(--night-deep); border: 1px solid var(--line-strong); color: var(--bone);
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder { color: var(--bone-faint); }
.input:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(107,109,184,.25); }
.input.invalid { border-color: var(--danger-color); }
textarea.input { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 46px; }
.input-wrap .toggle-pw { position: absolute; right: 4px; top: 4px; height: 36px; width: 38px; border: 0; background: transparent; color: var(--bone-dim); cursor: pointer; border-radius: 6px; display: grid; place-items: center; }
.input-wrap .toggle-pw:hover { color: var(--bone); background: rgba(255,255,255,.05); }
.input-wrap .toggle-pw svg { width: 18px; height: 18px; }
.help { font-size: 12.5px; color: var(--bone-faint); }
.caps { font-size: 12.5px; color: var(--pumpkin); display: none; }
.caps.show { display: block; }
.form-error { display: none; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); background: rgba(198,40,40,.12); border: 1px solid rgba(198,40,40,.4); color: #F2B8B5; font-size: 13.5px; margin-bottom: 14px; }
.form-error.show { display: flex; }
.form-error svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }
.row { display: flex; gap: 10px; align-items: center; }
.row-end { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--bone-dim); cursor: pointer; }
.check input { accent-color: var(--primary-color); width: 16px; height: 16px; }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(380px, 0.85fr); }
.auth-art { position: relative; overflow: hidden; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; border-right: 1px solid var(--line); background: #150E23; }
.auth-art .scene { position: absolute; inset: 0; width: 100%; height: 100%; }
.auth-art .copy { position: relative; max-width: 520px; }
.auth-art h1 { font-family: var(--font-serif); font-weight: 500; font-size: clamp(40px, 5vw, 68px); line-height: 1.02; letter-spacing: -0.01em; margin: 0 0 18px; color: var(--parchment); }
.auth-art p { font-family: var(--font-serif); font-size: 21px; line-height: 1.5; color: var(--bone-dim); margin: 0; max-width: 34ch; }
.auth-art .brand-top { position: relative; display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--bone-dim); }
.auth-art .footnote { position: relative; font-size: 13px; color: var(--bone-faint); }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--primary-color); display: grid; place-items: center; }
.brand-mark svg { width: 18px; height: 18px; }
.auth-panel { display: grid; place-items: center; padding: 40px 28px; background: var(--night); }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-family: var(--font-serif); font-weight: 600; font-size: 32px; margin: 0 0 6px; color: var(--parchment); }
.auth-card .sub { color: var(--bone-dim); margin: 0 0 26px; }
.auth-card .btn-primary { width: 100%; height: 46px; font-size: 15px; margin-top: 6px; }
.auth-card .between { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 16px; }

.moon-rise { animation: moonrise 2.4s cubic-bezier(.2,.7,.2,1) both; }
@keyframes moonrise { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.bat { animation: bat 14s linear infinite; }
.bat.b2 { animation-duration: 19s; animation-delay: -6s; }
@keyframes bat { 0% { transform: translate(-80px, 40px) scale(.8); } 50% { transform: translate(420px, -20px) scale(1); } 100% { transform: translate(900px, 30px) scale(.8); } }
.window-glow { animation: flicker 4s infinite; }
@keyframes flicker { 0%, 100% { opacity: .9; } 42% { opacity: .9; } 44% { opacity: .35; } 46% { opacity: .85; } 70% { opacity: .75; } }

/* ---------- topo ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding-top: var(--safe-top);
  background: rgba(18, 17, 22, 0.72);
  backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { max-width: 1120px; margin: 0 auto; height: 56px; padding: 0 20px; display: flex; align-items: center; gap: 14px; }
.topbar .brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-serif); font-size: 19px; font-weight: 600; color: var(--parchment); text-decoration: none; }
.topbar .spacer { flex: 1; }
.topbar .who { font-size: 13.5px; color: var(--bone-dim); }
.topbar .who strong { color: var(--bone); font-weight: 500; }

.page { max-width: 1120px; margin: 0 auto; padding: 32px 20px 80px; }

/* ---------- herói do jogo ---------- */
.hero { position: relative; padding: 34px 0 30px; display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 40px; align-items: end; }
.hero h1 { font-family: var(--font-serif); font-weight: 500; font-size: clamp(36px, 5.4vw, 64px); line-height: 1; margin: 0 0 16px; color: var(--parchment); letter-spacing: -0.01em; }
.hero .lede { font-family: var(--font-serif); font-size: 20px; line-height: 1.55; color: var(--bone-dim); max-width: 60ch; margin: 0; }
.hero .clock-hero { justify-self: end; width: 220px; opacity: .9; }
.prologue-toggle { margin-top: 16px; }
.prologue { font-family: var(--font-serif); font-size: 19px; line-height: 1.65; color: var(--bone); max-width: 64ch; }
.prologue p { margin: 0 0 14px; }

/* ---------- arquivo do caso (linha do tempo) ---------- */
.case-file { margin: 18px 0 30px; }
.case-file h2 { font-family: var(--font-serif); font-size: 22px; font-weight: 600; margin: 0 0 14px; color: var(--parchment); }
.timeline { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; position: relative; }
.seal {
  position: relative; text-align: left; padding: 16px 16px 14px; border-radius: 12px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); color: var(--bone);
  display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 12px; align-items: center;
  transition: border-color .15s, background .15s;
}
.seal:hover { border-color: var(--line-strong); background: #1E1D25; }
.seal[aria-current="true"] { border-color: var(--primary-light); box-shadow: 0 0 0 1px var(--primary-light) inset; }
.seal .wax {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-serif); font-weight: 700; font-size: 17px; color: var(--bone-dim);
  background: var(--surface-2); border: 1px solid var(--line-strong);
}
.seal.open .wax { background: radial-gradient(circle at 35% 30%, #7B7DCC, var(--primary-color) 55%, var(--primary-dark)); color: #fff; border-color: transparent; box-shadow: 0 0 0 4px rgba(74,76,156,.18), 0 0 24px rgba(107,109,184,.35); }
.seal.solved .wax { background: #1F2A20; color: #A5D6A7; border-color: rgba(46,125,50,.6); }
.seal .meta { min-width: 0; }
.seal .t { font-family: var(--font-serif); font-size: 18px; font-weight: 600; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seal .s { font-size: 12.5px; color: var(--bone-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seal.locked .t { color: var(--bone-faint); }
.seal.solved .s { color: #A5D6A7; }
.seal.open .s { color: #C5C6F0; }

/* ---------- capítulo ---------- */
.chapter { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 36px clamp(20px, 4vw, 48px) 40px; box-shadow: 0 30px 60px -30px rgba(0,0,0,.6); }
.chapter-head { display: flex; gap: 20px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 18px; }
.chapter-num { font-family: var(--font-serif); font-size: 17px; color: var(--bone-dim); margin: 0 0 4px; }
.chapter h2 { font-family: var(--font-serif); font-weight: 600; font-size: clamp(30px, 4vw, 44px); line-height: 1.05; margin: 0; color: var(--parchment); }
.chapter .narrative { font-family: var(--font-serif); font-size: 19.5px; line-height: 1.65; color: var(--bone); max-width: 66ch; }
.chapter .narrative p { margin: 0 0 14px; }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; font-size: 12.5px; font-weight: 500; border: 1px solid var(--line-strong); color: var(--bone-dim); white-space: nowrap; }
.badge.ok { color: #A5D6A7; border-color: rgba(46,125,50,.55); background: rgba(46,125,50,.12); }
.badge.warn { color: #FFCC80; border-color: rgba(245,124,0,.5); background: rgba(245,124,0,.1); }
.badge.bad { color: #EF9A9A; border-color: rgba(198,40,40,.5); background: rgba(198,40,40,.1); }
.badge.info { color: #C5C6F0; border-color: rgba(107,109,184,.5); background: rgba(74,76,156,.14); }
.badge svg { width: 13px; height: 13px; }

.artifact { margin: 26px 0 30px; }

/* diário */
.diary {
  position: relative; max-width: 720px; margin: 0 auto; padding: 42px clamp(18px, 5vw, 56px) 34px;
  background:
    radial-gradient(120% 90% at 50% 40%, transparent 55%, rgba(120, 90, 50, 0.28)),
    linear-gradient(180deg, #EBE1C9, #E1D3B3);
  color: var(--ink); border-radius: 4px;
  box-shadow: 0 1px 0 rgba(255,255,255,.4) inset, 0 30px 50px -20px rgba(0,0,0,.7);
  transform: rotate(-0.4deg);
}
.diary::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: repeating-linear-gradient(0deg, transparent 0 37px, rgba(91,77,61,.08) 37px 38px); border-radius: 4px; }
.diary ol { list-style: none; margin: 0; padding: 0; position: relative; z-index: 1; }
.diary li { display: grid; grid-template-columns: 40px minmax(0,1fr); gap: 14px; align-items: center; min-height: 50px; font-family: var(--font-serif); font-size: clamp(18px, 2.4vw, 22px); font-style: italic; line-height: 1.35; padding: 3px 0; }
.diary .candle { width: 30px; height: 46px; justify-self: center; overflow: visible; }
.diary li:has(.candle.out) > span:last-child { opacity: .82; }
.diary .flame { transform-origin: 50% 100%; animation: flame 1.6s ease-in-out infinite alternate; }
.diary li:nth-child(odd) .flame { animation-duration: 1.9s; }
@keyframes flame { 0% { transform: scale(1, 1) rotate(-2deg); } 50% { transform: scale(.92, 1.08) rotate(2deg); } 100% { transform: scale(1.04, .95) rotate(-1deg); } }
.diary .smoke { animation: smoke 3.4s ease-out infinite; opacity: 0; }
@keyframes smoke { 0% { opacity: 0; transform: translateY(2px); } 30% { opacity: .5; } 100% { opacity: 0; transform: translateY(-8px); } }
.diary .signature { text-align: right; font-family: var(--font-serif); font-style: italic; color: var(--ink-soft); margin-top: 22px; font-size: 17px; position: relative; z-index: 1; }

/* sessão espírita */
.facts { max-width: 760px; margin: 0 auto 22px; padding: 22px 26px; border-radius: 10px; background: linear-gradient(180deg, #EBE1C9, #E1D3B3); color: var(--ink); box-shadow: 0 20px 40px -20px rgba(0,0,0,.6); }
.facts h3 { margin: 0 0 10px; font-family: var(--font-serif); font-size: 21px; }
.facts ol { margin: 0; padding-left: 22px; font-family: var(--font-serif); font-size: 18.5px; line-height: 1.55; }
.facts li { margin-bottom: 6px; }
.suspects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.suspect {
  position: relative; text-align: left; cursor: pointer; padding: 18px 18px 16px; border-radius: 12px;
  background: linear-gradient(180deg, #201F27, #1A1920); border: 1px solid var(--line-strong); color: var(--bone);
  transition: border-color .15s, opacity .2s, transform .15s;
}
.suspect:hover { border-color: rgba(232,221,196,.3); }
.suspect .initial { position: absolute; right: 14px; top: 8px; font-family: var(--font-serif); font-size: 44px; line-height: 1; color: rgba(232,221,196,.08); font-weight: 700; }
.suspect .nm { font-family: var(--font-serif); font-size: 21px; font-weight: 600; color: var(--parchment); }
.suspect .rl { font-size: 12.5px; color: var(--bone-dim); margin-bottom: 10px; }
.suspect blockquote { margin: 0; font-family: var(--font-serif); font-style: italic; font-size: 18px; line-height: 1.45; }
.suspect .mark { margin-top: 12px; font-size: 12px; color: var(--bone-faint); display: flex; align-items: center; gap: 6px; }
.suspect.suspeito { border-color: rgba(245,124,0,.7); box-shadow: 0 0 0 1px rgba(245,124,0,.35) inset; }
.suspect.suspeito .mark { color: #FFCC80; }
.suspect.descartado { opacity: .45; }
.suspect.descartado .nm { text-decoration: line-through; text-decoration-color: rgba(198,40,40,.8); }
.suspect-help { text-align: center; font-size: 13px; color: var(--bone-faint); margin-top: 12px; }

/* relógios */
.clock { display: block; width: 100%; height: auto; }
.plaque {
  max-width: 760px; margin: 0 auto 26px; padding: 22px 22px 18px; border-radius: 10px;
  background: linear-gradient(160deg, #5C4527, #3B2A16 60%, #4A3620); border: 1px solid rgba(176,138,85,.5);
  box-shadow: 0 1px 0 rgba(255,220,160,.2) inset, 0 20px 40px -20px rgba(0,0,0,.7);
}
.plaque .label, .wall .label { font-family: var(--font-serif); font-size: 17px; font-style: italic; color: #E7CFA3; margin-bottom: 12px; text-align: center; }
.clock-row { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.clock-cell { display: grid; gap: 6px; justify-items: center; }
.clock-cell .letter { font-family: var(--font-serif); font-size: 26px; font-weight: 700; color: #F3DEB4; line-height: 1; }
.plaque .name { text-align: center; margin-top: 12px; font-family: var(--font-serif); font-size: 15px; color: #CDB286; }
.wall {
  padding: 26px 22px; border-radius: 10px;
  background:
    radial-gradient(600px 300px at 30% 20%, rgba(255,255,255,.04), transparent 70%),
    repeating-linear-gradient(0deg, #2B2B30 0 46px, #232327 46px 48px),
    #2A2A2E;
  border: 1px solid var(--line);
}
.wall-groups { display: grid; gap: 22px; }
.wall-group { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; padding: 10px 12px; border-radius: 8px; border: 1px dashed rgba(232,221,196,.14); }
.wall-group .clock-cell { width: clamp(78px, 12vw, 108px); }

/* túmulos */
.inscription {
  max-width: 720px; margin: 0 auto 24px; padding: 26px 30px; text-align: center; border-radius: 10px;
  background: linear-gradient(180deg, #E9E6E0, #CFCAC0); color: #2E2B28;
  box-shadow: 0 1px 0 #fff inset, 0 20px 40px -20px rgba(0,0,0,.7);
}
.inscription p { margin: 0 0 6px; font-family: var(--font-serif); font-size: 19.5px; line-height: 1.5; font-style: italic; }
.tombs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.tomb {
  position: relative; padding: 22px 16px 16px; border-radius: 80px 80px 10px 10px; text-align: center;
  background: linear-gradient(180deg, #3A3A40, #26262B); border: 1px solid rgba(232,221,196,.14);
}
.tomb .numeral { font-family: var(--font-serif); font-size: 30px; font-weight: 700; color: var(--parchment); margin-bottom: 8px; letter-spacing: .04em; }
.tomb .clock { max-width: 120px; margin: 0 auto; }
.tombs .tomb:nth-child(5) { grid-column: span 1; }

/* resposta */
.answer-box { max-width: 720px; margin: 0 auto; padding-top: 26px; border-top: 1px solid var(--line); }
.answer-box .q { font-family: var(--font-serif); font-size: 24px; font-weight: 600; color: var(--parchment); margin: 0 0 14px; }
.answer-form { display: flex; gap: 10px; }
.answer-form .input { height: 50px; font-size: 16px; }
.answer-form .btn { height: 50px; padding: 0 22px; }
.feedback { min-height: 26px; margin-top: 10px; font-family: var(--font-serif); font-style: italic; font-size: 18px; color: var(--bone-dim); }
.feedback.bad { color: #EF9A9A; }
.feedback.near { color: #FFCC80; }
.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.attempts-note { font-size: 12.5px; color: var(--bone-faint); margin-top: 4px; }

.hint-box { margin-top: 22px; padding: 16px 18px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255,255,255,.02); display: flex; gap: 14px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.hint-box .txt { font-size: 14px; color: var(--bone-dim); max-width: 52ch; }
.hint-box .txt strong { color: var(--bone); font-weight: 500; }
.hint-open { margin-top: 22px; padding: 18px 20px; border-radius: 12px; border: 1px solid rgba(255,181,71,.35); background: rgba(255,181,71,.06); }
.hint-open h4 { margin: 0 0 6px; font-size: 13px; color: var(--candle); font-weight: 600; }
.hint-open p { margin: 0; font-family: var(--font-serif); font-size: 18.5px; line-height: 1.55; color: var(--bone); }

.notes { max-width: 720px; margin: 26px auto 0; }
.notes summary { cursor: pointer; font-size: 14px; color: var(--bone-dim); list-style: none; display: flex; align-items: center; gap: 8px; }
.notes summary::-webkit-details-marker { display: none; }
.notes summary svg { width: 16px; height: 16px; }
.notes textarea { margin-top: 10px; font-family: var(--font-serif); font-size: 17px; }
.notes .help { margin-top: 6px; }

.solved-box { max-width: 720px; margin: 0 auto; padding: 22px 24px; border-radius: 12px; background: rgba(46,125,50,.08); border: 1px solid rgba(46,125,50,.35); }
.solved-box .ans { font-size: 13px; color: #A5D6A7; margin-bottom: 8px; }
.solved-box .ans strong { font-family: var(--font-serif); font-size: 22px; color: var(--parchment); font-weight: 600; margin-left: 6px; }
.solved-box p { font-family: var(--font-serif); font-size: 19px; line-height: 1.6; margin: 0 0 12px; }

/* bloqueado */
.locked-view { text-align: center; padding: 30px 10px 20px; }
.locked-view .seal-big { width: 110px; height: 110px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-serif); font-size: 40px; font-weight: 700; color: #F3D9D9; background: radial-gradient(circle at 35% 30%, #8E3A3A, #5A1E1E 60%, #3B1212); box-shadow: 0 0 0 6px rgba(198,40,40,.12), 0 20px 40px -10px rgba(0,0,0,.6); }
.locked-view h2 { margin-bottom: 8px; }
.locked-view p { color: var(--bone-dim); margin: 0 auto; max-width: 46ch; font-family: var(--font-serif); font-size: 19px; }
.countdown { display: inline-flex; gap: 18px; margin-top: 22px; padding: 14px 22px; border-radius: 12px; border: 1px solid var(--line); background: var(--night-deep); }
.countdown div { display: grid; justify-items: center; min-width: 48px; }
.countdown b { font-family: var(--font-serif); font-size: 36px; font-weight: 600; line-height: 1; color: var(--parchment); font-variant-numeric: tabular-nums lining-nums; }
.countdown span { font-size: 11.5px; color: var(--bone-faint); margin-top: 4px; }

/* final */
.finale { text-align: center; padding: 20px 0; }
.finale .narrative { margin: 0 auto; text-align: left; }
.winners { max-width: 640px; margin: 24px auto 0; text-align: left; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.winner { display: grid; grid-template-columns: 44px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 14px 18px; border-top: 1px solid var(--line); }
.winner:first-child { border-top: 0; }
.winner .pos { font-family: var(--font-serif); font-size: 24px; font-weight: 700; color: var(--candle); text-align: center; }
.winner .nm { font-family: var(--font-serif); font-size: 21px; font-weight: 600; color: var(--parchment); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.winner .dt { font-size: 12.5px; color: var(--bone-dim); }

/* sucesso (quebra do selo) */
.burst { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; pointer-events: none; background: radial-gradient(circle, rgba(255,181,71,.18), transparent 60%); animation: burst 1.8s ease-out forwards; }
.burst .word { font-family: var(--font-serif); font-size: clamp(40px, 8vw, 90px); color: var(--parchment); text-shadow: 0 0 40px rgba(255,181,71,.6); animation: word 1.8s ease-out forwards; }
@keyframes burst { 0% { opacity: 0; } 15% { opacity: 1; } 80% { opacity: 1; } 100% { opacity: 0; } }
@keyframes word { 0% { transform: scale(.8); letter-spacing: .3em; opacity: 0; } 30% { opacity: 1; } 100% { transform: scale(1); letter-spacing: .05em; } }

/* ---------- modal ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(6, 5, 9, .72); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 20px; animation: fade .15s ease-out; }
.modal { width: 100%; max-width: 460px; max-height: calc(100vh - 40px); overflow: auto; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.6); animation: pop .18s ease-out; }
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 6px; }
.modal-head h3 { margin: 0; font-family: var(--font-serif); font-size: 24px; font-weight: 600; color: var(--parchment); }
.modal-body { padding: 10px 20px 4px; color: var(--bone); }
.modal-body p { margin: 0 0 12px; color: var(--bone-dim); }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 14px 20px 18px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

/* ---------- toast ---------- */
#toast-root { position: fixed; z-index: 120; right: 20px; bottom: calc(76px + var(--safe-bottom)); display: grid; gap: 8px; }
.toast { min-width: 240px; max-width: 360px; padding: 12px 14px; border-radius: 10px; background: #26252E; border: 1px solid var(--line-strong); box-shadow: 0 10px 30px rgba(0,0,0,.4); font-size: 14px; animation: pop .2s ease-out; display: flex; gap: 10px; align-items: flex-start; }
.toast.ok { border-color: rgba(46,125,50,.6); }
.toast.bad { border-color: rgba(198,40,40,.6); }
.toast svg { width: 16px; height: 16px; flex: none; margin-top: 2px; }

/* ---------- admin ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 22px; overflow-x: auto; scrollbar-width: none; }
.tab { height: 42px; padding: 0 14px; border: 0; background: transparent; color: var(--bone-dim); cursor: pointer; font-weight: 500; border-bottom: 2px solid transparent; white-space: nowrap; display: inline-flex; align-items: center; gap: 8px; }
.tab svg { width: 16px; height: 16px; }
.tab:hover { color: var(--bone); }
.tab[aria-selected="true"] { color: var(--bone); border-bottom-color: var(--primary-light); }
.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.admin-head h1 { font-family: var(--font-serif); font-weight: 600; font-size: 36px; margin: 0; color: var(--parchment); }
.admin-head p { margin: 4px 0 0; color: var(--bone-dim); }

.stat-strip { display: grid; grid-template-columns: 1.3fr repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin-bottom: 22px; overflow: hidden; }
.stat-strip > div { padding: 16px 18px; border-left: 1px solid var(--line); min-width: 0; }
.stat-strip > div:first-child { border-left: 0; }
.stat-strip .big { font-family: var(--font-serif); font-size: 44px; font-weight: 600; line-height: 1; color: var(--parchment); font-variant-numeric: tabular-nums lining-nums; }
.stat-strip .num { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-strip .lbl { font-size: 12.5px; color: var(--bone-dim); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.card-head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.card-body { padding: 18px; }
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.grid th { text-align: left; font-weight: 500; font-size: 12.5px; color: var(--bone-dim); background: rgba(255,255,255,.03); padding: 9px 12px; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.grid td { padding: 9px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; }
table.grid tr:last-child td { border-bottom: 0; }
table.grid tr.clickable { cursor: pointer; }
table.grid tr.clickable:hover td { background: rgba(255,255,255,.025); }
.cell-actions { display: flex; gap: 4px; justify-content: flex-end; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; }
.dim { color: var(--bone-dim); }
.pill { display: inline-flex; align-items: center; justify-content: center; min-width: 26px; height: 22px; padding: 0 7px; border-radius: 6px; font-size: 12px; font-weight: 600; }
.pill.solved { background: rgba(46,125,50,.18); color: #A5D6A7; }
.pill.open { background: rgba(74,76,156,.22); color: #C5C6F0; }
.pill.locked { background: rgba(255,255,255,.05); color: var(--bone-faint); }
.pill.closed { background: rgba(198,40,40,.14); color: #EF9A9A; }
.wk { display: grid; gap: 2px; }
.wk small { font-size: 11.5px; color: var(--bone-faint); }

.empty { text-align: center; padding: 40px 20px; }
.empty h3 { margin: 0 0 6px; font-family: var(--font-serif); font-size: 24px; color: var(--parchment); }
.empty p { color: var(--bone-dim); margin: 0 auto 16px; max-width: 44ch; }

/* resultado / campeão (admin) */
.result-rule { margin: 14px 16px 0; padding: 10px 14px; border-radius: 10px; font-size: 12.5px; line-height: 1.5; color: var(--bone-dim); background: rgba(255,255,255,.03); border: 1px solid var(--line); }
.champion { display: flex; align-items: center; gap: 14px; margin: 16px; padding: 14px 18px; border-radius: 12px;
  background: linear-gradient(120deg, rgba(255,181,71,.16), rgba(245,124,0,.05));
  border: 1px solid rgba(255,181,71,.45); }
.champion-medal { width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #FFD98A, #E8901A 70%); color: #3A2410;
  box-shadow: 0 0 0 4px rgba(255,181,71,.15), 0 0 22px rgba(255,181,71,.3); }
.champion-medal svg { width: 22px; height: 22px; }
.champion-label { font-size: 11.5px; color: var(--candle); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.champion-name { font-family: var(--font-serif); font-size: 25px; font-weight: 600; color: var(--parchment); line-height: 1.1; }
.champion-meta { font-size: 12.5px; color: var(--bone-dim); margin-top: 3px; }
table.grid tr.champ-row td { background: rgba(255,181,71,.08); }
table.grid tr.champ-row td:first-child { color: var(--candle); font-weight: 700; }
.winner-champ { background: rgba(255,181,71,.07); }
.winner-champ .pos { color: var(--candle); }

.settings-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 18px; }
.notice { padding: 12px 14px; border-radius: 10px; border: 1px solid rgba(2,119,189,.45); background: rgba(2,119,189,.1); color: #B3E0FA; font-size: 13.5px; margin-bottom: 18px; }
.notice.warn { border-color: rgba(245,124,0,.45); background: rgba(245,124,0,.08); color: #FFCC80; }
.preview-pick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.answer-key { display: grid; gap: 10px; margin-bottom: 18px; }
.answer-key .kv { display: grid; grid-template-columns: 150px minmax(0,1fr); gap: 12px; font-size: 14px; }
.answer-key .kv .k { color: var(--bone-dim); }

/* ---------- responsivo ---------- */
@media (max-width: 1000px) {
  .timeline { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-strip > div:nth-child(4) { border-left: 0; }
  .stat-strip > div:nth-child(n+4) { border-top: 1px solid var(--line); }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { min-height: 330px; padding: 28px 24px; border-right: 0; border-bottom: 1px solid var(--line); }
  .auth-art h1 { font-size: 40px; }
  .auth-art p { font-size: 18px; }
  .hero { grid-template-columns: 1fr; gap: 10px; }
  .hero .clock-hero { display: none; }
  .suspects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tombs { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .settings-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .page { padding: 20px 14px 70px; }
  .topbar-inner { padding: 0 14px; }
  .topbar .who { display: none; }
  .timeline { grid-template-columns: 1fr 1fr; gap: 8px; }
  .seal { grid-template-columns: 36px minmax(0,1fr); padding: 12px; gap: 10px; }
  .seal .wax { width: 36px; height: 36px; font-size: 14px; }
  .seal .t { font-size: 16px; }
  .chapter { padding: 24px 16px 28px; border-radius: 12px; }
  .suspects { grid-template-columns: 1fr; }
  .clock-row { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tombs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .answer-form { flex-direction: column; }
  .countdown { gap: 10px; padding: 12px 14px; }
  .countdown b { font-size: 28px; }
  .stat-strip { grid-template-columns: 1fr 1fr; }
  .stat-strip > div { border-left: 0; border-top: 1px solid var(--line); }
  .stat-strip > div:first-child { grid-column: span 2; border-top: 0; }
  .answer-key .kv { grid-template-columns: 1fr; gap: 2px; }
  .modal-foot .btn { flex: 1; }
}
@media (min-width: 1800px) {
  body { font-size: 17px; }
  .page, .topbar-inner { max-width: 1400px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .fog span { display: none; }
}

/* complementos */
.ico { display: inline-flex; align-items: center; justify-content: center; }
.ico svg { width: 16px; height: 16px; }
.seal .wax .ico svg { width: 18px; height: 18px; }
.badge .ico svg { width: 13px; height: 13px; }
.brand-mark svg { width: 16px; height: 16px; }
.prologue-toggle summary { list-style: none; }
.prologue-toggle summary::-webkit-details-marker { display: none; }
.cd-inline { font-variant-numeric: tabular-nums; }
@media (max-width: 560px) { .hide-sm { display: none; } }

/* botão da trilha de fundo */
.music-toggle {
  position: fixed; right: max(16px, env(safe-area-inset-right, 0px) + 12px); bottom: max(16px, env(safe-area-inset-bottom, 0px) + 12px); z-index: 60;
  width: 44px; height: 44px; border-radius: 999px; display: grid; place-items: center; cursor: pointer;
  background: rgba(23, 24, 28, 0.78); color: rgba(232, 221, 196, 0.75);
  border: 1px solid rgba(232, 221, 196, 0.16); box-shadow: 0 8px 24px -8px rgba(0,0,0,.6);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  transition: color .2s ease, border-color .2s ease, transform .2s ease;
}
.music-toggle svg { width: 20px; height: 20px; }
.music-toggle:hover { color: #F3DEB4; border-color: rgba(232, 221, 196, 0.32); transform: translateY(-1px); }
.music-toggle:focus-visible { outline: 2px solid var(--primary-light); outline-offset: 3px; }
.music-toggle.on { color: #FFB547; }
.music-toggle.on::after { content: ""; position: absolute; inset: -3px; border-radius: 999px; border: 1px solid rgba(255,181,71,.35); animation: music-pulse 2.4s ease-out infinite; }
@keyframes music-pulse { 0% { opacity: .8; transform: scale(.94); } 100% { opacity: 0; transform: scale(1.25); } }
@media (prefers-reduced-motion: reduce) { .music-toggle.on::after { animation: none; } }
