/* ============================================================
   Samvaada · design system v2 (redesign 2026-07-03)
   ಜನ ಸಂವಾದ — The People's Conversation
   Dark-first · saffron→pink→violet brand · Discord-style shell
   ============================================================ */

:root {
  --brand-1: #FDB913;          /* Karnataka flag yellow (haladi) */
  --brand-2: #E03A2F;          /* Karnataka flag red (kempu) */
  --brand-3: #8B5CF6;          /* violet — the mix */
  --brand-grad: linear-gradient(135deg, #FDB913 0%, #E03A2F 52%, #8B5CF6 100%);
  --brand-grad-soft: linear-gradient(135deg, rgba(253,185,19,.16), rgba(224,58,47,.15), rgba(139,92,246,.14));

  --bg: #0B0D14;
  --bg-2: #10131D;
  --panel: #151926;
  --panel-2: #1B2032;
  --line: rgba(148,163,184,.14);
  --line-strong: rgba(148,163,184,.28);
  --ink: #EDEFF7;
  --ink-2: #A9B1C7;
  --ink-3: #6B7490;
  --ok: #34D399;
  --warn: #FBBF24;
  --bad: #F87171;
  --up: #34D399;
  --down: #F87171;

  --r-s: 10px; --r-m: 14px; --r-l: 20px; --r-xl: 28px;
  --shadow-1: 0 8px 28px -12px rgba(0,0,0,.55);
  --shadow-2: 0 18px 50px -20px rgba(0,0,0,.65);
  --glow: 0 0 0 1px rgba(139,92,246,.25), 0 10px 40px -12px rgba(139,92,246,.35);

  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-kn: "Noto Sans Kannada", var(--font);
  --pad: clamp(14px, 2.4vw, 24px);
  --appbar-h: 60px;
  --tabbar-h: 62px;
  --rail-w: 292px;
}
[data-theme="light"] {
  --bg: #F6F7FB; --bg-2: #FFFFFF; --panel: #FFFFFF; --panel-2: #F1F3FA;
  --line: rgba(15,23,42,.10); --line-strong: rgba(15,23,42,.22);
  --ink: #10142A; --ink-2: #444C68; --ink-3: #7A8199;
  --shadow-1: 0 8px 28px -14px rgba(15,23,42,.18);
  --shadow-2: 0 18px 50px -22px rgba(15,23,42,.22);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html { height: 100%; }
body {
  margin: 0; min-height: 100%;
  background:
    radial-gradient(1100px 500px at 85% -80px, rgba(224,58,47,.13), transparent 60%),
    radial-gradient(900px 420px at -10% 0px, rgba(253,185,19,.12), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px; line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
:lang(kn), .kn { font-family: var(--font-kn); }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
img { max-width: 100%; }
::selection { background: rgba(139,92,246,.4); }

a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--brand-3); outline-offset: 2px; border-radius: 6px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- app shell ---------- */
#app-root { min-height: 100vh; }
.shell { display: grid; grid-template-rows: var(--appbar-h) 1fr; min-height: 100vh; }

.appbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  height: var(--appbar-h); padding: 0 var(--pad);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: var(--brand-grad); color: #fff;
  font-family: var(--font-kn); font-weight: 800; font-size: 17px;
  box-shadow: var(--glow);
}
.brand-name { font-weight: 800; letter-spacing: .01em; font-size: 16px; white-space: nowrap; }
.brand-sub { font-size: 11px; color: var(--ink-3); margin-top: -3px; white-space: nowrap; }
.beta-chip {
  font-size: 10px; font-weight: 800; letter-spacing: .12em;
  padding: 3px 8px; border-radius: 999px;
  background: var(--brand-grad); color: #fff; margin-left: 6px;
  animation: betaPulse 3.2s ease-in-out infinite;
}
@keyframes betaPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(224,58,47,.45);} 50% { box-shadow: 0 0 0 7px rgba(224,58,47,0);} }
.appbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink-2);
  display: grid; place-items: center; font-size: 16px;
  transition: transform .15s ease, border-color .15s ease, color .15s ease;
}
.icon-btn:hover { transform: translateY(-1px); border-color: var(--line-strong); color: var(--ink); }
.pill-me {
  display: flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--panel);
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff;
  background: var(--brand-grad);
}
.avatar.lg { width: 52px; height: 52px; font-size: 18px; border-radius: 16px; }

/* ---------- layout: rail + main ---------- */
.frame { display: grid; grid-template-columns: 1fr; max-width: 1280px; margin: 0 auto; width: 100%; }
.rail { display: none; }
.main { padding: var(--pad); padding-bottom: calc(var(--tabbar-h) + 24px); min-width: 0; }

@media (min-width: 980px) {
  .frame { grid-template-columns: var(--rail-w) 1fr; gap: 0; }
  .rail {
    display: block; position: sticky; top: var(--appbar-h);
    height: calc(100vh - var(--appbar-h));
    overflow-y: auto; padding: 18px 14px 24px;
    border-right: 1px solid var(--line);
  }
  .main { padding-bottom: 48px; }
  .tabbar { display: none !important; }
}
.rail-title {
  font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3); margin: 18px 10px 8px;
}
.rail-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 12px; color: var(--ink-2);
  border: 1px solid transparent; margin-bottom: 2px;
  transition: background .15s ease, color .15s ease;
}
.rail-item:hover { background: var(--panel); color: var(--ink); }
.rail-item.active { background: var(--brand-grad-soft); border-color: var(--line); color: var(--ink); font-weight: 700; }
.rail-dot { width: 26px; height: 26px; border-radius: 9px; flex: none; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; }
.rail-item .cnt { margin-left: auto; font-size: 11px; color: var(--ink-3); }

/* room theme dots (incl. legacy seed theme aliases) */
.t-saffron, .t-ledger { background: linear-gradient(135deg,#FDB913,#F59E0B); }
.t-flag { background: linear-gradient(180deg,#FDB913 0 50%,#E03A2F 50% 100%); }
.t-pink, .t-medical { background: linear-gradient(135deg,#EC4899,#F43F5E); }
.t-violet, .t-spine { background: linear-gradient(135deg,#8B5CF6,#6366F1); }
.t-teal    { background: linear-gradient(135deg,#14B8A6,#0EA5E9); }
.t-green, .t-cadre { background: linear-gradient(135deg,#22C55E,#84CC16); }
.t-blue, .t-engine { background: linear-gradient(135deg,#3B82F6,#06B6D4); }
.t-red, .t-rights { background: linear-gradient(135deg,#E03A2F,#F97316); }
.t-slate   { background: linear-gradient(135deg,#64748B,#94A3B8); }

/* ---------- mobile tabbar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  height: var(--tabbar-h);
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--ink-3); font-size: 10.5px; font-weight: 700;
}
.tab .ticon { font-size: 19px; line-height: 1; }
.tab.active { color: var(--ink); }
.tab.active .ticon { filter: drop-shadow(0 0 8px rgba(139,92,246,.8)); }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  border-radius: var(--r-xl); padding: clamp(22px, 4vw, 40px);
  background:
    radial-gradient(600px 240px at 90% -40px, rgba(224,58,47,.30), transparent 60%),
    radial-gradient(420px 200px at 0% 110%, rgba(253,185,19,.30), transparent 55%),
    var(--panel);
  border: 1px solid var(--line); box-shadow: var(--shadow-2);
  margin-bottom: 22px;
}
.hero-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase;
  color: var(--brand-1); margin-bottom: 10px;
}
.hero h1 { margin: 0 0 8px; font-size: clamp(26px, 4.6vw, 42px); line-height: 1.12; font-weight: 900; letter-spacing: -0.01em; }
.hero h1 .grad { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p { margin: 0; color: var(--ink-2); max-width: 640px; font-size: clamp(14px, 1.8vw, 16px); }
.hero-stats { display: flex; gap: 22px; margin-top: 18px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; }
.stat b { font-size: 22px; font-weight: 900; }
.stat span { font-size: 11.5px; color: var(--ink-3); font-weight: 600; }
.live-dot { display:inline-block; width:8px; height:8px; border-radius:50%; background: var(--ok); margin-right:6px; animation: betaPulse 2.4s infinite; }

/* ---------- cards & grids ---------- */
.section-h {
  display: flex; align-items: baseline; gap: 10px;
  margin: 26px 2px 12px;
}
.section-h h2 { margin: 0; font-size: 17px; font-weight: 800; }
.section-h .sub { color: var(--ink-3); font-size: 12.5px; }
.section-h .right { margin-left: auto; font-size: 12.5px; color: var(--brand-3); font-weight: 700; }

.grid-rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; }
.room-card {
  position: relative; overflow: hidden;
  border-radius: var(--r-l); padding: 16px 14px;
  background: var(--panel); border: 1px solid var(--line);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
  display: flex; flex-direction: column; gap: 10px; min-height: 108px;
}
.room-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-1); border-color: var(--line-strong); }
.room-card .rc-dot { width: 34px; height: 34px; border-radius: 12px; display: grid; place-items: center; font-weight: 800; color: #fff; font-size: 14px; }
.room-card .rc-name { font-weight: 800; font-size: 14.5px; line-height: 1.25; }
.room-card .rc-meta { font-size: 11.5px; color: var(--ink-3); margin-top: auto; }

/* thread cards (room list + activity feed) */
.thread-card {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 12px;
  padding: 14px 16px; margin-bottom: 10px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l);
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.thread-card:hover { transform: translateY(-2px); border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.tc-title { font-weight: 800; font-size: 15px; line-height: 1.3; }
.tc-snip { color: var(--ink-2); font-size: 13px; margin-top: 3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tc-meta { display: flex; gap: 10px; align-items: center; margin-top: 8px; font-size: 11.5px; color: var(--ink-3); flex-wrap: wrap; }
.tc-room-chip { font-size: 10.5px; font-weight: 800; padding: 2px 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); }
.tc-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; justify-content: center; }
.tc-count { font-size: 12px; color: var(--ink-3); font-weight: 700; }

/* ---------- thread view (chat style) ---------- */
.thread-hero {
  border-radius: var(--r-l); padding: 18px 20px; margin-bottom: 16px;
  background: var(--brand-grad-soft); border: 1px solid var(--line);
}
.thread-hero h1 { margin: 0 0 6px; font-size: clamp(18px, 3vw, 26px); font-weight: 900; line-height: 1.2; }
.thread-hero .th-body { color: var(--ink); white-space: pre-wrap; word-break: break-word; }
.msgs { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.msg { display: grid; grid-template-columns: 38px 1fr; gap: 10px; }
.msg.nested { margin-left: 46px; }
.msg-bubble {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 4px var(--r-m) var(--r-m) var(--r-m);
  padding: 10px 14px; min-width: 0;
  animation: msgIn .25s ease;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(4px);} to { opacity: 1; transform: none;} }
.msg.mine .msg-bubble { background: var(--brand-grad-soft); border-color: rgba(139,92,246,.35); }
.msg-head { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.msg-handle { font-weight: 800; font-size: 13px; }
.msg-when { font-size: 11px; color: var(--ink-3); }
.msg-body { white-space: pre-wrap; word-break: break-word; font-size: 14px; margin-top: 2px; }
.msg-actions { display: flex; gap: 12px; margin-top: 6px; font-size: 11.5px; color: var(--ink-3); align-items: center; }
.msg-actions button { background: none; border: 0; color: var(--ink-3); padding: 2px 4px; border-radius: 6px; font-size: 11.5px; font-weight: 700; }
.msg-actions button:hover { color: var(--ink); background: var(--panel-2); }
.hidden-note { font-style: italic; color: var(--ink-3); }

/* composer */
.composer {
  position: sticky; bottom: calc(var(--tabbar-h) + 10px); z-index: 20;
  display: flex; gap: 10px; align-items: flex-end;
  background: var(--panel-2); border: 1px solid var(--line-strong);
  border-radius: var(--r-l); padding: 10px; margin-top: 18px;
  box-shadow: var(--shadow-2);
}
@media (min-width: 980px) { .composer { bottom: 12px; } }
.composer textarea {
  flex: 1; resize: none; border: 0; background: transparent; outline: none;
  min-height: 42px; max-height: 160px; padding: 8px 6px; line-height: 1.45;
}
.composer .send {
  border: 0; border-radius: 14px; padding: 10px 18px;
  background: var(--brand-grad); color: #fff; font-weight: 800;
  transition: transform .12s ease, filter .12s ease;
}
.composer .send:hover { transform: translateY(-1px); filter: brightness(1.08); }
.composer .send:disabled { opacity: .45; transform: none; }

/* vote pills */
.vote-pill { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.vote-pill button { background: none; border: 0; padding: 5px 10px; color: var(--ink-3); font-weight: 800; font-size: 12px; }
.vote-pill button.on-up { color: var(--up); background: rgba(52,211,153,.12); }
.vote-pill button.on-down { color: var(--down); background: rgba(248,113,113,.12); }
.vote-pill b { font-size: 12px; padding: 0 4px; color: var(--ink-2); min-width: 20px; text-align: center; }

/* ---------- forms / auth ---------- */
.sheet {
  max-width: 460px; margin: 4vh auto 0;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r-xl); padding: clamp(20px, 4vw, 32px);
  box-shadow: var(--shadow-2);
}
.sheet h1 { margin: 0 0 6px; font-size: 24px; font-weight: 900; }
.sheet .sub { color: var(--ink-2); font-size: 13.5px; margin-bottom: 18px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 800; color: var(--ink-2); margin-bottom: 6px; letter-spacing: .02em; }
.field input, .field select, .field textarea {
  width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line-strong); background: var(--bg-2); outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand-3); box-shadow: 0 0 0 3px rgba(139,92,246,.22);
}
.field .hint { font-size: 11.5px; color: var(--ink-3); margin-top: 5px; }
.field .hint.err { color: var(--bad); }
.field .hint.ok { color: var(--ok); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 14px; padding: 12px 18px; border: 1px solid var(--line-strong);
  background: var(--panel-2); color: var(--ink); font-weight: 800; width: 100%;
  transition: transform .12s ease, filter .12s ease, border-color .12s ease;
}
.btn:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.btn.primary { background: var(--brand-grad); border: 0; color: #fff; }
.btn.google { background: #fff; color: #1F2937; border: 0; }
.btn.ghost { background: transparent; }
.btn.danger { background: rgba(248,113,113,.12); color: var(--bad); border-color: rgba(248,113,113,.4); }
.btn:disabled { opacity: .5; transform: none; cursor: default; }
.btn-row { display: flex; gap: 10px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 11px; font-weight: 800; letter-spacing: .1em; margin: 16px 0; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.check-row { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; color: var(--ink-2); margin: 14px 0; }
.check-row input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--brand-3); }

/* ---------- misc ---------- */
.empty {
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-l);
  padding: 26px 18px; text-align: center; color: var(--ink-3); font-size: 13.5px;
}
.empty a { color: var(--brand-3); font-weight: 800; }
.note { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px 14px; font-size: 12.5px; color: var(--ink-2); }
.toast-wrap { position: fixed; bottom: calc(var(--tabbar-h) + 14px); left: 50%; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
@media (min-width: 980px) { .toast-wrap { bottom: 22px; } }
.toast {
  background: var(--panel-2); border: 1px solid var(--line-strong); color: var(--ink);
  border-radius: 999px; padding: 10px 18px; font-size: 13px; font-weight: 700;
  box-shadow: var(--shadow-2); animation: msgIn .2s ease;
}
.modal-bd { position: fixed; inset: 0; background: rgba(5,8,16,.66); backdrop-filter: blur(4px); z-index: 80; display: grid; place-items: center; padding: 18px; }
.modal { width: min(440px, 100%); background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--r-l); padding: 20px; box-shadow: var(--shadow-2); }
.modal h3 { margin: 0 0 10px; font-size: 17px; font-weight: 900; }
.skel { border-radius: var(--r-l); background: linear-gradient(100deg, var(--panel) 40%, var(--panel-2) 50%, var(--panel) 60%); background-size: 200% 100%; animation: skel 1.4s infinite; }
@keyframes skel { to { background-position: -200% 0; } }
.badge { font-size: 10px; font-weight: 800; letter-spacing: .08em; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line-strong); color: var(--ink-2); }
.badge.admin { background: var(--brand-grad); color: #fff; border: 0; }
.badge.hidden { background: rgba(248,113,113,.15); color: var(--bad); border-color: rgba(248,113,113,.4); }
.mono { font-family: ui-monospace, "Cascadia Mono", monospace; font-size: 12px; }
.list-plain { list-style: none; margin: 0; padding: 0; }

/* modlog */
.mod-entry { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--panel); margin-bottom: 8px; align-items: center; }
.mod-action { font-weight: 800; font-size: 12px; }
.mod-action.hide-thread, .mod-action.hide-reply, .mod-action.ban { color: var(--bad); }
.mod-action.unhide-thread, .mod-action.unhide-reply, .mod-action.unban { color: var(--ok); }

/* admin */
.admin-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.admin-bar button { font-size: 11px; font-weight: 800; border-radius: 999px; padding: 4px 12px; border: 1px solid var(--line-strong); background: var(--panel-2); color: var(--ink-2); }
.admin-bar button:hover { color: var(--ink); }

/* prose pages (terms/privacy/coc) */
.prose { max-width: 720px; }
.prose h1 { font-size: 26px; font-weight: 900; }
.prose h2 { font-size: 17px; font-weight: 800; margin-top: 26px; }
.prose p, .prose li { color: var(--ink-2); font-size: 14px; }


/* ---------- animated welcome gate ---------- */
.welcome {
  position: fixed; inset: 0; z-index: 100; overflow: hidden;
  display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(224,58,47,.22), transparent 60%),
    radial-gradient(700px 420px at 10% 110%, rgba(253,185,19,.22), transparent 55%),
    var(--bg);
}
.welcome::before, .welcome::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(70px); opacity: .5;
  animation: wFloat 9s ease-in-out infinite alternate;
}
.welcome::before { width: 420px; height: 420px; background: rgba(253,185,19,.24); top: -120px; left: -100px; }
.welcome::after  { width: 380px; height: 380px; background: rgba(139,92,246,.25); bottom: -120px; right: -80px; animation-delay: -4s; }
@keyframes wFloat { from { transform: translateY(-16px);} to { transform: translateY(20px);} }
.welcome-card { position: relative; z-index: 1; text-align: center; max-width: 480px; width: 100%; }
.welcome-mark {
  width: 92px; height: 92px; margin: 0 auto 20px; border-radius: 28px;
  display: grid; place-items: center; color: #fff;
  font-family: var(--font-kn); font-weight: 800; font-size: 40px;
  background: var(--brand-grad); background-size: 200% 200%;
  box-shadow: var(--glow);
  animation: wMark .8s cubic-bezier(.2,.9,.3,1.4) both, wSheen 5s ease infinite 1s;
}
@keyframes wMark { from { transform: scale(.4) rotate(-8deg); opacity: 0;} to { transform: none; opacity: 1;} }
@keyframes wSheen { 0%,100% { background-position: 0% 50%;} 50% { background-position: 100% 50%;} }
.welcome-kicker { font-size: 12px; font-weight: 800; letter-spacing: .14em; color: var(--brand-1);
  animation: wUp .6s ease .15s both; }
.welcome h1 { margin: 8px 0 10px; font-size: clamp(28px, 6vw, 40px); font-weight: 900; line-height: 1.1;
  animation: wUp .6s ease .28s both; }
.welcome h1 .grad { background: var(--brand-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.welcome p { color: var(--ink-2); font-size: 14.5px; margin: 0 0 26px; animation: wUp .6s ease .4s both; }
.welcome .btn-col { display: flex; flex-direction: column; gap: 10px; animation: wUp .6s ease .52s both; }
.welcome .flag-line { position: absolute; top: 0; left: 0; right: 0; height: 4px;
  background: linear-gradient(90deg, #FDB913 0 50%, #E03A2F 50% 100%); }
@keyframes wUp { from { opacity: 0; transform: translateY(14px);} to { opacity: 1; transform: none;} }

/* ============================================================
   Responsive hardening — phones, tablets, laptops, large screens
   ============================================================ */

/* Touch targets: comfortable minimums on coarse pointers */
@media (pointer: coarse) {
  .icon-btn { width: 42px; height: 42px; }
  .msg-actions button, .vote-pill button { padding: 8px 12px; }
  .rail-item { padding: 12px 10px; }
  .tab { min-height: 48px; }
}

/* Small phones (≤ 400px) */
@media (max-width: 400px) {
  body { font-size: 14px; }
  .brand-sub { display: none; }
  .brand-name { font-size: 15px; }
  .pill-me b { max-width: 74px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .grid-rooms { grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 9px; }
  .room-card { padding: 12px 11px; min-height: 96px; }
  .thread-card { grid-template-columns: 36px 1fr; }
  .tc-right { display: none; }
  .msg { grid-template-columns: 32px 1fr; }
  .msg.nested { margin-left: 22px; }
  .avatar { width: 26px; height: 26px; font-size: 10.5px; }
  .hero { padding: 18px 16px; border-radius: 18px; }
  .hero-stats { gap: 14px; }
  .sheet { padding: 18px 16px; margin-top: 2vh; }
  .welcome-mark { width: 76px; height: 76px; font-size: 32px; }
  .composer { bottom: calc(var(--tabbar-h) + 6px); }
}

/* Phablets / small tablets (401–740px) */
@media (min-width: 401px) and (max-width: 740px) {
  .msg.nested { margin-left: 30px; }
}

/* Tablets portrait (741–979px): still tabbar, roomier grids */
@media (min-width: 741px) and (max-width: 979px) {
  .grid-rooms { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .main { padding-left: clamp(20px, 4vw, 44px); padding-right: clamp(20px, 4vw, 44px); }
  .sheet { max-width: 520px; }
}

/* Landscape phones (short viewport): compact chrome */
@media (max-height: 480px) and (orientation: landscape) {
  :root { --appbar-h: 50px; --tabbar-h: 50px; }
  .welcome-mark { width: 58px; height: 58px; font-size: 24px; margin-bottom: 10px; }
  .welcome h1 { font-size: 24px; }
  .welcome p { margin-bottom: 14px; }
  .hero { padding: 14px 18px; }
}

/* Big desktops (≥1500px): wider canvas, larger rail */
@media (min-width: 1500px) {
  .frame { max-width: 1460px; }
  :root { --rail-w: 320px; }
  .grid-rooms { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

/* Ultrawide (≥1900px) */
@media (min-width: 1900px) {
  .frame { max-width: 1640px; }
  body { font-size: 16px; }
}

/* Very tall rail lists (31 committees): tighter items + sticky group titles */
@media (min-width: 980px) {
  .rail { scrollbar-width: thin; }
  .rail-title { position: sticky; top: -18px; background: var(--bg); z-index: 1; padding: 6px 10px; margin: 12px 0 4px; }
  .rail-item { padding: 7px 10px; font-size: 13.5px; }
}

/* Keyboard-open mobile: keep composer visible above keyboard (dvh-aware) */
@supports (height: 100dvh) {
  .welcome { min-height: 100dvh; }
}

/* Safe areas (notches) */
.appbar { padding-left: max(var(--pad), env(safe-area-inset-left)); padding-right: max(var(--pad), env(safe-area-inset-right)); }
.tabbar { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }

/* Print: prose pages readable */
@media print {
  .appbar, .tabbar, .rail, .composer, .toast-wrap { display: none !important; }
  body { background: #fff; color: #000; }
}
