/* My Voice, by EdPsych Connect.
   Aims: WCAG 2.2 AA. Large targets (at least 48 by 48 pixels), strong focus
   rings, text contrast of at least 4.5 to 1, no motion, works at 400% zoom. */

:root {
  --ink: #1f2a44;
  --ink-soft: #46516b;
  --paper: #fbf8f3;
  --card: #ffffff;
  --line: #8a93a6;
  --primary: #1d5f8a;
  --primary-ink: #ffffff;
  --primary-soft: #e3f0fa;
  --stop: #b42318;
  --help-bg: #e8f1f8;
  --alert-bg: #fff4e5;
  --alert-line: #b45309;
  --like: #fff3cc;
  --hard: #e1effa;
  --unsure: #efeaf8;
  --focus: #ffd84d;
  --radius: 14px;
  --font: "Segoe UI", "Helvetica Neue", Arial, system-ui, sans-serif;
  font-size: 100%;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 1.125rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
body[data-band="b4-7"] { font-size: 1.375rem; }
body[data-band="b7-11"] { font-size: 1.25rem; }

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5em; }
h1 { font-size: 1.9em; }
h2 { font-size: 1.35em; }
h3 { font-size: 1.1em; }
p { margin: 0 0 0.8em; }
a { color: var(--primary); text-underline-offset: 0.15em; }

:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px var(--focus);
}
h1:focus, main:focus { outline: none; box-shadow: none; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 0.5rem; top: -4rem; z-index: 10;
  background: var(--ink); color: #fff; padding: 0.75rem 1rem; border-radius: 8px;
}
.skip-link:focus { top: 0.5rem; }

/* Top bar */
.topbar {
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem; background: var(--card); border-bottom: 2px solid #d9dee8;
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 0.6rem; font-size: 1.125rem; }
.brand-mark { width: 2rem; height: 2rem; border-radius: 50%; background: var(--primary); position: relative; flex: none; }
.brand-mark::after {
  content: ""; position: absolute; left: 0.45rem; top: 0.55rem; width: 1.1rem; height: 0.8rem;
  background: #fff; border-radius: 0.5rem 0.5rem 0.5rem 0.1rem;
}
.brand-name { font-weight: 700; }
.brand-by { color: var(--ink-soft); font-size: 0.9em; }
.topbar-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }

.mode-banner {
  margin: 0; padding: 0.5rem 1rem; background: #eef6ee; color: #1d4d24;
  font-size: 0.95rem; border-bottom: 1px solid #cfe3cf; text-align: center;
}

main { flex: 1; width: 100%; max-width: 64rem; margin: 0 auto; padding: 1.25rem 1rem 2rem; }

/* Help bar: the same place on every screen */
.helpbar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: center;
  padding: 0.6rem 1rem; background: var(--help-bg); border-top: 2px solid #c5d8e8;
}
.helpbar-text { margin: 0; font-weight: 600; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 3rem; min-width: 3rem; padding: 0.55rem 1.1rem;
  font: inherit; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer;
  border-radius: 999px; border: 2px solid var(--primary); background: var(--card); color: var(--primary);
}
.btn:hover { background: var(--primary-soft); }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: #164c6f; }
.btn-stop { background: var(--stop); border-color: var(--stop); color: #fff; font-size: 1.1rem; padding-inline: 1.3rem; }
.btn-stop:hover { background: #8f1c13; }
.btn-help { background: var(--card); }
.btn-say { min-height: 2.75rem; min-width: 2.75rem; padding: 0.4rem; }
.btn[aria-pressed="true"] { background: var(--primary-soft); box-shadow: inset 0 0 0 2px var(--primary); }
.icon { display: inline-flex; width: 1.25em; height: 1.25em; flex: none; }
.icon-svg { width: 100%; height: 100%; }

.nav { display: flex; flex-wrap: wrap; gap: 0.75rem; justify-content: space-between; align-items: center; margin: 1.5rem 0 0.5rem; }
.nav-choices { justify-content: flex-start; }
.nav-small { justify-content: flex-start; margin-top: 0.75rem; }
.skip-hint { text-align: right; }

/* Screens */
.screen-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; justify-content: space-between; }
.eyebrow, .progress { color: var(--ink-soft); font-weight: 600; margin-bottom: 0.25rem; }
.lead { font-size: 1.1em; }
.hint { color: var(--ink-soft); font-size: 0.95em; }
.meta { color: var(--ink-soft); font-size: 0.95rem; }
.plain-list li { margin-bottom: 0.4rem; }

.panel {
  background: var(--card); border: 2px solid #d9dee8; border-radius: var(--radius);
  padding: 1rem 1.25rem; margin: 1rem 0;
}
.panel-adult { border-color: var(--primary); }
.alert {
  background: var(--alert-bg); border: 3px solid var(--alert-line); border-radius: var(--radius);
  padding: 0.75rem 1rem; margin-bottom: 1rem;
}

.assent-list { padding-left: 1.25em; }
.assent-list li { margin-bottom: 0.5em; }

.adult-prompts {
  margin: 1.25rem 0 0; border: 2px dashed var(--line); border-radius: var(--radius);
  padding: 0.5rem 1rem; background: #fdfcf9; font-size: 1rem;
}
.adult-prompts summary { cursor: pointer; font-weight: 600; min-height: 2.75rem; display: flex; align-items: center; }

/* Start page */
.band-grid { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); gap: 1rem; }
.band-card {
  display: flex; flex-direction: column; align-items: center; gap: 0.4rem; text-align: center;
  padding: 1.25rem; background: var(--card); border: 2px solid #d9dee8; border-radius: var(--radius);
  text-decoration: none; color: var(--ink); min-height: 12rem; justify-content: center;
}
.band-card:hover { border-color: var(--primary); }
.band-picture { width: 5rem; height: 5rem; }
.band-card-title { font-weight: 700; font-size: 1.15rem; }
.band-card-meta { color: var(--ink-soft); font-size: 0.95rem; }

.tool-list { list-style: none; padding: 0; display: grid; gap: 1rem; }
.tool-card { background: var(--card); border: 2px solid #d9dee8; border-radius: var(--radius); padding: 1rem 1.25rem; }
.tool-list-planned .tool-card { background: transparent; border-style: dashed; }

/* Fields */
.field { margin: 1rem 0; }
.field-label { display: block; font-weight: 700; margin-bottom: 0.35rem; }
.input {
  width: 100%; font: inherit; color: var(--ink); background: #fff;
  border: 2px solid var(--line); border-radius: 10px; padding: 0.6rem 0.75rem; min-height: 3rem;
}
.textarea { resize: vertical; }
.flag-reply {
  margin-top: 0.5rem; padding: 0.6rem 0.8rem; background: var(--help-bg);
  border-left: 5px solid var(--primary); border-radius: 6px;
}
.own-words { margin-top: 0.75rem; }
.own-words-row { display: flex; gap: 0.5rem; align-items: stretch; }
.own-words-row .input { flex: 1; }

fieldset { border: 0; padding: 0; margin: 1rem 0; min-width: 0; }
legend { font-weight: 700; padding: 0; margin-bottom: 0.5rem; }

/* Choices and chips */
.choices-row { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.choice {
  font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 0.5rem;
  min-height: 3rem; padding: 0.55rem 1rem; border-radius: 12px;
  border: 2px solid var(--line); background: #fff; color: var(--ink); text-align: left;
}
.choice[aria-pressed="true"] { border: 3px solid var(--primary); background: var(--primary-soft); font-weight: 700; }
.choice-with-picture { flex-direction: column; text-align: center; width: 9.5rem; }
.choice-picture { width: 4.5rem; height: 4.5rem; }
.chips-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  font: inherit; cursor: pointer; display: inline-flex; align-items: center; gap: 0.4rem;
  min-height: 3rem; padding: 0.4rem 0.9rem; border-radius: 999px;
  border: 2px solid var(--line); background: #fff; color: var(--ink);
}
.chip-tick { width: 1em; height: 1em; display: none; color: var(--primary); }
.chip[aria-pressed="true"] { border: 3px solid var(--primary); background: var(--primary-soft); font-weight: 700; }
.chip[aria-pressed="true"] .chip-tick { display: inline-flex; }

/* Sort It Out */
.card-big {
  margin: 0.5rem auto; max-width: 18rem; background: #fff; border: 3px solid var(--ink);
  border-radius: 20px; padding: 0.75rem; text-align: center;
}
.card-picture { width: 100%; max-width: 9rem; height: auto; aspect-ratio: 1; }
.card-big figcaption { display: flex; align-items: center; justify-content: center; gap: 0.5rem; font-size: 1.3em; font-weight: 700; }
.piles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; margin: 1rem 0; }
.pile {
  font: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
  padding: 0.6rem 0.5rem; min-height: 7.5rem; border-radius: 18px; border: 3px solid var(--ink); color: var(--ink);
}
.pile-like { background: var(--like); }
.pile-hard { background: var(--hard); }
.pile-unsure { background: var(--unsure); }
.pile[aria-pressed="true"] { box-shadow: inset 0 0 0 4px var(--primary); }
.pile-picture { width: 4rem; height: 4rem; }
.pile-label { font-weight: 700; font-size: 1.1em; }
.pile-board { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 0.75rem; }
.pile-column { border: 3px solid var(--ink); border-radius: 18px; padding: 0.75rem; }
.pile-column.pile-skip { background: #f3f4f6; }
.pile-column h2 { display: flex; align-items: center; gap: 0.5rem; font-size: 1.1em; }
.pile-head-picture { width: 2.5rem; height: 2.5rem; }
.pile-cards { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.5rem; }
.mini-card {
  font: inherit; cursor: pointer; width: 100%; display: flex; align-items: center; gap: 0.6rem;
  background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 0.4rem 0.6rem; min-height: 3.5rem; color: var(--ink); text-align: left;
}
.mini-card[aria-pressed="true"] { border: 3px solid var(--primary); background: var(--primary-soft); }
.mini-picture { width: 2.75rem; height: 2.75rem; flex: none; }
.choices-cards .choice-with-picture { width: 8.5rem; }

/* Set-up */
.setup-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 0.5rem; }
.setup-card, .setup-check { display: flex; align-items: center; gap: 0.5rem; background: #fff; border: 2px solid #d9dee8; border-radius: 10px; padding: 0.3rem 0.6rem; margin-bottom: 0.4rem; }
.setup-card input, .setup-check input { width: 1.5rem; height: 1.5rem; flex: none; accent-color: var(--primary); }
.setup-card label, .setup-check label { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; min-height: 3rem; flex: 1; }
.setup-picture { width: 2.5rem; height: 2.5rem; flex: none; }

/* Placement line */
.place { margin: 1.25rem 0; padding: 0.75rem 1rem 1rem; background: #fff; border: 2px solid #d9dee8; border-radius: var(--radius); }
.place-ends { display: flex; justify-content: space-between; gap: 1rem; font-weight: 600; font-size: 0.95em; }
.place-end { display: flex; align-items: center; gap: 0.5rem; max-width: 48%; }
.place-end-right { flex-direction: row-reverse; text-align: right; }
.place-picture { width: 3.5rem; height: 3.5rem; flex: none; }
.place-status { margin: 0.25rem 0 0; color: var(--ink-soft); text-align: center; }
.place-input { width: 100%; height: 3.5rem; margin: 0.5rem 0 0; background: transparent; cursor: pointer; appearance: none; -webkit-appearance: none; }
.place-input::-webkit-slider-runnable-track { height: 0.9rem; border-radius: 999px; background: linear-gradient(90deg, #c9d1dc, #f4c95d); border: 2px solid var(--ink); }
.place-input::-moz-range-track { height: 0.9rem; border-radius: 999px; background: linear-gradient(90deg, #c9d1dc, #f4c95d); border: 2px solid var(--ink); }
.place-input::-webkit-slider-thumb { -webkit-appearance: none; width: 2.75rem; height: 2.75rem; margin-top: -1.1rem; border-radius: 50%; background: var(--primary); border: 4px solid #fff; box-shadow: 0 0 0 2px var(--ink); }
.place-input::-moz-range-thumb { width: 2.4rem; height: 2.4rem; border-radius: 50%; background: var(--primary); border: 4px solid #fff; box-shadow: 0 0 0 2px var(--ink); }
.place-unset .place-input::-webkit-slider-thumb { background: #fff; border: 3px dashed var(--ink-soft); }
.place-unset .place-input::-moz-range-thumb { background: #fff; border: 3px dashed var(--ink-soft); }

/* Drawing */
.draw-tools { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-bottom: 0.5rem; }
.swatch { width: 3rem; height: 3rem; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 2px var(--ink); cursor: pointer; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink), 0 0 0 6px var(--primary); }
.swatch[data-colour="black"] { background: #1f2a44; }
.swatch[data-colour="red"] { background: #d1495b; }
.swatch[data-colour="blue"] { background: #2f6fbf; }
.swatch[data-colour="green"] { background: #3f8f3a; }
.swatch[data-colour="yellow"] { background: #e9b308; }
.swatch[data-colour="purple"] { background: #7b5ea7; }
.draw-canvas { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; background: #fff; border: 3px solid var(--ink); border-radius: 12px; touch-action: none; cursor: crosshair; }

.two-col { display: grid; gap: 1.25rem; }
@media (min-width: 52rem) {
  .two-col { grid-template-columns: 1fr 1fr; align-items: start; }
}

.area-head { display: flex; justify-content: center; }
.area-picture { width: 5rem; height: 5rem; }

/* Summary */
.summary-list li { margin-bottom: 0.4rem; }
.notes-text { white-space: pre-wrap; background: #f6f7f9; border: 1px solid #d9dee8; border-radius: 10px; padding: 1rem; font-size: 0.95rem; overflow-wrap: anywhere; }
.notes-details summary { cursor: pointer; font-weight: 600; min-height: 2.75rem; display: flex; align-items: center; }

/* Dialogs: Stop and Who can help */
dialog {
  border: 3px solid var(--ink); border-radius: 18px; padding: 1.25rem 1.5rem;
  max-width: min(36rem, 92vw); color: var(--ink); background: #fff; font-size: 1.2rem;
}
dialog::backdrop { background: rgba(31, 42, 68, 0.6); }
.dialog-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1rem; }
.dialog-actions-stack { flex-direction: column; align-items: stretch; }

/* Small screens */
@media (max-width: 36rem) {
  h1 { font-size: 1.55em; }
  .piles { grid-template-columns: 1fr; }
  .pile { flex-direction: row; min-height: 5rem; justify-content: flex-start; padding-inline: 1rem; }
  .pile-picture { width: 3.5rem; height: 3.5rem; }
  .brand-by { display: none; }
  .helpbar { position: static; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

@media (forced-colors: active) {
  .chip[aria-pressed="true"], .choice[aria-pressed="true"], .mini-card[aria-pressed="true"], .pile[aria-pressed="true"] { outline: 3px solid Highlight; }
  .place-input { forced-color-adjust: auto; }
}

@media print {
  .topbar, .helpbar, .mode-banner, .nav, .adult-prompts { display: none; }
}

.dialog-help { margin-top: 1.25rem; padding-top: 0.75rem; border-top: 2px solid #d9dee8; display: flex; flex-wrap: wrap; gap: 0.5rem 0.75rem; align-items: center; font-size: 1rem; }
.dialog-help p { margin: 0; font-weight: 600; }
