:root {
  --bg: #F4F1EB; --card: #FFFFFF; --card-2: #F7F5F0; --ink: #1D2230; --ink-2: #4B5263; --muted: #7A8194; --rule: #E3DFD6;
  --red: #D63A2F; --orange: #F28C28; --yellow: #F5C242; --green: #2FA36B; --blue: #2F6FDB; --gray: #9CA3AF;
  --shadow: 0 10px 30px rgba(29,34,48,.08);
  --sans: "Figtree", "Segoe UI", Roboto, "Helvetica Neue", Arial, system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #12151C; --card: #1B2029; --card-2: #232936; --ink: #EEF0F4; --ink-2: #C5CAD6; --muted: #8E95A6; --rule: #2E3542; --shadow: 0 10px 30px rgba(0,0,0,.35); }
}
:root[data-theme="dark"] { --bg: #12151C; --card: #1B2029; --card-2: #232936; --ink: #EEF0F4; --ink-2: #C5CAD6; --muted: #8E95A6; --rule: #2E3542; --shadow: 0 10px 30px rgba(0,0,0,.35); }

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 17px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--blue); }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.015em; }
h2 { font-size: 26px; margin: 0 0 6px; }
.muted { color: var(--muted); }
.fine { font-size: 13.5px; color: var(--muted); }
.sub { margin: 0 0 14px; color: var(--ink-2); max-width: 70ch; }

/* top bar */
.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 18px; padding: 10px 16px; background: var(--card); border-bottom: 1px solid var(--rule); flex-wrap: wrap; }
.mark { font-weight: 800; font-size: 20px; letter-spacing: -0.02em; line-height: 1; }
.mark small { display: block; font-weight: 500; font-size: 11px; color: var(--muted); margin-top: 3px; }
.tabs { display: flex; gap: 6px; }
.tabs a { text-decoration: none; color: var(--ink-2); font-weight: 700; padding: 8px 14px; border-radius: 999px; }
.tabs a[aria-current="page"] { background: var(--red); color: #fff; }
.out { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.out .who { font-size: 13px; color: var(--muted); }
.out button { background: transparent; border: 1px solid var(--rule); border-radius: 999px; padding: 6px 12px; font: inherit; font-size: 13.5px; color: var(--ink-2); cursor: pointer; }

.page { max-width: 980px; margin: 0 auto; padding: 16px 16px 60px; }

/* hero */
.hero { background: linear-gradient(120deg, #B62E22 0%, #D63A2F 35%, #F28C28 75%, #F5C242 100%); color: #fff; border-radius: 24px; padding: 26px 24px 20px; box-shadow: var(--shadow); }
.kicker { margin: 0 0 8px; font-size: 14px; opacity: .92; }
.hero h1 { font-size: clamp(28px, 4.6vw, 44px); margin: 0 0 12px; max-width: 20ch; font-weight: 800; }
.plain p { margin: 0 0 8px; font-size: 18px; max-width: 64ch; }
.tiles { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 10px; margin-top: 18px; }
.tile { background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3); border-radius: 16px; padding: 12px 14px; }
.tile b { display: block; font-size: 30px; font-weight: 800; line-height: 1; }
.tile b small { font-size: 14px; font-weight: 600; }
.tile span { display: block; font-size: 13px; opacity: .95; margin-top: 6px; line-height: 1.35; }
.tile em { font-style: normal; font-weight: 700; }
.moodbar, .minibar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: rgba(255,255,255,.25); margin-top: 8px; }
.moodbar i, .minibar i { display: block; height: 100%; }
.pos { background: var(--green); } .neu { background: var(--gray); } .neg { background: var(--red); }
.tile .pos, .tile .neu, .tile .neg { color: #fff; }
.moodbar .pos { background: #58D68D; } .moodbar .neu { background: #E5E7EB; } .moodbar .neg { background: #7F1D1D; }
.note { margin: 14px 0 0; font-size: 14px; background: rgba(0,0,0,.18); border-radius: 12px; padding: 8px 12px; }

/* sections */
.sec { margin-top: 28px; }
.sec.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.card { background: var(--card); border-radius: 20px; padding: 18px 20px; box-shadow: var(--shadow); }
.card h2 { font-size: 20px; }
.card ul { margin: 8px 0 0; padding-left: 20px; }
.card li { margin: 6px 0; }
.card.good { border-top: 8px solid var(--green); }
.card.watch { border-top: 8px solid var(--red); }

/* topics */
.topics { display: grid; gap: 10px; }
.topic { background: var(--card); border-radius: 16px; box-shadow: var(--shadow); border-left: 8px solid var(--gray); }
.topic.good { border-left-color: var(--green); } .topic.bad { border-left-color: var(--red); } .topic.mixed { border-left-color: var(--orange); }
.topic summary { list-style: none; display: grid; grid-template-columns: 36px 1fr 120px; gap: 12px; align-items: center; padding: 14px 16px; cursor: pointer; }
.topic summary::-webkit-details-marker { display: none; }
.rank { width: 36px; height: 36px; border-radius: 12px; background: var(--card-2); display: grid; place-items: center; font-weight: 800; }
.tlabel { font-weight: 700; font-size: 17px; }
.tlabel small { display: block; font-weight: 500; color: var(--muted); font-size: 13px; }
.minibar { height: 10px; margin: 0; background: var(--card-2); }
.tbody { padding: 0 16px 16px 64px; color: var(--ink-2); }
.tbody p { margin: 0 0 8px; }
.advice { color: var(--ink); background: color-mix(in srgb, var(--green) 10%, var(--card)); border-radius: 10px; padding: 8px 12px; }
.ex { margin: 6px 0 0; padding-left: 18px; font-size: 14.5px; }

/* quotes */
.quotes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.qcol { background: var(--card); border-radius: 16px; padding: 14px; box-shadow: var(--shadow); border-top: 8px solid var(--gray); }
.qcol.pos { border-top-color: var(--green); } .qcol.neg { border-top-color: var(--red); } .qcol.neu { border-top-color: var(--gray); }
.qcol h3 { margin: 0 0 8px; font-size: 16px; }
blockquote { margin: 0 0 10px; padding: 10px 12px; background: var(--card-2); border-radius: 10px; font-size: 15px; }
blockquote cite { display: block; font-style: normal; color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.empty { background: var(--card); border: 2px dashed var(--rule); border-radius: 16px; padding: 18px; color: var(--muted); }

/* posts */
.posts { display: grid; gap: 10px; }
.post { background: var(--card); border-radius: 16px; padding: 14px 16px; box-shadow: var(--shadow); }
.phead { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; color: var(--muted); }
.phead b { color: var(--ink); }
.post p { margin: 6px 0 8px; font-size: 15.5px; }
.pstats { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); }
.pstats .minibar { width: 90px; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0; background: var(--card); border-radius: 20px; box-shadow: var(--shadow); }
.timeline li { display: grid; grid-template-columns: 110px 1fr; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--rule); }
.timeline li:last-child { border-bottom: 0; }
.timeline .d { font-weight: 700; color: var(--ink-2); }
.timeline .t p { margin: 0; } .timeline .t small { color: var(--muted); }

/* actions */
.actions { margin: 0; padding: 0 0 0 0; list-style: none; counter-reset: a; display: grid; gap: 10px; }
.actions li { background: var(--card); border-radius: 16px; padding: 14px 16px 14px 60px; position: relative; box-shadow: var(--shadow); }
.actions li::before { counter-increment: a; content: counter(a); position: absolute; left: 16px; top: 14px; width: 32px; height: 32px; border-radius: 10px; background: var(--red); color: #fff; display: grid; place-items: center; font-weight: 800; }
.actions b { display: block; font-size: 17px; }
.actions p { margin: 4px 0 0; color: var(--ink-2); font-size: 15.5px; }

.sources { margin-top: 28px; background: var(--card); border-radius: 16px; padding: 4px 18px; box-shadow: var(--shadow); }
.sources summary { padding: 14px 0; font-weight: 700; cursor: pointer; }
.sources ul { margin: 0; padding: 0 0 12px 18px; font-size: 14.5px; }
.sources .dt { color: var(--muted); font-variant-numeric: tabular-nums; }
footer { margin-top: 24px; color: var(--muted); font-size: 13px; text-align: center; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login { width: 100%; max-width: 400px; background: var(--card); border-radius: 22px; padding: 26px 24px; box-shadow: var(--shadow); }
.login h1 { font-size: 26px; margin: 16px 0 4px; }
.login label { display: block; font-weight: 600; margin: 14px 0 0; font-size: 14.5px; }
.login input { width: 100%; margin-top: 6px; padding: 12px 12px; border: 1px solid var(--rule); border-radius: 12px; font: inherit; background: var(--card-2); color: var(--ink); }
.btn { width: 100%; margin-top: 18px; background: var(--red); color: #fff; border: 0; border-radius: 12px; padding: 13px; font: inherit; font-weight: 700; font-size: 16px; cursor: pointer; }
.alert { margin-top: 12px; background: color-mix(in srgb, var(--red) 12%, var(--card)); color: var(--red); border-radius: 10px; padding: 10px 12px; font-size: 14.5px; }

@media (max-width: 760px) {
  body { font-size: 16px; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile.mood { grid-column: 1 / -1; }
  .sec.two, .quotes { grid-template-columns: 1fr; }
  .topic summary { grid-template-columns: 32px 1fr; }
  .topic .minibar { grid-column: 2; }
  .tbody { padding-left: 16px; }
  .timeline li { grid-template-columns: 1fr; gap: 2px; }
  .tabs a { padding: 6px 10px; }
  .out .who { display: none; }
}

/* link to the full analysis page */
.fullink { text-decoration: none; font-weight: 700; font-size: 13.5px; color: var(--red); border: 1px solid var(--red); border-radius: 999px; padding: 6px 12px; white-space: nowrap; }
.fullink:hover { background: var(--red); color: #fff; }
.note.switch a { color: #fff; font-weight: 800; text-decoration: underline; text-underline-offset: 3px; }
@media (max-width: 640px) { .fullink { order: 3; } }

/* admin */
.admin-table { overflow-x: auto; background: var(--card); border-radius: 16px; box-shadow: var(--shadow); }
.admin-table table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.admin-table th, .admin-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.admin-table th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.admin-table tr:last-child td { border-bottom: 0; }
.admin-table button { background: transparent; border: 1px solid var(--rule); border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 12.5px; cursor: pointer; }
.admin-table small { color: var(--muted); }
.tabs a[aria-current="page"] { background: var(--red); color: #fff; }
