/* Soraia · Código — design system */
:root {
  --accent: #2ce08b;
  --accent-dark: #14b86b;
  --accent-ink: #063a22;
  --blue: #4fd8eb;
  --red: #ff5d6c;
  --amber: #ffb84d;

  --bg: #f2f5f3;
  --card: #ffffff;
  --card2: #e9efeb;
  --ink: #101413;
  --ink2: #5c6662;
  --line: rgba(16,20,19,.08);
  --shadow: 0 6px 24px rgba(16,20,19,.08);
  --nav-bg: rgba(255,255,255,.88);
}
[data-theme="dark"] {
  --bg: #0d0f0e;
  --card: #191d1b;
  --card2: #232826;
  --ink: #f2f5f3;
  --ink2: #93a09a;
  --line: rgba(242,245,243,.08);
  --shadow: 0 6px 24px rgba(0,0,0,.35);
  --nav-bg: rgba(20,23,22,.88);
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink);
  min-height: 100dvh; overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
  transition: background .3s, color .3s;
  user-select: none; -webkit-user-select: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select { font: inherit; }

.boot-splash { display:flex; align-items:center; justify-content:center; height:100dvh; }
.boot-logo { font-size:56px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.15); opacity:.7 } }

/* layout */
.screen {
  padding: calc(env(safe-area-inset-top) + 16px) 20px calc(env(safe-area-inset-bottom) + 110px);
  max-width: 560px; margin: 0 auto;
  animation: slidein .28s cubic-bezier(.2,.8,.25,1);
}
@keyframes slidein { from { opacity:0; transform: translateY(14px) } to { opacity:1; transform:none } }

h1 { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; line-height: 1.15; }
h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 1.02rem; font-weight: 700; }
.muted { color: var(--ink2); }
.small { font-size: .85rem; }

.topbar { display:flex; align-items:center; justify-content:space-between; margin-bottom: 18px; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  color: #063a22; display:flex; align-items:center; justify-content:center;
  font-weight: 800; font-size: 1.1rem;
}
.iconbtn {
  width: 42px; height: 42px; border-radius: 50%; background: var(--card);
  box-shadow: var(--shadow); display:flex; align-items:center; justify-content:center; font-size: 1.15rem;
  transition: transform .12s;
}
.iconbtn:active { transform: scale(.92); }

.card {
  background: var(--card); border-radius: 22px; padding: 18px;
  box-shadow: var(--shadow); margin-bottom: 14px;
}
.card.accent { background: var(--accent); color: var(--accent-ink); }
.card.blue { background: var(--blue); color: #06333a; }
.row { display:flex; gap: 12px; }
.row > * { flex: 1; }
.center { text-align: center; }
.spread { display:flex; align-items:center; justify-content:space-between; }

.btn {
  display:block; width:100%; padding: 15px 20px; border-radius: 999px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 1rem;
  text-align:center; transition: transform .12s, filter .2s;
}
.btn:active { transform: scale(.97); }
.btn.ghost { background: var(--card2); color: var(--ink); }
.btn.dark { background: var(--ink); color: var(--bg); }
.btn.danger { background: var(--red); color: #fff; }
.btn[disabled] { opacity:.45; pointer-events:none; }
.btn.sm { padding: 10px 16px; font-size: .9rem; width:auto; display:inline-block; }

/* bottom nav */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 14px);
  display:flex; gap: 4px; background: var(--nav-bg);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border-radius: 999px; padding: 6px; box-shadow: var(--shadow); z-index: 40;
}
.tabbar button {
  display:flex; flex-direction:column; align-items:center; gap:2px;
  padding: 9px 17px; border-radius: 999px; font-size: 1.25rem; color: var(--ink2);
  transition: background .2s, color .2s;
}
.tabbar button span { font-size: .62rem; font-weight: 600; }
.tabbar button.active { background: var(--accent); color: var(--accent-ink); }

/* botão assistente flutuante */
.ai-fab {
  position: fixed; right: 18px; bottom: calc(env(safe-area-inset-bottom) + 96px);
  width: 54px; height: 54px; border-radius: 50%; z-index: 41;
  background: linear-gradient(135deg, #7c5cff, var(--blue));
  color:#fff; font-size: 1.5rem; display:flex; align-items:center; justify-content:center;
  box-shadow: 0 8px 22px rgba(90,80,255,.4); transition: transform .15s;
}
.ai-fab:active { transform: scale(.9); }

/* stats/tiles */
.tile { background: var(--card); border-radius: 20px; padding: 16px; box-shadow: var(--shadow); }
.tile .big { font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }
.tile .lbl { font-size: .78rem; color: var(--ink2); font-weight: 600; margin-bottom: 4px; }
.delta { font-size: .78rem; font-weight: 700; color: var(--accent-dark); }
.delta.neg { color: var(--red); }

.level-badge {
  width: 84px; height: 84px; border-radius: 28px; display:flex; align-items:center; justify-content:center;
  font-size: 2.6rem; font-weight: 900; color: var(--accent-ink); background: var(--accent);
  box-shadow: 0 10px 30px rgba(44,224,139,.35);
}
.level-B { background:#a3e635; } .level-C { background:var(--amber); }
.level-D { background:#ff936; } .level-E { background:var(--red); color:#fff; }

.progressbar { height: 8px; border-radius: 99px; background: var(--card2); overflow: hidden; }
.progressbar > div { height: 100%; border-radius: 99px; background: var(--accent); transition: width .4s cubic-bezier(.2,.8,.25,1); }

.chip {
  display:inline-flex; align-items:center; gap:6px; padding: 8px 14px; border-radius: 999px;
  background: var(--card2); font-size: .85rem; font-weight: 600; margin: 0 6px 8px 0;
  border: 2px solid transparent; transition: all .15s;
}
.chip.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, var(--card2)); }

/* teste */
.q-image { width: 100%; border-radius: 18px; display:block; background: var(--card2); aspect-ratio: 4/2.6; object-fit: cover; }
.q-text { font-size: 1.08rem; font-weight: 700; line-height: 1.4; margin: 14px 0; }
.opt {
  display:flex; align-items:center; gap: 12px; width:100%;
  background: var(--card); border: 2px solid var(--line); border-radius: 18px;
  padding: 14px 16px; margin-bottom: 10px; text-align:left; font-size: .95rem; font-weight: 500;
  transition: all .15s;
}
.opt .letter {
  width: 30px; height: 30px; min-width:30px; border-radius: 50%; background: var(--card2);
  display:flex; align-items:center; justify-content:center; font-weight: 800; font-size:.85rem;
  text-transform: uppercase;
}
.opt.sel { border-color: var(--ink); }
.opt.correct { border-color: var(--accent-dark); background: color-mix(in srgb, var(--accent) 16%, var(--card)); }
.opt.correct .letter { background: var(--accent); color: var(--accent-ink); }
.opt.wrong { border-color: var(--red); background: color-mix(in srgb, var(--red) 12%, var(--card)); }
.opt.wrong .letter { background: var(--red); color:#fff; }
.opt:active { transform: scale(.985); }

.test-head { display:flex; align-items:center; gap: 12px; margin-bottom: 14px; }
.test-head .progressbar { flex:1; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: .95rem; }
.timer.low { color: var(--red); animation: pulse 1s infinite; }

.explain {
  background: var(--card2); border-radius: 16px; padding: 14px; margin-top: 4px;
  font-size: .92rem; line-height: 1.5; animation: slidein .25s;
}

/* resultados */
.score-ring { width: 168px; height: 168px; margin: 10px auto; position: relative; }
.score-ring svg { transform: rotate(-90deg); }
.score-ring .val { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; }
.score-ring .val b { font-size: 2.4rem; letter-spacing:-.03em; }

.review-item { border-top: 1px solid var(--line); padding: 14px 0; }
.review-item:first-child { border-top: 0; }

/* listas */
.list-item {
  display:flex; align-items:center; gap: 14px; background: var(--card);
  border-radius: 18px; padding: 14px 16px; margin-bottom: 10px; box-shadow: var(--shadow);
  width: 100%; text-align: left; transition: transform .12s;
}
.list-item:active { transform: scale(.98); }
.list-item .emoji { font-size: 1.5rem; width: 44px; height: 44px; border-radius: 14px; background: var(--card2); display:flex; align-items:center; justify-content:center; }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .sub { font-size: .8rem; color: var(--ink2); }

/* sheet / modal */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 60;
  animation: fadein .2s; -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
@keyframes fadein { from { opacity: 0 } }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 61;
  background: var(--bg); border-radius: 26px 26px 0 0;
  padding: 12px 20px calc(env(safe-area-inset-bottom) + 20px);
  max-height: 88dvh; display: flex; flex-direction: column;
  animation: sheetup .32s cubic-bezier(.2,.8,.25,1);
  max-width: 560px; margin: 0 auto;
}
@keyframes sheetup { from { transform: translateY(100%) } }
.sheet .grab { width: 40px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 12px; }
.sheet-body { overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; }

/* chat */
.chat-log { display:flex; flex-direction:column; gap:10px; padding: 6px 0; }
.msg { max-width: 85%; padding: 11px 15px; border-radius: 18px; font-size: .93rem; line-height: 1.45; white-space: pre-wrap; user-select: text; -webkit-user-select: text; }
.msg.user { align-self: flex-end; background: var(--accent); color: var(--accent-ink); border-bottom-right-radius: 6px; }
.msg.ai { align-self: flex-start; background: var(--card); box-shadow: var(--shadow); border-bottom-left-radius: 6px; }
.msg.typing::after { content: '…'; animation: pulse .8s infinite; }
.chat-input { display:flex; gap: 8px; padding-top: 10px; }
.chat-input input {
  flex:1; border: 0; background: var(--card); border-radius: 999px; padding: 13px 18px;
  color: var(--ink); outline: none; box-shadow: var(--shadow); font-size: 16px;
}
.chat-input button { width: 46px; height: 46px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 1.15rem; }

/* forms */
.field { margin-bottom: 14px; }
.field label { display:block; font-size: .82rem; font-weight: 700; color: var(--ink2); margin-bottom: 6px; }
.field input, .field select {
  width: 100%; border: 2px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 16px; padding: 13px 16px; outline: none; font-size: 16px;
}
.field input:focus { border-color: var(--accent); }

.seg { display:flex; background: var(--card2); border-radius: 999px; padding: 4px; }
.seg button { flex:1; padding: 9px; border-radius: 999px; font-weight: 700; font-size: .85rem; color: var(--ink2); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

/* onboarding */
.ob-hero { font-size: 74px; text-align:center; margin: 30px 0 10px; animation: pop .5s cubic-bezier(.2,.8,.25,1); }
@keyframes pop { from { transform: scale(.4); opacity:0 } }
.dots { display:flex; gap:6px; justify-content:center; margin: 18px 0; }
.dots span { width:8px; height:8px; border-radius:50%; background: var(--line); transition: all .25s; }
.dots span.on { background: var(--accent); width: 22px; }

/* countdown */
.count-num { font-size: 2.6rem; font-weight: 900; letter-spacing: -.03em; line-height: 1; }

/* barras temas */
.theme-bar { margin-bottom: 12px; }
.theme-bar .spread { margin-bottom: 5px; font-size: .87rem; }

canvas.chart { width: 100%; height: 150px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 170px); z-index: 99;
  background: var(--ink); color: var(--bg); padding: 11px 20px; border-radius: 999px;
  font-size: .88rem; font-weight: 600; box-shadow: var(--shadow);
  animation: slidein .25s; max-width: 86vw; text-align:center;
}

.offline-dot { display:inline-block; width:8px; height:8px; border-radius:50%; background: var(--amber); margin-right:6px; }
