/* Q&A do Congresso — mobile-first, app-like. */
:root {
  --bg: #f5f3ff; --card: #fff; --ink: #1e1b2e; --muted: #6b7280;
  --brand: #5b21b6; --brand2: #7c3aed; --line: #e7e5ef;
  --live: #dc2626; --ok: #16a34a; --soon: #2563eb;
  --shadow: 0 1px 3px rgba(30,20,60,.08), 0 6px 20px rgba(30,20,60,.05);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, Roboto, sans-serif;
  background: var(--bg); color: var(--ink); line-height: 1.45;
  padding-bottom: calc(64px + var(--safe-b)); -webkit-font-smoothing: antialiased;
}
h1 { font-size: 22px; margin: 0 0 4px; } h2 { font-size: 16px; } h3 { margin: 0 0 6px; }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center;
  gap: 8px; padding: max(10px, env(safe-area-inset-top)) 14px 10px;
  background: linear-gradient(120deg, var(--brand), var(--brand2)); color: #fff;
}
.topbar .brand { background: none; border: 0; color: #fff; font-weight: 700; font-size: 16px; display: flex; gap: 6px; align-items: center; max-width: 70%; }
.topbar .brand span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .who { background: rgba(255,255,255,.18); border: 0; color: #fff; padding: 7px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; }

main { padding: 14px 14px 0; max-width: 720px; margin: 0 auto; }
.loading, .empty { color: var(--muted); text-align: center; padding: 32px 8px; }
.empty.big { padding: 48px 16px; } .empty .ei, .empty.big .ei { font-size: 40px; }

/* Tab bar */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: flex;
  background: #fff; border-top: 1px solid var(--line); padding-bottom: var(--safe-b);
}
.tabbar button {
  flex: 1; background: none; border: 0; padding: 9px 4px; font-size: 11px; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px; font-weight: 600;
}
.tabbar button > :first-child { font-size: 20px; }
.tabbar button.active { color: var(--brand); }

/* Buttons */
.btn { border: 0; border-radius: 10px; padding: 11px 16px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn-p { background: var(--brand); color: #fff; }
.btn-p:disabled { opacity: .6; }

/* Badges */
.badge { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: #eef; color: #475569; }
.badge.live { background: #fee2e2; color: var(--live); }
.badge.ended { background: #f1f5f9; color: #64748b; }
.badge.soon { background: #dbeafe; color: var(--soon); }
.badge.ok { background: #dcfce7; color: var(--ok); }

/* ---- Agenda ---- */
.agenda-hd { margin-bottom: 8px; }
.dayhd { margin: 18px 2px 8px; color: var(--brand); text-transform: capitalize; }
.nowlive { background: linear-gradient(135deg, #fff1f2, #fff); border: 1px solid #fecaca; border-radius: 16px; padding: 8px; margin-bottom: 10px; }
.nowlive-tag { color: var(--live); font-weight: 800; font-size: 12px; letter-spacing: .04em; padding: 6px 6px 2px; }

.talk {
  display: flex; gap: 12px; align-items: stretch; background: var(--card); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px; margin: 8px 0; box-shadow: var(--shadow); cursor: pointer;
}
.talk:active { transform: scale(.99); }
.talk.live { border-color: #fecaca; }
.talk.current { border-color: var(--brand2); box-shadow: 0 0 0 2px var(--brand2), var(--shadow); scroll-margin-top: 70px; }
.talk.big { background: #fff; }
.talk-time { font-variant-numeric: tabular-nums; font-weight: 700; font-size: 13px; color: var(--brand); min-width: 44px; }
.talk-main { flex: 1; min-width: 0; }
.talk-title { font-weight: 700; }
.talk-sub { font-size: 13px; color: var(--muted); margin: 2px 0 6px; }
.talk-meta { display: flex; gap: 8px; align-items: center; }
.talk-go { align-self: center; color: #c4b5fd; font-size: 24px; font-weight: 700; }

/* ---- Talk view ---- */
.back { background: none; border: 0; color: var(--brand); font-weight: 600; padding: 4px 0; font-size: 15px; }
.talk-hd { margin: 6px 0 12px; }
.talk-hd .badge { margin-top: 6px; }
.ask { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; box-shadow: var(--shadow); margin-bottom: 14px; }
.ask textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px; font: inherit; resize: none; }
.ask textarea:focus { outline: 2px solid var(--brand2); border-color: transparent; }
.ask-row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 8px; }

.qlist { display: flex; flex-direction: column; gap: 8px; }
.qcard { display: flex; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; box-shadow: var(--shadow); }
.qcard.answered { background: #f6fef9; border-color: #bbf7d0; }
.qvote { display: flex; flex-direction: column; align-items: center; min-width: 44px; }
.qvote .up { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: #faf9ff; color: var(--brand); font-size: 18px; font-weight: 800; }
.qvote .up.done { background: var(--brand); color: #fff; border-color: var(--brand); }
.qvote .score { font-weight: 800; font-size: 16px; margin-top: 3px; }
.qbody { flex: 1; min-width: 0; }
.qtext { font-size: 15px; }
.qby { margin-top: 4px; }

/* ---- Mine / Rank ---- */
.myrank { background: linear-gradient(120deg, var(--brand), var(--brand2)); color: #fff; padding: 12px 14px; border-radius: 12px; margin: 8px 0 12px; }
.ladder { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.ladder li { display: flex; align-items: center; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); }
.ladder li.top3 { border-color: #ddd6fe; }
.ladder .pos { font-size: 18px; min-width: 34px; font-weight: 800; }
.ladder .nm { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ladder .pts { font-weight: 700; font-size: 13px; }

/* ---- QR ---- */
.qrview { text-align: center; padding-top: 8px; }
.qrview .qr { width: min(78vw, 420px); height: auto; border-radius: 16px; background: #fff; padding: 10px; box-shadow: var(--shadow); }
.qurl { word-break: break-all; color: var(--muted); font-size: 13px; }

/* ---- Modal ---- */
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(20,12,40,.5); display: flex; align-items: flex-end; justify-content: center; padding: 16px; }
.modal-card { background: #fff; border-radius: 18px; padding: 18px; width: 100%; max-width: 420px; box-shadow: var(--shadow); }
.modal-card input { width: 100%; padding: 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 16px; margin: 8px 0 12px; }
.modal-card .btn { width: 100%; }
@media (min-width: 520px) { .modal { align-items: center; } }

/* ---- Toast ---- */
.toast { position: fixed; left: 50%; bottom: calc(76px + var(--safe-b)); transform: translateX(-50%); z-index: 60;
  background: #1e1b2e; color: #fff; padding: 11px 16px; border-radius: 12px; font-size: 14px; max-width: 92vw; box-shadow: var(--shadow); }
.toast.ok { background: #14532d; } .toast.err { background: #7f1d1d; }
