/* Sabedoria Compartilhada — complementos ao design system "Céu de Serenidade" (base.css) */

/* ---------- Cenário vivo: o sol nasce e a árvore cresce a cada etapa ---------- */
.scene { --dawn: 0; }
.scene svg { overflow: visible; }
.scene .sun { transform: translateY(calc((1 - var(--dawn)) * 70px)); transition: transform 1.6s cubic-bezier(.2,.7,.2,1); transform-box: view-box; }
.scene .sun-glow { opacity: calc(.35 + var(--dawn) * .65); transition: opacity 1.6s ease; }
.scene .sky-tint { opacity: calc(.75 - var(--dawn) * .75); transition: opacity 1.6s ease; }
.scene .grow { opacity: 0; transform: scale(.6); transform-origin: 50% 100%; transform-box: fill-box; transition: opacity 1s ease, transform 1.2s cubic-bezier(.2,.8,.2,1.15); }
.scene .lamp { opacity: 0; transition: opacity .9s ease .4s; }
.scene[data-stage="1"] .g1,
.scene[data-stage="2"] .g1, .scene[data-stage="2"] .g2,
.scene[data-stage="3"] .g1, .scene[data-stage="3"] .g2, .scene[data-stage="3"] .g3,
.scene[data-stage="4"] .grow, .scene[data-stage="5"] .grow { opacity: 1; transform: scale(1); }
.scene[data-stage="1"] .seed, .scene[data-stage="2"] .seed, .scene[data-stage="3"] .seed, .scene[data-stage="4"] .seed, .scene[data-stage="5"] .seed { opacity: 0; }
.scene .seed { transition: opacity .6s ease; }
.scene[data-stage="3"] .lamp, .scene[data-stage="4"] .lamp, .scene[data-stage="5"] .lamp { opacity: 1; }
.scene .lamp circle { animation: twinkle 3.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.scene .lamp circle:nth-child(2n) { animation-delay: 1.2s; }
.scene .lamp circle:nth-child(3n) { animation-delay: 2.1s; }
@keyframes twinkle { 50% { opacity: .55; transform: scale(.82); } }
.scene .stars circle { opacity: calc(.9 - var(--dawn) * .7); transition: opacity 1.6s ease; }
.scene .rising { opacity: 0; }
.scene[data-stage="5"] .rising { animation: rise 3.4s cubic-bezier(.3,.1,.2,1) .6s forwards; }
@keyframes rise {
  0% { opacity: 0; transform: translate(0, 0) scale(.6); }
  15% { opacity: 1; }
  100% { opacity: 1; transform: translate(44px, -98px) scale(1.25); }
}
.scene .new-star { opacity: 0; }
.scene[data-stage="5"] .new-star { animation: starborn 1.4s ease 3.8s forwards; }
@keyframes starborn { from { opacity: 0; transform: scale(.2); } to { opacity: 1; transform: scale(1); } }
.scene .new-star { transform-box: fill-box; transform-origin: center; }
.drift-slow { animation: cloud 38s linear infinite; }
.drift-slower { animation: cloud 54s linear infinite reverse; }
@keyframes cloud { 0%,100% { transform: translateX(0); } 50% { transform: translateX(18px); } }

/* ---------- Formulário ---------- */
.verse { margin: 18px 0 0; padding: 16px 18px; border-radius: 18px; background: linear-gradient(115deg, #FFF8EE, #F7F1FB); border: 1px solid #F1E3CF; }
.verse p { font: italic 16px/1.5 var(--serif) !important; color: #5B4A33 !important; margin: 0 0 6px !important; }
.verse cite { font-style: normal; font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; color: #9A7A4C; font-weight: 700; }
.letter p:first-child { font: normal 19px/1.5 var(--serif); color: var(--ink); }
.signature { font: italic 17px var(--serif); color: var(--primary); margin-top: 4px !important; }
.time-hint { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--muted); background: #F4F7FB; border-radius: 100px; padding: 6px 12px; margin-top: 4px; }
.counter { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 6px; }
.transcript-box { margin-top: 16px; text-align: left; }
.transcript-box .field textarea { min-height: 140px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #C9D7EA; border-top-color: var(--primary); animation: spin 1s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }
.status-line { display: flex; gap: 10px; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; margin: 14px 0 0; }
.wave { display: flex; gap: 3px; height: 26px; align-items: center; justify-content: center; margin: 4px 0 8px; }
.wave i { width: 3px; border-radius: 3px; background: var(--danger); height: 6px; transition: height .08s; }
.consent { display: flex; gap: 11px; align-items: flex-start; border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px; background: #FAFCFF; cursor: pointer; font-size: 13px; color: #3F536B; line-height: 1.5; }
.consent input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--primary); flex-shrink: 0; }
.consent:has(input:checked) { border-color: var(--primary); background: #F3F7FD; }
.review-card .edit { float: right; font-size: 12px; border: 0; background: none; color: var(--primary); text-decoration: underline; padding: 0; }
.form-error { background: #FFF4F2; border: 1px solid #F2D9D4; color: var(--danger); border-radius: 14px; padding: 12px 14px; font-size: 13px; margin: 12px 0 0; }
.field input[aria-invalid="true"], .field textarea[aria-invalid="true"] { border-color: var(--danger); }
.ts-box { margin: 14px 0 0; min-height: 0; }
.finish .verse { text-align: left; margin: 22px 0 8px; }
.finish p { max-width: 430px; margin-left: auto !important; margin-right: auto !important; }
.panel { position: relative; }
.mobile-scene { display: none; }

@media (max-width: 700px) {
  .left { display: none; }
  .mobile-scene { display: block; position: relative; height: 196px; margin: 0 0 14px; border-radius: 24px; overflow: hidden; border: 1px solid rgba(255,255,255,.75); background: linear-gradient(160deg,#BFD6F1 0%,#DCE6F7 48%,#F2E5F4 75%,#F8E8DE 100%); box-shadow: 0 14px 55px rgba(72,100,143,.10); }
  .mobile-scene svg { position: absolute; inset: 0; width: 100%; height: 100%; }
  .mobile-scene .mobile-title { position: absolute; left: 20px; top: 18px; z-index: 1; max-width: 52%; }
  .mobile-scene .mobile-title strong { display: block; font: normal 27px/1.05 var(--serif); letter-spacing: -.8px; color: #263E5A; margin-top: 8px; }
  .topbar { min-height: 64px; }
}

/* ---------- Telas internas (login, painel, resultados) ---------- */
.narrow { max-width: 440px; margin: 6vh auto 0; }
.card { background: rgba(255,255,255,.94); border: 1px solid #fff; border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 32px; }
.card h1 { font: normal 34px/1.1 var(--serif); letter-spacing: -1px; margin: 12px 0 10px; }
.muted { color: var(--muted); }
.tabs { display: flex; gap: 6px; padding: 5px; background: rgba(255,255,255,.7); border: 1px solid #fff; border-radius: 100px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 0; background: transparent; padding: 9px 16px; border-radius: 100px; color: var(--muted); font-size: 13px; font-weight: 650; white-space: nowrap; }
.tabs button[aria-selected="true"] { background: var(--primary); color: #fff; box-shadow: 0 6px 16px #42678F24; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; margin: 18px 0; }
.kpi { background: rgba(255,255,255,.94); border: 1px solid #fff; border-radius: var(--r-md); padding: 18px; box-shadow: 0 8px 30px rgba(55,77,108,.07); min-width: 0; }
.kpi span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 650; }
.kpi strong { display: block; font: normal 36px/1.1 var(--serif); color: var(--ink); margin-top: 6px; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--soft); font-size: 12px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.box { background: rgba(255,255,255,.94); border: 1px solid #fff; border-radius: var(--r-md); padding: 20px; box-shadow: 0 8px 30px rgba(55,77,108,.07); min-width: 0; }
.box h3 { font: normal 21px/1.2 var(--serif); margin: 0 0 4px; color: var(--ink); }
.box .sub { font-size: 12px; color: var(--muted); margin: 0 0 14px; }
.bars { display: grid; gap: 10px; }
.bar { display: grid; grid-template-columns: minmax(84px, 34%) 1fr 34px; gap: 10px; align-items: center; font-size: 13px; }
.bar .track { height: 10px; background: #EDF2F8; border-radius: 10px; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 4px; background: #3D6FA8; width: 0; transition: width 1s cubic-bezier(.2,.7,.2,1); }
.bar .val { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12px; }
.bar .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #3F536B; }
.split { display: flex; height: 14px; border-radius: 4px; overflow: hidden; gap: 2px; margin: 6px 0 12px; }
.split i { display: block; height: 100%; border-radius: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: #3F536B; }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.columns { display: flex; align-items: flex-end; gap: 8px; height: 150px; padding-top: 18px; }
.columns .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 0; height: 100%; justify-content: flex-end; }
.columns .col b { font-size: 12px; font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.columns .col i { display: block; width: 100%; max-width: 46px; border-radius: 4px 4px 0 0; background: #3D6FA8; height: 0; transition: height 1s cubic-bezier(.2,.7,.2,1); min-height: 2px; }
.columns .col span { font-size: 11px; color: var(--muted); white-space: nowrap; }
.list { display: grid; gap: 10px; }
.resp { background: rgba(255,255,255,.96); border: 1px solid #fff; border-radius: var(--r-md); padding: 18px; box-shadow: 0 8px 30px rgba(55,77,108,.07); }
.resp header { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.resp h4 { margin: 0; font: normal 20px/1.2 var(--serif); }
.resp .tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.resp blockquote { margin: 0; font: normal 17px/1.55 var(--serif); color: #304C69; white-space: pre-wrap; overflow-wrap: anywhere; }
.resp audio { width: 100%; margin-top: 12px; }
.resp details { margin-top: 10px; font-size: 12px; color: var(--muted); }
.resp .row-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 18px 0 14px; }
.toolbar input { flex: 1; min-width: 180px; border: 1px solid #D8E2EE; background: #fff; border-radius: 100px; padding: 11px 16px; }
.bday { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #EEF2F7; }
.bday:last-child { border-bottom: 0; }
.bday .date { width: 54px; height: 54px; border-radius: 16px; background: linear-gradient(130deg,#FBE9D9,#F2E5F7); display: grid; place-items: center; text-align: center; font: normal 15px/1.1 var(--serif); color: #6A4F30; flex-shrink: 0; }
.bday .date small { display: block; font: 600 9px var(--sans); letter-spacing: 1px; text-transform: uppercase; }
.bday strong { display: block; font-size: 14px; }
.bday span { font-size: 12px; color: var(--muted); }
.pill.gold { background: #FBF0DF; color: #8A6534; }
.pill.green { background: #E8F3EF; color: var(--success); }
.empty { text-align: center; padding: 30px 16px; color: var(--muted); font-size: 14px; }
.reflection h2 { font: normal clamp(30px, 4.4vw, 46px)/1.08 var(--serif); letter-spacing: -1.2px; margin: 10px 0 14px; color: #263E5A; }
.reflection .lead { font: normal 19px/1.6 var(--serif); color: #3C5470; }
.reflection p { font-size: 15px; line-height: 1.8; color: #3F536B; }
.theme { border: 1px solid #E3EAF4; border-radius: 18px; padding: 16px; background: linear-gradient(115deg,#F6F9FE,#FBF7FD); }
.theme h4 { margin: 0 0 6px; font: normal 19px/1.2 var(--serif); color: var(--ink); display: flex; justify-content: space-between; gap: 10px; }
.theme h4 span { font: 600 12px var(--sans); color: var(--primary); }
.theme p { font-size: 13px !important; line-height: 1.6 !important; margin: 0 0 10px; }
.theme .track { height: 6px; background: #E6EDF6; border-radius: 6px; overflow: hidden; }
.theme .fill { height: 100%; background: linear-gradient(90deg, var(--gold), #C89B5E); width: 0; transition: width 1.2s ease; }
.closing { text-align: center; padding: 26px 18px; border-radius: 22px; background: linear-gradient(125deg,#E1ECFB,#EEE4F7 65%,#FBE9D9); }
.closing p { font: italic 22px/1.4 var(--serif) !important; color: #304C69 !important; margin: 10px auto 0; max-width: 560px; }
.editor .field textarea { min-height: 110px; }
.editor .theme-edit { display: grid; grid-template-columns: 1fr 90px; gap: 8px; margin-bottom: 8px; }
.editor .theme-edit textarea { grid-column: 1 / -1; min-height: 70px; }
.linkbox { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.linkbox code { flex: 1; min-width: 0; overflow-wrap: anywhere; background: #F4F7FB; border: 1px solid var(--line); padding: 12px 14px; border-radius: 12px; font-size: 12px; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(30px); opacity: 0; background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 100px; font-size: 13px; transition: all .3s; z-index: 50; pointer-events: none; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.section-title { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; margin: 26px 0 12px; }
.section-title h2 { font: normal 30px/1.1 var(--serif); letter-spacing: -.8px; margin: 0; }

@media (max-width: 930px) { .kpis { grid-template-columns: repeat(2, minmax(0,1fr)); } .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 700px) {
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .kpi strong { font-size: 30px; }
  .card { padding: 24px 20px; }
  .box { padding: 17px; }
  .section-title h2 { font-size: 26px; }
}

/* Cabeçalho da tela de resultados (mesmo estilo do hero do design system) */
.ds-hero { border-radius: 24px; padding: 30px; background: linear-gradient(125deg,#E1ECFB,#EEE4F7 65%,#FBE9D9); margin: 8px 0 4px; }
@media (max-width: 700px) { .ds-hero { padding: 22px; } }

/* Quem prefere menos movimento vê o estado final do cenário, sem animação */
@media (prefers-reduced-motion: reduce) {
  .scene[data-stage="5"] .rising { opacity: 1; transform: translate(44px, -98px) scale(1.25); }
  .scene[data-stage="5"] .new-star { opacity: 1; }
}
