:root {
  --bg: #f7f8f6;
  --card: #ffffff;
  --text: #1d1f1c;
  --muted: #6b7068;
  --line: #e3e6e0;
  --accent: #2f6f4f;
  --accent-soft: #e4efe8;
  --bad: #c2553f;
  --radius: 14px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151715;
    --card: #1e211e;
    --text: #eceee9;
    --muted: #9aa096;
    --line: #2e322d;
    --accent: #6fbf94;
    --accent-soft: #233229;
    --bad: #e07a63;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
}

.logo { font-size: 24px; margin: 0; letter-spacing: -0.02em; }
.date { color: var(--muted); font-size: 14px; }

.screen {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}

.lead { font-size: 19px; margin-top: 0; }
.rules { padding-left: 20px; color: var(--muted); }
.rules li { margin-bottom: 6px; }
code { background: var(--accent-soft); padding: 1px 5px; border-radius: 5px; font-size: 0.9em; }

.progress {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 12px;
}

.tag {
  background: var(--accent-soft);
  color: var(--accent);
  padding: 1px 10px;
  border-radius: 999px;
}

.question { font-size: 22px; line-height: 1.35; margin: 0 0 20px; }
.question.small { font-size: 18px; }
.scale-hint { margin: -10px 0 14px; color: var(--accent); font-size: 15px; }
.scale-hint:empty { display: none; }

.input-row { display: flex; align-items: center; gap: 10px; }

.answer-input {
  flex: 1;
  min-width: 0;
  font-size: 24px;
  padding: 12px 14px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
}
.answer-input:focus { outline: none; border-color: var(--accent); }

.unit { color: var(--muted); white-space: nowrap; }
.preview { color: var(--muted); font-size: 14px; min-height: 22px; margin: 6px 2px 16px; }

.btn {
  width: 100%;
  font: inherit;
  font-weight: 600;
  padding: 13px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
}
.btn.primary { background: var(--accent); color: var(--card); }
.btn:disabled { opacity: 0.4; cursor: default; }

.compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}
.label { color: var(--muted); font-size: 13px; }
.value { font-size: 22px; font-weight: 600; word-break: break-word; }
.value.accent { color: var(--accent); }

.score-line { display: flex; align-items: center; gap: 12px; }
.score-bar { flex: 1; height: 10px; background: var(--line); border-radius: 999px; overflow: hidden; }
.score-fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width 0.6s ease; }
.score-num { font-weight: 600; white-space: nowrap; }

.ratio { color: var(--muted); font-size: 14px; margin: 6px 0 14px; }
.explanation { margin: 0 0 8px; }
.source { color: var(--muted); font-size: 13px; margin: 0 0 18px; word-break: break-word; }
.source a { color: inherit; }

.feedback {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 15px;
}
.feedback span { flex: 1; }
.vote {
  font-size: 20px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px 12px;
  cursor: pointer;
}
.vote.chosen { border-color: var(--accent); background: var(--accent-soft); }

.total { font-size: 48px; font-weight: 700; text-align: center; letter-spacing: -0.02em; }
.total .of { font-size: 22px; color: var(--muted); font-weight: 500; }

.results { padding-left: 22px; margin: 18px 0 22px; }
.results li { margin-bottom: 10px; }
.results .r-q { font-size: 14px; color: var(--muted); }
.results .r-pts { font-weight: 600; }

.hint { text-align: center; color: var(--muted); font-size: 14px; margin: 10px 0 0; }
.hint.left { text-align: left; margin: 0 0 16px; }

.name-input { width: 100%; margin-bottom: 16px; font-size: 20px; }
.player { color: var(--muted); font-size: 14px; margin: 0 0 14px; }
.player strong { color: var(--text); }
.link {
  font: inherit;
  color: var(--accent);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
}

.board { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 16px; }
.board h3 { margin: 0 0 4px; font-size: 18px; }
.percentile { color: var(--accent); font-weight: 600; margin: 0 0 10px; }
.board-list { padding-left: 24px; margin: 0; }
.board-list li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.board-list li.me { font-weight: 700; color: var(--accent); }
.board-list .b-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
