/* Theme preferences are shared by all pages that use the top bar. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #171817;
  --surface: #202220;
  --surface-muted: #2a2c29;
  --field: #252725;
  --text: #f2f2ef;
  --text-soft: #b2b6b0;
  --border: #3b3e3a;
  --border-strong: #646861;
  --link: #92cfb4;
  --accent: #ee928c;
  --green: #80bf9e;
  --amber: #dbb779;
  --type-post: #8cbdff;
  --type-video: #c3a5ef;
  --type-comment: #89d2c1;
  --sentiment-neutral: #edcf65;
  --shadow: 0 2px 16px rgba(0, 0, 0, .12);
}

/* Shared navigation: keep every action readable at every viewport size. */
.topbar .top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
}

.topbar .top-actions > :is(a, button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  gap: 7px;
  width: auto;
  min-width: 0;
  height: 40px;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .18s ease, border-color .18s ease, color .18s ease;
}

.topbar .top-actions > :is(a, button) > span { display: inline; }
.topbar .top-actions > :is(a, button) > svg {
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  stroke-width: 1.75;
}
.topbar .top-actions > :is(a, button):hover:not(:disabled) {
  background: var(--surface-muted);
  border-color: var(--border);
  color: var(--text);
  transform: none;
}
.topbar .top-actions > :is(a, button):focus-visible {
  outline: 2px solid var(--link, var(--blue));
  outline-offset: 3px;
}
.topbar .top-actions > .primary-action {
  padding-inline: 15px;
  background: var(--text);
  border-color: var(--text);
  color: var(--surface);
  font-weight: 650;
}
.topbar .top-actions > .primary-action:hover:not(:disabled) {
  background: color-mix(in srgb, var(--text) 85%, var(--surface));
  border-color: transparent;
  color: var(--surface);
}
.topbar .top-actions > .primary-action > svg { fill: currentColor; }
.topbar .top-actions > :disabled { opacity: .55; cursor: wait; }
.topbar .top-actions > .primary-action:disabled {
  background: var(--surface-muted);
  border-color: var(--border);
  color: var(--text-soft);
}

@media (max-width: 1100px) {
  .topbar { flex-wrap: wrap; gap: 12px; }
  .topbar .brand { flex-shrink: 0; }
  .topbar .top-actions { margin-left: auto; }
}

@media (max-width: 760px) {
  .topbar { gap: 10px; }
  .topbar .top-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
    gap: 6px;
  }
  .topbar .top-actions > :is(a, button) {
    height: 38px;
    min-height: 38px;
    padding-inline: 10px;
    background: var(--surface-muted);
    font-size: 12px;
  }
  .topbar .top-actions > .primary-action {
    background: var(--text);
    color: var(--surface);
  }
  .topbar .top-actions > .primary-action:disabled {
    background: var(--surface-muted);
    color: var(--text-soft);
  }
}
