:root {
  --qatar: #8a1538;
  --qatar-dark: #65102a;
  --qatar-soft: #f8eef2;
  --ink: #161417;
  --muted: #6f6870;
  --line: #e7e1e4;
  --panel: #ffffff;
  --canvas: #f6f4f5;
  --soft: #f1edef;
  --green: #178754;
  --shadow: 0 10px 30px rgba(63, 21, 37, 0.08);
  --radius: 18px;
  --max: 1420px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Inter, "Segoe UI", Tahoma, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(138, 21, 56, .18);
  outline-offset: 2px;
}
.hidden { display: none !important; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 68px;
  background: rgba(255,255,255,.94);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--max);
  height: 100%;
  margin: 0 auto;
  padding: 0 22px;
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(260px, 640px) 1fr;
  align-items: center;
  gap: 22px;
}
.brand {
  border: 0;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
  color: inherit;
  justify-self: start;
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: var(--qatar);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 21px;
  box-shadow: 0 7px 18px rgba(138,21,56,.22);
}
.brand-name { font-size: 20px; font-weight: 800; letter-spacing: -.6px; }
.brand-name span { color: var(--qatar); }

.search-wrap {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8f6f7;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  transition: .2s ease;
}
.search-wrap:focus-within {
  background: white;
  border-color: rgba(138,21,56,.45);
  box-shadow: 0 0 0 4px rgba(138,21,56,.07);
}
.search-icon { font-size: 22px; color: #7f777c; transform: rotate(-15deg); }
.search-wrap input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}
.search-wrap kbd {
  border: 1px solid #ddd6da;
  background: white;
  color: #888084;
  border-radius: 6px;
  min-width: 23px;
  height: 23px;
  display: grid;
  place-items: center;
  font-size: 12px;
}

.top-actions { display: flex; align-items: center; justify-content: flex-end; gap: 9px; }
#loginBtn {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#loginBtn.authenticated {
  color: var(--qatar);
  border-color: rgba(138,21,56,.28);
  background: var(--qatar-soft);
}

.primary-btn, .ghost-btn, .soft-btn, .lang-switch {
  border-radius: 999px;
  height: 40px;
  padding: 0 16px;
  font-weight: 750;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.primary-btn {
  background: var(--qatar);
  color: white;
  border-color: var(--qatar);
  box-shadow: 0 6px 16px rgba(138,21,56,.16);
}
.primary-btn:hover { background: var(--qatar-dark); transform: translateY(-1px); }
.primary-btn.large { height: 46px; padding-inline: 22px; }
.ghost-btn { background: white; border-color: var(--line); color: var(--ink); }
.ghost-btn:hover { border-color: #cfc5ca; background: #fbfafb; }
.soft-btn { background: var(--qatar-soft); color: var(--qatar); border-color: transparent; }
.soft-btn:hover { background: #f1e0e6; }
.lang-switch {
  width: 46px;
  padding: 0;
  background: white;
  border-color: var(--line);
  color: var(--qatar);
}
.btn-plus { font-size: 18px; line-height: 1; }

.shell {
  max-width: var(--max);
  margin: 0 auto;
  padding: 22px;
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr) 300px;
  gap: 22px;
  align-items: start;
}
.left-rail, .right-rail { position: sticky; top: 90px; }
.rail-nav {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.rail-link {
  width: 100%;
  height: 44px;
  border: 0;
  background: transparent;
  border-radius: 11px;
  padding: 0 13px;
  display: flex;
  align-items: center;
  gap: 11px;
  color: #4c4549;
  font-weight: 650;
  text-align: start;
}
.rail-link span:first-child { width: 23px; text-align: center; font-size: 20px; color: #7c7378; }
.rail-link:hover { background: #eee9eb; }
.rail-link.active { background: #efe4e8; color: var(--qatar); }
.rail-link.active span:first-child { color: var(--qatar); }

.rail-section { padding-top: 18px; }
.rail-heading {
  padding: 0 13px 9px;
  font-size: 12px;
  font-weight: 800;
  color: #91888d;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.topics-list { display: grid; gap: 3px; }
.topic-link {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 8px 12px;
  border-radius: 10px;
  display: grid;
  grid-template-columns: 27px 1fr auto;
  align-items: center;
  gap: 8px;
  color: #514a4e;
  text-align: start;
}
.topic-link:hover, .topic-link.active { background: #eee9eb; color: var(--qatar); }
.topic-icon { font-size: 17px; }
.topic-count { font-size: 11px; color: #a1979c; }
.rail-footer {
  margin-top: 20px;
  padding: 16px 13px 0;
  border-top: 1px solid var(--line);
  color: #9c9398;
  font-size: 11px;
  line-height: 1.7;
  display: grid;
}

.main-feed { min-width: 0; }
.welcome-card {
  position: relative;
  overflow: hidden;
  min-height: 210px;
  border-radius: 24px;
  padding: 30px 32px;
  background:
    radial-gradient(circle at 85% 15%, rgba(255,255,255,.18), transparent 24%),
    linear-gradient(135deg, #6d102d 0%, #8a1538 54%, #a41c46 100%);
  color: white;
  box-shadow: 0 15px 34px rgba(83, 13, 34, .18);
  display: flex;
  align-items: center;
}
.welcome-copy { position: relative; z-index: 2; max-width: 600px; }
.eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
  opacity: .9;
  text-transform: uppercase;
}
.flag-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 0 0 3px rgba(255,255,255,.14);
}
.welcome-card h1 {
  margin: 10px 0 8px;
  font-size: clamp(27px, 4vw, 39px);
  line-height: 1.15;
  letter-spacing: -.8px;
}
.welcome-card p { margin: 0; max-width: 560px; color: rgba(255,255,255,.86); font-size: 15px; line-height: 1.75; }
.welcome-actions { margin-top: 20px; display: flex; gap: 9px; }
.welcome-card .primary-btn { background: white; color: var(--qatar); border-color: white; box-shadow: none; }
.welcome-card .primary-btn:hover { background: #fbf4f6; }
.welcome-card .soft-btn { background: rgba(255,255,255,.12); color: white; border: 1px solid rgba(255,255,255,.22); }
.welcome-card .soft-btn:hover { background: rgba(255,255,255,.19); }
.welcome-art { position: absolute; inset-inline-end: 20px; top: 0; width: 210px; height: 100%; opacity: .92; }
.answer-bubble {
  position: absolute;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22);
  backdrop-filter: blur(8px);
  color: white;
  font-weight: 900;
  box-shadow: 0 14px 28px rgba(48, 4, 18, .12);
}
.bubble-one { width: 90px; height: 90px; border-radius: 28px 28px 8px 28px; top: 37px; inset-inline-end: 20px; font-size: 38px; transform: rotate(7deg); }
.bubble-two { width: 62px; height: 62px; border-radius: 20px 20px 20px 6px; top: 115px; inset-inline-end: 112px; font-size: 25px; transform: rotate(-7deg); }
.bubble-three { width: 45px; height: 45px; border-radius: 50%; top: 22px; inset-inline-end: 132px; font-size: 18px; }

.feed-toolbar {
  padding: 25px 4px 13px;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
}
.feed-toolbar h2 { margin: 0; font-size: 21px; letter-spacing: -.3px; }
.feed-subtitle { color: var(--muted); font-size: 13px; margin-top: 4px; }
.sort-pills { display: flex; gap: 5px; padding: 4px; background: #ece8ea; border-radius: 999px; }
.sort-pill {
  height: 32px;
  min-width: 54px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #756e72;
  font-size: 12px;
  font-weight: 750;
}
.sort-pill.active { background: white; color: var(--qatar); box-shadow: 0 2px 8px rgba(0,0,0,.06); }

.active-filter {
  margin-bottom: 10px;
  border: 1px solid #ead8df;
  background: #fbf4f6;
  color: var(--qatar);
  border-radius: 12px;
  min-height: 40px;
  padding: 7px 11px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 700;
}
.active-filter button { border: 0; background: transparent; color: var(--qatar); font-size: 18px; }

.feed { display: grid; gap: 10px; }
.post-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.post-card:hover {
  border-color: #d8cdd2;
  box-shadow: 0 10px 25px rgba(71,30,45,.055);
  transform: translateY(-1px);
}
.vote-column {
  background: #faf8f9;
  border-inline-end: 1px solid #f0ecee;
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.vote-btn {
  width: 34px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #91898d;
  display: grid;
  place-items: center;
  font-size: 18px;
}
.vote-btn:hover { background: #eee8ea; color: var(--qatar); }
.vote-btn.selected { color: var(--qatar); background: #f4e6eb; }
.vote-btn.down.selected { color: #315c99; background: #e8eef7; }
.vote-score { font-weight: 850; font-size: 13px; color: #3f393d; padding: 3px 0; }
.post-content { padding: 15px 16px 13px; min-width: 0; }
.post-meta {
  color: #8a8186;
  font-size: 11.5px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.topic-badge {
  border-radius: 999px;
  background: var(--qatar-soft);
  color: var(--qatar);
  font-weight: 750;
  padding: 3px 8px;
}
.author { color: #5c5559; font-weight: 700; }
.post-title {
  margin: 8px 0 6px;
  font-size: 18px;
  line-height: 1.42;
  letter-spacing: -.2px;
  cursor: pointer;
}
.post-title:hover { color: var(--qatar); }
.post-title-link { color: inherit; text-decoration: none; }
.post-title-link:visited { color: inherit; }
.post-excerpt { color: #676065; font-size: 13.5px; line-height: 1.7; margin: 0; }
.post-actions {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.post-action {
  border: 0;
  background: transparent;
  color: #756d72;
  border-radius: 9px;
  padding: 6px 9px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
}
.post-action:hover { background: #f4f1f2; color: var(--qatar); }
.post-action.selected { color: var(--qatar); background: var(--qatar-soft); }
.post-action:disabled { opacity: .55; cursor: wait; }
.accepted-mark { color: var(--green); font-weight: 800; }

.side-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 13px;
  box-shadow: 0 6px 18px rgba(57,23,35,.035);
}
.side-card-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 850; margin-bottom: 12px; }
.pulse-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--qatar); box-shadow: 0 0 0 4px var(--qatar-soft); }
.trending-list { display: grid; gap: 4px; }
.trending-item {
  border: 0;
  background: transparent;
  padding: 10px 8px;
  border-radius: 10px;
  text-align: start;
  display: grid;
  gap: 3px;
}
.trending-item:hover { background: #f7f3f5; }
.trending-rank { color: #a49ba0; font-size: 10px; font-weight: 800; }
.trending-title { color: #3f393c; font-size: 13px; font-weight: 750; line-height: 1.4; }
.trending-count { color: #9a9196; font-size: 10px; }
.about-card p { color: var(--muted); font-size: 12.5px; line-height: 1.7; margin: 0; }
.mini-stats { margin-top: 13px; display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.mini-stats div { background: #f8f5f6; border-radius: 10px; padding: 9px; display: grid; gap: 2px; }
.mini-stats strong { font-size: 11px; color: var(--qatar); }
.mini-stats span { font-size: 10px; color: #8f858a; }
.rules-card ol { margin: 0; padding-inline-start: 20px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.rules-card li + li { margin-top: 5px; }

.empty-state { text-align: center; background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: 42px 20px; }
.empty-icon { width: 52px; height: 52px; margin: 0 auto 10px; border-radius: 16px; background: var(--qatar-soft); color: var(--qatar); display: grid; place-items: center; font-size: 28px; }
.empty-state h3 { margin: 8px 0 6px; }
.empty-state p { color: var(--muted); margin: 0 0 16px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  padding: 22px;
  background: rgba(23,13,17,.5);
  backdrop-filter: blur(7px);
  display: grid;
  place-items: center;
}
.modal {
  width: min(620px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  background: white;
  border-radius: 22px;
  box-shadow: 0 28px 80px rgba(27,7,14,.25);
  padding: 22px;
}
.small-modal { width: min(440px, 100%); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 18px; }
.modal-header .eyebrow { color: var(--qatar); }
.modal-header h2 { margin: 4px 0 0; font-size: 24px; }
.icon-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: white;
  color: #686064;
  font-size: 24px;
  display: grid;
  place-items: center;
}
.field { display: grid; gap: 7px; margin-bottom: 15px; color: #51494e; font-size: 12px; font-weight: 750; }
.field input, .field textarea, .field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbfafb;
  padding: 11px 12px;
  outline: 0;
  color: var(--ink);
  resize: vertical;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: rgba(138,21,56,.55); background: white; box-shadow: 0 0 0 4px rgba(138,21,56,.06); }
.field small { color: #a49a9f; justify-self: end; font-weight: 500; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #655d61; }
.check-row input { accent-color: var(--qatar); }
.modal-actions { margin-top: 20px; display: flex; justify-content: flex-end; gap: 8px; }
.login-options { display: grid; gap: 9px; }
.provider-btn {
  height: 46px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: #40393d;
  font-weight: 750;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.provider-btn:hover { background: #faf8f9; border-color: #d4cbd0; }
.provider-icon { width: 25px; height: 25px; border-radius: 8px; background: #f1edef; display: grid; place-items: center; color: var(--qatar); font-weight: 900; }
.provider-icon.apple { color: #111; }
.divider { position: relative; text-align: center; color: #999095; font-size: 11px; margin: 4px 0; }
.divider::before { content: ""; position: absolute; top: 50%; inset-inline: 0; height: 1px; background: var(--line); }
.divider span { position: relative; background: white; padding: 0 10px; }
.modal-note { color: #93898f; font-size: 11px; line-height: 1.6; margin: 13px 0 0; text-align: center; }

.answer-modal {
  width: min(720px, 100%);
}

.answer-question-body {
  color: #5f575c;
  line-height: 1.75;
  font-size: 14px;
  padding: 0 0 16px;
  border-bottom: 1px solid var(--line);
  white-space: pre-wrap;
}

.answer-section-heading {
  padding: 17px 0 9px;
  font-size: 14px;
}

.answers-list {
  display: grid;
  gap: 10px;
  max-height: 38vh;
  overflow: auto;
  padding-bottom: 8px;
}

.answer-item {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fbf9fa;
  padding: 13px 14px;
}

.answer-item-meta {
  color: #8b8287;
  font-size: 11px;
  margin-bottom: 7px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.answer-item-body {
  color: #40393d;
  font-size: 13.5px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.answer-empty {
  padding: 18px;
  border: 1px dashed #ddd3d8;
  border-radius: 13px;
  color: #8d8388;
  text-align: center;
  font-size: 12.5px;
}


.answer-item-actions {
  display: flex;
  align-items: center;
  margin-top: 8px;
}

.reply-toggle,
.reply-cancel {
  border: 0;
  background: transparent;
  color: var(--qatar);
  padding: 5px 2px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
}

.reply-toggle:hover,
.reply-cancel:hover {
  text-decoration: underline;
}

.reply-count {
  color: #8b8287;
  font-weight: 700;
}

.answer-replies {
  margin-top: 9px;
  margin-inline-start: 18px;
  padding-inline-start: 12px;
  border-inline-start: 2px solid #eadde3;
  display: grid;
  gap: 7px;
}

.reply-item {
  background: #fff;
  border: 1px solid #eee6ea;
  border-radius: 11px;
  padding: 9px 11px;
}

.reply-meta {
  color: #8b8287;
  font-size: 10.5px;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
}

.reply-body {
  color: #494146;
  font-size: 12.5px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.reply-composer {
  margin-top: 9px;
  margin-inline-start: 18px;
  padding: 10px;
  border: 1px solid #eadde3;
  border-radius: 12px;
  background: #fff;
}

.reply-textarea {
  width: 100%;
  resize: vertical;
  min-height: 68px;
  border: 1px solid #ddd3d8;
  border-radius: 10px;
  padding: 10px 11px;
  font: inherit;
  font-size: 12.5px;
  line-height: 1.6;
  outline: none;
}

.reply-textarea:focus {
  border-color: var(--qatar);
  box-shadow: 0 0 0 3px rgba(138, 21, 56, .08);
}

.reply-composer-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.reply-composer-actions .primary-btn {
  padding: 8px 12px;
  font-size: 11.5px;
}

.answer-form {
  margin-top: 14px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.toast {
  position: fixed;
  z-index: 200;
  inset-inline-start: 50%;
  bottom: 24px;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  background: #211a1e;
  color: white;
  border-radius: 999px;
  padding: 11px 17px;
  box-shadow: 0 14px 36px rgba(0,0,0,.2);
  font-size: 12px;
  font-weight: 700;
  transition: .22s ease;
}
[dir="rtl"] .toast { transform: translate(50%, 20px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
[dir="rtl"] .toast.show { transform: translate(50%, 0); }

.mobile-topic-filter {
  display: none;
}

.mobile-topic-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 2px 8px;
  font-size: 12px;
  font-weight: 800;
  color: #6f6870;
}

.mobile-filter-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.mobile-clear-topic {
  border: 0;
  background: transparent;
  color: var(--qatar);
  font-size: 12px;
  font-weight: 800;
  padding: 4px 0;
}

.mobile-topics-list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 10px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}

.mobile-topics-list::-webkit-scrollbar {
  display: none;
}

.mobile-topic-chip {
  flex: 0 0 auto;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: #544d51;
  padding: 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
  scroll-snap-align: start;
  box-shadow: 0 3px 10px rgba(57,23,35,.035);
}

.mobile-topic-chip .mobile-topic-count {
  color: #9b9297;
  font-size: 10px;
}

.mobile-topic-chip.active {
  border-color: var(--qatar);
  background: var(--qatar);
  color: white;
  box-shadow: 0 6px 16px rgba(138,21,56,.16);
}

.mobile-topic-chip.active .mobile-topic-count {
  color: rgba(255,255,255,.8);
}

.mobile-ask {
  display: none;
  position: fixed;
  z-index: 45;
  inset-inline-end: 18px;
  bottom: 18px;
  width: 54px;
  height: 54px;
  border: 0;
  border-radius: 18px;
  background: var(--qatar);
  color: white;
  font-size: 26px;
  box-shadow: 0 12px 28px rgba(138,21,56,.28);
}

html[dir="rtl"] .brand { justify-self: end; }
html[dir="rtl"] .post-meta,
html[dir="rtl"] .post-actions,
html[dir="rtl"] .welcome-actions { direction: rtl; }
html[dir="ltr"] .post-meta,
html[dir="ltr"] .post-actions,
html[dir="ltr"] .welcome-actions { direction: ltr; }

@media (max-width: 1160px) {
  .shell { grid-template-columns: 205px minmax(0, 1fr); }
  .right-rail { display: none; }
  .topbar-inner { grid-template-columns: 200px minmax(220px, 1fr) auto; }
}
@media (max-width: 820px) {
  .topbar { height: auto; }
  .topbar-inner {
    min-height: 64px;
    padding: 10px 14px;
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand actions"
      "search search";
    gap: 9px 12px;
  }
  .brand { grid-area: brand; }
  .search-wrap { grid-area: search; }
  .top-actions { grid-area: actions; }
  .desktop-only, #askTopBtn { display: none; }
  #loginBtn {
    display: inline-flex;
    height: 36px;
    max-width: 92px;
    padding: 0 10px;
    font-size: 11.5px;
  }
  .shell { display: block; padding: 14px; }
  .left-rail { display: none; }
  .mobile-topic-filter { display: block; margin: -2px 0 6px; }
  .welcome-card { min-height: 195px; padding: 25px 22px; }
  .welcome-art { opacity: .35; inset-inline-end: -30px; }
  .welcome-copy { max-width: 90%; }
  .mobile-ask { display: grid; place-items: center; }
  .feed-toolbar { padding-top: 20px; }
}
@media (max-width: 540px) {
  .brand-name { font-size: 17px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 10px; font-size: 19px; }
  .lang-switch { width: 42px; height: 36px; }
  .welcome-card { border-radius: 19px; padding: 22px 18px; }
  .welcome-card h1 { font-size: 27px; }
  .welcome-card p { font-size: 13px; }
  .welcome-actions { flex-wrap: wrap; }
  .feed-toolbar { align-items: flex-start; flex-direction: column; }
  .sort-pills { width: 100%; }
  .sort-pill { flex: 1; }
  .post-card { grid-template-columns: 46px minmax(0,1fr); border-radius: 15px; }
  .vote-column { padding-inline: 4px; }
  .post-content { padding: 13px 12px 11px; }
  .post-title { font-size: 16px; }
  .post-excerpt { font-size: 12.5px; }
  .modal-backdrop { padding: 10px; align-items: end; }
  .modal { border-radius: 20px 20px 12px 12px; max-height: 90vh; padding: 18px; }
}

.mobile-clear-topic.active,
#mobileMyQuestions.active,
#mobileSavedQuestions.active {
  color: white;
  background: var(--qatar);
  border-radius: 999px;
  padding: 6px 10px;
}

.email-auth-panel { margin-top: 4px; }
.email-auth-back,
.email-change-btn {
  border: 0;
  background: transparent;
  color: var(--qatar);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  padding: 6px 0;
}
.email-auth-form {
  display: grid;
  gap: 12px;
  margin-top: 10px;
}
.email-auth-form label {
  display: grid;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  color: #5f565b;
}
.email-auth-form input {
  width: 100%;
  border: 1px solid #ddd3d8;
  border-radius: 12px;
  padding: 12px 13px;
  font: inherit;
  font-size: 14px;
  outline: none;
}
.email-auth-form input:focus {
  border-color: var(--qatar);
  box-shadow: 0 0 0 3px rgba(138,21,56,.08);
}
.email-sent-line {
  font-size: 12px;
  color: #6f6870;
  word-break: break-word;
}
#emailCodeInput {
  letter-spacing: 7px;
  font-size: 22px;
  font-weight: 800;
  text-align: center;
}

.chat-top-btn {
  position: relative;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.chat-top-icon { font-size: 15px; line-height: 1; }
.chat-top-unread {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--qatar);
  color: white;
  font-size: 9px;
  font-weight: 900;
}
@media (max-width: 980px) {
  .chat-top-label { display: none; }
  .chat-top-btn { padding-inline: 9px; }
}
