/* The Old School Fixed Fee Challenge — mobile-first, one column, max 480px. */

@font-face {
  font-family: 'Rubik';
  src: url('assets/fonts/Rubik-VariableFont_wght.ttf') format('truetype');
  font-weight: 300 900;
  font-display: swap;
}

:root {
  color-scheme: light;

  /* Brand mark colours (logo-altfee.svg) */
  --teal: #00353c;
  --orange-logo: #ff8f57;
  --mauve: #b3706f;

  /* Marketing palette (altfeeco.com) */
  --orange: #f2834a;
  --orange-deep: #ff6f26;
  --ink: #091e23;

  /* Game palette, sampled from the challenge poster */
  --cream: #faf7f2;
  --cream-deep: #f1ebe1;
  --salmon: #ee8a7e;
  --grey-band: #a9b1b6;
  --grey-light: #cfd6da; /* the 1-point band (COLOR.outer in dial.js) */
  --line: #e6dfd4;
  --muted: #5b6b6f;
  --card: #fff;

  --radius: 16px;
  --shadow: 0 1px 2px rgba(0, 53, 60, 0.06), 0 10px 28px -18px rgba(0, 53, 60, 0.35);
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--cream);
  color: var(--ink);
  font-family: 'Rubik', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  font-weight: 400;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

img {
  display: block;
  max-width: 100%;
}

button,
input {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding:
    max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(28px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}

.app--wide {
  max-width: 1100px;
}

/* Panes are the halves of a screen that sit side by side in landscape; the
   gauge (dial plus readout) is pinned on the left there. Stacked, their parts
   are spaced like the screen's own. See Landscape below. */
.pane,
.gauge {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: inherit;
}

/* Layouts use grid gaps or margins: iOS before 14.5 ignores `gap` in flexbox. */
.screen {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
}

/* ---------- Shared ---------- */

.eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--orange);
}

.muted {
  margin: 0;
  color: var(--muted);
}

.card {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.prompt {
  margin: 6px 0 0;
  font-size: 21px;
  font-weight: 500;
  line-height: 1.28;
  color: var(--teal);
}

/* Rounds 1 and 2: "Where would most people put…", the thing, then its spectrum. */
.spectrum-ask {
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.spectrum-ask + .prompt {
  margin-top: 2px;
}

.spectrum {
  display: flex;
  align-items: center;
  margin: 14px 0 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal);
}

.spectrum span {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--cream-deep);
  white-space: nowrap;
}

.spectrum i {
  flex: 1;
  height: 2px;
  margin: 0 8px;
  border-radius: 1px;
  background: linear-gradient(90deg, var(--grey-band), var(--orange));
}

.prompt--small {
  margin-top: 10px;
  font-size: 18px;
  font-weight: 600;
}

.btn {
  display: block;
  width: 100%;
  padding: 17px 20px;
  border: 0;
  border-radius: 10px;
  -webkit-appearance: none;
  appearance: none;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.08s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: linear-gradient(90deg, var(--orange), var(--orange-deep));
  color: #fff;
  box-shadow: 0 10px 20px -10px rgba(255, 111, 38, 0.7);
}

.btn--ghost {
  background: transparent;
  color: var(--teal);
  box-shadow: inset 0 0 0 1.5px var(--teal);
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn:focus-visible,
.nudge:focus-visible,
.dial:focus-visible,
.link:focus-visible {
  outline: 3px solid var(--orange-logo);
  outline-offset: 3px;
}

.link {
  color: var(--orange-deep);
  font-weight: 500;
  text-decoration: none;
}

/* ---------- Dial ---------- */

.dial-slot svg {
  display: block;
  width: 100%;
  max-width: 440px;
  height: auto;
  margin: 0 auto;
}

.dial {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}

.dial.is-dragging {
  cursor: grabbing;
}

.dial--static,
.dial.is-locked {
  cursor: default;
}

.dial__scale {
  font-size: 13px;
  font-weight: 600;
  fill: #f7f3ec;
}

.dial__qmark {
  font-size: 56px;
  font-weight: 800;
  fill: #fff;
  fill-opacity: 0.35;
}

.dial__pts {
  font-size: 11px;
  font-weight: 700;
  fill: #fff;
}

.dial__pts--outer {
  fill: var(--teal); /* on the light grey 1-point band */
}

.dial__region--under {
  fill: var(--mauve);
  fill-opacity: 0.14;
}

.dial__region--over {
  fill: var(--teal);
  fill-opacity: 0.08;
}

.dial__region-label {
  font-size: 11px;
  font-weight: 600;
}

.dial__region-label--under {
  fill: var(--mauve);
}

.dial__region-label--over {
  fill: var(--teal);
}

.dial--idle .dial__sway {
  animation: sway 6s ease-in-out infinite;
}

@keyframes sway {
  0%,
  100% {
    transform: rotate(-6deg);
  }

  50% {
    transform: rotate(6deg);
  }
}

/* ---------- Intro ---------- */

.intro {
  gap: 18px;
  text-align: center;
}

.intro__brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 8px;
}

/* Logo heights are set (the SVG is 100 x 23) so their space is held before
   they load, which keeps game.js's vertical centring right. */
.intro__logo {
  width: 150px;
  height: 34.5px;
  margin: 0 auto;
}

.intro__presents {
  margin: 10px 0 0;
  font-size: 13px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--teal);
}

.title {
  margin: 0;
  text-transform: uppercase;
  line-height: 1.02;
}

.title__top {
  display: block;
  font-size: max(22px, min(6.6vw, 32px)); /* clamp(), which iOS 12 lacks */
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--teal);
}

.title__main {
  display: block;
  margin-top: 4px;
  font-size: max(22px, min(6.9vw, 38px)); /* "Fixed Fee Challenge" on one line */
  font-weight: 900;
  letter-spacing: 0.03em;
  color: var(--orange);
  background: linear-gradient(90deg, #f39a5f, #e8662c 55%, #f08a4f);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.dial-slot--intro {
  margin: 0 -6px;
}

.steps {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.step {
  display: grid;
  grid-template-columns: 24px 38px 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.step__num {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.step__icon {
  width: 38px;
  height: 38px;
  color: var(--orange);
}

.step__icon svg {
  width: 100%;
  height: 100%;
}

.step__text {
  display: flex;
  flex-direction: column;
  font-size: 14px;
  line-height: 1.35;
  color: var(--muted);
}

.step__text strong {
  margin-bottom: 2px;
  font-size: 16px;
  font-weight: 600;
  color: var(--teal);
}

.board {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  text-align: left;
}

.board ol {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  counter-reset: rank;
}

.board li {
  display: flex;
  align-items: center;
  padding: 7px 0;
  border-top: 1px solid var(--line);
  counter-increment: rank;
}

.board li:first-child {
  border-top: 0;
}

.board li::before {
  content: counter(rank);
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--cream-deep);
  color: var(--teal);
  font-size: 12px;
  font-weight: 700;
}

.board li span {
  flex: 1;
  color: var(--teal);
}

.board li strong {
  margin-left: 10px;
  color: var(--orange-deep);
}

/* ---------- Round ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
}

.topbar > * + * {
  margin-left: 10px;
}

.topbar__logo {
  width: 92px;
  height: 21.16px;
}

.progress {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.dots {
  display: flex;
  margin: 5px 0 0;
  padding: 0;
  list-style: none;
}

.dot + .dot {
  margin-left: 5px;
}

.dot {
  width: 22px;
  height: 6px;
  border-radius: 3px;
  background: var(--line);
}

.dot--done {
  background: var(--orange);
}

.dot--current {
  background: var(--teal);
}

.score-pill {
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
}

.score-pill strong {
  margin-left: 3px;
  font-weight: 700;
}

.matter {
  padding: 16px 18px;
}

.matter__title {
  margin: 8px 0 0;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--teal);
}

.matter__brief {
  margin: 3px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.matter__details {
  display: grid;
  gap: 5px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.matter__details li {
  position: relative;
  padding-left: 20px;
  font-size: 15px;
  line-height: 1.3;
}

.matter__details li::before {
  content: '';
  position: absolute;
  top: 0.5em;
  left: 4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
}

.matter__base {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 14px;
  color: var(--muted);
}

.matter__base strong {
  font-size: 18px;
  color: var(--teal);
}

.readout {
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  align-items: center;
  gap: 8px;
  margin-top: -6px;
}

.readout__value {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0;
}

.readout__num {
  font-size: 46px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  color: var(--teal);
}

/* Words instead of a number ("Very stressful"), in the same height as one. */
.readout__num--words {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  font-size: 20px;
  line-height: 1.15;
  letter-spacing: 0;
  text-align: center;
}

.readout__label {
  min-height: 1.4em;
  margin-top: 6px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.nudge {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: var(--card);
  box-shadow: var(--shadow), inset 0 0 0 1.5px var(--line);
  color: var(--teal);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
}

.nudge:disabled {
  opacity: 0.35;
  cursor: default;
}

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

/* ---------- Feedback ---------- */

.feedback {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  margin: 0;
  padding: 5px 14px 5px 5px;
  border-radius: 999px;
  background: var(--cream-deep);
  color: var(--teal);
  font-size: 15px;
  font-weight: 700;
}

.badge__pts {
  display: grid;
  place-items: center;
  min-width: 40px;
  height: 30px;
  margin-right: 10px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
}

.badge--bullseye .badge__pts {
  background: var(--orange);
}

.badge--close .badge__pts {
  background: var(--salmon);
}

.badge--edge .badge__pts {
  background: var(--grey-band);
}

.badge--outer .badge__pts {
  background: var(--grey-light);
  color: var(--teal);
}

.feedback__answer {
  margin: 0;
  font-size: 17px;
  color: var(--teal);
}

.feedback__answer small {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  color: var(--muted);
}

.feedback__fact,
.feedback__body {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
}

.feedback__title {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--teal);
}

.feedback__pitch {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}

.receipt {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--cream);
  font-size: 14px;
}

.receipt__title {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal);
}

.receipt__group {
  margin: 10px 0 2px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--orange);
}

.receipt__row {
  display: flex;
  justify-content: space-between;
  padding: 3px 0;
}

.receipt__row > span + span {
  margin-left: 12px;
}

.receipt__row small {
  display: block;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.receipt__row > span:last-child {
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--teal);
}

.receipt__row--sub {
  margin-top: 6px;
  padding-top: 7px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
}

.receipt__row--total {
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1.5px solid var(--teal);
  font-size: 16px;
  font-weight: 700;
  color: var(--teal);
}

.receipt__row--total > span:last-child {
  font-size: 18px;
  font-weight: 800;
  color: var(--orange-deep);
}

.receipt__you {
  margin: 8px 0 0;
  text-align: right;
  font-size: 13px;
  color: var(--muted);
}

/* ---------- Results ---------- */

.total {
  text-align: center;
}

.total__score {
  margin: 4px 0 0;
  color: var(--teal);
}

.total__score strong {
  font-size: 72px;
  font-weight: 900;
  line-height: 1;
  color: var(--orange-deep);
}

.total__score span {
  margin-left: 6px;
  font-size: 22px;
  font-weight: 600;
}

.total__split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}

.total__split p {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 10px;
  border-radius: 12px;
  background: var(--cream);
}

.total__split span {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.total__split strong {
  font-size: 20px;
  color: var(--teal);
}

.verdict {
  padding: 18px;
  border-radius: var(--radius);
  background: var(--teal);
  color: #fff;
}

.verdict--hit {
  background: linear-gradient(135deg, #0d5560, var(--teal));
}

.verdict h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.25;
}

.verdict p {
  margin: 8px 0 0;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.85);
}

.recap {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.recap__row {
  display: grid;
  grid-template-areas:
    'name pts'
    'detail pts';
  grid-template-columns: 1fr auto;
  column-gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.recap__name {
  grid-area: name;
  font-weight: 600;
  color: var(--teal);
}

.recap__detail {
  grid-area: detail;
  font-size: 13px;
  color: var(--muted);
}

.recap__pts {
  grid-area: pts;
  align-self: center;
  min-width: 42px;
  padding: 6px 8px;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  text-align: center;
  font-weight: 700;
}

.recap__pts--bullseye {
  background: var(--orange);
}

.recap__pts--close {
  background: var(--salmon);
}

.recap__pts--edge {
  background: var(--grey-band);
}

.recap__pts--outer {
  background: var(--grey-light);
  color: var(--teal);
}

.prize {
  padding: 18px;
  border: 2px dashed var(--orange);
  border-radius: var(--radius);
  background: #fff6ef;
  text-align: center;
}

.prize__icon {
  display: block;
  width: 44px;
  height: 44px;
  margin: 0 auto 4px;
  color: var(--orange);
}

.prize__icon svg {
  width: 100%;
  height: 100%;
}

.prize__name {
  margin: 6px 0 0;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--teal);
}

.prize__plus {
  margin: 4px 0 0;
  font-size: 15px;
  color: var(--muted);
}

.lead {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.lead h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--teal);
}

.field {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

.field small {
  font-weight: 400;
}

.field input {
  padding: 13px 14px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  -webkit-appearance: none; /* drops older iOS's inner shadow */
  background: #fff;
  color: var(--ink);
  font-size: 16px; /* 16px stops iOS zooming into the field */
}

.field input:focus {
  border-color: var(--orange);
  outline: none;
  box-shadow: 0 0 0 3px rgba(242, 131, 74, 0.2);
}

.check {
  display: flex;
  align-items: flex-start;
  font-size: 14px;
}

.check input {
  flex: none;
  width: 20px;
  height: 20px;
  margin: 1px 10px 0 0;
  accent-color: var(--orange);
}

.fineprint {
  margin: 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- Ticket ---------- */

.ticket {
  padding-top: 12px;
  text-align: center;
}

.ticket-card {
  position: relative;
  padding: 26px 20px;
  border-radius: 20px;
  background: var(--teal);
  color: #fff;
  box-shadow: var(--shadow);
}

/* Punched notches on the ticket's sides */
.ticket-card::before,
.ticket-card::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--cream);
  transform: translateY(-50%);
}

.ticket-card::before {
  left: -12px;
}

.ticket-card::after {
  right: -12px;
}

.ticket-card .eyebrow {
  color: var(--orange-logo);
}

.ticket-card__hello {
  margin: 8px 0 0;
  font-size: 17px;
}

.ticket-card__prize {
  margin: 12px 0 0;
  font-size: 26px;
  font-weight: 800;
  line-height: 1.15;
}

.ticket-card__plus {
  margin: 6px 0 0;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.8);
}

.ticket-card__code {
  display: inline-block;
  margin: 18px 0 0;
  padding: 10px 18px;
  border: 1.5px dashed rgba(255, 255, 255, 0.45);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.ticket-card__score {
  margin: 10px 0 0;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
}

.ticket__note {
  margin: 0;
  color: var(--muted);
}

/* ---------- Staff ---------- */

.staff__title {
  margin: 0;
  font-size: 26px;
  font-weight: 600;
  color: var(--teal);
}

.staff__actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-width: 480px;
}

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; /* momentum scrolling on iOS 12 */
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.table-wrap table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table-wrap th,
.table-wrap td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

.table-wrap th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Landscape ---------- */

/* Wider than tall (a phone on its side, an iPad on a stand, a laptop): a
   screen's two panes sit side by side, and in a round the dial keeps the left
   half while the question, lock button and feedback stack on the right. */
@media (orientation: landscape) and (min-width: 600px) {
  .app:not(.app--wide) {
    max-width: 980px;
  }

  .app {
    padding-top: max(12px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .intro,
  .results,
  .ticket {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: 32px;
    align-items: start;
  }

  .intro,
  .ticket {
    align-items: center;
  }

  .round {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
    /* The right column's parts take the auto rows; the last row soaks up any
       extra height of the gauge beside them. */
    grid-template-rows: repeat(5, auto) 1fr;
    column-gap: 32px;
  }

  .round > .gauge {
    grid-column: 1;
    grid-row: 1 / -1;
    align-self: start;
    position: -webkit-sticky; /* iOS 12 */
    position: sticky;
    top: 12px;
  }

  .round > :not(.gauge) {
    grid-column: 2;
  }

  /* Dials are sized by the screen's height so a phone on its side fits them
     (400 x 252 is the dial's shape). */
  .gauge .dial-slot svg {
    max-width: min(440px, calc((100vh - 150px) * 1.59));
  }

  .intro__hero .dial-slot svg {
    max-width: min(440px, calc((100vh - 250px) * 1.59));
  }

  /* The title sits in half the width, so it scales with less of it. */
  .title__top {
    font-size: max(18px, min(2.9vw, 32px));
  }

  .title__main {
    font-size: max(22px, min(3.4vw, 36px));
  }
}

/* Tall landscape (an iPad, a laptop): bigger dials. game.js centres each
   screen vertically when there's room. */
@media (orientation: landscape) and (min-width: 600px) and (min-height: 600px) {
  .gauge .dial-slot svg {
    max-width: min(540px, calc((100vh - 150px) * 1.59));
  }

  .intro__hero .dial-slot svg {
    max-width: min(500px, calc((100vh - 250px) * 1.59));
  }
}

/* Tablets held upright (an iPad in portrait): a wider column and dial, so the
   game doesn't sit in a narrow strip. */
@media (orientation: portrait) and (min-width: 700px) {
  .app:not(.app--wide) {
    max-width: 580px;
  }

  .dial-slot svg {
    max-width: 540px;
  }
}

/* Short landscape (a small phone on its side): tighter intro steps, so Start
   fits on screen, and a slimmer ticket. */
@media (orientation: landscape) and (min-width: 600px) and (max-height: 500px) {
  .intro {
    gap: 12px;
  }

  .step {
    grid-template-columns: 24px 1fr;
    padding: 9px 12px;
  }

  .step__icon {
    display: none;
  }

  .ticket {
    padding-top: 0;
  }

  .ticket-card {
    padding: 18px 20px;
  }
}

/* ---------- Motion ---------- */

/* Screens: parts rise in one after another (game.js sets --i); the old screen fades out. */
.screen > *,
.pane > * {
  animation: rise 0.55s cubic-bezier(0.2, 0.85, 0.25, 1) both;
  animation-delay: calc(var(--i, 0) * 70ms);
}

.screen > .pane {
  animation: none;
}

.screen--leaving {
  animation: leave 0.22s ease-in both;
  pointer-events: none;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
}

@keyframes leave {
  to {
    opacity: 0;
    transform: translateY(-12px) scale(0.985);
  }
}

/* Intro: the title slams in, then the steps and leaderboard follow the dial. */
.title__top {
  animation: slide-in 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.2) 0.15s both;
}

.title__main {
  animation: slam 0.75s cubic-bezier(0.2, 0.9, 0.3, 1.25) 0.4s both;
}

.step,
.board li {
  animation: rise 0.5s cubic-bezier(0.2, 0.85, 0.25, 1) both;
}

.step {
  animation-delay: calc(0.9s + var(--n, 0) * 120ms);
}

.board li {
  animation-delay: calc(1.3s + var(--n, 0) * 90ms);
}

@keyframes slide-in {
  from {
    opacity: 0;
    transform: translateX(-40px);
  }
}

@keyframes slam {
  0% {
    opacity: 0;
    transform: scale(1.8);
  }

  55% {
    opacity: 1;
    transform: scale(0.94);
  }

  100% {
    transform: none;
  }
}

/* Buttons that should catch the eye: a light sweep, plus a slow pulse on Start. */
.btn {
  position: relative;
  overflow: hidden;
}

.btn--shine::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0; /* not `inset`, which iOS before 14.5 ignores */
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.5) 50%, transparent 65%);
  transform: translateX(-110%);
  animation: shine 3.4s ease-in-out 1.6s infinite;
  pointer-events: none;
}

.pane > .btn--pulse {
  animation:
    rise 0.55s cubic-bezier(0.2, 0.85, 0.25, 1) calc(var(--i, 0) * 70ms) both,
    pulse 2.4s ease-in-out 2.2s infinite;
}

@keyframes shine {
  0%,
  60% {
    transform: translateX(-110%);
  }

  90%,
  100% {
    transform: translateX(110%);
  }
}

@keyframes pulse {
  50% {
    transform: scale(1.03);
    box-shadow: 0 14px 28px -10px rgba(255, 111, 38, 0.8);
  }
}

/* Dial: a knock when locked, a shake on a miss, wedges that fan open on the
   intro and a pulse on the wedge that was hit. */
.dial--knock {
  animation: knock 0.35s ease-out;
}

.dial--shake {
  animation: shake 0.55s cubic-bezier(0.36, 0.07, 0.19, 0.97) both;
}

.dial__wedge--fan,
.dial__wedge--hit {
  transform-box: view-box;
  transform-origin: 200px 198px; /* the needle pivot (CX, CY in dial.js) */
}

.dial__wedge--fan {
  animation: fan-in 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
  animation-delay: calc(0.55s + var(--w, 0) * 90ms);
}

.dial__wedge--hit {
  stroke: #fff;
  stroke-width: 2.5;
  animation: wedge-hit 0.9s ease-in-out 3;
}

@keyframes knock {
  30% {
    transform: scale(0.965);
  }

  65% {
    transform: scale(1.012);
  }
}

@keyframes shake {
  10%,
  90% {
    transform: translateX(-2px);
  }

  20%,
  80% {
    transform: translateX(4px);
  }

  30%,
  50%,
  70% {
    transform: translateX(-8px);
  }

  40%,
  60% {
    transform: translateX(8px);
  }
}

@keyframes fan-in {
  from {
    opacity: 0;
    transform: rotate(-35deg) scale(0.4);
  }
}

@keyframes wedge-hit {
  50% {
    transform: scale(1.06);
  }
}

/* Feedback: appears right after the reveal, its parts follow one by one and
   the pricing breakdown prints line by line (game.js sets --i and --r). */
.screen > .feedback {
  animation: rise 0.5s cubic-bezier(0.2, 0.85, 0.25, 1) both;
}

.feedback > * {
  animation: rise 0.45s cubic-bezier(0.2, 0.85, 0.25, 1) both;
  animation-delay: calc(0.1s + var(--i, 0) * 90ms);
}

.feedback > .badge {
  animation: pop-in 0.55s cubic-bezier(0.3, 1.5, 0.5, 1) 0.1s both;
}

.receipt > * {
  animation: print 0.3s ease-out both;
  animation-delay: calc(0.45s + var(--r, 0) * 70ms);
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.4);
  }
}

@keyframes print {
  from {
    opacity: 0;
    transform: translateY(-5px);
  }
}

/* Results: recap rows and their points follow the score; the gift wiggles. */
.total__score strong {
  display: inline-block;
}

.recap__row {
  animation: rise 0.45s cubic-bezier(0.2, 0.85, 0.25, 1) both;
  animation-delay: calc(0.3s + var(--n, 0) * 110ms);
}

.recap__pts {
  animation: pop-in 0.5s cubic-bezier(0.3, 1.5, 0.5, 1) both;
  animation-delay: calc(0.55s + var(--n, 0) * 110ms);
}

.prize__icon {
  animation: wiggle 1.2s ease-in-out 1.4s 3;
}

@keyframes wiggle {
  0%,
  75%,
  100% {
    transform: none;
  }

  15% {
    transform: rotate(-12deg) scale(1.12);
  }

  30% {
    transform: rotate(10deg) scale(1.12);
  }

  45% {
    transform: rotate(-6deg);
  }

  60% {
    transform: rotate(4deg);
  }
}

/* Ticket: drops in like it was just printed, then the code flips in. */
.pane > .ticket-card {
  animation: ticket-drop 0.9s cubic-bezier(0.2, 0.9, 0.3, 1) 0.1s both;
}

.ticket-card__code {
  perspective: 400px;
}

.ticket-card__code span {
  display: inline-block;
  animation: flap 0.5s cubic-bezier(0.3, 1.4, 0.5, 1) both;
  animation-delay: calc(0.85s + var(--c, 0) * 90ms);
}

@keyframes ticket-drop {
  0% {
    opacity: 0;
    transform: translateY(-110%) rotate(-8deg);
  }

  55% {
    opacity: 1;
    transform: translateY(10px) rotate(2deg);
  }

  75% {
    transform: translateY(-4px) rotate(-1deg);
  }

  100% {
    transform: none;
  }
}

@keyframes flap {
  from {
    opacity: 0;
    transform: rotateX(90deg);
  }
}

/* Effects layer (fx.js): confetti canvas, floating points, round title cards. */
.fx-canvas {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 80;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.fx-float {
  position: absolute;
  z-index: 81;
  font-size: 40px;
  font-weight: 900;
  color: var(--orange-deep);
  text-shadow: 0 2px 0 #fff, 0 6px 18px rgba(0, 53, 60, 0.25);
  pointer-events: none;
  animation: float-up 1.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.fx-float--close {
  color: #e2685b;
}

.fx-float--edge {
  color: #7b868c;
}

.fx-float--outer {
  color: #93a1a8;
}

.fx-float--miss {
  color: var(--teal);
}

.fx-pop {
  animation: pop 0.45s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.fx-banner {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 50% 45%, #0b4c55, var(--teal) 70%);
  animation: banner-fade 1.3s ease-in-out both; /* keep in step with BANNER_MS in fx.js */
}

.fx-banner__inner {
  text-align: center;
  animation: banner-zoom 1.3s cubic-bezier(0.2, 0.9, 0.3, 1) both;
}

.fx-banner__sub {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--orange-logo);
}

.fx-banner__title {
  margin: 8px 0 0;
  font-size: max(44px, min(14vw, 72px));
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #fff;
}

@keyframes float-up {
  0% {
    opacity: 0;
    transform: translate(-50%, -40%) scale(0.4);
  }

  18% {
    opacity: 1;
    transform: translate(-50%, -80%) scale(1.25);
  }

  32% {
    transform: translate(-50%, -90%) scale(1);
  }

  75% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -230%) scale(1);
  }
}

@keyframes pop {
  40% {
    transform: scale(1.22);
  }
}

@keyframes banner-fade {
  0% {
    opacity: 0;
  }

  18%,
  72% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes banner-zoom {
  0% {
    opacity: 0;
    transform: scale(1.5);
  }

  22% {
    opacity: 1;
    transform: scale(1);
  }

  70% {
    opacity: 1;
    transform: scale(1.04);
  }

  100% {
    opacity: 0;
    transform: scale(0.92);
  }
}

/* Reduced motion: every animation jumps straight to its end state
   (fx.js and dial.js also skip their scripted effects). */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
