:root {
  --bg: #f7f5f0;
  --fg: #1f1d18;
  --accent: #b91c1c;
  --accent-soft: #fde8e8;
  --muted: #6b6b6b;
  --card-bg: #ffffff;
  --border: #e6e3da;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.55;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0.8rem 1.5rem;
  background: var(--fg);
  color: var(--bg);
  border-bottom: 3px solid var(--accent);
}
.topbar .brand {
  font-weight: bold;
  color: var(--bg);
  text-decoration: none;
  font-size: 1.1rem;
}
.topbar .nav {
  display: flex;
  gap: 1.2rem;
  align-items: center;
}
.topbar .nav a { color: var(--bg); text-decoration: none; }
.topbar .nav a:hover { text-decoration: underline; }
.topbar .user { color: var(--muted); font-style: italic; }
.logout-form { display: inline; margin: 0; }
.logout-form button {
  background: transparent;
  color: var(--bg);
  border: 1px solid var(--bg);
  padding: 0.2rem 0.6rem;
  cursor: pointer;
  font: inherit;
}
.container {
  max-width: 1100px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}
.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.4rem 1.6rem;
  margin: 1.4rem 0;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.card h1, .card h2 { margin-top: 0; }
.card-list { list-style: none; padding: 0; }
.card-list li { margin: 0.6rem 0; }
.actions { display: flex; gap: 0.8rem; margin-top: 0.3rem; }
.actions a { font-size: 0.92rem; color: var(--accent); }
.muted { color: var(--muted); font-size: 0.92rem; }
.error {
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 0.6rem 1rem;
  border-radius: 4px;
  margin-bottom: 1rem;
}
.form { display: flex; flex-direction: column; gap: 0.8rem; max-width: 360px; }
.form label { display: flex; flex-direction: column; gap: 0.25rem; }
.form input {
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font: inherit;
}
.form button {
  padding: 0.6rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
}
.register { margin-top: 1rem; }
.entries { list-style: none; padding: 0; }
.entry header { display: flex; align-items: baseline; gap: 0.8rem; }
.entry .markdown { line-height: 1.65; }
.badge {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.story-events { list-style: none; padding: 0; counter-reset: beat; }
.story-event { position: relative; }
.story-event .meta { display: flex; gap: 0.6rem; align-items: center; margin-bottom: 0.4rem; }
.story-event .comment { font-size: 1.05rem; margin: 0.4rem 0; }
.story-event .source { color: var(--muted); font-size: 0.82rem; }
.story-event.act-build_up { border-left: 3px solid var(--muted); }
.story-event.act-high_point { border-left: 3px solid var(--accent); }
.story-event.act-crisis { border-left: 3px solid #444; }
.story-event.act-turning_point { border-left: 3px solid #2e7d32; }
.story-event.act-finale { border-left: 3px solid var(--accent); background: var(--accent-soft); }
.rivalries, .rivalry-list { list-style: none; padding: 0; }
.rivalry header, .rivalry-card header { display: flex; justify-content: space-between; align-items: baseline; }
.rivalry .intensity, .rivalry-card .intensity { color: var(--accent); }
.history { list-style: none; padding-left: 1rem; border-left: 2px solid var(--border); }
.story-list, .rivalry-list { list-style: none; padding: 0; }
.story-card header { display: flex; gap: 0.6rem; align-items: baseline; }
.subject { font-style: italic; color: var(--muted); margin: 0.3rem 0; }
.footer {
  margin-top: 4rem;
  padding: 1.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  border-top: 1px solid var(--border);
}