/* Phone quiz. Mobile-first from 360px. Flat signal colours, ink rules, no rounded cards. */

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

html {
  font-size: 106.25%; /* 17px body that still scales with the phone's text-size setting */
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}

h1,
h2,
h3,
p,
ol,
ul {
  margin: 0;
}

ol,
ul {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.05;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--fg);
  outline-offset: 3px;
}

[tabindex="-1"]:focus {
  outline: none;
}

[hidden] {
  display: none !important;
}

/* ── Frame ───────────────────────────────────────────────────────────────── */
.masthead {
  border-bottom: var(--rule) solid var(--fg);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 560px;
  min-height: 56px;
  margin: 0 auto;
  padding: 0 16px;
  color: var(--fg);
  text-decoration: none;
  font-family: var(--font-display);
  font-stretch: 118%;
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

main.wrap {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.site-footer {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(20px + env(safe-area-inset-bottom));
  border-top: var(--rule) solid var(--fg);
  font-weight: 600;
  font-size: 0.85rem;
}

.screen {
  display: flex;
  flex-direction: column;
  gap: 22px;
  animation: enter 0.2s ease-out;
}

@keyframes enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

/* Colour bands run edge to edge on a phone. */
.bleed {
  margin-inline: -16px;
}

@media (min-width: 592px) {
  .bleed {
    margin-inline: 0;
  }
}

.kicker {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--muted);
}

.note {
  font-weight: 600;
  color: var(--muted);
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 60px;
  padding: 14px 20px;
  border: var(--rule) solid var(--fg);
  border-radius: 0;
  background: transparent;
  color: var(--fg);
  font-family: var(--font-display);
  font-stretch: 112%;
  font-weight: 800;
  font-size: 1.1rem;
  text-align: center;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.btn:active:not(:disabled) {
  transform: translateY(2px);
}

.btn-primary {
  background: var(--fg);
  color: var(--bg);
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-small {
  width: auto;
  min-height: 48px;
  padding: 8px 18px;
  font-size: 0.95rem;
}

.actions {
  display: grid;
  gap: 12px;
}

.back {
  align-self: flex-start;
  min-height: 48px;
  margin: -12px 0 -14px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

/* ── Start ───────────────────────────────────────────────────────────────── */
.title {
  font-stretch: 115%;
  font-weight: 900;
  font-size: clamp(2.2rem, 10.5vw, 3.3rem);
  line-height: 0.98;
  letter-spacing: -0.025em;
}

.intro {
  font-size: 1.15rem;
  line-height: 1.45;
}

.bands li {
  display: grid;
  grid-template-columns: 4.2rem minmax(0, 1fr);
  align-items: center;
  min-height: 62px;
  padding: 0 16px;
}

.band-letter {
  font-family: var(--font-display);
  font-stretch: 125%;
  font-weight: 900;
  font-size: 2.3rem;
  line-height: 1;
}

.band-name {
  font-family: var(--font-display);
  font-stretch: 110%;
  font-weight: 800;
  font-size: 1.25rem;
}

/* ── Pick a case ─────────────────────────────────────────────────────────── */
.page-title {
  font-stretch: 115%;
  font-size: clamp(1.9rem, 8.5vw, 2.5rem);
  letter-spacing: -0.02em;
}

.case-list {
  border-top: var(--rule) solid var(--fg);
}

.case-list li {
  border-bottom: 2px solid var(--fg);
}

.case-item {
  display: grid;
  grid-template-columns: 2.9rem minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 12px;
  width: 100%;
  min-height: 84px;
  padding: 14px 4px;
  border: 0;
  background: none;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.case-item:active {
  background: var(--fg);
  color: var(--bg);
}

.case-num {
  align-self: start;
  font-family: var(--font-display);
  font-stretch: 125%;
  font-weight: 900;
  font-size: 1.35rem;
  line-height: 1.3;
}

.case-name {
  display: block;
  font-family: var(--font-display);
  font-stretch: 108%;
  font-weight: 800;
  font-size: 1.25rem;
  line-height: 1.15;
}

.case-tag {
  display: block;
  margin-top: 3px;
  font-size: 0.95rem;
  line-height: 1.35;
  color: var(--muted);
}

.case-item:active .case-tag {
  color: inherit;
}

.case-done {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Case story ──────────────────────────────────────────────────────────── */
.story {
  padding-left: 16px;
  border-left: 5px solid var(--fg);
  font-size: 1.12rem;
  line-height: 1.6;
}

/* ── Question ────────────────────────────────────────────────────────────── */
.signal {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: end;
  gap: 18px;
  padding: 18px 16px 16px;
}

.signal-letter {
  font-family: var(--font-display);
  font-stretch: 125%;
  font-weight: 900;
  font-size: clamp(7rem, 38vw, 9.5rem);
  line-height: 0.78;
  letter-spacing: -0.04em;
}

.signal-meta {
  display: grid;
  gap: 6px;
  padding-bottom: 2px;
}

.signal-step {
  font-weight: 600;
  font-size: 0.95rem;
}

.signal-name {
  font-family: var(--font-display);
  font-stretch: 112%;
  font-weight: 900;
  font-size: clamp(1.5rem, 7vw, 1.9rem);
  line-height: 1;
}

.steps {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.steps li {
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
}

.steps li.is-done,
.steps li.is-current {
  background: currentColor;
}

.steps li.is-current {
  width: 28px;
}

.question {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(1.45rem, 6.4vw, 1.8rem);
  line-height: 1.18;
  letter-spacing: -0.01em;
}

.answers {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.answer {
  min-height: 72px;
  border: var(--rule) solid var(--fg);
  background: transparent;
  color: var(--fg);
  font-family: var(--font-display);
  font-stretch: 120%;
  font-weight: 900;
  font-size: 1.6rem;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.answer:active:not(:disabled) {
  transform: translateY(2px);
}

.answer[aria-pressed="true"] {
  background: var(--fg);
  color: var(--bg);
}

.answer:disabled {
  cursor: default;
}

.answer:disabled:not([aria-pressed="true"]) {
  opacity: 0.3;
}

.take-slot {
  display: grid;
  gap: 20px;
}

.take-slot:empty {
  display: none;
}

.take {
  display: grid;
  gap: 6px;
  padding-top: 16px;
  border-top: var(--rule) solid var(--fg);
  animation: enter 0.25s ease-out;
}

.take-verdict {
  font-family: var(--font-display);
  font-stretch: 110%;
  font-weight: 900;
  font-size: 1.4rem;
  line-height: 1.1;
}

.take-compare {
  font-weight: 600;
}

.take-label {
  margin-top: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--muted);
}

.take-reason {
  font-size: 1.15rem;
  line-height: 1.45;
}

/* ── Result ──────────────────────────────────────────────────────────────── */
.verdict {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 8px 20px;
  padding: 20px 16px;
}

.verdict-red { background: var(--red); color: #ffffff; }
.verdict-yellow { background: var(--amber); color: var(--ink); }
.verdict-green { background: var(--green); color: #ffffff; }

.verdict-count {
  font-weight: 600;
}

.verdict-word {
  font-family: var(--font-display);
  font-stretch: 118%;
  font-weight: 900;
  font-size: clamp(2.6rem, 13vw, 3.8rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.verdict-headline {
  grid-column: 1 / -1;
  margin-top: 10px;
  font-stretch: 105%;
  font-size: clamp(1.45rem, 6.6vw, 1.85rem);
  line-height: 1.12;
}

.result-line {
  font-size: 1.15rem;
  line-height: 1.45;
}

.traffic {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 40px;
  background: var(--housing);
  box-shadow: 0 0 0 2px var(--housing-edge);
}

.lamp {
  display: block;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--lamp);
  opacity: 0.22;
}

.lamp-red { --lamp: var(--red); }
.lamp-yellow { --lamp: var(--amber); }
.lamp-green { --lamp: var(--green); }

.lamp.is-on {
  opacity: 1;
  box-shadow: 0 0 22px 4px var(--lamp);
  animation: lamp-on 0.9s ease-out both;
}

@keyframes lamp-on {
  0% { opacity: 0.22; transform: scale(0.92); box-shadow: none; }
  30% { opacity: 1; }
  45% { opacity: 0.45; }
  65% { opacity: 1; transform: scale(1.04); }
  100% { opacity: 1; transform: scale(1); box-shadow: 0 0 22px 4px var(--lamp); }
}

.recap {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  border-top: var(--rule) solid var(--fg);
  border-bottom: var(--rule) solid var(--fg);
}

.recap li {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 60px;
}

.recap li + li {
  border-left: 2px solid var(--fg);
}

.recap .tile {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  font-family: var(--font-display);
  font-stretch: 120%;
  font-weight: 900;
  font-size: 1rem;
}

.recap-answer {
  font-weight: 500;
}

.recap li.is-no .recap-answer {
  font-weight: 800;
}

.block {
  display: grid;
  gap: 6px;
}

.block h3 {
  font-stretch: 110%;
  font-size: 1.2rem;
}

.block p {
  font-size: 1.08rem;
  line-height: 1.55;
}

.tally {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  font-weight: 600;
  color: var(--muted);
}

.tally[data-state="done"] {
  color: var(--fg);
}

.tally:empty {
  display: none;
}

.laptop-note {
  font-weight: 600;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
