:root {
  color-scheme: dark;
  --bg: #0d1923;
  --header: #15232f;
  --panel: #14222e;
  --line: #344858;
  --text: #f4f7fb;
  --muted: #b9c4d0;
  --accent: #2e6897;
  --accent-soft: #8fc8ef;
  --ok: #dff5e9;
  --ok-text: #26734c;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.top {
  padding: 20px 24px 0;
  border-bottom: 1px solid var(--line);
  background: var(--header);
}

.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand-copy { min-width: 0; }
.brand-copy h1 {
  margin: 0;
  font: 700 clamp(30px, 4vw, 42px)/1.08 Georgia, serif;
  white-space: nowrap;
}
.brand-copy p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: clamp(16px, 2vw, 21px);
}

.actions {
  display: flex;
  flex: 0 0 auto;
  gap: 12px;
}
.actions button,
.actions a {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--text);
  background: transparent;
  text-decoration: none;
  font-size: 30px;
  cursor: pointer;
}
.actions button:hover,
.actions a:hover { background: rgba(255,255,255,.05); }

nav {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  overflow-x: auto;
  scrollbar-width: none;
}
nav::-webkit-scrollbar { display: none; }
nav button {
  flex: 1 0 128px;
  min-width: 112px;
  border: 0;
  border-radius: 16px 16px 0 0;
  padding: 22px 14px;
  background: transparent;
  color: var(--muted);
  font: 700 20px/1.1 inherit;
  letter-spacing: .05em;
  cursor: pointer;
  white-space: nowrap;
}
nav button span {
  margin-left: 7px;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0;
}
nav button.active {
  color: #fff;
  background: var(--accent);
  box-shadow: inset 0 0 0 2px var(--accent-soft);
}

.meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 28px 24px 22px;
}
.meta-copy {
  display: flex;
  align-items: baseline;
  min-width: 0;
  font-size: 21px;
}
.dot {
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  margin-right: 13px;
  border-radius: 50%;
  background: var(--accent-soft);
}
#section-title { white-space: nowrap; }
.sep { margin: 0 11px; color: var(--muted); }
#post-date { color: var(--muted); }

.badge {
  border: 0;
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 999px;
  background: var(--ok);
  color: var(--ok-text);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .02em;
  line-height: 1;
  white-space: nowrap;
  word-break: keep-all;
  cursor: pointer;
}

.badge:hover { filter: brightness(1.03); }

.viewer {
  position: relative;
  height: calc(100vh - 285px);
  min-height: 500px;
  margin: 0 18px 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #f5f5f5;
}
.viewer iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.message {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 36px;
  background: var(--panel);
  color: var(--muted);
  text-align: center;
  font-size: 20px;
}
.message.hidden { display: none; }
.message a { color: #dba7f6; }
.message-card {
  display: grid;
  justify-items: center;
  gap: 16px;
}
.message-card p { margin: 0; }
.message-card a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #092033;
  font-weight: 800;
  text-decoration: none;
}
.external-links-card {
  width: min(680px, 100%);
}
.external-links {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}
.message-card a.external-link-button {
  flex-direction: column;
  justify-content: center;
  min-width: 150px;
  min-height: 74px;
  border-radius: 18px;
  padding: 13px 18px;
  background: var(--accent);
  color: #fff;
  letter-spacing: .02em;
}
.external-link-button span {
  margin-top: 4px;
  color: rgba(255,255,255,.72);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
}

@media (max-width: 760px) {
  .top { padding: 14px 14px 0; }
  .header-row { gap: 10px; }
  .brand-copy h1 { font-size: clamp(27px, 8.5vw, 36px); }
  .brand-copy p { margin-top: 3px; font-size: 15px; }
  .actions { gap: 7px; }
  .actions button,
  .actions a {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    font-size: 24px;
  }

  nav { gap: 4px; margin-top: 16px; }
  nav button {
    flex: 0 0 auto;
    min-width: 82px;
    padding: 17px 12px;
    font-size: 18px;
  }
  nav button span { display: none; }
  .meta {
    align-items: center;
    gap: 10px;
    padding: 18px 14px 15px;
  }
  .meta-copy {
    flex-wrap: wrap;
    row-gap: 3px;
    font-size: 16px;
    line-height: 1.25;
  }
  .dot { width: 11px; height: 11px; margin-right: 9px; }
  .sep { margin: 0 7px; }
  .badge {
    min-height: 34px;
    padding: 7px 12px;
    font-size: 14px;
    white-space: nowrap;
  }

  .viewer {
    height: calc(100vh - 220px);
    min-height: 410px;
    margin: 0 7px 7px;
    border-radius: 16px;
  }
  .message { padding: 26px 18px; font-size: 18px; }
  .external-links { gap: 9px; }
  .message-card a.external-link-button {
    min-width: 124px;
    min-height: 66px;
    border-radius: 15px;
    padding: 11px 14px;
  }
}

@media (max-width: 420px) {
  .brand-copy h1 { font-size: 27px; }
  .actions button,
  .actions a { width: 42px; height: 42px; }
  .meta { padding-left: 11px; padding-right: 11px; }
  #post-date { font-size: 15px; }
  .badge { padding-inline: 10px; font-size: 13px; }
}
