.sorteador-overlay {
  --ink: #12102A;
  --paper: #F6EFE3;
  --gold: #D8A657;
  --gold-soft: #F0D9A6;
  --blue: #7C8CE0;
  --ui-muted: rgba(246,239,227,0.55);
  --display: 'Fraunces', serif;
  --body: 'Literata', serif;
  --ui: 'Inter', sans-serif;
  
  display: none;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  z-index: 99999;
  align-items: center;
  justify-content: center;
  padding: 0; /* Removido para controle mais fino no mobile */
  font-family: var(--body);
  color: var(--paper);
}

.sorteador-overlay.ativo { display: flex; }

.sorteador-box {
  background: radial-gradient(ellipse at 20% -10%, #2A1759 0%, var(--ink) 55%);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 16px;
  position: relative;
  box-shadow: 0 15px 40px rgba(0,0,0,0.6);
  border: 1px solid rgba(246,239,227,0.1);
}

.btn-fechar {
  position: absolute;
  top: 16px; right: 16px;
  background: rgba(216,166,87, 0.2);
  border: 1px solid rgba(216,166,87, 0.4);
  color: #D8A657;
  font-size: 16px;
  border-radius: 50%;
  width: 36px; height: 36px;
  cursor: pointer;
  z-index: 10;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
}

.btn-fechar:hover { background: #D8A657; color: #12102A; }

#stars { position:absolute; inset:0; z-index:0; pointer-events:none; }
.star { position:absolute; border-radius:50%; background: var(--gold-soft); opacity:0.5; animation: twinkle 4s ease-in-out infinite; }
@keyframes twinkle { 0%,100%{ opacity:0.15; transform:scale(1); } 50%{ opacity:0.9; transform:scale(1.35); } }

.app-cosmico {
  position: relative; z-index: 1; padding: 20px 15px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}

.brand { text-align:center; margin-bottom: 20px; }
.brand .glyph { font-size:20px; color: var(--gold); letter-spacing: 6px; }
.brand h1 { font-family:var(--display); font-weight:500; font-size: 14px; letter-spacing: 3px; text-transform: uppercase; color: var(--ui-muted); margin: 8px 0 0; }

h2.lead { font-family: var(--display); font-style: italic; font-weight: 500; font-size: 26px; line-height: 1.35; text-align:center; max-width: 520px; margin: 10px 0 30px; }

.cards { display:grid; grid-template-columns: 1fr 1fr; gap: 20px; width:100%; }

.card { display:block; text-decoration:none; color: inherit; background: rgba(246,239,227,0.04); border: 1px solid rgba(246,239,227,0.14); border-radius: 20px; padding: 25px 20px; text-align:center; transition: transform .25s ease, background .25s ease; }
.card:hover { transform: translateY(-4px); background: rgba(246,239,227,0.07); }
.card .icon { margin: 0 auto 15px; display:block; }
.card h3 { font-family: var(--display); font-style: italic; font-weight: 500; font-size: 20px; margin: 0 0 10px; }
.card p { font-size: 14px; line-height:1.6; color: rgba(246,239,227,0.72); margin: 0 0 20px; }
.card .tag { display:inline-block; font-family: var(--ui); font-weight:600; font-size: 12px; color: var(--ink); background: linear-gradient(180deg, var(--gold-soft), var(--gold)); border-radius: 100px; padding: 10px 20px; }
.card.b .tag { background: linear-gradient(180deg, #cbd6ff, var(--blue)); }

.progress-wrap { width:100%; margin: 0 0 30px; display:none; }
.progress-wrap.show { display:block; }
.progress-track { height:3px; width:100%; background: rgba(246,239,227,0.12); border-radius: 2px; overflow:hidden; }
.progress-fill { height:100%; width:0%; background: linear-gradient(90deg, var(--gold), var(--gold-soft)); transition: width .5s ease; }
.progress-label { display:flex; justify-content:space-between; font-family: var(--ui); font-size:11px; color: var(--ui-muted); margin-top:8px; text-transform: uppercase; }

.screen { width: 100%; flex:1; display:none; flex-direction:column; justify-content:center; animation: fadeUp .55s ease both; align-items: center; }
.screen.active { display:flex; }
@keyframes fadeUp { from{ opacity:0; transform: translateY(14px); } to{ opacity:1; transform: translateY(0); } }

#intro .sigil { width:74px; height:74px; margin: 0 auto 20px; }
#intro h2 { font-family: var(--display); font-style: italic; font-weight: 500; font-size: 28px; text-align:center; margin: 0 0 15px; }
#intro p { text-align:center; font-size:15px; line-height:1.7; color: rgba(246,239,227,0.78); max-width: 480px; margin: 0 auto 25px; }

.btn-primary { font-family: var(--ui); font-weight:600; font-size:14px; color: var(--ink); background: linear-gradient(180deg, var(--gold-soft), var(--gold)); border:none; border-radius: 100px; padding: 15px 30px; cursor:pointer; box-shadow: 0 10px 30px -10px rgba(216,166,87,0.55); transition: transform .2s ease; }
.btn-primary:hover { transform: translateY(-2px); }
.btn-ghost { font-family: var(--ui); font-size: 13px; color: rgba(246,239,227,0.6); background:none; border: 1px solid rgba(246,239,227,0.22); border-radius: 100px; padding: 12px 22px; cursor:pointer; margin: 15px auto 0; }

.chapter-tag { font-family: var(--ui); font-size: 11px; text-transform:uppercase; color: var(--gold); margin-bottom: 15px; }
#question-text { font-family: var(--display); font-weight: 500; font-size: 22px; text-align:center; margin: 0 0 30px; }
.options { display:flex; flex-direction:column; gap:12px; width: 100%; max-width: 500px;}
.option { font-family: var(--body); font-size: 15px; text-align:left; color: var(--paper); background: rgba(246,239,227,0.05); border: 1px solid rgba(246,239,227,0.14); border-radius: 14px; padding: 15px 20px; cursor:pointer; transition: background .2s ease; }
.option:hover { background: rgba(216,166,87,0.1); border-color: rgba(216,166,87,0.5); }

.card-letter { background: var(--paper); color: var(--ink); border-radius: 18px; padding: 30px; box-shadow: 0 30px 60px -20px rgba(0,0,0,0.55); width: 100%; max-width: 500px;}
.card-letter .eyebrow { font-family: var(--ui); font-size: 11px; text-transform: uppercase; text-align:center; color: rgba(18,16,42,0.5); margin-bottom: 10px; }
.card-letter h2 { font-family: var(--display); font-style: italic; font-weight: 600; font-size: 26px; text-align:center; margin: 0 0 15px; }
.constellation { display:block; margin: 0 auto 15px; }
.card-letter p.desc { font-size: 14.5px; line-height:1.7; color: rgba(18,16,42,0.82); margin: 0 0 15px; text-align: center;}
.card-letter p.phrase { font-family: var(--display); font-style: italic; font-size: 17px; line-height:1.5; text-align:center; padding: 15px 5px; border-top: 1px solid rgba(18,16,42,0.12); border-bottom: 1px solid rgba(18,16,42,0.12); margin-bottom: 15px; }
.card-letter .post-label { text-align:center; font-family: var(--ui); font-size: 12px; color: rgba(18,16,42,0.55); margin: 0 0 15px; }
.card-letter .cta { display:block; text-align:center; font-family: var(--ui); font-weight:600; font-size: 14px; color: var(--paper); background: var(--ink); text-decoration:none; border-radius: 100px; padding: 15px; }
.signature { text-align:center; font-family: var(--display); font-style: italic; font-size: 13px; color: rgba(246,239,227,0.45); margin-top: 25px; }

/* =========================================
   PROPORÇÃO EXATA DA REFERÊNCIA (MOBILE)
   ========================================= */
@media (max-width: 640px) {
  .sorteador-box {
    width: 90%; /* Força as bordas não tocarem na lateral do celular */
    border-radius: 12px;
  }
  
  .app-cosmico {
    padding: 24px 8px 8px;
  }
  
  .brand { margin-bottom: 8px; }
  .brand .glyph { font-size: 14px; letter-spacing: 3px; }
  .brand h1 { font-size: 10px; letter-spacing: 2px; }
  
  h2.lead {
    font-size: 18px; /* Título bem mais proporcional */
    margin: 6px 0 18px;
    line-height: 1.25;
  }

  .cards {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .card {
    padding: 14px 12px;
    border-radius: 12px;
  }
  
  .card .icon {
    width: 24px;
    height: 24px;
    margin: 0 auto 8px;
  }
  
  .card h3 {
    font-size: 15px;
    margin: 0 0 6px;
  }
  
  .card p {
    font-size: 12px;
    line-height: 1.35;
    margin: 0 0 12px;
  }
  
  .card .tag {
    font-size: 11px;
    padding: 8px 16px;
  }

  .signature {
    margin-top: 12px;
    font-size: 10px;
  }

  .btn-fechar {
    top: 12px;
    right: 12px;
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  /* --- Otimizações para a tela de Quiz no Mobile --- */
  #intro .sigil { width: 44px; height: 44px; margin: 0 auto 12px; }
  #intro h2 { font-size: 20px; margin: 0 0 10px; }
  #intro p { font-size: 13px; margin: 0 auto 16px; line-height: 1.5; }
  .btn-primary { padding: 12px 24px; font-size: 13px; }
  
  #question-text { font-size: 18px; margin: 0 0 16px; }
  .option { padding: 10px 14px; font-size: 13px; }
  
  .card-letter { padding: 20px 16px; }
  .card-letter h2 { font-size: 20px; }
  .card-letter p.desc { font-size: 13px; }
  .card-letter p.phrase { font-size: 14px; padding: 10px 4px; }
  .card-letter .cta { font-size: 13px; padding: 12px; }
}