:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --text: #1f2937;
  --subtle: #6b7280;
  --line: #e5e7eb;
  --brand: #4b535f;
  --brand-dark: #2d3239;
  --bg-stripe-a: rgba(75, 83, 95, 0.034);
  --bg-stripe-b: rgba(45, 50, 57, 0.024);
  --bg-grad-start: #ece5da;
  --bg-grad-mid: #d9d0c2;
  --bg-grad-end: #f3eee6;
  --header-stripe-a: rgba(75, 83, 95, 0.013);
  --header-stripe-b: rgba(45, 50, 57, 0.009);
  --header-overlay-start: rgba(255, 255, 255, 0.48);
  --header-overlay-mid: rgba(148, 163, 184, 0.08);
  --header-overlay-end: rgba(31, 41, 55, 0.096);
  --header-grad-end: rgba(241, 234, 225, 0.66);
  --brand-shadow: rgba(45, 50, 57, 0.24);
  --unread-bg: #e9e2d7;
  --unread-border: #7d8696;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    repeating-linear-gradient(45deg, var(--bg-stripe-a) 0 1px, transparent 1px 8px),
    repeating-linear-gradient(-45deg, var(--bg-stripe-b) 0 1px, transparent 1px 10px),
    linear-gradient(160deg, var(--bg-grad-start) 0%, var(--bg-grad-mid) 42%, var(--bg-grad-end) 100%);
  color: var(--text);
}

.site-header {
  position: relative;
  background:
    repeating-linear-gradient(45deg, var(--header-stripe-a) 0 1px, transparent 1px 8px),
    repeating-linear-gradient(-45deg, var(--header-stripe-b) 0 1px, transparent 1px 10px),
    linear-gradient(90deg, var(--header-overlay-start) 0%, var(--header-overlay-mid) 76%, var(--header-overlay-end) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.5), var(--header-grad-end));
  box-shadow: 0 12px 34px rgba(17, 24, 39, 0.22);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem 1rem;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
}

.brand {
  font-family: "Avenir Next", "Nunito", "Segoe UI", ui-sans-serif, -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 800;
  font-size: 2.16rem;
  line-height: 0.95;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--brand);
  text-shadow: none;
  position: relative;
  z-index: 1006;
}

.brand:hover,
.brand:focus-visible,
.brand:active {
  text-decoration: none;
}

.brand-wrap {
  display: flex;
  align-items: flex-start;
  gap: 0.38rem;
  position: relative;
  z-index: 1006;
  flex-shrink: 0;
}

.beta-badge {
  display: inline-block;
  margin-top: 0.2rem;
  padding: 0.1rem 0.36rem;
  border-radius: 999px;
  border: 1px solid rgba(45, 50, 57, 0.26);
  background: rgba(255, 255, 255, 0.72);
  color: var(--brand-dark);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1.2;
  text-transform: uppercase;
}

.menu-toggle {
  min-width: 2.35rem;
  padding: 0.38rem 0.62rem;
  font-size: 1.15rem;
  line-height: 1;
  position: relative;
  z-index: 1006;
}

.site-nav {
  position: absolute;
  right: 0.95rem;
  top: calc(100% + 0.45rem);
  z-index: 1005;
  min-width: 208px;
  display: none;
  flex-direction: column;
  gap: 0.32rem;
  padding: 0.52rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 12px 30px rgba(17, 24, 39, 0.2);
}

.site-nav.open {
  display: flex;
}

.site-nav a,
.site-nav button {
  width: 100%;
}

.site-nav a {
  display: block;
  padding: 0.34rem 0.42rem;
  border-radius: 7px;
}

.site-nav .inline-form {
  display: block;
}

.site-nav .inline-form button {
  text-align: left;
}

a {
  color: var(--brand);
  text-decoration: none;
}

a:hover {
  color: var(--brand-dark);
  text-decoration: underline;
}

.container {
  width: min(840px, 95vw);
  margin: 1.2rem auto;
  padding-top: 4.4rem;
  min-height: calc(100vh - 140px);
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 0.9rem;
}

.post-row {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 0.8rem;
}

.vote-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

button,
.btn {
  background: var(--brand);
  color: white;
  border: 0;
  border-radius: 8px;
  padding: 0.45rem 0.75rem;
  font: inherit;
  cursor: pointer;
}

button:hover,
.btn:hover {
  background: var(--brand-dark);
  text-decoration: none;
}

.btn-link {
  background: transparent;
  color: #1d4ed8;
  padding: 0;
}

.score {
  font-weight: 700;
}

.meta {
  color: var(--subtle);
  font-size: 0.9rem;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 0.55rem 0.65rem;
  font: inherit;
}

label {
  display: block;
  margin-bottom: 0.6rem;
}

.form-spaced label {
  margin-bottom: 1rem;
}

.form-spaced label input,
.form-spaced label select,
.form-spaced label textarea {
  margin-top: 0.45rem;
}

.form-spaced .meta {
  margin: -0.35rem 0 1rem;
}

.inline-form {
  display: inline;
}

.error {
  color: #b91c1c;
  margin-bottom: 0.8rem;
}

.notice {
  border-color: #bfdbfe;
  background: #eff6ff;
  padding: 0.7rem;
  border-radius: 8px;
}

.attachments {
  margin-top: 1rem;
}

.embeds {
  margin-top: 1rem;
}

.feed-preview {
  margin-top: 0.8rem;
  max-width: 560px;
}

.feed-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px 170px 170px auto;
  gap: 0.6rem;
}

.header-tagline {
  position: absolute;
  right: 4.2rem;
  left: auto;
  transform: none;
  margin: 0;
  width: min(58vw, 640px);
  text-align: right;
  color: var(--brand);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  pointer-events: none;
}

.embed-frame {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}

.embed-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.attachment-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.75rem;
}

.attachment-image,
.attachment-video,
.attachment-pdf {
  width: 100%;
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.attachment-image {
  max-height: 520px;
  object-fit: contain;
}

.attachment-video {
  max-height: 520px;
}

.attachment-pdf {
  height: 520px;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.auth-notice {
  grid-column: 1 / -1;
  margin-bottom: 0.2rem;
}

.turnstile-wrap {
  margin: 0.8rem 0;
}

.comment-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.75rem;
  margin-bottom: 0.8rem;
}

.comment-children {
  margin-top: 0.8rem;
  margin-left: 1rem;
  border-left: 2px solid var(--line);
  padding-left: 0.8rem;
}

.comment-form,
.reply-form {
  margin-top: 0.7rem;
}

.status-line {
  margin-top: 0.45rem;
}

.moderation-help {
  margin-top: 0.35rem;
}

.status-badge {
  display: inline-block;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  font-size: 0.78rem;
  text-transform: lowercase;
  font-weight: 700;
}

.status-badge.pending_review {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.rejected {
  background: #fee2e2;
  color: #991b1b;
}

.status-badge.approved {
  background: #dcfce7;
  color: #166534;
}

.moderation-item {
  margin-bottom: 0.9rem;
}

.moderation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.moderation-actions .inline-form {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

.moderation-actions .inline-form input[type='text'] {
  width: 220px;
}

.moderation-tag-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
  align-items: end;
  margin-top: 0.7rem;
}

.profile-item {
  border-top: 1px solid var(--line);
  padding-top: 0.7rem;
  margin-top: 0.7rem;
}

.notifications-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.notification-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.8rem;
  margin-bottom: 0.7rem;
}

.notification-item.unread {
  background: var(--unread-bg);
  border-color: var(--unread-border);
}

.theme-randomizer-btn {
  position: fixed;
  left: 0.9rem;
  bottom: 0.9rem;
  z-index: 1100;
  width: 2.3rem;
  height: 2.3rem;
  min-width: 0;
  border-radius: 999px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: var(--brand);
  box-shadow: 0 8px 20px rgba(17, 24, 39, 0.24);
}

.theme-randomizer-btn:hover,
.theme-randomizer-btn:focus-visible {
  transform: scale(1.04);
}

.theme-picker-panel {
  position: fixed;
  left: 0.9rem;
  bottom: 3.7rem;
  z-index: 1100;
  width: 176px;
  padding: 0.65rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 14px 34px rgba(17, 24, 39, 0.24);
  display: none;
}

.theme-picker-panel.open {
  display: block;
}

.theme-picker-label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.82rem;
  color: var(--subtle);
}

.theme-color-input {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.2rem;
  background: var(--surface);
  cursor: pointer;
}

.theme-picker-actions {
  margin-top: 0.55rem;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
}

.theme-picker-action-btn {
  width: 100%;
  padding: 0.38rem 0.55rem;
  font-size: 0.83rem;
}

.theme-dark-mode-btn {
  grid-column: 1 / -1;
}

.analytics-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
}

.analytics-tile {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem;
}

.analytics-tile h3 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
}

.analytics-tile p {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.back-to-top-row {
  display: flex;
  justify-content: center;
  margin: 1.1rem 0 1.6rem;
}

.back-to-top-btn {
  min-width: 120px;
  text-align: center;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  margin-top: 0.5rem;
}

.footer-inner {
  width: min(840px, 95vw);
  margin: 0 auto;
  padding: 0.9rem 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 700;
  color: var(--brand);
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.footer-link {
  color: var(--brand-dark);
}

.legal-page h2 {
  margin-top: 1.1rem;
  margin-bottom: 0.35rem;
}

@media (max-width: 800px) {
  .header-tagline {
    display: none;
  }

  .site-header {
    padding: 0.65rem 0.75rem;
    align-items: flex-start;
    gap: 0.55rem;
  }

  .site-nav {
    right: 0.75rem;
    min-width: 188px;
  }

  .site-nav.guest-nav {
    min-width: 164px;
  }

  .brand {
    font-size: 1.86rem;
  }

  .beta-badge {
    margin-top: 0.15rem;
    font-size: 0.62rem;
    padding: 0.08rem 0.3rem;
  }

  .container {
    width: 94vw;
    padding-top: 5.6rem;
    margin-top: 0.6rem;
  }

  .guest-auth-btn {
    padding: 0.45rem 0.75rem;
    font-size: 1rem;
  }

  .site-nav.guest-nav .guest-auth-btn {
    padding: 0.36rem 0.66rem;
    font-size: 0.9rem;
    border-radius: 999px;
    white-space: nowrap;
  }

  .post-row {
    grid-template-columns: 1fr;
  }

  .vote-col {
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.5rem;
  }

  .auth-grid {
    grid-template-columns: 1fr;
  }

  .feed-controls {
    grid-template-columns: minmax(0, 1fr) 130px auto;
    align-items: center;
  }

  .feed-controls select[name='contentType'],
  .feed-controls select[name='contentCategory'] {
    display: none;
  }

  .moderation-tag-form {
    grid-template-columns: 1fr;
  }

  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .comment-children {
    margin-left: 0.6rem;
    padding-left: 0.6rem;
  }

  .moderation-actions .inline-form input[type='text'] {
    width: 100%;
  }

  .choice-grid {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .theme-picker-panel {
    bottom: 3.45rem;
    width: 162px;
  }
}

.choice-group {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.8rem;
  margin-bottom: 1rem;
}

.choice-group legend {
  padding: 0 0.25rem;
  font-weight: 700;
}

.choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem 0.9rem;
}

.choice-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
}

.choice-item input[type='radio'],
.choice-item input[type='checkbox'] {
  width: auto;
}

.report-box {
  margin-top: 0.45rem;
}

.report-box summary {
  cursor: pointer;
  color: var(--subtle);
}

.report-form {
  margin-top: 0.45rem;
}

.twitter-tweet,
.twitter-tweet-rendered {
  width: 100% !important;
  max-width: 100% !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.twitter-tweet iframe {
  max-width: 100% !important;
}

.guest-auth-btn {
  display: inline-block;
  line-height: 1;
  text-decoration: none;
  padding: 0.34rem 0.58rem;
  font-size: 0.9rem;
}

.guest-auth-btn:hover,
.back-to-top-btn:hover,
.guest-auth-btn:focus-visible,
.back-to-top-btn:focus-visible {
  background: var(--brand-dark);
  color: white;
  text-decoration: none;
}

.x-embed-placeholder {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
  min-height: 78px;
  padding: 0.65rem 0.75rem;
}

.x-embed-placeholder a {
  color: var(--brand-dark);
  font-weight: 600;
}

.x-embed-placeholder.x-embed-loading {
  opacity: 0.86;
}
