@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600&family=Spectral:wght@400;500;600&display=swap');

:root {
  --bg: #f4f1ec;
  --paper: #ffffff;
  --ink: #1f1f1f;
  --muted: #6f6b66;
  --accent: #2f7c6e;
  --line: #8cbfff;
  --shadow: 0 20px 60px rgba(35, 31, 26, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Manrope', system-ui, sans-serif;
  background: radial-gradient(circle at top, #fff8ee 0%, var(--bg) 48%, #efe7dc 100%);
  color: var(--ink);
  min-height: 100vh;
}

.home-hero {
  min-height: 100vh;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 20px;
}

.home-hero-title {
  margin: 0;
  font-family: 'Spectral', serif;
  font-size: clamp(44px, 8vw, 92px);
  line-height: 1.05;
}

.home-hero-subtitle {
  margin: 10px 0 0;
  font-family: 'Manrope', sans-serif;
  font-size: 22px;
  color: var(--muted);
}

.home-hero-cta {
  margin-top: 22px;
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: 999px;
  padding: 12px 24px;
  text-decoration: none;
  font-size: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 36px;
}

.brand {
  font-family: 'Spectral', serif;
  font-size: 28px;
  letter-spacing: 0.5px;
}

.topbar-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 14px;
}

.topbar-actions a,
.topbar-actions button {
  border: 1px solid var(--line);
  background: transparent;
  padding: 8px 14px;
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
}

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid #69a8ff;
  outline-offset: 2px;
}

.editor-shell {
  display: flex;
  justify-content: center;
  padding: 0 20px 80px;
}

.editor {
  width: min(900px, 100%);
  background: var(--paper);
  padding: 40px 56px 56px;
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.page-title {
  margin: 0 0 14px;
  font-family: 'Spectral', serif;
  font-size: 36px;
}

.editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.title-input {
  width: 100%;
  border: none;
  font-family: 'Spectral', serif;
  font-size: 40px;
  outline: none;
  margin-bottom: 12px;
}

.author-input {
  width: 100%;
  border: none;
  font-size: 16px;
  color: var(--muted);
  outline: none;
  margin-bottom: 24px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.toolbar button {
  border: 1px solid var(--line);
  background: #faf7f2;
  border-radius: 12px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 14px;
}

.editor-body {
  min-height: 320px;
  font-family: 'Spectral', serif;
  font-size: 20px;
  line-height: 1.7;
  outline: none;
}

.editor-body:empty:before {
  content: 'Начните писать историю...';
  color: #b2aba3;
}

.editor-body h1,
.editor-body h2,
.editor-body h3 {
  font-family: 'Spectral', serif;
  margin: 24px 0 12px;
}

.editor-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  color: var(--muted);
  margin: 24px 0;
}

.post-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  color: var(--muted);
  margin: 24px 0;
}

.editor-body pre {
  background: #f5f1ea;
  padding: 16px;
  border-radius: 12px;
  overflow-x: auto;
}

.editor-body figure {
  margin: 28px 0;
}

.editor-body img {
  max-width: 100%;
  border-radius: 16px;
  display: block;
}

.editor-body a,
.post-content a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.editor-body hr,
.post-content hr {
  width: 78%;
  margin: 24px auto;
  border: 0;
  border-top: 1px solid var(--line);
}

.publish-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 15px;
  cursor: pointer;
  white-space: nowrap;
}

.status {
  color: var(--muted);
  font-size: 14px;
}

.posts-panel {
  margin-top: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  background: #f8fbff;
}

.page-posts-panel {
  margin-top: 0;
}

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

.posts-panel-head h2 {
  margin: 0;
  font-family: 'Manrope', sans-serif;
  font-size: 18px;
}

.ghost-btn {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  font-size: 13px;
}

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

.posts-empty {
  margin: 0;
  color: var(--muted);
}

.post-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.post-card-main {
  min-width: 0;
}

.post-card-title {
  font-family: 'Spectral', serif;
  font-size: 21px;
  color: var(--ink);
  text-decoration: none;
}

.post-card-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.post-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.post-card-actions a,
.post-card-actions button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.post-card-actions button {
  border-color: #f1b8b8;
  color: #8f3030;
}

.auth-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
}

.auth-card {
  background: var(--paper);
  padding: 40px;
  border-radius: 24px;
  box-shadow: var(--shadow);
  width: min(420px, 100%);
}

.auth-card h1 {
  font-family: 'Spectral', serif;
  margin-top: 0;
}

.auth-card label {
  display: block;
  margin-top: 16px;
  font-size: 14px;
  color: var(--muted);
}

.auth-card input {
  width: 100%;
  margin-top: 6px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 14px;
}

.auth-card button {
  margin-top: 24px;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 15px;
  cursor: pointer;
}

.auth-card .auth-note {
  margin-top: 16px;
  font-size: 14px;
  color: var(--muted);
}

.post-page {
  background: radial-gradient(circle at top, #fff8ee 0%, var(--bg) 48%, #efe7dc 100%);
}

.post-shell {
  display: flex;
  justify-content: center;
  padding: 0 20px 80px;
}

.post-article {
  width: min(900px, 100%);
  background: var(--paper);
  padding: 40px 56px 56px;
  border-radius: 28px;
  box-shadow: var(--shadow);
  font-family: 'Spectral', serif;
  color: var(--ink);
  line-height: 1.7;
}

.post-top-actions {
  gap: 10px;
}

.edit-link {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.delete-link {
  border: 1px solid #f1b8b8;
  color: #8f3030;
  background: #fff;
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
}

.post-title {
  font-size: 44px;
  margin-bottom: 12px;
}

.post-meta {
  display: flex;
  gap: 12px;
  font-family: 'Manrope', sans-serif;
  color: var(--muted);
  font-size: 14px;
}

.post-content {
  font-size: 22px;
}

@media (max-width: 720px) {
  .editor {
    padding: 30px 22px 40px;
  }

  .title-input {
    font-size: 30px;
  }

  .post-title {
    font-size: 34px;
  }

  .post-content {
    font-size: 21px;
  }

  .post-article {
    padding: 30px 22px 40px;
  }

  .editor-topbar {
    align-items: flex-start;
    flex-direction: column-reverse;
  }

  .publish-btn {
    width: 100%;
  }

  .post-card {
    flex-direction: column;
  }

  .post-card-actions {
    width: 100%;
  }
}
