:root {
  color-scheme: dark;
  --bg: #0a0a0f;
  --panel: #14141c;
  --panel-2: #1a1a23;
  --border: #30303b;
  --ink: #ececf2;
  --dim: #a1a1aa;
  --green: #7ee0a0;
  --green-deep: #183d27;
  --blue: #8cbdec;
  --red: #ff6b60;
  --yellow: #f6ce72;
  --paper: #eee4c8;
  --paper-deep: #dfd1ac;
  --paper-ink: #242018;
  --paper-dim: #6d6250;
  --radius: 15px;
  --shadow: 0 18px 50px #0007;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  min-width: 280px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(900px 580px at 72% 6%, #182634 0%, transparent 66%),
    radial-gradient(700px 500px at 8% 62%, #171622 0%, transparent 70%),
    var(--bg);
  color: var(--ink);
  font: 15px/1.55 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--blue);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: #b7d8f8;
}

:focus-visible {
  outline: 3px solid #9ed4ff;
  outline-offset: 3px;
}

#flyDecor {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: 8px;
  background: #fff;
  color: #111;
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: none;
}

.site-header,
.experiment-banner,
#app,
.site-footer {
  position: relative;
  z-index: 1;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid #24242e;
  background: #0a0a0fe8;
  box-shadow: 0 10px 30px #0005;
}

.header-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  width: min(1180px, calc(100% - 28px));
  min-height: 66px;
  margin: 0 auto;
  padding: max(7px, env(safe-area-inset-top)) 0 7px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.brand:hover {
  color: #fff;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid #34343f;
  border-radius: 50%;
  background: #16161e;
  font-size: 19px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
  letter-spacing: .02em;
}

.brand small {
  margin-top: -2px;
  color: var(--dim);
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.section-nav {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.section-nav::-webkit-scrollbar {
  display: none;
}

.section-nav a {
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #b6b6c0;
  font-size: 12px;
  text-decoration: none;
}

.section-nav a:hover {
  border-color: #30303a;
  color: #fff;
}

.section-nav a[aria-current="page"] {
  border-color: #42664d;
  background: #17251c;
  color: var(--green);
}

.account-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  white-space: nowrap;
}

.account-name {
  max-width: 130px;
  overflow: hidden;
  color: #c8c8d1;
  font-size: 12px;
  text-overflow: ellipsis;
}

button,
.button-link {
  min-height: 36px;
  padding: 7px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}

button:hover,
.button-link:hover {
  border-color: #545463;
  background: #1d1d27;
  color: #fff;
}

button:active,
.button-link:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: .55;
  transform: none;
}

.primary-button {
  border-color: #39734b;
  background: var(--green-deep);
  color: #bdf3cf;
  font-weight: 700;
}

.primary-button:hover {
  border-color: #65b77f;
  background: #214f31;
}

.danger-button {
  border-color: #67302d;
  background: #311716;
  color: #ffaaa3;
}

.danger-button:hover {
  border-color: #a54842;
  background: #48201e;
}

.quiet-button {
  background: transparent;
  color: var(--dim);
}

.icon-button {
  display: grid;
  width: 38px;
  min-width: 38px;
  padding: 0;
  place-items: center;
  font-size: 24px;
  line-height: 1;
}

.inline-button {
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--blue);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.inline-button:hover {
  background: none;
  color: #c4e1fb;
}

.experiment-banner {
  width: min(930px, calc(100% - 28px));
  margin: 18px auto 0;
  padding: 9px 14px;
  border: 1px solid #65572c;
  border-radius: 10px;
  background: #282213e8;
  color: #ddcfaa;
  font-size: 12px;
  text-align: center;
}

.experiment-banner strong {
  color: var(--yellow);
}

#app {
  width: min(930px, calc(100% - 28px));
  min-height: 62vh;
  margin: 30px auto 60px;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.page-head h1,
.paper h1,
.paper h2,
.paper h3,
.empty-state h2,
.gate-page h1 {
  line-height: 1.15;
}

.page-head h1 {
  margin: 0 0 6px;
  font-size: clamp(27px, 4vw, 42px);
  letter-spacing: -.035em;
}

.page-head p {
  max-width: 650px;
  margin: 0;
  color: var(--dim);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--green);
  font: 700 11px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.feed-list {
  display: grid;
  gap: 20px;
}

.paper {
  position: relative;
  isolation: isolate;
  padding: clamp(20px, 4vw, 34px);
  border: 1px solid #cbbd99;
  border-radius: 6px 15px 8px 13px;
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, #6a5e4010 0, #6a5e4010 1px, transparent 1px, transparent 4px),
    radial-gradient(circle at 16% 13%, #fff8 0, transparent 29%),
    radial-gradient(circle at 84% 90%, #8d7d5520 0, transparent 34%);
  box-shadow: var(--shadow), inset 0 0 50px #a18c5720;
  color: var(--paper-ink);
}

.paper:nth-child(even) {
  transform: rotate(.12deg);
}

.paper:nth-child(odd) {
  transform: rotate(-.08deg);
}

.paper::after {
  position: absolute;
  z-index: -1;
  right: 13px;
  bottom: 11px;
  width: 36px;
  height: 13px;
  border-radius: 50%;
  background: #483d2b12;
  box-shadow: 0 0 8px #483d2b1a;
  content: "";
  transform: rotate(-14deg);
}

.post-card {
  padding: clamp(20px, 3.5vw, 30px);
}

.post-card h2,
.post-detail h1 {
  overflow-wrap: anywhere;
}

.post-card h2 {
  margin: 8px 0 8px;
  font: 750 clamp(22px, 3vw, 30px)/1.16 ui-serif, Georgia, serif;
}

.post-card h2 a,
.author-link,
.paper a {
  color: #365777;
}

.post-card h2 a {
  text-decoration: none;
}

.post-card h2 a:hover {
  color: #173d63;
  text-decoration: underline;
}

.post-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 2px 8px;
  border: 1px solid #9b8b61;
  border-radius: 999px;
  color: #574b2d;
  font: 750 10px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.badge.official {
  border-color: #4c825f;
  background: #d7ead9;
  color: #205332;
}

.badge.promotional {
  border-color: #a57754;
  background: #f0d5bc;
  color: #703d20;
}

.byline,
.post-dates {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px 9px;
  color: var(--paper-dim);
  font-size: 12px;
}

.byline {
  margin-bottom: 18px;
}

.byline .author-link {
  font-weight: 750;
}

.author-website {
  display: inline-block;
  max-width: min(100%, 360px);
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
  white-space: nowrap;
}

.markdown {
  color: #2d2921;
  overflow-wrap: anywhere;
}

.markdown.feed-body {
  position: relative;
  max-height: 15em;
  overflow: hidden;
}

.markdown.feed-body::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3.5em;
  background: linear-gradient(transparent, var(--paper));
  content: "";
  pointer-events: none;
}

.markdown > :first-child {
  margin-top: 0;
}

.markdown > :last-child {
  margin-bottom: 0;
}

.markdown p,
.markdown ul,
.markdown ol,
.markdown blockquote,
.markdown pre {
  margin: 0 0 1em;
}

.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4 {
  margin: 1.35em 0 .5em;
  font-family: ui-serif, Georgia, serif;
}

.markdown blockquote {
  margin-left: 0;
  padding: .1em 0 .1em 1em;
  border-left: 3px solid #938462;
  color: #554e40;
}

.markdown code {
  padding: .1em .28em;
  border-radius: 4px;
  background: #6c5d3920;
  font: .9em ui-monospace, SFMono-Regular, Menlo, monospace;
}

.markdown pre {
  padding: 12px;
  border: 1px solid #aa9a74;
  border-radius: 8px;
  background: #ded2b5;
  overflow-x: auto;
}

.markdown pre code {
  padding: 0;
  background: none;
}

.post-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 22px;
  padding-top: 15px;
  border-top: 1px solid #b9aa84;
}

.paper button,
.paper .button-link {
  border-color: #a99b78;
  background: #e3d6b6;
  color: #3e372a;
}

.paper button:hover,
.paper .button-link:hover {
  border-color: #776a4e;
  background: #d8c8a2;
  color: #211d16;
}

.paper .primary-button {
  border-color: #52775a;
  background: #d2e3cf;
  color: #204a2b;
}

.paper .danger-button {
  border-color: #a67570;
  background: #ead0ca;
  color: #712d29;
}

.paper .quiet-button {
  background: transparent;
}

.vote-button[aria-pressed="true"] {
  border-color: #4e7c59;
  background: #cce4ce;
  color: #174b25;
  font-weight: 700;
}

.spam-button {
  max-width: 370px;
  white-space: normal;
}

.post-stats {
  margin-left: auto;
  color: var(--paper-dim);
  font-size: 12px;
}

.read-more {
  margin-top: 14px;
}

.read-more a {
  font-weight: 700;
}

.post-detail {
  margin-bottom: 24px;
}

.post-detail h1 {
  max-width: 760px;
  margin: 8px 0 10px;
  font: 800 clamp(30px, 5vw, 48px)/1.08 ui-serif, Georgia, serif;
  letter-spacing: -.025em;
}

.post-dates {
  margin: 18px 0 22px;
  padding-bottom: 15px;
  border-bottom: 1px solid #b9aa84;
}

.comments-section {
  margin-top: 28px;
}

.comments-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.comments-heading h2 {
  margin: 0;
  font-size: 23px;
}

.comment-reminder {
  margin: 12px 0 20px;
  padding: 12px 14px;
  border: 1px solid #8fa084;
  border-radius: 8px;
  background: #dde6cf;
  color: #39452f;
  font-size: 13px;
}

.comment-form {
  padding: 17px;
  border: 1px dashed #9f906e;
  border-radius: 10px;
  background: #e5d9bb80;
}

.comment-list {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.comment {
  padding: 15px 16px;
  border: 1px solid #b7a983;
  border-radius: 8px 12px 9px 11px;
  background: #e7dbbe;
}

.comment-head,
.comment-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.comment-head {
  justify-content: space-between;
  color: var(--paper-dim);
  font-size: 12px;
}

.comment-author {
  color: #403929;
  font-weight: 750;
}

.comment-body {
  margin: 10px 0 13px;
  color: #2d2921;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment-actions button {
  min-height: 31px;
  padding: 4px 8px;
  font-size: 12px;
}

.stack-form {
  display: grid;
  gap: 8px;
}

.stack-form label {
  margin-top: 8px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  padding: 10px 11px;
  border: 1px solid #41414d;
  border-radius: 8px;
  background: #101017;
  color: var(--ink);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: #73737e;
}

.paper input,
.paper textarea,
.paper select {
  border-color: #a59776;
  background: #f5ecd6;
  color: var(--paper-ink);
}

.paper input::placeholder,
.paper textarea::placeholder {
  color: #8a7d63;
}

.editor textarea {
  min-height: 310px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  line-height: 1.55;
}

.editor-rules {
  margin: 0 0 8px;
  padding: 12px 14px;
  border-left: 4px solid #917948;
  background: #e1d2ae;
  color: #4c422f;
  font-size: 13px;
}

.editor-actions,
.dialog-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 14px;
}

.field-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.char-count,
.field-hint,
.optional {
  color: var(--dim);
  font-size: 11px;
  font-weight: 400;
}

.paper .char-count,
.paper .field-hint,
.paper .optional {
  color: var(--paper-dim);
}

.form-error {
  min-height: 1.4em;
  margin: 5px 0 0;
  color: #ff9c94;
  font-size: 13px;
}

.paper .form-error {
  color: #8b201a;
}

.check-label {
  display: grid !important;
  grid-template-columns: 20px 1fr;
  align-items: start;
  gap: 8px;
  font-weight: 400 !important;
}

.check-label input {
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
}

.empty-state,
.loading-state,
.error-state {
  padding: 50px min(7vw, 55px);
  border: 1px solid #30303b;
  border-radius: var(--radius);
  background: #111119e8;
  box-shadow: var(--shadow);
  text-align: center;
}

.empty-state h2,
.error-state h2 {
  margin-top: 0;
}

.empty-state p,
.loading-state,
.error-state p {
  color: var(--dim);
}

.loading-dots::after {
  display: inline-block;
  width: 1.5em;
  content: "…";
  animation: blink 1s steps(2, jump-none) infinite;
}

@keyframes blink {
  50% { opacity: .25; }
}

.gate-page {
  display: grid;
  min-height: 55vh;
  padding: 30px;
  place-items: center;
  border: 1px solid #38483d;
  border-radius: 18px;
  background: #101912ed;
  box-shadow: var(--shadow);
  text-align: center;
}

.gate-page > div {
  width: min(520px, 100%);
}

.gate-page h1 {
  margin: 7px 0 13px;
  font-size: clamp(29px, 6vw, 54px);
}

.gate-word {
  display: block;
  margin: 24px 0 18px;
  color: var(--green);
  font: 800 clamp(34px, 8vw, 68px)/1 ui-serif, Georgia, serif;
  letter-spacing: -.03em;
}

.gate-page input {
  max-width: 360px;
  margin: 0 auto;
  text-align: center;
}

.gate-page .quiet-button {
  margin-top: 18px;
}

.modal {
  width: min(92vw, 520px);
  max-height: min(88vh, 760px);
  padding: 21px;
  border: 1px solid #42424f;
  border-radius: 16px;
  background: #15151e;
  box-shadow: 0 30px 90px #000c;
  color: var(--ink);
  overflow: auto;
}

.modal::backdrop {
  background: #050508d9;
  backdrop-filter: blur(3px);
}

.modal-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.modal-heading h2 {
  margin: 0;
  line-height: 1.15;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin: 12px 0 15px;
  padding: 4px;
  border-radius: 10px;
  background: #0e0e14;
}

.auth-tabs button[aria-selected="true"] {
  border-color: #55735e;
  background: #1b3222;
  color: var(--green);
}

.terms-modal {
  width: min(92vw, 680px);
}

.terms-copy h3 {
  margin: 22px 0 5px;
}

.terms-copy p {
  color: #c8c8d0;
}

.warning-block {
  padding: 13px 15px;
  border: 1px solid #725f2f;
  border-radius: 9px;
  background: #282213;
  color: #e2d2a7 !important;
}

.pow-modal {
  width: min(92vw, 590px);
}

.pow-consent p,
.pow-working p {
  color: #c8c8d0;
  line-height: 1.55;
}

.pow-working label {
  display: block;
  margin: 4px 0 9px;
  font-weight: 750;
}

.pow-working progress {
  width: 100%;
  height: 20px;
  border: 1px solid #415044;
  border-radius: 999px;
  background: #0c0f0d;
  accent-color: #59ba75;
  overflow: hidden;
}

.pow-working progress::-webkit-progress-bar {
  background: #0c0f0d;
}

.pow-working progress::-webkit-progress-value {
  background: linear-gradient(90deg, #327c49, #67cd85);
}

.pow-working progress::-moz-progress-bar {
  background: linear-gradient(90deg, #327c49, #67cd85);
}

.pow-status {
  min-height: 3em;
  margin-bottom: 5px;
  color: #dff5e5 !important;
  font-variant-numeric: tabular-nums;
}

.gate-modal {
  width: min(92vw, 560px);
  text-align: center;
}

.gate-modal h2 {
  margin: 8px 0 12px;
}

.comment-gate-word {
  min-width: min(310px, 100%);
  min-height: 74px;
  margin: 20px auto 8px;
  border-color: #4a885d;
  border-radius: 14px;
  background: #1a3a24;
  color: #bdf4cf;
  font: 800 clamp(25px, 7vw, 39px)/1 ui-serif, Georgia, serif;
}

.comment-gate-word:hover {
  border-color: #79c18f;
  background: #245031;
  color: #e5ffed;
}

.admin-grid {
  display: grid;
  gap: 22px;
}

.admin-section {
  padding: 20px;
  border: 1px solid #353540;
  border-radius: 13px;
  background: #12121adf;
}

.admin-section h2 {
  margin: 0 0 14px;
}

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

.moderation-item {
  padding: 13px;
  border: 1px solid #393945;
  border-radius: 9px;
  background: #191922;
}

.moderation-item p {
  margin: 7px 0;
  color: #c7c7d0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.moderation-meta {
  color: var(--dim);
  font-size: 12px;
}

.moderation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.profile-card {
  max-width: 650px;
  margin: 0 auto;
}

.terms-page {
  max-width: 760px;
  margin: 0 auto;
}

.terms-page h2 {
  margin-top: 1.5em;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(930px, calc(100% - 28px));
  margin: 0 auto;
  padding: 24px 0 calc(28px + env(safe-area-inset-bottom));
  border-top: 1px solid #282832;
  color: var(--dim);
  font-size: 12px;
}

.site-footer p {
  max-width: 600px;
  margin: 0;
}

.site-footer div {
  white-space: nowrap;
}

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

@media (max-width: 900px) {
  .header-inner {
    grid-template-columns: auto 1fr;
    gap: 6px 12px;
  }

  .section-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    order: 3;
    padding-bottom: 2px;
  }

  .account-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .header-inner {
    padding-bottom: 6px;
  }
}

@media (max-width: 620px) {
  body {
    font-size: 14px;
  }

  .header-inner,
  #app,
  .experiment-banner,
  .site-footer {
    width: min(100% - 18px, 930px);
  }

  .brand-mark {
    display: none;
  }

  .brand strong {
    font-size: 16px;
  }

  .brand small {
    font-size: 9px;
  }

  .account-name {
    display: none;
  }

  .account-actions button,
  .account-actions .button-link {
    min-height: 33px;
    padding: 5px 8px;
    font-size: 12px;
  }

  .section-nav a {
    padding: 6px 8px;
    font-size: 11px;
  }

  .experiment-banner {
    margin-top: 10px;
    font-size: 11px;
    text-align: left;
  }

  #app {
    margin-top: 23px;
    margin-bottom: 38px;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .paper {
    padding: 20px 17px;
    border-radius: 5px 11px 7px 10px;
  }

  .post-card h2 {
    font-size: 23px;
  }

  .post-footer {
    align-items: stretch;
  }

  .post-footer button,
  .post-footer .button-link {
    flex: 1 1 auto;
  }

  .post-footer .spam-button {
    flex-basis: 100%;
  }

  .post-stats {
    flex-basis: 100%;
    margin: 4px 0 0;
  }

  .editor textarea {
    min-height: 260px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-footer div {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .modal {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 20px);
    padding: 17px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
