:root {
  --bg: #f3f4f7; --card: #ffffff; --text: #16191d; --muted: #616c7a; --line: #e2e5ea;
  --accent: #1f3a5f; --accent-soft: #e6edf6; --accent-text: #ffffff;
  --ok: #1e7d3a; --warn: #9a6700; --bad: #b42318;
  --bar: rgba(243, 244, 247, 0.92);
  --radius: 14px;
  --reader-size: 18px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216; --card: #181c22; --text: #e8ebef; --muted: #98a3b0; --line: #262c34;
    --accent: #8fb4e3; --accent-soft: #1d2a3a; --accent-text: #0f1216;
    --ok: #5cc27a; --warn: #e3b341; --bad: #f47067;
    --bar: rgba(15, 18, 22, 0.92);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Kannada", sans-serif;
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
  overscroll-behavior-y: contain;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { width: 22px; height: 22px; fill: currentColor; flex: none; }
input {
  width: 100%; border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 12px; padding: 12px 14px; font: inherit; font-size: 16px; outline: none;
}
input:focus { border-color: var(--accent); }
button.primary {
  border: 0; background: var(--accent); color: var(--accent-text);
  border-radius: 12px; padding: 12px 16px; font-weight: 600;
}
button.ghost { border: 0; background: none; color: var(--muted); padding: 10px; }
.muted { color: var(--muted); }
.msg { color: var(--muted); font-size: 14px; min-height: 1.2em; }

/* ----- top bar and tabs ----- */
.appbar {
  position: sticky; top: 0; z-index: 5;
  background: var(--bar); backdrop-filter: saturate(1.5) blur(12px); -webkit-backdrop-filter: saturate(1.5) blur(12px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.bar {
  max-width: 720px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.bar h1 { font-size: 22px; margin: 0; letter-spacing: -0.01em; }
.chip {
  display: flex; align-items: center; gap: 4px; min-width: 0; max-width: 60%;
  border: 0; background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; padding: 6px 12px 6px 8px; font-size: 14px; font-weight: 600;
}
.chip svg { width: 18px; height: 18px; }
.chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; justify-content: center;
  background: var(--bar); backdrop-filter: saturate(1.5) blur(12px); -webkit-backdrop-filter: saturate(1.5) blur(12px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar button {
  flex: 1; max-width: 200px; border: 0; background: none; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 6px; font-size: 12px; font-weight: 500;
}
.tabbar button.on { color: var(--accent); }

main { max-width: 720px; margin: 0 auto; padding: 12px 16px 24px; }

/* ----- lists ----- */
.segmented {
  display: flex; background: var(--line); border-radius: 12px; padding: 3px; gap: 3px; margin-bottom: 12px;
}
.segmented button {
  flex: 1; border: 0; background: none; border-radius: 10px; padding: 8px 6px;
  color: var(--muted); font-weight: 600; font-size: 15px;
}
.segmented button.on { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.segmented.small button { font-size: 13px; padding: 6px 4px; }
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.list-title { font-weight: 650; font-size: 15px; line-height: 1.35; margin: 2px 0 8px; }
.status { color: var(--muted); font-size: 14px; margin: 6px 0 12px; }
.status:empty { display: none; }
.icon-btn {
  border: 0; background: none; color: var(--muted); border-radius: 999px;
  width: 40px; height: 40px; display: grid; place-items: center; flex: none;
}
.icon-btn:active { background: var(--line); }
.icon-btn.spin svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px; cursor: pointer;
  transition: transform .08s ease;
}
.card:active { transform: scale(0.99); }
.card .headline { font-size: 17px; line-height: 1.42; font-weight: 600; }
.card.lead .headline { font-size: 19px; }
.meta {
  margin-top: 8px; font-size: 13px; color: var(--muted);
  display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center;
}
.dot::before { content: "·"; margin-right: 10px; }
.badge {
  font-size: 11px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 999px;
}
.badge.Confirmed { color: var(--ok); background: color-mix(in srgb, var(--ok) 14%, transparent); }
.badge.Reported { color: var(--warn); background: color-mix(in srgb, var(--warn) 14%, transparent); }
.badge.Unverified { color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, transparent); }
.more {
  width: 100%; border: 1px solid var(--line); background: var(--card); border-radius: 12px;
  padding: 12px; font-weight: 600; color: var(--accent); margin: 4px 0 16px;
}
.empty { text-align: center; color: var(--muted); padding: 40px 12px; font-size: 15px; }

/* loading placeholders */
.skeleton { pointer-events: none; }
.skeleton .bar1, .skeleton .bar2, .skeleton .bar3 {
  height: 14px; border-radius: 6px; background: var(--line); margin: 6px 0;
  animation: pulse 1.2s ease-in-out infinite;
}
.skeleton .bar1 { width: 92%; } .skeleton .bar2 { width: 70%; } .skeleton .bar3 { width: 40%; height: 10px; margin-top: 12px; }
@keyframes pulse { 50% { opacity: .45; } }

/* ----- search ----- */
.searchbox {
  display: flex; align-items: center; gap: 8px; margin-bottom: 10px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px;
}
.searchbox svg { color: var(--muted); width: 20px; height: 20px; }
.searchbox input { border: 0; padding: 12px 0; background: none; }
.recent { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.recent button {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 6px 12px; font-size: 14px;
}

/* ----- settings ----- */
.group { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 13px 16px; border: 0; border-bottom: 1px solid var(--line); background: none; width: 100%; text-align: left;
}
.row:last-child { border-bottom: 0; }
.row b { font-weight: 600; text-align: right; }
.row.link { color: var(--accent); font-weight: 600; }
.row.danger { color: var(--bad); }
.steps { display: flex; gap: 6px; }
.steps button { border: 1px solid var(--line); background: var(--bg); border-radius: 8px; padding: 4px 12px; font-weight: 600; }
.note-group { padding: 4px 16px 12px; }
.note-group h3 { font-size: 15px; margin: 12px 0 6px; }
.note-group p { margin: 0 0 8px; color: var(--muted); font-size: 14px; }

/* ----- full-screen sheets: login, home picker ----- */
.sheet {
  position: fixed; inset: 0; z-index: 20; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  padding: calc(20px + env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom));
}
.panel {
  width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line);
  border-radius: 18px; padding: 22px; display: flex; flex-direction: column; gap: 10px;
}
.panel h2 { margin: 0; font-size: 21px; }
.panel p { margin: 0 0 4px; font-size: 14px; line-height: 1.45; }
.logo { width: 56px; height: 56px; border-radius: 14px; }
.choices { display: flex; flex-direction: column; gap: 6px; max-height: 45vh; overflow-y: auto; }
.choices button {
  text-align: left; border: 1px solid var(--line); background: var(--bg); border-radius: 10px;
  padding: 10px 12px; display: flex; justify-content: space-between; gap: 8px;
}
.choices small { color: var(--muted); }

/* ----- reader ----- */
.reader {
  position: fixed; inset: 0; z-index: 10; background: var(--bg); overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.reader-bar {
  position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 4px;
  background: var(--bar); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: calc(6px + env(safe-area-inset-top)) 8px 6px;
}
.reader-source { font-weight: 600; color: var(--muted); font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reader-body { max-width: 680px; margin: 0 auto; padding: 16px 18px calc(40px + env(safe-area-inset-bottom)); }
.reader h2 { font-size: calc(var(--reader-size) + 7px); line-height: 1.3; margin: 10px 0 8px; letter-spacing: -0.01em; }
.reader .note { color: var(--muted); font-size: 13px; margin: 0 0 14px; display: flex; gap: 6px; align-items: flex-start; }
.reader img { width: 100%; border-radius: 12px; margin: 4px 0 14px; background: var(--line); display: block; }
.reader .text p { font-size: var(--reader-size); line-height: 1.7; margin: 0 0 16px; }
.versions-label { font-size: 13px; color: var(--muted); margin: 18px 0 8px; }
.versions { display: flex; flex-wrap: wrap; gap: 8px; }
.versions button {
  border: 1px solid var(--line); background: var(--card); border-radius: 999px;
  padding: 6px 12px; font-size: 13px;
}
.versions button.on { border-color: var(--accent); color: var(--accent); font-weight: 600; }

@media (min-width: 720px) {
  .card .headline { font-size: 18px; }
}

/* ----- trending box ----- */
.trending {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 0 10px; margin-bottom: 14px;
}
.tr-head { display: flex; align-items: center; gap: 6px; padding: 0 14px 6px; font-size: 15px; }
.tr-head svg { width: 18px; height: 18px; color: #e8590c; }
.tr-head span { color: var(--muted); font-size: 13px; margin-left: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.tr-group { margin-top: 6px; }
.tr-label { font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); padding: 0 14px 6px; }
/* phones: swipe sideways */
.tr-list { display: flex; gap: 8px; overflow-x: auto; padding: 0 14px 4px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.tr-list::-webkit-scrollbar { display: none; }
.tr-item {
  flex: 0 0 72%; max-width: 260px; scroll-snap-align: start; text-align: left;
  border: 1px solid var(--line); background: var(--bg); border-radius: 12px; padding: 9px 11px;
  font: inherit; color: inherit; cursor: pointer;
}
.tr-item .tr-title {
  font-weight: 600; font-size: 14px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tr-item .tr-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.tr-item.search .tr-title { -webkit-line-clamp: 1; }
.tr-item .tr-news { display: none; margin-top: 6px; font-size: 12.5px; line-height: 1.4; color: var(--text); }
.tr-item .tr-news div { margin-top: 4px; }
.tr-item .tr-news small { color: var(--muted); }
.tr-item.open .tr-news { display: block; }
.tr-note { color: var(--muted); font-size: 12px; padding: 0 14px; }

/* wide screens: the box sits beside the news */
@media (min-width: 980px) {
  main { max-width: 1100px; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
  main > section { grid-column: 1; }
  .trending { grid-column: 2; grid-row: 1 / span 4; position: sticky; top: 76px; margin-bottom: 0; }
  .tr-list { flex-direction: column; overflow: visible; padding: 0 12px 2px; }
  .tr-item { flex: none; max-width: none; width: 100%; }
  .tr-item.search .tr-title { -webkit-line-clamp: 2; }
}
