/* Only these five colours are used anywhere in the app.
   Accent is for fills (with --text on top), borders and tags; never for text. */
:root {
  --bg: #171213;
  --surface: #242323;
  --border: #3D3837;
  --text: #D2CEC7;
  --accent: #A11A17;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.5;
}

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

h1 { font-size: 1.75rem; line-height: 1.2; margin: 0 0 16px; }
h2 { font-size: 1.25rem; margin: 32px 0 8px; }
h3 { font-size: 1.0625rem; margin: 0; }
p { margin: 0 0 12px; }

h1:focus { outline: none; } /* focused only to announce a new screen */

.hint { font-size: 0.9375rem; }

/* --- Focus: always visible, in --text (accent on --bg is too low-contrast) */
:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 3px;
}

/* --- Panels -------------------------------------------------------------- */
.note, .card, .question {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.note { margin: 0 0 24px; }
.note h2 { margin-top: 0; font-size: 1.0625rem; }
.note p:last-child { margin-bottom: 0; }

/* --- Form fields --------------------------------------------------------- */
.field { margin: 0 0 20px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.field legend, .field > label:not(.choice) {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  padding: 0;
}

input[type="text"], select {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  font: inherit;
  font-size: 1rem; /* 16px+: stops iOS zooming on focus */
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
select:disabled { opacity: 0.7; }

.question { margin: 0 0 16px; }
.question legend {
  float: left; /* keeps the legend inside the padded panel */
  width: 100%;
  font-weight: 600;
  margin-bottom: 10px;
  padding: 0;
}
.question legend + * { clear: both; }
.question.missing { border-color: var(--accent); border-width: 2px; }
.qnum { font-variant-numeric: tabular-nums; }

/* Whole row is the tap target. */
.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 8px 12px;
  margin: 0 0 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
}
.choice:last-child { margin-bottom: 0; }
.choice input {
  width: 22px;
  height: 22px;
  margin: 0;
  flex: none;
  accent-color: var(--accent);
}
.choice:has(input:checked) { border-color: var(--accent); border-width: 2px; padding: 7px 11px; }
.choice:has(input:focus-visible) { outline: 3px solid var(--text); outline-offset: 2px; }
.choice input:focus-visible { outline: none; }

.error {
  border-left: 4px solid var(--accent);
  background: var(--surface);
  padding: 10px 12px;
  border-radius: 4px;
}

/* --- Buttons ------------------------------------------------------------- */
button {
  display: block;
  width: 100%;
  min-height: 48px;
  margin: 24px 0 0;
  padding: 12px 16px;
  font: inherit;
  font-weight: 600;
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
}
button.primary { background: var(--accent); border: 2px solid var(--accent); }
button.secondary { background: var(--surface); border: 2px solid var(--border); }
button:active { transform: translateY(1px); }

/* --- Results ------------------------------------------------------------- */
.summary { font-size: 1.125rem; font-weight: 600; }

.cards { list-style: none; margin: 0; padding: 0; }
.card { margin: 0 0 12px; }
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.tag {
  flex: none;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 4px 10px;
  border-radius: 999px;
  border: 2px solid var(--border);
  color: var(--text);
  background: transparent;
}
.tag-slight { border-color: var(--accent); }
.tag-disagree { background: var(--accent); border-color: var(--accent); }

dl { margin: 0; }
dl > div { display: flex; flex-wrap: wrap; gap: 0 8px; margin-bottom: 4px; }
dt { font-weight: 400; }
dt::after { content: ":"; }
dd { margin: 0; font-weight: 600; }

.country {
  font-size: 0.9375rem;
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.country + .country { border-top: 0; padding-top: 0; margin-top: 6px; }

/* --- Conversation starters --------------------------------------------- */
.prompt { margin: 8px 0 0; }

/* --- Planner ------------------------------------------------------------- */
.plan-task h3 { margin-bottom: 10px; }
.plan-fields {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 12px;
}
.plan-fields label {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 4px;
}
.plan-fields select, .plan-fields input { min-width: 0; }
input.invalid { border-color: var(--accent); border-width: 2px; }
.plan-mode { margin-top: 24px; }

.plan-result { margin-top: 24px; }
.plan-result h2 { margin-top: 0; font-size: 1.25rem; }
.plan-result .summary { font-size: 1.0625rem; }
.plan-result h3 { margin: 16px 0 8px; }

.bar-labels {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  margin-bottom: 6px;
}
.bar-labels > span { display: flex; align-items: center; gap: 6px; }
.bar-labels > span:last-child { text-align: right; }
.bar {
  display: flex;
  height: 28px;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: var(--bg);
}
.bar-a, .bar-b { flex-basis: 0; min-width: 0; }
/* Solid vs striped, so the two halves differ by more than colour. */
.bar-a, .key-a { background: var(--accent); }
.bar-b, .key-b {
  background: repeating-linear-gradient(45deg, var(--text) 0 3px, var(--surface) 3px 8px);
}
.bar-a + .bar-b { border-left: 2px solid var(--bg); }
.key { display: inline-block; width: 14px; height: 14px; border-radius: 3px; flex: none; }

.suggestions { margin: 0; padding-left: 1.25em; }
.suggestions li { margin-bottom: 8px; }

@media (prefers-reduced-motion: reduce) {
  button:active { transform: none; }
}
