:root {
  --bg: #07100d;
  --panel: rgba(10, 26, 20, 0.9);
  --panel-soft: rgba(17, 41, 31, 0.7);
  --line: rgba(228, 197, 122, 0.18);
  --gold: #e4c57a;
  --gold-strong: #f5dc94;
  --text: #f6f4ec;
  --muted: #aab7ae;
  --danger: #f08d80;
  --success: #9be3b3;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 12%, rgba(47, 104, 75, 0.2), transparent 32%),
    radial-gradient(circle at 88% 88%, rgba(228, 197, 122, 0.09), transparent 28%),
    linear-gradient(145deg, #050b08 0%, #07140f 48%, #0a1510 100%);
  font-family: "Bai Jamjuree", sans-serif;
  overflow-x: hidden;
}

button { font: inherit; }
button:focus-visible, a:focus-visible { outline: 3px solid rgba(245, 220, 148, 0.75); outline-offset: 3px; }

.ambient {
  position: fixed;
  width: 340px;
  height: 340px;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .22;
  pointer-events: none;
}
.ambient-one { top: -100px; left: -120px; background: #3f9d6b; }
.ambient-two { bottom: -130px; right: -110px; background: #b89445; }

.app-shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 24px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--gold);
  background: rgba(255,255,255,.035);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.02);
}
.brand strong { display: block; font-family: "Cinzel", serif; letter-spacing: .04em; font-size: 17px; }
.brand small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; letter-spacing: .09em; text-transform: uppercase; }

.top-actions { display: flex; gap: 8px; }
.icon-btn {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: rgba(255,255,255,.035);
  cursor: pointer;
  transition: .2s ease;
}
.icon-btn:hover:not(:disabled) { transform: translateY(-2px); border-color: rgba(228,197,122,.5); background: rgba(228,197,122,.08); }
.icon-btn:disabled { opacity: .28; cursor: not-allowed; }

.progress-area { margin-bottom: 14px; }
.progress-meta { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 8px; color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.progress-track { height: 5px; border-radius: 999px; overflow: hidden; background: rgba(255,255,255,.07); }
.progress-track span { display: block; width: 7.7%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #9a7d36, var(--gold-strong)); transition: width .35s ease; }

.story-card {
  min-height: 620px;
  border: 1px solid var(--line);
  border-radius: 28px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.012));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.passo { display: none; min-height: 620px; }
.passo.ativo { display: grid; animation: reveal .38s ease both; }
.passo:has(.scene-image-wrap).ativo { grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr); }

@keyframes reveal {
  from { opacity: 0; transform: translateY(10px) scale(.995); }
  to { opacity: 1; transform: none; }
}

.scene-image-wrap { position: relative; min-height: 620px; overflow: hidden; background: #0f1b15; }
.scene-image-wrap::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 45%, rgba(7,16,13,.22)), linear-gradient(0deg, rgba(7,16,13,.45), transparent 35%); pointer-events: none; }
.scene-image-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(.85) contrast(1.05); }
.scene-badge { position: absolute; z-index: 2; left: 24px; bottom: 24px; padding: 9px 12px; border-radius: 999px; background: rgba(6,14,11,.78); border: 1px solid rgba(228,197,122,.28); color: var(--gold-strong); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; backdrop-filter: blur(10px); }
.scene-badge.muted { color: #ddd5c0; }
.scene-badge.success { color: var(--success); border-color: rgba(155,227,179,.3); }

.story-content { width: min(760px, 100%); margin: auto; padding: clamp(34px, 7vw, 78px); }
.eyebrow { margin: 0 0 14px; color: var(--gold); font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
h1, h2 { margin: 0; font-family: "Cinzel", serif; line-height: 1.08; text-wrap: balance; }
h1 { font-size: clamp(34px, 5.8vw, 68px); }
h2 { font-size: clamp(30px, 4.5vw, 52px); }
.story-content > p:not(.eyebrow) { max-width: 690px; margin: 22px 0 0; color: #ccd4ce; font-size: clamp(16px, 1.8vw, 19px); line-height: 1.75; }

.choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 34px; }
.choices.single { grid-template-columns: minmax(0, 520px); }
.btn-proximo {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 88px;
  padding: 18px 20px;
  border: 1px solid rgba(228,197,122,.2);
  border-radius: 18px;
  color: var(--text);
  background: linear-gradient(180deg, rgba(228,197,122,.09), rgba(255,255,255,.025));
  text-align: left;
  cursor: pointer;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}
.btn-proximo:hover { transform: translateY(-3px); border-color: rgba(228,197,122,.55); background: linear-gradient(180deg, rgba(228,197,122,.15), rgba(255,255,255,.04)); }
.btn-proximo span { font-weight: 700; font-size: 16px; }
.btn-proximo small { color: var(--muted); font-size: 12px; line-height: 1.4; }
.danger-choice { border-color: rgba(240,141,128,.18); }
.danger-choice:hover { border-color: rgba(240,141,128,.5); }

.final-copy { align-self: center; }
.restart-cta {
  margin-top: 30px;
  padding: 14px 20px;
  border: 1px solid rgba(228,197,122,.38);
  border-radius: 14px;
  background: var(--gold);
  color: #171207;
  font-weight: 700;
  cursor: pointer;
  transition: .2s ease;
}
.restart-cta:hover { transform: translateY(-2px); background: var(--gold-strong); }

footer { display: flex; justify-content: space-between; gap: 16px; padding: 18px 4px 0; color: #728079; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }

@media (max-width: 820px) {
  .app-shell { width: min(100% - 20px, 680px); padding-top: 16px; }
  .story-card, .passo, .scene-image-wrap { min-height: auto; }
  .passo:has(.scene-image-wrap).ativo { grid-template-columns: 1fr; }
  .scene-image-wrap { height: clamp(260px, 58vw, 390px); }
  .story-content { padding: 34px 24px 40px; }
  .choices { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .brand strong { font-size: 15px; }
  .brand small { font-size: 10px; }
  .brand-mark { width: 40px; height: 40px; border-radius: 12px; }
  .icon-btn { width: 40px; height: 40px; }
  .story-card { border-radius: 22px; }
  .story-content { padding: 30px 20px 34px; }
  .btn-proximo { min-height: 78px; border-radius: 15px; }
  footer { flex-direction: column; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
