:root {
  --bg: #ffffff;
  --fg: #000000;
  --muted: #777777;
  --border: #c9c9c9;
  --card-bg: transparent;

  --accent-h: 210;
  --accent-s: 92%;
  --accent-l: 55%;
  --accent-a: 0.75;

  --radius: 12px;
  --maxw: 860px;

  --accent: hsla(var(--accent-h), var(--accent-s), var(--accent-l), var(--accent-a));
  --accent-soft: hsla(var(--accent-h), var(--accent-s), var(--accent-l), 0.18);
}

body.dark {
  --bg: #0b0b0b;
  --fg: #ffffff;
  --muted: #9a9a9a;
  --border: #2b2b2b;
}

body.midnight {
  --bg: #05070d;
  --fg: #e6edf3;
  --muted: #8b949e;
  --border: #1f2937;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 200ms linear, color 200ms linear;
}

/* GLOBAL FONT FIX */
p, span, div {
  font-weight: 500;
}

textarea,
input,
select {
  font-weight: 600;
  font-size: 14px;
}

.btn,
.icon-btn,
.event,
.react {
  font-weight: 600;
}

.brand__title {
  font-weight: 700;
}

.brand__tagline {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.4px;
  color: var(--fg);
  text-align: center;
  white-space: nowrap;
}

.field__label {
  width: 100%;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}

.composer__meta,
.system-note,
.settings__note,
.settings__footer,
.philosophy {
  font-weight: 500;
  opacity: 0.9;
}

textarea::placeholder {
  color: var(--muted);
  opacity: 0.75;
  font-weight: 500;
}

/* CENTER ABOUT PANEL */
.topbar__left .dropdown__panel {
  text-align: center;
}

.topbar__left .dropdown__panel button {
  display: inline-block;
  margin: 0 4px;
  font-weight: 600;
}

/* EXISTING STYLES BELOW (UNCHANGED) */

.gate {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.gate__box {
  width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  background: var(--bg);
}

.gate__actions {
  margin-top: 16px;
  display: flex;
  gap: 10px;
  justify-content: center;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px);
  overflow: visible;
}

.topbar__left {
  justify-self: start;
  display: flex;
  align-items: center;
}

.topbar__center {
  justify-self: center;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.topbar__right {
  justify-self: end;
  display: flex;
  align-items: center;
}

.topbar__left .icon-btn {
  margin-left: 4px;
}

.topbar__controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
}

.btn,
.icon-btn {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  border-radius: 10px;
  cursor: pointer;
}

.btn {
  padding: 10px 12px;
}

.btn--solid {
  background: var(--fg);
  color: var(--bg);
  border-color: var(--fg);
}

.btn--danger {
  border-color: color-mix(in srgb, var(--border) 70%, #ff0000);
}

.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  padding: 0;
}

.btn:focus-visible,
.icon-btn:focus-visible,
textarea:focus-visible,
select:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--accent-soft);
  border-color: var(--accent);
}

.dropdown {
  position: relative;
}

.dropdown summary {
  list-style: none;
}

.dropdown summary::-webkit-details-marker {
  display: none;
}

.dropdown__panel {
  position: absolute;
  top: calc(100% + 8px);
  width: 320px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 16px;
  z-index: 1000;
  box-shadow: 0 8px 24px color-mix(in srgb, var(--fg) 12%, transparent);
}

.topbar__left .dropdown__panel {
  left: 0;
  right: auto;
}

.topbar__right .dropdown__panel {
  right: 0;
  left: auto;
}

.topbar__left .dropdown[open] .dropdown__panel {
  left: 0;
  right: auto;
}

.topbar__right .dropdown[open] .dropdown__panel {
  right: 0;
  left: auto;
}

.field {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  width: 100%;
}

.settings__note {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.settings__actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
}

.settings__footer {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

select,
input[type="range"],
textarea {
  width: 100%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  border-radius: 10px;
}

select {
  padding: 8px 10px;
}

select option {
  color: #000000;
  background: #ffffff;
}

input[type="range"] {
  border: none;
  padding: 0;
}

input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 42px;
  border-radius: 999px;
  border: 2px solid var(--border);
  padding: 0;
  background: transparent;
  cursor: pointer;
  overflow: hidden;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
  border-radius: 999px;
}

input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 999px;
}

input[type="color"]::-moz-color-swatch {
  border: none;
  border-radius: 999px;
}

.color-wrap {
  position: relative;
  width: 100%;
  height: 42px;
  border-radius: 999px;
  border: 2px solid var(--border);
  overflow: hidden;
}

.color-wrap input[type="color"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.color-fill {
  width: 100%;
  height: 100%;
  border-radius: 999px;
}

.events {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.event {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 999px;
  cursor: pointer;
}

.event.active {
  border-color: var(--fg);
  color: var(--fg);
}

.composer {
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

textarea {
  min-height: 92px;
  border-radius: 10px;
  padding: 10px;
  resize: vertical;
}

.composer__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.feed {
  margin-top: 14px;
}

.empty {
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 14px;
  color: var(--muted);
  text-align: center;
}

.feed__list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--card-bg);
}

.card__text {
  white-space: pre-wrap;
  font-weight: 500;
  line-height: 1.45;
}

.card__actions {
  margin-top: 10px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.react {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 13px;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  transition: all 160ms ease;
}

.feed__footer {
  display: flex;
  gap: 10px;
  margin: 14px 0 30px;
}

.philosophy {
  margin-top: 20px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  text-align: center;
  line-height: 1.4;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 520px) {
  .topbar {
    grid-template-columns: 38px 1fr 38px;
    align-items: center;
  }

  .brand__tagline {
    white-space: normal;
    font-size: 13px;
    line-height: 1.2;
  }

  .composer__row,
  .feed__footer,
  .gate__actions {
    flex-direction: column;
  }

  .topbar__left .dropdown__panel {
    position: fixed;
    top: 60px;
    left: 12px;
    right: 12px;
    width: auto;
    max-width: none;
    transform: none;
  }

  .topbar__right .dropdown__panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: auto;
    transform: none;
    width: 320px;
    max-width: calc(100vw - 24px);
  }
}