:root {
  --bg: #0c0c0e;
  --paper: #18181b;
  --surface: #111114;
  --ink: #f0ece4;
  --muted: #8a8478;
  --line: #2a2a2e;
  --line-light: #3a3a3e;
  --brand: #e63220;
  --brand-rgb: 230, 50, 32;
  --brand-hot: #f97316;
  --brand-hot-rgb: 249, 115, 22;
  --brand-soft: #2d1510;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", sans-serif;
  background:
    radial-gradient(circle at 80% -10%, rgba(var(--brand-rgb), 0.08) 0%, transparent 45%),
    radial-gradient(circle at 0% 120%, rgba(var(--brand-hot-rgb), 0.06) 0%, transparent 40%),
    var(--bg);
}

.topbar {
  border-bottom: 1px solid rgba(var(--brand-rgb), 0.3);
  background: rgba(12, 12, 14, 0.92);
  position: sticky;
  top: 0;
  backdrop-filter: blur(8px);
}

.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand,
.fake-name,
.post-link {
  background: linear-gradient(135deg, var(--brand), var(--brand-hot));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-size: 1.35rem;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.brand img {
  width: 34px;
  height: 34px;
}

.top-links {
  display: flex;
  gap: 0.75rem;
}

.top-links a,
.inline-link {
  color: var(--ink);
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  font-size: 0.9rem;
}

.shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem;
}

.feed-header h1,
.admin-header h1 {
  margin: 0;
}

.feed-header p,
.admin-header p {
  color: var(--muted);
  margin-top: 0.5rem;
}

.logout-form {
  margin-top: 0.5rem;
  max-width: 180px;
}

.admin-notice {
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  margin: 0.6rem 0 0.2rem;
  border: 1px solid var(--line);
  width: fit-content;
}

.admin-notice.error {
  background: #2d1210;
  border-color: #5c2420;
  color: #f0a8a0;
}

.admin-notice.success {
  background: #122d10;
  border-color: #1e5c20;
  color: #a0f0a8;
}

.feed-list {
  display: grid;
  gap: 0.75rem;
}

.post-card {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 0.8rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: 14px;
  padding: 0.75rem;
}

.avatar-wrap {
  width: 52px;
  height: 52px;
}

.avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid var(--brand-soft);
  background: #1e1e22;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.fake-name,
.post-link {
  text-decoration: none;
  font-weight: 700;
}

.inline-meta-link {
  color: var(--ink);
  text-decoration: underline;
}

.thread-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.08rem 0.45rem;
  background: #1a1518;
  color: var(--muted);
  font-size: 0.82rem;
}

.thread-chip.is-reply {
  background: var(--brand-soft);
  border-color: rgba(var(--brand-rgb), 0.3);
  color: #e8a090;
}

.post-content p {
  margin: 0.45rem 0 0;
  line-height: 1.45;
  white-space: pre-wrap;
}

.post-image {
  margin-top: 0.55rem;
  width: min(100%, 560px);
  border-radius: 10px;
  border: 1px solid var(--line);
  display: block;
}

.parent-quote-card {
  background: #141316;
  border-style: dashed;
}

.pager {
  margin: 1rem 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.page-link {
  text-decoration: none;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 8px;
  padding: 0.35rem 0.55rem;
  color: var(--ink);
}

.page-link.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  font-weight: 700;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem;
}

.panel h2 {
  margin-top: 0;
}

label {
  display: block;
  margin: 0.45rem 0 0.2rem;
  font-size: 0.9rem;
}

input,
select,
textarea,
button {
  width: 100%;
  border: 1px solid var(--line-light);
  border-radius: 9px;
  padding: 0.5rem 0.6rem;
  font: inherit;
  background: var(--surface);
  color: var(--ink);
}

button {
  margin-top: 0.75rem;
  background: linear-gradient(135deg, var(--brand), var(--brand-hot));
  border-color: var(--brand);
  color: white;
  font-weight: 700;
  cursor: pointer;
}

span.field-validation-error {
  color: #f0706a;
  display: block;
  font-size: 0.85rem;
  margin-top: 0.2rem;
}

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.item-list li {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.5rem;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 0.6rem;
}

.text-list li {
  grid-template-columns: 1fr;
}

.item-list img {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
}

.inline-edit-form {
  margin-top: 0.45rem;
  display: grid;
  gap: 0.35rem;
}

.inline-edit-form button {
  width: auto;
  margin-top: 0.1rem;
  padding: 0.35rem 0.6rem;
}

.empty-state {
  background: var(--paper);
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 1rem;
}

.thread-list {
  gap: 0.65rem;
}

.thread-node {
  margin-left: calc(var(--thread-depth, 0) * 1.1rem);
  position: relative;
}

.thread-node::before {
  content: "";
  position: absolute;
  left: -0.65rem;
  top: 0.45rem;
  bottom: 0.45rem;
  border-left: 2px solid var(--brand);
}

.root-node {
  margin-left: 0;
}

.root-node::before {
  display: none;
}

@media (max-width: 768px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .post-card {
    grid-template-columns: 44px 1fr;
  }

  .avatar-wrap {
    width: 44px;
    height: 44px;
  }

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