:root {
  --coral: #fd524f;
  --dark: #363330;
  --light: #f9f7f6;
  --muted: #8a837d;
  --line: #e7e2de;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--light);
  color: var(--dark);
  font-family: ui-sans-serif, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--dark);
}

.brand img { height: 26px; }

.brand span {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .02em;
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 28px 20px 80px;
}

h1 { font-size: 26px; margin: 0 0 8px; line-height: 1.25; }
h2 { font-size: 16px; margin: 0 0 14px; }
h2.section { margin: 32px 0 14px; }
p { margin: 0 0 10px; }

.muted { color: var(--muted); }
.empty { text-align: center; padding: 32px 0; }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 22px;
}

.login { max-width: 380px; margin: 60px auto; text-align: center; }
.login form { margin-top: 18px; }

input[type=text], input[type=password], textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  color: var(--dark);
  background: var(--light);
  margin-bottom: 10px;
  resize: vertical;
}

input:focus, textarea:focus {
  outline: none;
  border-color: var(--coral);
  background: #fff;
}

.row { display: flex; gap: 10px; align-items: flex-start; }
.row input[type=text] { margin-bottom: 0; }

button.primary {
  background: var(--coral);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 11px 22px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

button.primary:hover { filter: brightness(.94); }
.login button.primary { width: 100%; }

.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
  padding: 0;
}

.link-btn:hover { color: var(--coral); }

.flash {
  background: #fff1f0;
  border: 1px solid #f7c9c7;
  color: #9c2f2c;
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 18px;
}

.sorts { display: flex; gap: 16px; margin: 0 0 14px 4px; }

.sorts a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}

.sorts a.on { color: var(--coral); }

.posts, .comments { list-style: none; padding: 0; margin: 0; }

.post, .comment {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.posts .post {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 12px;
}

.comment {
  border-top: 1px solid var(--line);
  padding: 14px 4px;
}

.post-main { min-width: 0; flex: 1; }

.vote {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  min-width: 46px;
  padding: 7px 4px;
  background: var(--light);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font: inherit;
  cursor: pointer;
}

.vote:hover { border-color: var(--coral); color: var(--coral); }

.vote.voted {
  background: var(--coral);
  border-color: var(--coral);
  color: #fff;
}

.vote .arrow { font-size: 11px; line-height: 1; }
.vote .score { font-size: 15px; font-weight: 700; }
.vote.small { min-width: 38px; padding: 5px 3px; }
.vote.small .score { font-size: 13px; }

a.post-title {
  display: block;
  font-size: 18px;
  font-weight: 600;
  color: var(--dark);
  text-decoration: none;
  margin-bottom: 4px;
}

a.post-title:hover { color: var(--coral); }
h1.post-title { margin-bottom: 6px; }

.post-body, .comment-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin-bottom: 6px;
}

.meta { font-size: 13px; color: var(--muted); margin: 0; }
.meta a { color: var(--muted); }
.meta a:hover { color: var(--coral); }

a.back { color: var(--muted); text-decoration: none; font-size: 14px; }
a.back:hover { color: var(--coral); }
