:root {
  --bg: #faf7f2;
  --ink: #2b2a28;
  --muted: #7a766e;
  --accent: #3a7ca5;
  --accent-dark: #2c6183;
  --good: #4a7c59;
  --bad: #b8593f;
  --card-border: #e5e0d8;
  --radius: 14px;
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Latin faces stay first so Latin text is unaffected; CJK glyphs fall through
   to the rest. Separate stacks per language because Han characters are shaped
   differently in Chinese and Japanese, and :lang() follows the <html lang>
   attribute the switcher sets. */
:root:lang(zh) {
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
}

:root:lang(ja) {
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", Meiryo, "Noto Sans CJK JP", sans-serif;
}

:root:lang(ko) {
  --font-stack: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans CJK KR", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-stack);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  width: 0%;
  background: var(--accent);
  z-index: 100;
  transition: width 0.25s ease;
}

.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}

/* Feedback on the left, language on the right. Wraps rather than squashing:
   some translations of the link are much longer than the English. */
.top-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 4px;
}

.feedback-link {
  color: var(--muted);
  font-size: 0.88rem;
  text-decoration: none;
}

.feedback-link:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.feedback-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.lang-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 8px 34px 8px 14px;
  border: 1px solid var(--card-border);
  border-radius: 999px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%237a766e' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.lang-select:hover {
  border-color: var(--accent);
}

.lang-select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.header {
  text-align: center;
  margin-bottom: 40px;
}

.header h1 {
  font-size: 1.9rem;
  line-height: 1.25;
  margin: 12px 0 8px;
}

/* The English domain under the translated heading, in every language: quiet,
   but there so people pick up the address. Clicking it shares the site. */
.wordmark {
  margin: 0;
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  overflow-wrap: anywhere;
}

.wordmark:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.wordmark:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Measure is capped so the centred lines stay readable on a wide screen. */
.tagline {
  max-width: 44ch;
  margin: 18px auto 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
  text-wrap: pretty;
}

.question {
  margin-bottom: 36px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--card-border);
}

.question:last-of-type {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.q-label {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0 0 6px;
  display: block;
}

.q-label.small {
  font-size: 0.9rem;
  margin-top: 14px;
}

.optional {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.85em;
}

.q-help {
  color: var(--muted);
  font-size: 0.88rem;
  margin: 0 0 14px;
  line-height: 1.4;
}

input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  font-size: 1rem;
  background: #fff;
  color: var(--ink);
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}

.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  background: #fff;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.option:has(input:checked) {
  border-color: var(--accent);
  background: #eef4f9;
}

.option input[type="radio"] {
  accent-color: var(--accent);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.option span {
  font-size: 0.98rem;
}

.followup {
  margin-top: 14px;
  animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Focused programmatically after a reset; no ring needed for a mouse user. */
.header h1:focus {
  outline: none;
}

.result {
  margin-top: 48px;
  padding-top: 40px;
  border-top: 2px solid var(--card-border);
  animation: fadeIn 0.4s ease;
}

.result-title {
  font-size: 1.5rem;
  line-height: 1.3;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 8px;
}

.result-verdict {
  font-size: 1.25rem;
  line-height: 1.35;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 28px;
}

.result-verdict.positive {
  color: var(--good);
}

.result-verdict.negative {
  color: var(--bad);
}

.breakdown {
  list-style: none;
  padding: 0;
  margin: 0 0 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.breakdown li {
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 0.92rem;
  line-height: 1.4;
  border-left: 4px solid var(--card-border);
  background: #fff;
}

.breakdown li.positive {
  border-left-color: var(--good);
}

.breakdown li.negative {
  border-left-color: var(--bad);
}

/* Both trailing actions are deliberately quiet: a full-width bordered button
   here read as a submit button, which neither of these is.
   No display property on purpose: the UA [hidden] rule needs to win when the
   form is untouched. */
.reset-btn,
.share-btn {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: var(--radius);
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

/* Separates the pair from the question or breakdown above. */
.reset-btn {
  margin-top: 24px;
}

.share-btn {
  margin-top: 4px;
}

.reset-btn:hover,
.share-btn:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.reset-btn:focus-visible,
.share-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}