:root {
  --bg: #0b0f1c;
  --bg-alt: #161d33;
  --surface: #1a2140;
  --surface-alt: #232c50;
  --ink: #eef1fb;
  --ink-dim: #8b93b8;
  --muted: #545d80;
  --maroon: #e0223f;
  --maroon-dark: #ff7c93;
  --gold: #e8b84b;
  --gold-light: #f6d685;
  --gold-deep: #b8862f;
  --green: #35dd8a;
  --success-bg: rgba(53, 221, 138, 0.15);
  --red: #ff5f6d;
  --danger-bg: rgba(255, 95, 109, 0.16);
  --card-shadow: 0 10px 24px rgba(0, 0, 0, 0.5);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, 'Helvetica Neue', Arial, sans-serif;
  background:
    radial-gradient(ellipse 900px 500px at 50% -10%, #232c56 0%, transparent 60%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overscroll-behavior: none;
}

.hidden { display: none !important; }

body.gate-locked { overflow: hidden; }

.gate-screen {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background:
    radial-gradient(ellipse 900px 500px at 50% -10%, #232c56 0%, transparent 60%),
    var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.gate-box {
  width: 100%;
  max-width: 340px;
  text-align: center;
  background: linear-gradient(160deg, var(--surface), var(--bg-alt));
  border: 1px solid rgba(232, 184, 75, 0.35);
  border-radius: var(--radius);
  padding: 32px 24px;
  box-shadow: var(--card-shadow);
}

.gate-icon { font-size: 2.4rem; margin-bottom: 8px; }

.gate-box h2 { margin: 0 0 6px; font-size: 1.2rem; }

.gate-box p { color: var(--ink-dim); margin: 0 0 18px; font-size: 0.9rem; }

.gate-input {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 2px solid rgba(232, 184, 75, 0.35);
  background: var(--bg-alt);
  color: var(--ink);
  font-size: 1rem;
  text-align: center;
  margin-bottom: 4px;
}

.gate-input:focus { outline: none; border-color: var(--gold); }

.gate-input + .gate-input { margin-top: 10px; }

.gate-box .btn:disabled { opacity: 0.6; cursor: default; }

.gate-error { color: var(--red); font-size: 0.85rem; margin: 10px 0 0; }

header.app-header {
  background: linear-gradient(135deg, #1c2444, #2a0f1c 140%);
  background-color: var(--maroon);
  border-bottom: 2px solid var(--gold-deep);
  color: var(--ink);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.45);
  position: sticky;
  top: 0;
  z-index: 10;
}

header.app-header .back-btn {
  background: rgba(255,255,255,0.06);
  border: 2px solid var(--gold);
  color: var(--gold-light);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 1rem;
  cursor: pointer;
}

header.app-header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
  flex: 1;
  text-align: center;
  letter-spacing: 0.5px;
}

.header-logo {
  height: 30px;
  vertical-align: middle;
}

.menu-cover {
  display: block;
  width: 100%;
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  margin-bottom: 4px;
}

main {
  flex: 1;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.screen { animation: fadein 0.25s ease; }

@keyframes fadein {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Menu */
.menu-subtitle {
  text-align: center;
  color: var(--ink-dim);
  margin-top: 8px;
  margin-bottom: 24px;
  font-size: 0.95rem;
}

.mode-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mode-card {
  background: linear-gradient(160deg, var(--surface), var(--bg-alt));
  border: 1px solid rgba(232, 184, 75, 0.35);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  box-shadow: var(--card-shadow);
  text-align: left;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.mode-card:active { transform: scale(0.98); border-color: var(--gold); }

.mode-card .icon {
  font-size: 1.7rem;
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(232, 184, 75, 0.1);
  border-radius: 12px;
}

.mode-card .label { font-weight: 800; font-size: 1.05rem; color: var(--gold-light); }
.mode-card .desc { font-size: 0.85rem; color: var(--ink-dim); margin-top: 2px; }

.progress-badge {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--gold-light);
  background: rgba(232, 184, 75, 0.12);
  border: 1px solid var(--gold-deep);
  border-radius: 999px;
  padding: 2px 9px;
}

.progress-badge:empty { display: none; }

.install-hint {
  margin-top: 22px;
  text-align: center;
  font-size: 0.8rem;
  color: var(--ink-dim);
}

#install-btn {
  display: block;
  margin: 14px auto 0;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-deep));
  border: none;
  color: #241a05;
  font-weight: 800;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(232, 184, 75, 0.3);
}

.reset-all-btn {
  display: block;
  margin: 22px auto 0;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 6px;
}

.reset-all-btn.confirming {
  color: var(--red);
  font-weight: bold;
  text-decoration: none;
}

/* Buttons */
.btn {
  display: inline-block;
  width: 100%;
  padding: 14px;
  border-radius: var(--radius);
  border: none;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  font-family: inherit;
  cursor: pointer;
  background: linear-gradient(135deg, #ff3d5c, var(--maroon) 55%, #a30f28);
  color: #fff;
  box-shadow: 0 6px 16px rgba(224, 34, 63, 0.35);
  margin-top: 10px;
}

.btn.secondary {
  background: transparent;
  border: 2px solid var(--maroon);
  color: var(--maroon-dark);
  box-shadow: none;
}

.btn:active { transform: scale(0.98); }

/* Quiz */
.progress-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--ink-dim);
  margin-bottom: 10px;
}

.progress-bar {
  height: 8px;
  background: var(--bg-alt);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 18px;
}

.progress-bar > div {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-deep), var(--gold-light));
  transition: width 0.3s ease;
}

.question-card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--card-shadow);
  margin-bottom: 16px;
}

.question-card .category {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gold);
  font-weight: 800;
}

.question-card .question-text {
  font-size: 1.15rem;
  margin-top: 6px;
  color: var(--ink);
  font-weight: 600;
}

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

.option-btn {
  background: var(--surface);
  border: 2px solid var(--bg-alt);
  border-radius: var(--radius);
  padding: 13px;
  text-align: left;
  font-size: 0.98rem;
  font-family: inherit;
  cursor: pointer;
  color: var(--ink);
}

.option-btn:active { transform: scale(0.99); }

.option-btn.correct {
  background: var(--success-bg);
  border-color: var(--green);
  color: var(--green);
  font-weight: bold;
}

.option-btn.wrong {
  background: var(--danger-bg);
  border-color: var(--red);
  color: var(--red);
  font-weight: bold;
}

.option-btn:disabled { cursor: default; }

.feedback-row {
  margin-top: 14px;
  text-align: center;
}

.streak-badge {
  display: inline-block;
  background: linear-gradient(135deg, var(--gold-light), var(--gold-deep));
  color: #241a05;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
}

.result-box {
  text-align: center;
  background: var(--surface);
  border: 1px solid rgba(232, 184, 75, 0.25);
  border-radius: var(--radius);
  padding: 28px 18px;
  box-shadow: var(--card-shadow);
}

.result-box .score {
  font-size: 2.4rem;
  color: var(--gold-light);
  font-weight: 800;
  margin: 8px 0;
}

.result-box .score-label { color: var(--ink-dim); font-size: 0.9rem; }

.result-box .verse {
  margin-top: 16px;
  font-style: italic;
  color: var(--ink-dim);
  font-size: 0.9rem;
  border-top: 1px dashed var(--gold-deep);
  padding-top: 14px;
}

/* Fases (usado pelo Quiz, Organizar o Versículo, Palavra Cruzada e Memória) */
.phase-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 14px;
}

.phase-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--bg-alt);
  border: 1px solid var(--gold-deep);
}

.phase-dot.done { background: var(--gold); border-color: var(--gold); }
.phase-dot.active {
  background: var(--maroon);
  border-color: var(--maroon);
  transform: scale(1.25);
  box-shadow: 0 0 8px rgba(224, 34, 63, 0.7);
}

/* Organizar o Versículo */
.verse-instruction {
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 4px 0 14px;
}

.answer-area {
  min-height: 74px;
  background: var(--surface);
  border: 2px dashed var(--gold-deep);
  border-radius: var(--radius);
  padding: 12px;
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 8px;
  margin-bottom: 14px;
}

.answer-area.wrong { border-color: var(--red); }

.answer-placeholder {
  color: var(--muted);
  font-style: italic;
  font-size: 0.9rem;
}

.word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 6px;
}

.word-chip {
  background: var(--bg-alt);
  border: 2px solid var(--gold-deep);
  border-radius: 999px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--gold-light);
  cursor: pointer;
}

.word-chip:active { transform: scale(0.95); }

.word-chip.placed {
  background: linear-gradient(135deg, var(--maroon), #a30f28);
  color: #fff;
  border-color: var(--maroon);
  cursor: default;
}

.undo-link {
  display: block;
  margin: 10px auto 0;
  background: none;
  border: none;
  color: var(--ink-dim);
  text-decoration: underline;
  font-family: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.verse-correct { color: var(--green); font-weight: bold; }
.verse-wrong { color: var(--red); font-weight: bold; }
.verse-ref { font-style: italic; color: var(--ink-dim); font-size: 0.9rem; margin-top: 4px; }

/* Palavra Cruzada */
.cw-grid-wrap {
  overflow-x: auto;
  margin-bottom: 14px;
}

table.cw-grid {
  border-collapse: collapse;
  margin: 0 auto;
}

table.cw-grid td {
  width: 42px;
  height: 42px;
  padding: 0;
}

td.cw-blank { background: transparent; }

td.cw-cell {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--gold-deep);
}

.cw-number {
  position: absolute;
  top: 2px;
  left: 3px;
  font-size: 0.6rem;
  color: #241a05;
  background: var(--gold);
  border-radius: 3px;
  padding: 0 3px;
  line-height: 1.3;
}

td.cw-cell input {
  width: 100%;
  height: 100%;
  border: none;
  text-align: center;
  text-transform: uppercase;
  font-family: inherit;
  font-weight: bold;
  font-size: 1.3rem;
  color: var(--ink);
  background: transparent;
  padding: 0;
}

td.cw-cell input:focus { outline: 2px solid var(--gold); outline-offset: -2px; }

td.cw-cell input.cw-right { background: var(--success-bg); color: var(--green); }
td.cw-cell input.cw-wrong { background: var(--danger-bg); color: var(--red); }

.cw-actions {
  display: flex;
  gap: 10px;
}

.cw-actions .btn { margin-top: 0; }

.cw-clues {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  margin-top: 20px;
}

.cw-clue-col { flex: 1; min-width: 140px; }

.cw-clue-col h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--gold);
  margin: 0 0 8px;
}

.cw-clue {
  font-size: 0.85rem;
  color: var(--ink-dim);
  margin-bottom: 8px;
  line-height: 1.35;
}

/* Adventure */
.story-picker {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.story-card {
  background: linear-gradient(160deg, var(--surface), var(--bg-alt));
  border: 1px solid rgba(232, 184, 75, 0.3);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  box-shadow: var(--card-shadow);
}

.story-card .title { font-weight: 800; color: var(--gold-light); font-size: 1.05rem; }
.story-card .blurb { font-size: 0.85rem; color: var(--ink-dim); margin-top: 4px; }

.story-card.done { border-color: var(--green); opacity: 0.7; }
.story-card.done .title { color: var(--green); }

/* Sistema de Pistas */
.clue-status-row {
  font-size: 0.78rem;
  color: var(--gold-light);
  background: rgba(232, 184, 75, 0.1);
  border: 1px solid var(--gold-deep);
  border-radius: 999px;
  padding: 4px 12px;
  display: inline-block;
  margin-bottom: 12px;
}

.hotspot-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: var(--surface-alt);
  border: 2px dashed var(--gold);
  border-radius: var(--radius);
  padding: 13px 14px;
  text-align: left;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--gold-light);
  cursor: pointer;
  margin-bottom: 12px;
}

.hotspot-btn:active { transform: scale(0.98); }
.hotspot-btn .lens { font-size: 1.2rem; flex-shrink: 0; }

.clue-reveal {
  background: var(--success-bg);
  border-left: 4px solid var(--green);
  border-radius: 0 10px 10px 0;
  padding: 12px 14px;
  font-size: 0.9rem;
  font-style: italic;
  color: var(--green);
  margin-bottom: 16px;
}

.choice-btn.locked {
  background: var(--bg-alt);
  color: var(--muted);
  border-color: var(--muted);
  border-style: dashed;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.choice-btn .lock-tag {
  font-size: 0.72rem;
  background: var(--muted);
  color: var(--bg);
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}

.choice-btn.shake { animation: shake 0.4s ease; }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.locked-hint {
  font-size: 0.78rem;
  color: var(--maroon-dark);
  text-align: center;
  margin: -4px 0 12px;
  min-height: 1em;
}

.story-text-box {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius);
  padding: 20px 18px;
  box-shadow: var(--card-shadow);
  margin-bottom: 16px;
  line-height: 1.6;
  font-size: 1.02rem;
}

.choice-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.choice-btn {
  background: var(--bg-alt);
  border: 2px solid var(--gold-deep);
  border-radius: var(--radius);
  padding: 13px;
  text-align: left;
  font-family: inherit;
  font-size: 0.98rem;
  cursor: pointer;
  color: var(--ink);
}

.choice-btn:active { transform: scale(0.99); }

.ending-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: bold;
  margin-bottom: 10px;
}

.ending-badge.good { background: var(--success-bg); color: var(--green); }
.ending-badge.bad { background: var(--danger-bg); color: var(--red); }
.ending-badge.neutral { background: var(--bg-alt); color: var(--ink-dim); }

/* Memory */
.memory-stats {
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
  font-size: 0.9rem;
  color: var(--ink-dim);
}

.memory-preview-banner {
  text-align: center;
  background: linear-gradient(135deg, #ff3d5c, var(--maroon) 55%, #a30f28);
  color: #fff;
  font-weight: 800;
  padding: 10px;
  border-radius: var(--radius);
  margin-bottom: 14px;
  animation: fadein 0.25s ease;
  box-shadow: 0 6px 16px rgba(224, 34, 63, 0.35);
}

.memory-grid.previewing {
  pointer-events: none;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.memory-card {
  aspect-ratio: 1 / 1;
  background: linear-gradient(160deg, var(--surface-alt), var(--bg-alt));
  border: 1px solid var(--gold-deep);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  cursor: pointer;
  box-shadow: var(--card-shadow);
  user-select: none;
  color: var(--gold-light);
}

.memory-card.flipped {
  background: var(--surface);
  border-color: rgba(255,255,255,0.1);
  color: var(--ink);
}

.memory-card.matched {
  background: var(--success-bg);
  border-color: var(--green);
  color: var(--green);
  cursor: default;
}

.memory-card .label {
  font-size: 0.55rem;
  text-align: center;
  padding: 2px;
  line-height: 1.1;
}
