:root {
  --ink: #101828;
  --muted: #667085;
  --line: #d9e1ec;
  --panel: #ffffff;
  --page: #f3f6fa;
  --nav: #152033;
  --nav-soft: #22324d;
  --accent: #0f766e;
  --green: #078653;
  --amber: #a15c00;
  --red: #be123c;
  --blue: #2563eb;
  --shadow: 0 16px 38px rgba(16, 24, 40, 0.08);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--page);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 326px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 18px;
  color: #fff;
  background:
    radial-gradient(circle at 22% 18%, rgba(255, 223, 161, 0.18) 0 1px, transparent 2px),
    radial-gradient(circle at 76% 31%, rgba(255, 255, 255, 0.22) 0 1px, transparent 2px),
    radial-gradient(circle at 44% 69%, rgba(255, 213, 130, 0.16) 0 1px, transparent 2px),
    linear-gradient(155deg, #5d0613 0%, #8c0b1a 38%, #bd1b2d 72%, #d63a42 100%);
  box-shadow:
    inset -1px 0 0 rgba(255, 255, 255, 0.12),
    inset 0 0 80px rgba(255, 214, 145, 0.1);
  isolation: isolate;
  overflow: hidden;
}

.sidebar::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  content: "";
  background-image:
    radial-gradient(circle, rgba(255, 229, 171, 0.34) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgba(255, 255, 255, 0.2) 0 1px, transparent 1.8px);
  background-position:
    12px 18px,
    42px 54px;
  background-size:
    92px 92px,
    128px 128px;
  opacity: 0.55;
  pointer-events: none;
  animation: sidebarSparkle 16s linear infinite;
}

.brand {
  position: relative;
  z-index: 1;
  min-height: calc(100vh - 56px);
  text-align: center;
}

.brand-name {
  position: absolute;
  top: 16px;
  right: 0;
  left: 0;
  font-family: "Segoe UI Variable Display", "Segoe UI", Inter, Arial, sans-serif;
  font-size: 48px;
  font-weight: 950;
  line-height: 0.95;
  letter-spacing: 0;
  color: #fff;
  text-shadow:
    0 2px 0 rgba(255, 217, 153, 0.2),
    0 12px 28px rgba(56, 0, 11, 0.45);
}

.brand-meme {
  position: absolute;
  top: 53%;
  left: 50%;
  display: block;
  width: min(304px, calc(100% - 8px));
  height: auto;
  max-height: min(46vh, 360px);
  object-fit: contain;
  transform: translate(-50%, -46%);
  filter:
    drop-shadow(0 0 8px rgba(255, 244, 219, 0.32))
    drop-shadow(0 22px 24px rgba(42, 0, 10, 0.38));
}

@keyframes sidebarSparkle {
  from {
    background-position:
      12px 18px,
      42px 54px;
  }

  to {
    background-position:
      104px 110px,
      170px 182px;
  }
}

.section-title h2,
h1,
h2,
h3,
p {
  margin: 0;
}

.main {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin-top: 5px;
  font-size: 32px;
  line-height: 1.15;
}

.status-wrap {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 12px;
  color: var(--muted);
  background: #fff;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #b8c1cf;
}

.live-dot.on {
  background: #16a34a;
  box-shadow: 0 0 0 5px rgba(22, 163, 74, 0.14);
}

.layer-view {
  display: none;
}

.layer-view.active {
  display: block;
}

.layer-switcher {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(150px, 1fr));
  gap: 6px;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 5px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(16, 24, 40, 0.06);
}

.layer-tab {
  display: grid;
  gap: 2px;
  min-height: 48px;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 7px 12px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.layer-tab strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.1;
}

.layer-tab span {
  font-size: 12px;
  font-weight: 800;
}

.layer-tab.active {
  border-color: color-mix(in srgb, var(--green) 32%, var(--line));
  color: var(--green);
  background: #e8f7ef;
}

[hidden],
.hidden,
.layer-view.hidden {
  display: none !important;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-top: 22px;
}

.facebook-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.formula-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  margin-top: 22px;
  border: 1px solid #d9b568;
  border-radius: var(--radius);
  padding: 14px;
  color: #fff;
  background:
    radial-gradient(circle at 12% 14%, rgba(255, 224, 158, 0.18), transparent 24%),
    linear-gradient(135deg, #111827 0%, #3c0710 48%, #8f121d 100%);
  box-shadow: 0 18px 40px rgba(45, 7, 13, 0.18);
}

.formula-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(255, 224, 158, 0.22);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.06);
}

.formula-panel .eyebrow {
  color: #f8d98d;
}

.formula-panel h2 {
  font-size: 25px;
  line-height: 1.1;
}

.hot-equation {
  display: grid;
  grid-template-columns: auto auto minmax(260px, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 118px;
  padding: 16px;
  border-radius: var(--radius);
  color: #111827;
  background: linear-gradient(180deg, #fff9ed, #fff2d7);
  box-shadow: inset 0 0 0 1px rgba(146, 93, 20, 0.18);
}

.equation-name {
  color: #7f1d1d;
  font-size: 24px;
  font-weight: 950;
  white-space: nowrap;
}

.equation-equals {
  color: #4b5563;
  font-size: 18px;
  font-weight: 900;
  white-space: nowrap;
}

.fraction {
  display: grid;
  gap: 7px;
  min-width: 0;
  text-align: center;
}

.numerator,
.denominator {
  color: #182235;
  font-size: 15px;
  font-weight: 800;
  line-height: 1.35;
}

.numerator b {
  color: #8f121d;
  font-weight: 950;
}

.denominator {
  color: #4b5563;
}

.fraction-line {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: #8f121d;
}

.formula-note {
  max-width: 760px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  line-height: 1.45;
}

.formula-legend {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(255, 224, 158, 0.22);
  border-radius: var(--radius);
  background: rgba(6, 10, 18, 0.28);
}

.formula-legend h3 {
  margin: 0 0 6px;
  color: #f8d98d;
  font-size: 13px;
  text-transform: uppercase;
}

.formula-legend p {
  margin: 0;
  color: rgba(255, 255, 255, 0.76);
  font-size: 12px;
  line-height: 1.4;
}

.score-scale {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.score-scale li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  padding: 6px 8px;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
}

.score-scale b {
  font-size: 12px;
}

.score-scale em {
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.scale-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #64748b;
}

.scale-dot.viral {
  background: #dc2626;
}

.scale-dot.hot {
  background: #ea580c;
}

.scale-dot.signal {
  background: #2563eb;
}

.scale-dot.normal {
  background: #64748b;
}

.scale-dot.trash {
  background: #94a3b8;
}

.metric,
.toolbar,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric {
  display: grid;
  gap: 9px;
  min-height: 98px;
  padding: 17px;
}

.metric span,
.muted {
  color: var(--muted);
}

.metric span {
  font-size: 13px;
  font-weight: 800;
}

.metric strong {
  font-size: 27px;
  line-height: 1.05;
}

.page-breakdown-card {
  gap: 8px;
}

.page-breakdown {
  display: grid;
  gap: 5px;
}

.page-count-row {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.page-count-row i {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--accent, #64748b);
}

.page-count-row b {
  overflow: hidden;
  color: var(--muted);
  font: inherit;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-count-row strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding: 14px;
  box-shadow: none;
}

.chip-row,
.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid color-mix(in srgb, var(--accent) 25%, var(--line));
  border-radius: 999px;
  padding: 0 11px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 9%, #fff);
  font-size: 13px;
  font-weight: 900;
}

.secondary-button,
.text-button {
  min-height: 40px;
  border-radius: var(--radius);
  padding: 0 13px;
  font-weight: 900;
}

.secondary-button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

.text-button {
  min-height: 28px;
  border: 0;
  color: var(--muted);
  background: transparent;
  padding: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
}

.badge.ready {
  color: var(--green);
  background: #e8f7ef;
}

.badge.warn {
  color: var(--amber);
  background: #fff4df;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-title h2 {
  font-size: 20px;
}

.section-title.compact h2 {
  font-size: 17px;
}

.facebook-list-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.search-field {
  display: grid;
  gap: 5px;
  min-width: min(320px, 45vw);
}

.search-field span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.search-field input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 800;
}

.search-field input::placeholder {
  color: #94a3b8;
}

.pagination-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
}

.pagination-bar button {
  min-width: 34px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
  font-weight: 900;
}

.pagination-bar button.active {
  border-color: var(--green);
  color: #fff;
  background: var(--green);
}

.pagination-bar button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.update-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: transparent;
  box-shadow: inset 0 0 0 1px transparent;
}

.update-dot.on {
  background: #16a34a;
  box-shadow: 0 0 0 3px #dcfce7;
}

.source-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 8px;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 11%, #fff);
}

.age-pill {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-left: 5px;
  border-radius: 999px;
  padding: 0 7px;
  color: #64748b;
  background: rgba(226, 232, 240, 0.7);
  font-size: 12px;
  font-weight: 900;
  vertical-align: middle;
}

.panel {
  padding: 16px;
  box-shadow: none;
}

.facebook-toolbar {
  align-items: flex-start;
}

.facebook-cookie-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.cookie-rescue {
  position: fixed;
  right: 18px;
  bottom: 18px;
  left: auto;
  z-index: 20;
  display: grid;
  gap: 10px;
  width: min(760px, calc(100vw - 36px));
  max-height: min(72vh, 520px);
  overflow: auto;
  border: 1px solid #f59e0b;
  border-radius: var(--radius);
  padding: 13px;
  background: #fff7ed;
  box-shadow: 0 10px 24px rgba(146, 64, 14, 0.1);
}

.cookie-rescue.hidden {
  display: none;
}

.cookie-rescue-copy {
  display: grid;
  gap: 3px;
}

.cookie-rescue-copy strong {
  color: #7c2d12;
  font-size: 14px;
}

.cookie-rescue-copy span {
  color: #9a3412;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.cookie-input {
  width: 100%;
  min-height: 82px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  color: var(--ink);
  background: #fff;
  font: 13px/1.4 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

.cookie-input:focus {
  outline: 2px solid color-mix(in srgb, var(--green) 28%, transparent);
  outline-offset: 1px;
}

.cookie-verify-block {
  display: grid;
  gap: 6px;
}

.cookie-verify-block > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.cookie-verify-block .cookie-input {
  min-height: 64px;
}

.cookie-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.primary-inline {
  border-color: color-mix(in srgb, var(--green) 28%, var(--line));
  color: #fff;
  background: var(--green);
}

.cookie-status.ready {
  color: var(--green);
  font-weight: 900;
}

.cookie-status.warn {
  color: var(--amber);
  font-weight: 900;
}

.mini-field.inline {
  min-width: 150px;
}

.mini-field.inline.compact-number {
  width: 150px;
  min-width: 150px;
}

.sort-segment {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 4px;
  background: #f8fafc;
}

.sort-option {
  min-height: 34px;
  border: 0;
  border-radius: calc(var(--radius) - 2px);
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  font-weight: 900;
}

.sort-option.active {
  color: #fff;
  background: var(--green);
}

.facebook-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin-top: 18px;
}

.facebook-layer-results,
.error-list {
  display: grid;
  gap: 10px;
  margin-top: 13px;
}

.scan-diagnostic {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid #fbbf24;
  border-radius: var(--radius);
  color: #7c2d12;
  background: #fff7ed;
  font-size: 13px;
}

.scan-diagnostic span {
  color: #9a3412;
}

.scan-diagnostic ul {
  margin: 0;
  padding-left: 18px;
  color: #7c2d12;
}

.mini-field {
  display: grid;
  gap: 6px;
}

.mini-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.mini-field select,
.mini-field input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  color: var(--ink);
  background: #fff;
}

.fb-post-item {
  --score: #64748b;
  --score-soft: #f8fafc;
  position: relative;
  display: grid;
  gap: 9px;
  padding: 13px;
  border: 1px solid color-mix(in srgb, var(--score) 24%, var(--line));
  border-left: 5px solid var(--score);
  border-radius: var(--radius);
  background: var(--score-soft);
}

.verify-warning {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 1;
  border-radius: 999px;
  padding: 4px 8px;
  color: #fff;
  background: #dc2626;
  font-size: 11px;
  font-weight: 900;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.24);
}

.fb-post-item.normal {
  --score: #64748b;
  --score-soft: #f8fafc;
}

.fb-post-item.trash {
  --score: #94a3b8;
  --score-soft: #f8fafc;
  opacity: 0.82;
}

.fb-post-item.signal {
  --score: #2563eb;
  --score-soft: #eff6ff;
}

.fb-post-item.hot {
  --score: #ea580c;
  --score-soft: #fff7ed;
}

.fb-post-item.viral {
  --score: #dc2626;
  --score-soft: #fef2f2;
}

.fb-post-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
}

.fb-post-head .update-dot {
  margin-right: 7px;
  vertical-align: middle;
}

.fb-post-head strong {
  display: block;
  margin-top: 7px;
  font-size: 14px;
  line-height: 1.32;
}

.hot-score {
  display: grid;
  place-items: center;
  min-width: 82px;
  min-height: 48px;
  border-radius: var(--radius);
  padding: 6px 9px;
  color: #fff;
  background: var(--score);
  line-height: 1;
}

.hot-score small {
  font-size: 10px;
  font-weight: 900;
}

.hot-score strong {
  margin-top: 3px;
  font-size: 18px;
  font-weight: 900;
}

.fb-post-item p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.fb-note {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  font-size: 12px;
  font-weight: 800;
}

.fb-note.warning {
  color: #b45309;
  background: #fff4df;
  border: 1px solid #fbbf24;
}

.fb-note.verify-note {
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #fca5a5;
}

.fb-note.metric-missing {
  min-height: 18px;
  padding: 0 7px;
  color: #b91c1c;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  font-size: 10px;
  letter-spacing: 0;
}

.fb-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 7px;
  margin: 0;
}

.fb-metrics div {
  display: grid;
  gap: 2px;
  padding: 8px;
  border-radius: var(--radius);
  background: #f6f8fb;
}

.fb-metrics .secondary-metric {
  background: #eef3f8;
}

.fb-metrics dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.fb-metrics dd {
  margin: 0;
  font-weight: 900;
}

.metric-previous {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
  opacity: 0.78;
}

.fb-post-item footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.fb-post-item footer a {
  color: var(--green);
  text-decoration: none;
}

.fb-post-item footer span:last-child {
  color: var(--muted);
}

.post-meta {
  min-width: 0;
}

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

.comment-detail-button {
  min-height: 32px;
  border-color: #bfdbfe;
  color: #1d4ed8;
  background: #eff6ff;
}

.comment-detail-button:hover {
  color: #fff;
  border-color: #2563eb;
  background: #2563eb;
}

.comment-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.52);
}

.comment-modal.hidden {
  display: none;
}

.modal-open {
  overflow: hidden;
}

.comment-dialog {
  width: min(780px, 100%);
  max-height: min(82vh, 760px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.comment-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.comment-dialog-head h2 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.comment-modal-body {
  max-height: calc(min(82vh, 760px) - 66px);
  overflow: auto;
  padding: 16px 18px 18px;
}

.comment-modal-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.comment-modal-meta a,
.comment-item a {
  color: var(--green);
  text-decoration: none;
}

.comment-list {
  display: grid;
  gap: 10px;
}

.comment-item {
  display: grid;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.comment-item:first-child {
  border-top: 0;
  padding-top: 0;
}

.comment-item-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.comment-item-head strong {
  color: var(--ink);
  font-size: 14px;
}

.comment-item-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.comment-item p {
  margin: 0;
  color: var(--ink);
  line-height: 1.55;
}

.comment-diagnostics {
  display: grid;
  gap: 6px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
}

.comment-diagnostics p {
  margin: 0;
}

.dream-refresh-button {
  min-height: 30px;
  border: 1px solid #c4b5fd;
  border-radius: 999px;
  padding: 0 11px;
  color: #5b21b6;
  background: #f3e8ff;
  font-size: 12px;
  font-weight: 900;
  box-shadow: 0 6px 14px rgba(124, 58, 237, 0.12);
}

.dream-refresh-button:hover:not(:disabled) {
  color: #fff;
  background: #8b5cf6;
  border-color: #8b5cf6;
}

.dream-refresh-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.refresh-limited-note {
  color: #9a3412;
  font-size: 11px;
  font-weight: 900;
}

.error-list p {
  display: grid;
  gap: 3px;
  color: var(--red);
  font-size: 13px;
}

.error-list span {
  color: var(--muted);
}

.loading {
  padding: 18px;
  color: var(--muted);
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    min-height: 0;
  }

  .brand {
    min-height: 430px;
  }

  .brand-meme {
    width: min(300px, calc(100% - 24px));
    max-height: 310px;
  }

}

@media (max-width: 780px) {
  body {
    background: #f6f8fb;
  }

  .main,
  .sidebar {
    padding: 14px;
  }

  .main {
    padding-top: 12px;
  }

  .sidebar {
    overflow: visible;
    border-bottom: 1px solid rgba(255, 255, 255, 0.16);
  }

  .brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    gap: 14px;
    text-align: left;
  }

  .brand-name,
  .brand-meme {
    position: static;
    transform: none;
  }

  .topbar,
  .toolbar,
  .section-title {
    display: grid;
    gap: 12px;
  }

  .topbar {
    align-items: stretch;
  }

  h1 {
    font-size: 24px;
    line-height: 1.18;
  }

  .status-wrap {
    width: fit-content;
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }

  .layer-switcher {
    width: 100%;
    grid-template-columns: 1fr 1fr;
    margin-top: 14px;
  }

  .layer-tab {
    min-height: 46px;
    padding: 7px 9px;
  }

  .brand-name {
    font-size: 34px;
  }

  .brand-meme {
    width: 92px;
    max-height: 64px;
    filter:
      drop-shadow(0 0 5px rgba(255, 244, 219, 0.28))
      drop-shadow(0 10px 12px rgba(42, 0, 10, 0.3));
  }

  .facebook-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 14px;
  }

  .metric {
    min-height: 82px;
    padding: 12px;
  }

  .metric span {
    font-size: 12px;
  }

  .metric strong {
    font-size: 23px;
  }

  .page-breakdown-card {
    grid-column: 1 / -1;
  }

  .sort-segment,
  .toolbar-actions,
  .facebook-list-tools,
  .search-field {
    width: 100%;
  }

  .sort-option,
  .mini-field.inline {
    min-width: 0;
  }

  .toolbar {
    margin-top: 12px;
    padding: 12px;
  }

  .chip-row {
    gap: 7px;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  .chip {
    flex: 0 0 auto;
    min-height: 28px;
    padding: 0 9px;
    font-size: 12px;
  }

  .toolbar-actions {
    display: grid;
    grid-template-columns: 1fr 118px;
    align-items: end;
    gap: 10px;
  }

  .mini-field.inline.compact-number {
    width: 100%;
    min-width: 0;
  }

  .sort-segment {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: 1fr 1fr;
  }

  .secondary-button {
    grid-column: 1 / -1;
    min-height: 44px;
  }

  .badge {
    justify-self: start;
  }

  .formula-panel {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 14px;
    padding: 10px;
  }

  .formula-card,
  .formula-legend {
    padding: 12px;
  }

  .formula-panel h2 {
    font-size: 20px;
  }

  .hot-equation {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 13px;
    text-align: center;
  }

  .equation-name {
    font-size: 22px;
  }

  .numerator,
  .denominator {
    font-size: 13px;
  }

  .formula-note,
  .formula-legend p {
    font-size: 12px;
  }

  .score-scale {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 12px;
  }

  .section-title.compact h2 {
    font-size: 16px;
  }

  .facebook-list-tools {
    justify-content: stretch;
  }

  .search-field {
    min-width: 0;
  }

  .search-field input,
  .cookie-input,
  .mini-field select,
  .mini-field input {
    min-height: 42px;
  }

  .cookie-rescue {
    right: 10px;
    bottom: 10px;
    left: 10px;
    width: auto;
    max-height: 72vh;
    padding: 11px;
  }

  .cookie-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: stretch;
  }

  .cookie-actions .cookie-status {
    grid-column: 1 / -1;
  }

  .pagination-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .pagination-bar button {
    flex: 0 0 auto;
  }

  .facebook-layer-results {
    gap: 8px;
  }

  .fb-post-item {
    gap: 7px;
    padding: 9px 10px 10px;
    border-left-width: 3px;
    box-shadow: 0 5px 18px rgba(15, 23, 42, 0.06);
  }

  .verify-warning {
    position: static;
    width: fit-content;
    order: -1;
    padding: 2px 7px;
    font-size: 10px;
  }

  .fb-post-head {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 8px;
  }

  .source-pill {
    min-height: 24px;
    padding: 0 10px;
    font-size: 13px;
  }

  .age-pill {
    min-height: 21px;
    padding: 0 7px;
    font-size: 11px;
  }

  .fb-post-head strong {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    margin-top: 6px;
    font-size: 15px;
    line-height: 1.24;
  }

  .hot-score {
    min-width: 62px;
    min-height: 44px;
    padding: 5px 7px;
    border-radius: 10px;
  }

  .hot-score small {
    font-size: 9px;
  }

  .hot-score strong {
    margin-top: 2px;
    font-size: 17px;
  }

  .fb-post-item p {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    margin: 0;
    font-size: 12px;
    line-height: 1.32;
  }

  .fb-note {
    min-height: 20px;
    padding: 0 7px;
    font-size: 10px;
  }

  .fb-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
  }

  .fb-metrics div {
    gap: 1px;
    min-width: 0;
    padding: 6px 7px;
    border-radius: 9px;
  }

  .fb-metrics dt {
    overflow: hidden;
    font-size: 10px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .fb-metrics dd {
    font-size: 16px;
    line-height: 1.1;
  }

  .metric-previous {
    display: none;
  }

  .fb-post-item footer,
  .post-actions {
    display: grid;
    justify-content: stretch;
    width: 100%;
  }

  .fb-post-item footer {
    gap: 6px;
    font-size: 11px;
    line-height: 1.25;
  }

  .post-meta {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .post-actions {
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 6px;
  }

  .post-actions > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .dream-refresh-button {
    min-height: 30px;
    padding: 0 12px;
  }
}

@media (max-width: 430px) {
  .main,
  .sidebar {
    padding-right: 10px;
    padding-left: 10px;
  }

  h1 {
    font-size: 21px;
  }

  .brand-name {
    font-size: 30px;
  }

  .brand-meme {
    width: 82px;
    max-height: 58px;
  }

  .facebook-summary {
    grid-template-columns: 1fr 1fr;
  }

  .toolbar-actions {
    grid-template-columns: 1fr;
  }

  .sort-segment,
  .secondary-button {
    grid-column: auto;
  }

  .facebook-layer-results {
    gap: 9px;
  }

  .fb-post-item {
    padding: 8px 9px 9px;
  }

  .fb-post-head {
    gap: 7px;
  }

  .fb-post-head strong {
    font-size: 14px;
  }

  .hot-score {
    min-width: 58px;
  }

  .fb-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .fb-metrics div {
    padding: 6px 5px;
  }

  .fb-metrics dd {
    font-size: 15px;
  }

  .post-actions {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .dream-refresh-button {
    width: auto;
  }
}

/* HOT-news web push toggle */
.topbar-right {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.push-toggle {
  min-height: 36px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 0.01em;
  background: linear-gradient(135deg, #8c0b1a 0%, #bd1b2d 60%, #d63a42 100%);
  box-shadow: 0 8px 20px rgba(141, 11, 26, 0.28);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.push-toggle:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px rgba(141, 11, 26, 0.36);
  filter: brightness(1.04);
}

.push-toggle:active:not(:disabled) {
  transform: translateY(0);
}

.push-toggle[data-state="on"] {
  background: linear-gradient(135deg, #0f766e 0%, #12907f 100%);
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.26);
}

.push-toggle[data-state="denied"],
.push-toggle[data-state="unsupported"] {
  background: #eef2f7;
  color: var(--muted);
  box-shadow: none;
}

.push-toggle:disabled {
  cursor: default;
  opacity: 0.9;
}

/* Deep-link focus highlight (mở bài từ Telegram) */
.fb-post-item.focus-flash {
  animation: finnewsFocusFlash 4.5s ease-out;
  scroll-margin-top: 24px;
}
@keyframes finnewsFocusFlash {
  0%   { box-shadow: 0 0 0 3px rgba(189, 27, 45, 0.0); background: transparent; }
  12%  { box-shadow: 0 0 0 3px rgba(189, 27, 45, 0.85); background: rgba(214, 58, 66, 0.10); }
  70%  { box-shadow: 0 0 0 3px rgba(189, 27, 45, 0.55); background: rgba(214, 58, 66, 0.06); }
  100% { box-shadow: 0 0 0 3px rgba(189, 27, 45, 0.0); background: transparent; }
}
