:root {
  color-scheme: light;
  --bg: #fff4f7;
  --paper: #fffaf7;
  --text: #3a1f2a;
  --muted: #8f6673;
  --line: #efcbd5;
  --panel: rgba(255, 250, 247, 0.92);
  --panel-strong: #ffffff;
  --accent: #b83f67;
  --accent-strong: #7f263f;
  --accent-soft: #ffe0e9;
  --wine: #4f1727;
  --owner: #5b2a47;
  --owner-soft: #f0e6ef;
  --puppy-soft: #ffe0e9;
  --danger: #b44655;
  --shadow: 0 22px 60px rgba(108, 38, 61, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 16% 8%, rgba(255, 219, 229, 0.72), transparent 28%),
    radial-gradient(circle at 88% 18%, rgba(255, 234, 210, 0.8), transparent 24%),
    linear-gradient(180deg, #fff6f8 0%, #fff0f4 46%, #fff8f4 100%);
  color: var(--text);
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  background-image:
    linear-gradient(rgba(127, 38, 63, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(127, 38, 63, 0.028) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.55), transparent 78%);
}

a {
  color: inherit;
  text-decoration: none;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1040px;
  margin: 14px auto 0;
  padding: 14px 20px;
  background: rgba(255, 250, 247, 0.78);
  border: 1px solid rgba(239, 203, 213, 0.74);
  border-radius: 999px;
  box-shadow: 0 14px 34px rgba(127, 38, 63, 0.08);
  backdrop-filter: blur(18px);
}

.brand {
  display: grid;
  gap: 4px;
}

.brand span {
  font-size: 20px;
  font-weight: 760;
  color: var(--wine);
}

.brand small,
time,
.post-item p,
.empty,
.summary,
.page-heading p,
td span {
  color: var(--muted);
}

nav {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

nav a {
  border-radius: 999px;
  color: var(--muted);
  padding: 8px 12px;
}

nav .active {
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-weight: 700;
}

main {
  position: relative;
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}

.hero {
  position: relative;
  min-height: 420px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: 44px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(255, 224, 233, 0.72)),
    var(--paper);
  border: 1px solid rgba(239, 203, 213, 0.9);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.hero::after {
  position: absolute;
  right: 32px;
  bottom: 28px;
  width: 140px;
  height: 140px;
  content: "";
  border: 1px solid rgba(184, 63, 103, 0.2);
  border-radius: 999px;
  box-shadow: inset 0 0 0 18px rgba(255, 240, 244, 0.72);
  transform: rotate(-14deg);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  line-height: 1.12;
}

.hero h1 {
  position: relative;
  z-index: 1;
  max-width: 760px;
  color: var(--wine);
  font-size: clamp(48px, 8vw, 92px);
  letter-spacing: 0;
}

.hero-copy {
  position: relative;
  z-index: 1;
  max-width: 620px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 19px;
  line-height: 1.7;
}

.hero-notes {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 30px;
}

.hero-notes span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid rgba(184, 63, 103, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  padding: 7px 12px;
}

.post-list {
  display: grid;
  gap: 0;
  margin-top: 8px;
}

.thoughts-preview {
  padding: 42px 0 12px;
}

.post-section {
  padding-top: 32px;
}

.section-title,
.page-heading {
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

.section-title {
  align-items: end;
  margin-bottom: 18px;
}

.text-link {
  color: var(--accent);
  font-weight: 750;
  border-bottom: 1px solid rgba(184, 63, 103, 0.22);
  padding-bottom: 3px;
}

.role-badge {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 10px;
}

.role-badge.puppy {
  background: var(--puppy-soft);
  color: var(--accent-strong);
}

.role-badge.owner {
  background: var(--owner-soft);
  color: var(--owner);
}

.thought-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.thought-card {
  position: relative;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 22px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid rgba(239, 203, 213, 0.9);
  border-radius: 14px;
  box-shadow: 0 14px 34px rgba(127, 38, 63, 0.08);
}

.thought-card.owner,
.post-item.owner,
.post-detail.owner {
  border-color: rgba(91, 42, 71, 0.26);
}

.thought-card.owner {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(246, 238, 246, 0.92));
}

.thought-card::before {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 28px;
  height: 28px;
  content: "";
  border: 1px solid rgba(184, 63, 103, 0.2);
  border-radius: 999px;
  background: rgba(255, 224, 233, 0.5);
}

.thought-card p {
  margin: 0;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.thought-card time {
  font-size: 13px;
}

.page-heading {
  align-items: flex-start;
  flex-direction: column;
  max-width: 720px;
  min-height: 260px;
  justify-content: center;
  padding: 34px 0;
  border-top: 1px solid rgba(239, 203, 213, 0.9);
  border-bottom: 1px solid rgba(239, 203, 213, 0.9);
}

.page-heading h1 {
  color: var(--wine);
  font-size: clamp(42px, 8vw, 76px);
}

.page-heading p:last-child {
  max-width: 560px;
  margin: 4px 0 0;
  font-size: 18px;
  line-height: 1.7;
}

.thought-feed {
  max-width: 760px;
  display: grid;
  gap: 16px;
  margin: 36px auto 0;
}

.thought-feed .thought-card {
  min-height: 0;
}

.post-item {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 28px;
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
  transition: transform 160ms ease, border-color 160ms ease;
}

.post-item.owner h2 {
  color: var(--owner);
}

.post-item:hover {
  border-color: rgba(184, 63, 103, 0.34);
  transform: translateX(4px);
}

.post-item h2 {
  color: var(--wine);
  font-size: 28px;
}

.post-item h2 a:hover {
  color: var(--accent);
}

.post-item p {
  max-width: 680px;
  margin: 12px 0 0;
  line-height: 1.75;
}

.post-detail {
  max-width: 780px;
  margin: 42px auto 0;
  padding: 34px;
  background: rgba(255, 250, 247, 0.72);
  border: 1px solid rgba(239, 203, 213, 0.75);
  border-radius: 18px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 36px;
  color: var(--accent);
  font-weight: 700;
}

.post-detail h1 {
  margin-top: 14px;
  color: var(--wine);
  font-size: clamp(34px, 6vw, 64px);
}

.summary {
  margin: 20px 0 42px;
  font-size: 19px;
  line-height: 1.7;
}

.content {
  font-size: 18px;
  line-height: 1.85;
}

.content h2,
.content h3,
.content h4 {
  margin-top: 36px;
}

.comment-box {
  margin-top: 42px;
  padding-top: 28px;
  border-top: 1px solid rgba(239, 203, 213, 0.9);
}

.comment-box.inline {
  margin-top: 18px;
  padding-top: 18px;
}

.section-title.compact {
  margin-bottom: 12px;
}

.section-title.compact h2 {
  font-size: 20px;
}

.comment-list {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.comment-list.compact {
  margin-top: 12px;
}

.comment-item {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(239, 203, 213, 0.82);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.66);
}

.comment-item.owner {
  border-color: rgba(91, 42, 71, 0.22);
  background: rgba(246, 238, 246, 0.72);
}

.comment-item p {
  margin: 0;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.comment-item time {
  font-size: 12px;
}

.comment-form {
  display: grid;
  grid-template-columns: minmax(160px, 220px) 1fr auto;
  align-items: end;
  gap: 12px;
  margin-top: 14px;
}

.comment-form .form-message {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--danger);
  font-weight: 700;
}

.auth-panel,
.admin-shell,
.editor {
  max-width: 920px;
  margin: 42px auto 0;
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.auth-panel {
  max-width: 420px;
}

.stack,
.editor-form,
.thought-form {
  display: grid;
  gap: 18px;
  margin-top: 24px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  font: inherit;
  padding: 12px 13px;
}

input:focus,
textarea:focus,
select:focus {
  outline: 2px solid rgba(184, 63, 103, 0.18);
  border-color: var(--accent);
}

textarea {
  resize: vertical;
}

button,
.button,
.small-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-weight: 750;
  padding: 10px 16px;
}

button:hover,
.button:hover,
.small-button:hover {
  background: var(--accent-strong);
}

.small-button {
  min-height: 34px;
  padding: 8px 12px;
  font-size: 14px;
}

.danger {
  min-height: 34px;
  padding: 8px 12px;
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(180, 70, 63, 0.32);
}

.danger:hover {
  background: rgba(180, 70, 63, 0.08);
}

.admin-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 16px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 13px;
}

td:first-child {
  min-width: 260px;
}

td:first-child a {
  display: block;
  font-weight: 760;
}

td span {
  display: block;
  margin-top: 5px;
  font-size: 13px;
}

.status {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 10px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 13px;
}

.status.draft {
  background: #fff1db;
  color: #8f5b28;
}

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

.thought-admin-list {
  display: grid;
  gap: 12px;
  margin: 24px 0 0;
  padding: 0;
  list-style: none;
}

.thought-admin-list li {
  display: grid;
  gap: 12px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.thought-admin-list p {
  margin: 0;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.thought-admin-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.error {
  border-radius: 6px;
  background: rgba(180, 70, 63, 0.08);
  color: var(--danger);
  padding: 12px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 680px) {
  .site-header,
  .admin-title,
  .section-title,
  .post-item {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-header {
    padding: 22px 18px;
  }

  main {
    padding: 0 18px 56px;
  }

  .post-item {
    display: block;
  }

  .post-item h2 {
    margin-top: 10px;
    font-size: 24px;
  }

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

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

  .auth-panel,
  .admin-shell,
  .editor {
    padding: 20px;
  }
}
