:root {
  --ink-950: #08131f;
  --ink-900: #0f2740;
  --ink-700: #24415e;
  --ink-500: #4f6f8f;
  --sky-100: #ecf8ff;
  --card: rgba(255, 255, 255, 0.9);
  --line: rgba(8, 19, 31, 0.16);
  --line-strong: rgba(8, 19, 31, 0.26);
  --accent: #e46a2e;
  --accent-strong: #bf521e;
  --ok-bg: rgba(18, 96, 68, 0.08);
  --ok-line: rgba(18, 96, 68, 0.22);
  --danger-bg: rgba(176, 0, 32, 0.08);
  --danger-line: rgba(176, 0, 32, 0.28);
  --danger-text: #8f001a;
  --radius-xl: 24px;
  --radius-lg: 14px;
  --radius-md: 10px;
  --elev: 0 16px 38px rgba(8, 19, 31, 0.22);
  --max-width: 1080px;
  --editor-start-height: 480px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--ink-950);
  line-height: 1.45;
  background: linear-gradient(140deg, var(--ink-950), var(--ink-900));
  padding: 24px;
}

.background-shell {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 999px;
  filter: blur(3px);
}

.orb-a {
  width: min(42vw, 560px);
  aspect-ratio: 1;
  right: -8%;
  top: -18%;
  background: radial-gradient(circle at 35% 35%, rgba(228, 106, 46, 0.7), rgba(228, 106, 46, 0));
  animation: driftA 12s ease-in-out infinite;
}

.orb-b {
  width: min(46vw, 640px);
  aspect-ratio: 1;
  left: -10%;
  bottom: -24%;
  background: radial-gradient(circle at 60% 40%, rgba(189, 232, 255, 0.55), rgba(189, 232, 255, 0));
  animation: driftB 14s ease-in-out infinite;
}

.grid-haze {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black 20%, transparent 90%);
  opacity: 0.45;
}

.layout-shell,
.auth-shell {
  position: relative;
  z-index: 1;
  width: min(var(--max-width), 100%);
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.layout-shell {
  grid-template-columns: 1.15fr 0.85fr;
}

.layout-shell-user {
  grid-template-columns: 1fr;
}

.auth-shell {
  grid-template-columns: 1.05fr 0.95fr;
  align-items: start;
  padding-top: min(8vh, 48px);
}

.glass-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(8px);
  box-shadow: var(--elev);
  padding: clamp(20px, 3vw, 34px);
}

h1 {
  margin: 14px 0 12px;
  line-height: 1.06;
  font-size: clamp(2.05rem, 4.8vw, 3.35rem);
}

h2,
h3 {
  margin: 0;
  line-height: 1.2;
}

p {
  margin: 0;
}

.panel-header {
  margin-bottom: 18px;
}

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

.menu-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.menu-header-actions form {
  margin: 0;
}

.lead,
.subtle-copy {
  color: var(--ink-700);
}

.lead {
  max-width: 56ch;
  font-size: clamp(1rem, 2vw, 1.08rem);
}

.brand-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: "Space Mono", monospace;
  font-size: 13px;
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--accent);
}

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

.feature-tile {
  border: 1px solid var(--line);
  background: rgba(189, 232, 255, 0.3);
  border-radius: var(--radius-lg);
  padding: 14px;
}

.feature-tile h3 {
  font-size: 1rem;
}

.feature-tile p {
  margin-top: 7px;
  color: var(--ink-700);
  font-size: 0.92rem;
}

.posts-area {
  margin-top: 22px;
  border-top: 1px solid rgba(8, 19, 31, 0.1);
  padding-top: 14px;
}

.posts-topbar {
  display: grid;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.6);
}

.posts-subtitle {
  margin-top: 3px;
  font-size: 0.9rem;
}

.section-heading-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.mono-note,
.mono-hint {
  font-family: "Space Mono", monospace;
  color: var(--ink-700);
}

.mono-note {
  font-size: 0.8rem;
}

.mono-hint {
  font-size: 0.8rem;
  margin-top: 16px;
}

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

.posts-gallery {
  display: block;
  column-count: 3;
  column-gap: 12px;
}

.posts-search-form {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px;
}

.posts-search-form input[type="search"] {
  flex: 1;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.posts-search-form input[type="search"]:focus {
  box-shadow: none;
}

.post-card {
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px;
  break-inside: avoid;
  -webkit-column-break-inside: avoid;
  display: inline-block;
  width: 100%;
  margin: 0 0 12px;
  box-shadow: 0 6px 14px rgba(8, 19, 31, 0.08);
  transition: transform 140ms ease, box-shadow 140ms ease, border-color 140ms ease;
}

.post-card:hover {
  transform: translateY(-2px);
  border-color: rgba(8, 19, 31, 0.28);
  box-shadow: 0 12px 22px rgba(8, 19, 31, 0.14);
}

.post-card:nth-child(3n + 1) {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(237, 248, 255, 0.82));
}

.post-card:nth-child(3n + 2) {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 247, 240, 0.82));
}

.post-card:nth-child(3n + 3) {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(244, 252, 245, 0.82));
}

.post-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.post-head h3 {
  font-size: 1rem;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post-title-link {
  color: inherit;
  text-decoration: none;
}

.post-title-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.status-pill {
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.pill-public {
  color: #1b6449;
  background: var(--ok-bg);
  border: 1px solid var(--ok-line);
}

.pill-private {
  color: var(--ink-700);
  background: rgba(8, 19, 31, 0.07);
  border: 1px solid var(--line);
}

.post-content {
  margin-top: 9px;
  color: var(--ink-700);
  font-size: 0.93rem;
  max-height: 280px;
  overflow: auto;
}

.post-content.excerpt-content {
  display: -webkit-box;
  line-clamp: 6;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-height: none;
  white-space: normal;
}

.markdown-content {
  word-break: break-word;
}

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

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

.markdown-content p,
.markdown-content ul,
.markdown-content ol,
.markdown-content blockquote,
.markdown-content pre,
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
  margin: 0 0 10px;
}

.markdown-content ul,
.markdown-content ol {
  padding-left: 20px;
}

.markdown-content a {
  color: var(--accent-strong);
  text-decoration-thickness: 1.5px;
}

.markdown-content img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  margin: 8px 0;
}

.markdown-content code {
  font-family: "Space Mono", monospace;
  font-size: 0.84em;
  padding: 0 4px;
  background: rgba(8, 19, 31, 0.08);
  border-radius: 6px;
}

.markdown-content pre {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
  padding: 10px;
  overflow: auto;
}

.markdown-content pre code {
  background: transparent;
  padding: 0;
}

.markdown-content blockquote {
  margin-left: 0;
  padding-left: 12px;
  border-left: 3px solid var(--line-strong);
  color: var(--ink-700);
}

.post-actions {
  margin-top: 11px;
  padding-top: 10px;
  border-top: 1px solid rgba(8, 19, 31, 0.12);
  display: flex;
  flex-wrap: wrap;
  align-items: start;
  gap: 8px;
}

.empty-state {
  margin-top: 14px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  padding: 14px;
  color: var(--ink-700);
}

.empty-state p {
  margin-top: 4px;
  font-size: 0.92rem;
}

.user-summary {
  margin-bottom: 18px;
}

.identity-card {
  margin-top: 12px;
  background: var(--ok-bg);
  border: 1px solid var(--ok-line);
  border-radius: var(--radius-lg);
  padding: 12px;
  display: grid;
  gap: 3px;
}

.identity-card span {
  color: #19694d;
  font-size: 0.92rem;
}

.cta-row {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.stack-form,
.edit-form {
  display: grid;
  gap: 10px;
}

label {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

input,
textarea {
  width: 100%;
  font: inherit;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  padding: 10px 12px;
  background: #fff;
  color: var(--ink-950);
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

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

.edit-form textarea {
  min-height: 96px;
}

input:focus,
textarea:focus {
  border-color: rgba(228, 106, 46, 0.62);
  box-shadow: 0 0 0 3px rgba(228, 106, 46, 0.2);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-700);
  font-size: 0.92rem;
}

.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
}

.primary-btn,
.ghost-btn,
.small-btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  border-radius: 11px;
  border: 1px solid transparent;
  text-decoration: none;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform 130ms ease, box-shadow 130ms ease, background 130ms ease;
}

.primary-btn {
  padding: 11px 14px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 10px 20px rgba(228, 106, 46, 0.28);
}

.primary-btn:hover {
  background: var(--accent-strong);
  transform: translateY(-1px);
}

.ghost-btn {
  padding: 11px 14px;
  color: var(--ink-950);
  background: #fff;
  border-color: var(--line);
}

.ghost-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 7px 14px rgba(8, 19, 31, 0.1);
}

.small-btn {
  padding: 7px 10px;
  font-size: 0.84rem;
  border-color: var(--line);
  color: var(--ink-950);
  background: #fff;
}

.small-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(8, 19, 31, 0.1);
}

.danger-btn {
  color: var(--danger-text);
  background: var(--danger-bg);
  border-color: var(--danger-line);
}

details.edit-box > summary {
  list-style: none;
}

details.edit-box > summary::-webkit-details-marker {
  display: none;
}

details.edit-box[open] {
  width: 100%;
}

.edit-form {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.inline-error {
  margin-top: 12px;
  color: var(--danger-text);
  background: var(--danger-bg);
  border: 1px solid var(--danger-line);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 0.92rem;
}

.auth-points {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.auth-points li {
  border: 1px solid var(--line);
  background: rgba(189, 232, 255, 0.3);
  border-radius: 12px;
  padding: 12px;
  color: var(--ink-700);
  font-size: 0.93rem;
}

.new-post {
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.editor-callout {
  margin-top: 10px;
}

.editor-shell {
  position: relative;
  z-index: 1;
  width: min(1240px, 100%);
  margin: 0 auto;
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
}

.editor-top-actions {
  display: flex;
  gap: 10px;
}

.editor-form {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(0, 62%) 10px minmax(0, 38%);
  gap: 16px;
}

.editor-form.preview-hidden {
  grid-template-columns: 1fr;
}

.editor-form-top {
  grid-column: 1 / -1;
  display: grid;
  gap: 10px;
}

.editor-main {
  display: grid;
  gap: 10px;
}

.editor-inline-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.editor-primary-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.publish-stack {
  display: grid;
  gap: 8px;
  align-items: start;
}

.editor-resizer {
  width: 10px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(8, 19, 31, 0.12), rgba(8, 19, 31, 0.22));
  cursor: col-resize;
  align-self: stretch;
  position: relative;
}

.editor-resizer::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 3px;
  height: 54px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
}

.editor-resizer:hover,
.editor-resizer:focus-visible {
  background: linear-gradient(180deg, rgba(228, 106, 46, 0.34), rgba(228, 106, 46, 0.52));
}

.editor-form.preview-hidden .editor-resizer,
.editor-form.preview-hidden .editor-preview {
  display: none;
}

.editor-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.char-count {
  font-family: "Space Mono", monospace;
  font-size: 0.8rem;
  color: var(--ink-700);
}

.editor-textarea {
  min-height: var(--editor-start-height);
  height: var(--editor-start-height);
  font-family: "Space Mono", monospace;
  line-height: 1.5;
}

.editor-preview {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 12px;
  background: rgba(255, 255, 255, 0.74);
  display: grid;
  align-content: start;
  gap: 10px;
}

.preview-card {
  min-height: var(--editor-start-height);
  height: var(--editor-start-height);
  max-height: none;
  overflow: auto;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-md);
  padding: 10px;
  background: #fff;
  font-size: 0.92rem;
  color: var(--ink-700);
}

.preview-card:not(.markdown-content) {
  white-space: pre-wrap;
}

.preview-card.is-empty {
  color: var(--ink-500);
  font-style: italic;
}

.post-shell {
  position: relative;
  z-index: 1;
  width: min(980px, 100%);
  margin: 0 auto;
}

.post-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
}

.post-body {
  margin-top: 16px;
}

.post-markdown {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  color: var(--ink-700);
  padding: 14px;
  min-height: 260px;
  max-height: 70vh;
  overflow: auto;
  font-size: 0.9rem;
  line-height: 1.5;
}

.post-detail-actions {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button:focus-visible,
a:focus-visible,
summary:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(228, 106, 46, 0.42);
  outline-offset: 2px;
}

@keyframes driftA {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(14px) scale(1.03);
  }
}

@keyframes driftB {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-14px) scale(1.02);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 930px) {
  .layout-shell,
  .auth-shell {
    grid-template-columns: 1fr;
    padding-top: 0;
  }

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

  .editor-resizer {
    display: none;
  }

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

  .posts-gallery {
    column-count: 2;
  }
}

@media (max-width: 600px) {
  body {
    padding: 14px;
  }

  .glass-panel {
    padding: 18px;
    border-radius: 18px;
  }

  .section-heading-row {
    align-items: start;
    flex-direction: column;
    gap: 4px;
  }

  .posts-search-form {
    flex-wrap: wrap;
    border-radius: 12px;
  }

  .panel-header-row {
    flex-direction: column;
    align-items: start;
  }

  .menu-header-actions {
    width: 100%;
  }

  .editor-inline-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .editor-primary-actions {
    width: 100%;
  }

  .editor-header {
    flex-direction: column;
  }

  .posts-gallery {
    column-count: 1;
  }

  .post-detail-header {
    flex-direction: column;
  }

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

  .preview-card {
    min-height: 320px;
    height: 320px;
  }
}
