:root {
  --bg: #0f1419; --panel: #171d26; --card: #1d2531; --line: #2a3442;
  --text: #e6edf3; --muted: #93a1b0; --accent: #4fa3ff;
  --good: #3fb950; --warn: #d9a23b; --bad: #e5687a; --neutral: #7d8aa0;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.55 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex; flex-direction: column; min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
}
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5; padding-top: calc(14px + env(safe-area-inset-top));
}
.brand { font-weight: 700; font-size: 18px; }
.logo { color: var(--accent); letter-spacing: -2px; margin-right: 6px; }
.ethos { font-size: 13px; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--line); background: #131922; }
main { flex: 1; padding: 16px; max-width: 720px; width: 100%; margin: 0 auto; }

button { font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); padding: 11px 16px; }
button.primary { background: var(--accent); border-color: var(--accent); color: #04101f; font-weight: 700; }
button.primary:disabled { opacity: .5; }
button.ghost { background: transparent; }
button.icon { padding: 8px 11px; }

.inputbox { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.inputlabel { font-weight: 700; font-size: 14px; }
.inputrow { display: flex; gap: 10px; flex-wrap: wrap; }
.inputrow button { flex: 1; min-width: 150px; }
.newjudge { width: 100%; margin-top: 14px; }
textarea, input, select {
  width: 100%; background: #0f1722; color: var(--text); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; font: inherit; resize: vertical;
}

.status { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; border: 1px solid var(--line); background: var(--card); }
.status.err { border-color: var(--bad); color: #ffd9df; }
.status.work { border-color: var(--accent); }
.hidden { display: none !important; }

.empty { color: var(--muted); }
.empty ol { padding-left: 20px; }
.empty .tip { margin-top: 16px; font-size: 13px; }

.section { margin-bottom: 20px; }
.section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 8px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; }
.card .lead { font-weight: 600; }
.card .sub { color: var(--muted); font-size: 14px; margin-top: 5px; }
.summary { background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 12px; padding: 14px; margin-bottom: 18px; }
.mediaTitle { font-weight: 700; margin-bottom: 4px; }

.tag { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); margin-left: 6px; vertical-align: middle; }
.tag.framing { color: var(--warn); border-color: var(--warn); }
.tag.prediction { color: #c9a0ff; }
.estate { font-size: 11px; padding: 1px 8px; border-radius: 999px; }
.estate.well-supported { color: var(--good); border: 1px solid var(--good); }
.estate.contested, .estate.single-source { color: var(--warn); border: 1px solid var(--warn); }
.estate.no-primary-evidence { color: var(--bad); border: 1px solid var(--bad); }

.boundary { background: #1a1410; border: 1px solid var(--warn); border-radius: 12px; padding: 14px; }
.boundary h3 { color: var(--warn); }
.verify { background: #101a13; border: 1px solid var(--good); border-radius: 12px; padding: 14px; }
.verify h3 { color: var(--good); }
.verify ol { margin: 0; padding-left: 18px; }
.verify li { margin-bottom: 6px; }
.honesty { color: var(--muted); font-size: 13px; font-style: italic; margin-top: 12px; }

.prov { font-size: 10px; padding: 1px 6px; border-radius: 999px; vertical-align: middle; }
.prov.training { color: var(--warn); border: 1px solid var(--warn); }
.prov.verified { color: var(--good); border: 1px solid var(--good); }
.acct { border-left: 2px solid var(--line); padding-left: 10px; margin: 8px 0; }
.acct .sub { margin-top: 2px; }
.livebox { margin-top: 8px; padding: 8px 10px; border: 1px solid var(--good); border-radius: 8px; background: #0f1a12; font-size: 13px; }
.livecheck { margin-top: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; color: var(--text); }
.livecheck.ok { border-color: var(--good); background: #0f1a12; }
.livecheck.bad { border-color: var(--bad); background: #2a1416; }
.livecheck.mid { border-color: var(--warn); background: #1a1410; }
.livecheck.none { color: var(--muted); }
.livebox a { white-space: nowrap; }
.scripturewrap h3 { color: #c9a0ff; }
.card.scripture { border-left: 3px solid #c9a0ff; }
.verse { margin: 6px 0; line-height: 1.6; }
.verse.rtl { direction: rtl; text-align: right; font-size: 1.1em; }
.vlabel { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .05em; }
.ai-scripture h3 { color: var(--bad); }
.ai-warn { background: #2a1416; border: 1px solid var(--bad); color: #ffd9df; border-radius: 8px; padding: 10px 12px; font-weight: 700; font-size: 12px; margin-bottom: 10px; line-height: 1.45; }

.glance { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
details.acc { border: 1px solid var(--line); border-left-width: 3px; border-radius: 10px; margin-bottom: 8px; background: var(--panel); }
details.acc > summary { list-style: none; cursor: pointer; padding: 13px 14px; display: grid; grid-template-columns: 1fr 24px 38px 26px; align-items: center; column-gap: 10px; }
details.acc > summary::-webkit-details-marker { display: none; }
.acchead { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.acctitle { font-weight: 600; font-size: 15px; }
.accnote { font-size: 12px; color: var(--muted); }
.accnote.warn { color: var(--bad); font-weight: 600; }
.help { width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--muted); background: transparent; color: #fff; font-size: 13px; font-weight: 700; cursor: pointer; justify-self: center; display: flex; align-items: center; justify-content: center; }
.help:hover { background: var(--accent); color: #04101f; border-color: var(--accent); }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 20px; }
.modal.hidden { display: none; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; max-width: 380px; width: 100%; }
.modal-title { font-weight: 700; font-size: 16px; margin-bottom: 8px; color: var(--text); }
.modal-text { color: var(--text); font-size: 14px; line-height: 1.55; }
.modal-close { margin-top: 16px; width: 100%; background: var(--accent); color: #04101f; border: none; border-radius: 8px; padding: 11px; font-weight: 600; font-size: 14px; cursor: pointer; }
.help-spacer { width: 24px; }
.cnt { font-size: 12px; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: 1px 0; text-align: center; }
.cnt:empty { border: none; background: none; }
.chev { color: var(--text); font-size: 20px; line-height: 1; justify-self: center; transition: transform .15s ease; }
details.acc[open] > summary .chev { transform: rotate(180deg); }
details.acc[open] > summary { border-bottom: 1px solid var(--line); }
.helptip { display: none; grid-column: 1 / -1; font-size: 13px; color: var(--muted); font-style: italic; margin-top: 8px; line-height: 1.5; font-weight: 400; }
.helptip.show { display: block; }
.acc-body { padding: 10px 14px 14px; }
.tone-facts { border-left-color: var(--accent); }
.tone-sources { border-left-color: var(--neutral); }
.tone-uncertain { border-left-color: var(--warn); }
.tone-verify { border-left-color: var(--good); }
.tone-scripture { border-left-color: #c9a0ff; }
.tone-ai { border-left-color: var(--bad); }
.tone-ai .acctitle, .tone-ai .accnote { color: var(--bad); }
.card.proof { border-left: 3px solid var(--good); }
.card.noproof { border-left: 3px solid var(--bad); }
.card.disputed { border-left: 3px solid var(--warn); }
.card.claim.neutral { border-left: 3px solid var(--neutral); }
.cstatus { display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 999px; margin-left: 6px; vertical-align: middle; border: 1px solid; }
.cstatus.proof { color: var(--good); border-color: var(--good); }
.cstatus.noproof { color: var(--bad); border-color: var(--bad); }
.cstatus.disputed { color: var(--warn); border-color: var(--warn); }
.cstatus.neutral { color: var(--neutral); border-color: var(--neutral); }

/* Image check (media authenticity) */
.card.summary.mstate-original-like { border-left-color: var(--good); }
.card.summary.mstate-stripped, .card.summary.mstate-screenshot { border-left-color: var(--warn); }
.card.summary.mstate-unknown { border-left-color: var(--neutral); }
.revbtn { display: block; padding: 10px 12px; margin-bottom: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--text); text-decoration: none; }
.revbtn:hover { border-color: var(--accent); }
.revbtn .sub { display: inline; color: var(--muted); font-size: 13px; }
#mediaBtn { font-weight: 600; }

/* Provider key help */
.keyhelp { margin-top: 10px; }
.keyhelp summary { color: var(--accent); cursor: pointer; font-size: 13px; }
.keyhelp ol { margin: 8px 0; padding-left: 20px; color: var(--muted); font-size: 13px; }
.keyhelp li { margin-bottom: 5px; }
.keyhelp a { font-size: 13px; }
code { background: #0f1722; padding: 1px 5px; border-radius: 4px; font-size: .9em; }

.footer { border-top: 1px solid var(--line); padding: 12px 16px; font-size: 12px; color: var(--muted); background: var(--panel); }
a { color: var(--accent); }

.spinner { display: inline-block; width: 15px; height: 15px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* back buttons + required-key error */
.sheet-back { display: inline-block; background: transparent; border: none; color: var(--accent); font-size: 14px; font-weight: 600; padding: 0 0 10px; cursor: pointer; }
.intro-back { position: fixed; top: calc(14px + env(safe-area-inset-top)); left: 14px; z-index: 31; background: transparent; border: none; color: var(--accent); font-size: 15px; font-weight: 600; cursor: pointer; padding: 6px 8px; }
.keyerr { color: var(--bad); font-size: 13px; font-weight: 700; margin: 6px 0 0; }
input.invalid { border-color: var(--bad) !important; }

/* settings sheet */
/* Tall sheets must scroll: bottom-anchor via margin-top:auto (NOT align-items:flex-end,
   which clips the top off-screen with no way to scroll up when content overflows). */
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.55); display: flex; flex-direction: column; align-items: center; z-index: 20; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px 16px 0 0; padding: 20px; width: 100%; max-width: 560px; padding-bottom: calc(20px + env(safe-area-inset-bottom)); margin-top: auto; }
.sheet-card h2 { margin: 0 0 12px; font-size: 18px; }
.sheet-card label { display: block; margin-bottom: 4px; font-weight: 600; font-size: 14px; }
.sheet-card label.mt { margin-top: 16px; }
.hint { color: var(--muted); font-size: 13px; margin: 2px 0 8px; }
.req { color: var(--bad); font-size: 11px; border: 1px solid var(--bad); border-radius: 999px; padding: 1px 7px; }
.show { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; margin-top: 8px; font-weight: 400; }
.show input { width: auto; }
.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }
.sheet-actions button { flex: 1; }

.topbar .actions { display: flex; gap: 8px; }

/* Banner shown to shared-report recipients who aren't users yet */
.sharedbanner { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #101a2b; border: 1px solid var(--accent); border-radius: 12px; padding: 12px 14px; margin-bottom: 14px; font-size: 14px; }
.sharedbanner button { white-space: nowrap; }

/* Device setup + report actions */
.devtabs { display: flex; gap: 6px; margin-top: 6px; }
.devtabs button { flex: 1; min-width: 0; padding: 12px 2px; font-size: 13px; border-radius: 10px; }
.devtabs button.active { background: var(--accent); border-color: var(--accent); color: #04101f; font-weight: 700; }
.devsteps { margin-top: 12px; }
.devsteps h3 { font-size: 14px; margin: 14px 0 6px; color: var(--accent); }
.devsteps ol { margin: 0 0 8px; padding-left: 20px; }
.devsteps li { margin-bottom: 8px; font-size: 14px; line-height: 1.5; }
.devsteps .note { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
.reportactions { display: flex; gap: 10px; margin-top: 14px; }
.reportactions button { flex: 1; }

/* First-run intro (homepage) */
.intro { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column; align-items: center; padding: 24px; overflow-y: auto; -webkit-overflow-scrolling: touch; padding-top: calc(24px + env(safe-area-inset-top)); padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
.intro-card { max-width: 460px; width: 100%; text-align: center; margin: auto 0; }
.intro-logo { display: block; margin: 0 auto 10px; }
.intro-title { font-size: 30px; margin: 0; font-weight: 800; }
.intro-tag { color: var(--accent); font-weight: 700; margin: 4px 0 16px; }
.intro-lead { color: var(--muted); font-size: 15px; line-height: 1.6; margin: 0 0 18px; }
.intro-points { list-style: none; padding: 0; margin: 0 0 22px; text-align: left; display: inline-block; }
.intro-points li { position: relative; padding-left: 26px; margin-bottom: 10px; font-size: 15px; }
.intro-points li::before { content: "✓"; position: absolute; left: 0; color: var(--good); font-weight: 800; }
.intro-btn { width: 100%; font-size: 16px; padding: 14px; }
.intro-note { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
