/* ============================================================
   SORA — styles.css v31  ·  Fiel ao Protótipo Opção B
============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:        #0f0328;
  --grad:      linear-gradient(145deg, #6a1fe6 0%, #8b31e0 30%, #b060f0 60%, #2255d8 100%);
  --glass:     rgba(255,255,255,0.09);
  --glass-hi:  rgba(255,255,255,0.16);
  --gbd:       rgba(255,255,255,0.20);
  --gbd-hi:    rgba(255,255,255,0.38);
  --coral:     #ff5630;
  --coral-bg:  rgba(255,86,48,0.18);
  --coral-bd:  rgba(255,86,48,0.38);
  --green:     #36b37e;
  --green-bg:  rgba(54,179,126,0.18);
  --green-bd:  rgba(54,179,126,0.35);
  --yellow:    #f59e0b;
  --yellow-bg: rgba(245,158,11,0.16);
  --yellow-bd: rgba(245,158,11,0.32);
  --blue-lt:   #93c5fd;
  --blue-bg:   rgba(59,130,246,0.18);
  --purp-lt:   #d8b4fe;
  --purp-bg:   rgba(192,132,252,0.18);
  --t1:        rgba(255,255,255,0.95);
  --t2:        rgba(255,255,255,0.55);
  --t3:        rgba(255,255,255,0.28);
  --fd:        'Syne', sans-serif;
  --fb:        'Plus Jakarta Sans', sans-serif;
  --fm:        'JetBrains Mono', monospace;
  --r:         22px;
  --ri:        14px;
  --rs:        10px;
}

body {
  font-family: var(--fb);
  background: var(--bg);
  min-height: 100vh;
  padding: 14px 16px 20px;
  color: var(--t1);
  overflow-x: hidden;
}

/* ── HEADER ──────────────────────────────────────────────── */
.s-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.s-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.s-brand__logo { width: 28px; height: 28px; }

.s-brand__name {
  font-family: var(--fd);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -1px;
}
.s-brand__name em { color: #c084fc; font-style: normal; }

.s-brand__sub {
  font-family: var(--fm);
  font-size: 10px;
  color: var(--t3);
  letter-spacing: 1px;
}

.s-online {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--fm);
  font-size: 10px;
  color: var(--green);
  background: var(--green-bg);
  border: 1px solid var(--green-bd);
  border-radius: 20px;
  padding: 5px 12px;
  margin-left: auto;
}
.s-online__dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: blink 2s infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }

/* Guardian toggle */
.s-guardian { display: flex; align-items: center; cursor: pointer; user-select: none; }
.s-guardian input { display: none; }
.s-guardian__track {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--fm);
  font-size: 10px;
  color: var(--t2);
  background: var(--glass);
  border: 1px solid var(--gbd);
  border-radius: 20px;
  padding: 5px 12px;
  transition: all .2s;
}
.s-guardian input:checked ~ .s-guardian__track {
  background: var(--coral-bg);
  border-color: var(--coral-bd);
  color: var(--coral);
}

/* ── CHIPS ROW (linha própria, fora do header) ───────────── */
.s-chips {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.s-chips::-webkit-scrollbar { display: none; }

.hero-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px 8px 10px;
  background: var(--glass);
  border: 1px solid var(--gbd);
  border-radius: 40px;
  backdrop-filter: blur(18px);
  cursor: pointer;
  white-space: nowrap;
  transition: all .2s;
  font-size: 13px;
  color: var(--t2);
  font-family: var(--fb);
}
.hero-chip:hover { background: var(--glass-hi); color: var(--t1); }
.hero-chip.active {
  background: var(--glass-hi);
  border-color: var(--gbd-hi);
  color: var(--t1);
  box-shadow: 0 0 0 2px rgba(192,132,252,.3);
}
.hero-chip__emoji { font-size: 20px; }
.hero-chip__lvl {
  font-family: var(--fm);
  font-size: 9px;
  color: #c084fc;
  background: rgba(192,132,252,.2);
  border: 1px solid rgba(192,132,252,.3);
  padding: 2px 7px;
  border-radius: 8px;
}

/* ── MAIN SPLIT 50/50 ────────────────────────────────────── */
.s-main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  height: calc(100vh - 128px);
  min-height: 560px;
}

/* ══ LEFT PANEL ══════════════════════════════════════════ */
.s-panel--left {
  background: var(--grad);
  border-radius: var(--r);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Blob wrapper (div ao redor do SVG) */
.av-blob-wrapper {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.av-blob-svg { width: 240px; height: 240px; }

/* Avatar zone */
.av-zone {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 0;
}

.av-glow {
  position: absolute;
  width: 260px; height: 260px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(255,255,255,.25) 0%, transparent 70%);
  pointer-events: none;
}

.av-emoji {
  font-size: 130px;
  line-height: 1;
  position: relative;
  z-index: 2;
  filter: drop-shadow(0 12px 40px rgba(0,0,0,.5));
  transition: font-size .3s ease, filter .3s ease, opacity .16s ease;
  user-select: none;
}

.av-canvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  z-index: 4; pointer-events: none; display: none;
}
.av-video { display: none; }

.av-lv-bg {
  position: absolute;
  font-family: var(--fd);
  font-size: 160px;
  font-weight: 800;
  color: rgba(255,255,255,.08);
  user-select: none; pointer-events: none;
  z-index: 1; line-height: 1;
}

/* ── HERO INFO ── */
.hero-info {
  background: rgba(0,0,0,.28);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255,255,255,.12);
  padding: 14px 18px 18px;
  flex-shrink: 0;
}

.hero-info__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.hero-name {
  font-family: var(--fd);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -1px;
  line-height: 1.0;
}

/* Rank como texto pequeno abaixo do nome (como no protótipo) */
.hero-rank {
  font-family: var(--fm);
  font-size: 8px;
  letter-spacing: 1.5px;
  color: #c084fc;
  margin-top: 3px;
  text-transform: uppercase;
}

/* Número do nível — grande, à direita */
.hero-level-box { text-align: right; flex-shrink: 0; }
.hero-level-lbl { font-family: var(--fm); font-size: 9px; color: var(--t2); }
.hero-level-val {
  font-family: var(--fd);
  font-size: 36px;
  font-weight: 800;
  line-height: 1;
  color: #c084fc;
}

/* XP bar — roxo → branco (exatamente como no protótipo) */
.xp-wrap { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.xp-track {
  flex: 1; height: 5px;
  background: rgba(255,255,255,.18);
  border-radius: 5px; overflow: hidden;
}
.xp-fill {
  height: 100%; border-radius: 5px;
  background: linear-gradient(90deg, #c084fc, #fff);
  transition: width 1s cubic-bezier(.4,0,.2,1);
}
.xp-label { font-family: var(--fm); font-size: 10px; color: var(--purp-lt); flex-shrink: 0; }

/* Stat cards 2×2 */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.stat-card { border-radius: var(--rs); padding: 8px 10px; }
.stat-coral { background: var(--coral-bg); border: 1px solid var(--coral-bd); }
.stat-white { background: rgba(255,255,255,.88); }
.stat-glass { background: var(--glass);    border: 1px solid var(--gbd); }
.stat-dark  { background: rgba(0,0,0,.20); border: 1px solid rgba(255,255,255,.1); }

.stat-card__label {
  display: block;
  font-family: var(--fm);
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--t2);
}
.stat-coral .stat-card__label { color: var(--coral); }
.stat-white .stat-card__label { color: #7c3aed; }

.stat-card__val {
  display: block;
  font-family: var(--fd);
  font-size: 24px;
  font-weight: 800;
  color: var(--t1);
  line-height: 1.15;
}
.stat-coral .stat-card__val { color: var(--coral); }
.stat-white .stat-card__val { color: #1e1035; }

.stat-card__sub { display: block; font-size: 9px; color: var(--t3); }
.stat-white .stat-card__sub { color: rgba(124,58,237,.7); }

/* ══ RIGHT PANEL ══════════════════════════════════════════ */
.s-panel--right { display: flex; flex-direction: column; gap: 10px; }

/* Calendário */
.cal-card {
  flex: 1;
  background: var(--glass);
  border: 1px solid var(--gbd);
  border-radius: var(--r);
  backdrop-filter: blur(24px);
  padding: 18px 20px 14px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.cal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.cal-month-lbl { font-family: var(--fd); font-size: 18px; font-weight: 700; }
.cal-sub { font-family: var(--fm); font-size: 9px; color: var(--t2); margin-top: 3px; }

.cal-nav-row { display: flex; gap: 4px; margin-top: 6px; }
.cal-nav {
  background: none;
  border: 1px solid var(--gbd);
  color: var(--t2);
  border-radius: 6px;
  width: 22px; height: 22px;
  cursor: pointer;
  font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s; line-height: 1;
}
.cal-nav:hover { background: var(--glass-hi); color: var(--t1); }

/* Counters lado direito (como no protótipo) */
.cal-counters { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.cal-big {
  font-family: var(--fd);
  font-size: 46px;
  font-weight: 800;
  line-height: 1;
  color: var(--t1);
}
.cal-count-lbl { font-family: var(--fm); font-size: 9px; color: var(--t2); }
.streak-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--coral-bg);
  border: 1px solid var(--coral-bd);
  border-radius: 20px;
  padding: 3px 10px;
  font-family: var(--fm);
  font-size: 10px;
  color: var(--coral);
}

/* Grade do calendário */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  flex: 1;
  align-content: start;
}
.cal-day-lbl {
  font-family: var(--fm);
  font-size: 9px;
  color: var(--t3);
  text-align: center;
  padding: 3px 0;
}
.cal-cell {
  aspect-ratio: 1;
  border-radius: 9px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  transition: transform .15s, box-shadow .15s;
  position: relative;
}
.cal-cell:hover { transform: scale(1.12); z-index: 5; }
.cal-cell__emoji { font-size: clamp(11px, 1.6vw, 19px); line-height: 1; }
.cal-cell__day   { font-family: var(--fm); font-size: 7px; color: var(--t2); line-height: 1; }

.cal-cell--empty   { pointer-events: none; background: transparent !important; }
.cal-cell--done    { background: var(--green-bg);  border: 1px solid var(--green-bd); }
.cal-cell--none    { background: var(--coral-bg);  border: 1px solid var(--coral-bd); }
.cal-cell--partial { background: var(--yellow-bg); border: 1px solid var(--yellow-bd); }
.cal-cell--future  { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.07); pointer-events: none; }
.cal-cell--today   { border: 2px solid rgba(255,255,255,.72) !important; box-shadow: 0 0 0 3px rgba(192,132,252,.38); }

@keyframes cellIn {
  from { opacity: 0; transform: scale(.8); }
  to   { opacity: 1; transform: scale(1); }
}
.cal-cell--animate { animation: cellIn .3s ease both; }

/* Barra de progresso */
.cal-progress { margin-top: 10px; flex-shrink: 0; }
.cal-progress__track {
  height: 5px;
  background: rgba(255,255,255,.1);
  border-radius: 5px; overflow: hidden;
  margin-bottom: 6px;
}
.cal-progress__fill {
  height: 100%; border-radius: 5px;
  background: linear-gradient(90deg, var(--green) 0%, #a3e635 100%);
  transition: width 1.2s cubic-bezier(.4,0,.2,1);
}

.cal-legend { display: flex; gap: 12px; flex-wrap: wrap; }
.leg { display: flex; align-items: center; gap: 4px; font-size: 10px; color: var(--t2); }

/* ── QUEST FEED ──────────────────────────────────────────── */
.quest-feed {
  background: var(--glass);
  border: 1px solid var(--gbd);
  border-radius: var(--r);
  backdrop-filter: blur(24px);
  padding: 13px 16px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.quest-feed__hd { display: flex; align-items: center; gap: 8px; }
.quest-tabs { display: flex; gap: 3px; flex: 1; }
.q-tab {
  font-family: var(--fm);
  font-size: 9px;
  padding: 3px 9px;
  border-radius: 20px;
  cursor: pointer;
  color: var(--t2);
  border: 1px solid transparent;
  background: none;
  transition: all .15s;
}
.q-tab.active,
.q-tab:hover { background: rgba(255,255,255,.14); border-color: var(--gbd); color: var(--t1); }

.btn-nova-quest {
  font-family: var(--fm);
  font-size: 9px;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--coral-bg);
  border: 1px solid var(--coral-bd);
  color: var(--coral);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.btn-nova-quest:hover { background: rgba(255,86,48,.3); }

.hidden { display: none !important; }

.quest-list {
  display: flex; flex-direction: column; gap: 5px;
  max-height: 180px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.2) transparent;
}
.quest-empty { font-size: 12px; color: var(--t3); text-align: center; padding: 12px 0; }

.quest-item {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 10px;
  background: rgba(255,255,255,.07);
  border: 1px solid var(--gbd);
  border-radius: var(--rs);
  cursor: pointer;
  transition: background .15s;
}
.quest-item:hover { background: var(--glass-hi); }
.quest-item__main { flex: 1; min-width: 0; }
.quest-item__row1 { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.quest-item__title {
  font-size: 11px; font-weight: 600; color: var(--t1);
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.quest-item__chips { display: flex; gap: 4px; }
.quest-actions { display: flex; gap: 4px; flex-shrink: 0; }

.type-badge {
  font-family: var(--fm); font-size: 8px;
  padding: 2px 6px; border-radius: 20px;
  border: 1px solid transparent; white-space: nowrap; flex-shrink: 0;
}
.type-badge--diaria      { background: var(--blue-bg);  color: var(--blue-lt);  border-color: rgba(59,130,246,.3); }
.type-badge--epica       { background: var(--purp-bg);  color: var(--purp-lt);  border-color: rgba(192,132,252,.3); }
.type-badge--cooperativa { background: var(--green-bg); color: #6ee7b7; border-color: var(--green-bd); }

.reward-chip {
  font-family: var(--fm); font-size: 8px;
  padding: 2px 6px; border-radius: 20px;
  background: var(--green-bg); color: #6ee7b7; border: 1px solid var(--green-bd);
}

.q-btn {
  font-family: var(--fm); font-size: 9px;
  padding: 3px 8px; border-radius: 20px;
  border: 1px solid transparent; cursor: pointer; transition: all .15s; white-space: nowrap;
}
.q-btn--concluir { background: var(--green-bg); color: #6ee7b7; border-color: var(--green-bd); }
.q-btn--concluir:hover { background: rgba(54,179,126,.35); }
.q-btn--aprovar  { background: var(--green-bg); color: #6ee7b7; border-color: var(--green-bd); }
.q-btn--reprovar { background: var(--coral-bg); color: var(--coral); border-color: var(--coral-bd); }
.q-btn--waiting  { color: var(--t3); background: none; border: none; }

/* ── MODAL ───────────────────────────────────────────────── */
.modal-backdrop {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px); z-index: 100;
}
.modal-backdrop.open { display: block; }

.modal {
  display: none; position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%,-50%) scale(.9);
  z-index: 101;
  background: #1a0845;
  border: 1px solid var(--gbd);
  border-radius: var(--r);
  width: min(520px, 95vw);
  max-height: 90vh;
  overflow-y: auto;
}
.modal.open {
  display: block;
  animation: modalIn .25s cubic-bezier(.34,1.56,.64,1) forwards;
}
@keyframes modalIn {
  from { opacity: 0; transform: translate(-50%,-50%) scale(.88); }
  to   { opacity: 1; transform: translate(-50%,-50%) scale(1); }
}

.modal__hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--gbd);
}
.modal__title { font-family: var(--fd); font-size: 16px; font-weight: 700; }
.modal__close {
  background: none; border: none; color: var(--t2);
  font-size: 18px; cursor: pointer; padding: 4px 8px; border-radius: 6px; transition: all .15s;
}
.modal__close:hover { background: var(--glass-hi); color: var(--t1); }

.modal__tabs { display: flex; gap: 4px; padding: 12px 20px 0; }
.mtab {
  font-family: var(--fm); font-size: 10px;
  padding: 5px 12px; border-radius: 20px;
  background: none; border: 1px solid transparent; color: var(--t2); cursor: pointer; transition: all .15s;
}
.mtab.active { background: rgba(255,255,255,.14); border-color: var(--gbd); color: var(--t1); }

.modal__body { padding: 16px 20px 20px; }
.modal-form { display: none; }
.modal-form.active { display: flex; flex-direction: column; gap: 12px; }
.modal-form label {
  display: flex; flex-direction: column; gap: 5px;
  font-family: var(--fm); font-size: 9px;
  text-transform: uppercase; letter-spacing: .5px; color: var(--t2);
}
.modal-form input,
.modal-form select {
  background: rgba(255,255,255,.08);
  border: 1px solid var(--gbd); border-radius: var(--ri);
  color: var(--t1); padding: 8px 12px;
  font-family: var(--fb); font-size: 13px; outline: none; transition: border-color .15s;
}
.modal-form input:focus,
.modal-form select:focus { border-color: #c084fc; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn-primary {
  background: #c084fc; border: none; border-radius: var(--ri);
  color: #1e1035; font-family: var(--fd); font-size: 13px; font-weight: 700;
  padding: 10px 20px; cursor: pointer; transition: opacity .15s; margin-top: 4px;
}
.btn-primary:hover { opacity: .85; }
.btn-danger { background: var(--coral); color: #fff; }

/* ── TOAST ───────────────────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  display: flex; flex-direction: column; gap: 8px; z-index: 200;
}
.toast {
  font-family: var(--fm); font-size: 12px;
  padding: 10px 16px; border-radius: 12px;
  border: 1px solid var(--gbd);
  background: rgba(15,3,40,.9); backdrop-filter: blur(12px);
  color: var(--t1); animation: toastIn .3s ease;
}
.toast--success { border-color: var(--green-bd); color: #6ee7b7; }
.toast--error   { border-color: var(--coral-bd); color: var(--coral); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: none; }
}

/* ── REWARD FLY ──────────────────────────────────────────── */
.reward-fly {
  position: fixed; pointer-events: none; z-index: 300;
  font-size: 20px; font-weight: 700; color: #a3e635;
  animation: flyUp 1.3s ease-out forwards;
}
@keyframes flyUp {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to   { opacity: 0; transform: translateY(-80px) scale(1.4); }
}

/* ── SCROLLBAR ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 4px; }

/* ── RESPONSIVE ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .s-main { grid-template-columns: 1fr; height: auto; }
  .s-panel--left { min-height: 400px; }
  .cal-big { font-size: 36px; }
}
@media (max-width: 640px) {
  body { padding: 10px 12px 16px; }
  .s-brand__sub { display: none; }
  .av-emoji { font-size: 100px; }
  .hero-level-val { font-size: 28px; }
}
