:root {
  --bg: #f4f1ea;
  --card: #fffdf8;
  --ink: #2b2620;
  --muted: #7a7163;
  --accent: #c25e3f;
  --accent-soft: #e8c9bd;
  --line: #e2dccf;
  --good: #4e7a4e;
  font-size: 16px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.55;
}

header {
  max-width: 860px;
  margin: 0 auto;
  padding: 2.5rem 1.25rem 0.5rem;
  position: relative;
}

h1 {
  font-size: 2.4rem;
  margin: 0;
  letter-spacing: -0.5px;
}

.tagline {
  color: var(--muted);
  font-style: italic;
  margin-top: 0.35rem;
}

#settingsBtn {
  position: absolute;
  top: 2.5rem;
  right: 1.25rem;
}

main {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

footer {
  max-width: 860px;
  margin: 0 auto;
  padding: 1rem 1.25rem 2.5rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.5rem;
  margin: 1.25rem 0;
  box-shadow: 0 1px 3px rgba(43, 38, 32, 0.06);
}

.hidden { display: none; }

h2 {
  font-size: 1.15rem;
  margin: 1.1rem 0 0.5rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 0.3rem;
}
.card h2:first-child { margin-top: 0; }

.muted { color: var(--muted); font-size: 0.9rem; }

textarea, input, select {
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.55rem 0.7rem;
  width: 100%;
}

textarea { resize: vertical; }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin: 0.6rem 0;
}
@media (max-width: 640px) { .grid { grid-template-columns: 1fr; } }

.grid label, .row label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.row {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  flex-wrap: wrap;
  margin: 0.7rem 0;
}
.row label { flex-direction: row; align-items: center; gap: 0.5rem; }
.row input { width: auto; flex: 1; min-width: 200px; }

button {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.55rem 1.2rem;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: 0.5; cursor: wait; }

button.ghost {
  background: transparent;
  color: var(--accent);
}

button.primary {
  margin-top: 0.8rem;
  font-size: 1.05rem;
}

#status { margin-top: 0.6rem; min-height: 1.2em; }
#status.error { color: #a33; }

/* Dimension bars */
.dim {
  display: grid;
  grid-template-columns: 180px 1fr 2.2rem;
  gap: 0.7rem;
  align-items: center;
  margin: 0.45rem 0;
  font-size: 0.92rem;
}
@media (max-width: 640px) { .dim { grid-template-columns: 120px 1fr 2rem; } }

.dim .bar {
  background: var(--line);
  border-radius: 99px;
  height: 0.65rem;
  overflow: hidden;
}
.dim .bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.6s ease;
}
.dim .why {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 0.82rem;
  margin: -0.2rem 0 0.3rem;
  padding-left: 0.2rem;
}

/* Related works */
.related {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  margin: 0.5rem 0;
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
}
.related input[type="checkbox"] {
  width: auto;
  margin-top: 0.25rem;
  accent-color: var(--accent);
}
.related .rel-name { font-weight: bold; }
.related .rel-how {
  display: inline-block;
  font-size: 0.75rem;
  background: var(--accent-soft);
  border-radius: 99px;
  padding: 0.05rem 0.6rem;
  margin-left: 0.4rem;
  color: var(--ink);
}
.related p { margin: 0.25rem 0 0; font-size: 0.88rem; color: var(--muted); }

.narrative {
  font-size: 1rem;
  white-space: pre-wrap;
}

.verdict-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: 0.8rem 0;
}
@media (max-width: 640px) { .verdict-grid { grid-template-columns: 1fr; } }

.verdict-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}
.verdict-box h3 { margin: 0 0 0.5rem; font-size: 0.95rem; }

.big-score {
  font-size: 2.6rem;
  color: var(--accent);
}
.big-score small { font-size: 1.1rem; color: var(--muted); }
