@font-face {
  font-family: 'Sofia Sans';
  src: url('fonts/sofia-sans.woff2') format('woff2');
  font-weight: 300 800;
  font-display: swap;
}
@font-face {
  font-family: 'Sofia Sans XC';
  src: url('fonts/sofia-sans-extra-condensed.woff2') format('woff2');
  font-weight: 500 900;
  font-display: swap;
}

/* Colours of a UV hand-hygiene test box: dark violet chamber, the violet
   light of the tube, skin that turns dusky under it, and the pale blue-white
   glow of whatever disinfectant reached the skin. */
:root {
  color-scheme: dark;
  --chamber: #1a1135;
  --chamber-deep: #130c29;
  --window: #241850;
  --uv: #8f63ff;
  --uv-strong: #7449f0;
  --glow: #d9fbff;
  --glow-halo: #6fdcff;
  --skin: #4a3c84;
  --skin-under: #30265e;
  --edge: #110a26;
  --skin-line: #251a4e;
  --nail: #9a8ce0;
  --ink: #efeaff;
  --ink-dim: #a9a1d2;
  --rule: rgba(169, 161, 210, 0.18);

  --display: 'Sofia Sans XC', 'Sofia Sans', 'Arial Narrow', sans-serif;
  --body: 'Sofia Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html {
  background: var(--chamber-deep);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--chamber);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---- player (fills the first screen) ------------------------------------ */

.player {
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
  gap: 14px;
  min-height: 100vh;
  min-height: 100svh;
  max-width: 560px;
  margin: 0 auto;
  padding:
    max(10px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(14px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

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

.wordmark {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn[aria-pressed='false'] .on,
.icon-btn[aria-pressed='true'] .off { display: none; }
.icon-btn[aria-pressed='true'] { border-color: var(--uv); color: var(--ink); }

/* The viewing window of the box. */
.stage {
  position: relative;
  aspect-ratio: 1 / 0.94;
  max-height: 54svh;
  overflow: hidden;
  border-radius: 26px;
  background:
    radial-gradient(120% 80% at 50% -10%, #4a2d9c 0%, #2c1b62 38%, var(--window) 62%, #1c123f 100%);
  box-shadow:
    inset 0 0 0 1px rgba(196, 176, 255, 0.14),
    inset 0 -40px 60px -30px rgba(10, 5, 25, 0.7);
}

/* The UV tube along the top edge. */
.stage::before {
  content: '';
  position: absolute;
  top: 9px;
  left: 22%;
  right: 22%;
  height: 5px;
  border-radius: 3px;
  background: #efe6ff;
  box-shadow: 0 0 10px 2px rgba(160, 120, 255, 0.95), 0 0 34px 10px rgba(130, 80, 255, 0.55);
  z-index: 1;
}

.stage svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.clock {
  position: absolute;
  top: 26px;
  right: 18px;
  z-index: 2;
  text-align: right;
  pointer-events: none;
}
.clock-num {
  display: block;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.6rem, 12vw, 3.5rem);
  line-height: 0.85;
  font-variant-numeric: tabular-nums;
}
.clock-unit {
  display: block;
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.clock[hidden] { display: none; }

/* ---- step text ---------------------------------------------------------- */

.step { min-height: 7.6rem; }

.step-label {
  margin: 0 0 4px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

.step-title {
  margin: 0;
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.15rem, 10.6vw, 3.1rem);
  line-height: 0.92;
  letter-spacing: -0.005em;
  hyphens: manual;
}

.step-text {
  margin: 8px 0 0;
  max-width: 34ch;
  font-size: 1.125rem;
  line-height: 1.36;
}

/* ---- coverage readout --------------------------------------------------- */

.readout {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 4px 14px;
  padding: 10px 14px 8px;
  border: 1px solid var(--rule);
  border-radius: 18px;
}
.readout-label {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.readout-status {
  display: block;
  margin-top: 2px;
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}
.readout-hands { margin: 0; justify-self: end; width: min(100%, 290px); }
.readout-hands svg { display: block; width: 100%; height: auto; }
.readout-hands figcaption {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 2px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
  text-align: center;
}

/* ---- controls ------------------------------------------------------------ */

.controls {
  align-self: end;
  display: grid;
  grid-template-columns: 56px 1fr 56px;
  gap: 12px;
  align-items: center;
}

.nav-btn {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: rgba(36, 24, 80, 0.6);
  cursor: pointer;
}
.nav-btn svg { width: 24px; height: 24px; }
.nav-btn:disabled { opacity: 0.35; cursor: default; }

.main-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 56px;
  padding: 0 22px;
  border: 0;
  border-radius: 28px;
  background: var(--uv-strong);
  font-family: var(--display);
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset, 0 8px 28px -10px rgba(143, 99, 255, 0.8);
}
.main-btn svg { width: 22px; height: 22px; }
.main-btn:active { transform: translateY(1px); }

@media (hover: hover) {
  .nav-btn:not(:disabled):hover, .icon-btn:hover { border-color: rgba(196, 176, 255, 0.45); }
  .main-btn:hover { background: #7f55ff; }
}

/* ---- hands --------------------------------------------------------------- */

.h-outline path,
.h-outline circle {
  fill: var(--edge);
  stroke: var(--edge);
  stroke-width: 4.5;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.h-fill path,
.h-fill circle { fill: var(--skin); }
.hand.under .h-fill path,
.hand.under .h-fill circle { fill: var(--skin-under); }

.glow { fill: url(#glowfill); }
.pool { fill: url(#poolfill); }

.contour,
.crease {
  fill: none;
  stroke: var(--skin-line);
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.contour { stroke-width: 1.3; }
.crease { stroke-width: 1.1; opacity: 0.8; }
.tendon {
  fill: none;
  stroke: var(--skin-line);
  stroke-width: 1;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  opacity: 0.35;
}

.glow-line {
  fill: none;
  stroke: var(--glow-halo);
  stroke-width: 2.2;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.nail { fill: var(--nail); fill-opacity: 0.55; }


/* Zones the current step works on, outlined on the readout. */
.readout .target {
  stroke: #b393ff;
  stroke-width: 1.6;
  vector-effect: non-scaling-stroke;
  animation: target-pulse 0.9s ease-in-out infinite alternate;
}
.readout .contour.target { stroke-width: 2.2; }

@keyframes target-pulse {
  from { stroke-opacity: 0.35; }
  to { stroke-opacity: 1; }
}

.arrow,
.arrow-halo {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.arrow { stroke: #a582ff; stroke-width: 2.4; }
.arrow-halo { stroke: var(--edge); stroke-width: 6; opacity: 0.55; }

.drop { fill: var(--glow); }
.nozzle { fill: #5a4a9c; stroke: var(--edge); stroke-width: 2.5; vector-effect: non-scaling-stroke; }

/* ---- below the player ----------------------------------------------------- */

.info {
  max-width: 560px;
  margin: 0 auto;
  padding:
    28px max(20px, env(safe-area-inset-right)) max(36px, env(safe-area-inset-bottom))
    max(20px, env(safe-area-inset-left));
  border-top: 1px solid var(--rule);
}

.info h2 {
  margin: 0 0 14px;
  font-family: var(--display);
  font-weight: 800;
  font-size: 2.1rem;
  line-height: 1;
}

.rules {
  margin: 0 0 40px;
  padding: 0;
  list-style: none;
}
.rules li {
  padding: 12px 0;
  border-bottom: 1px solid var(--rule);
}
.rules b {
  display: block;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1.1;
  letter-spacing: 0.01em;
}
.rules span { color: var(--ink-dim); }

.steps {
  margin: 0 0 32px;
  padding: 0;
  list-style: none;
}
.steps li + li { margin-top: 6px; }
.steps button {
  display: grid;
  grid-template-columns: 2.1rem 84px 1fr;
  gap: 12px;
  align-items: center;
  width: 100%;
  padding: 10px 6px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.steps button:hover { background: rgba(143, 99, 255, 0.08); }
.steps .num {
  font-family: var(--display);
  font-weight: 800;
  font-size: 2rem;
  color: var(--ink-dim);
  text-align: center;
}
.steps svg {
  width: 84px;
  height: 80px;
  border-radius: 14px;
  background: radial-gradient(120% 90% at 50% 0%, #3a2580, var(--window) 70%);
}
.steps strong {
  display: block;
  font-family: var(--display);
  font-weight: 800;
  font-size: 1.4rem;
  line-height: 1.05;
}
.steps .desc { display: block; color: var(--ink-dim); font-size: 0.98rem; line-height: 1.35; }

.note { color: var(--ink-dim); }
.sources { font-size: 0.9rem; color: var(--ink-dim); }
.sources a { color: var(--ink); }

/* On phones the panel's children sit directly in the player grid. */
.panel { display: contents; }

/* Wide screens and phones held sideways: stage left, text and controls right. */
@media (min-width: 900px), (min-aspect-ratio: 4/3) and (min-width: 600px) {
  .player {
    max-width: 1160px;
    grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
    grid-template-rows: auto 1fr;
    column-gap: clamp(24px, 4vw, 56px);
  }
  .topbar { grid-column: 1 / -1; }
  .stage {
    align-self: center;
    max-height: min(calc(100svh - 96px), 720px);
  }
  .controls { align-self: stretch; }
  .panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
    min-width: 0;
  }
  .step { min-height: 9rem; }
  .readout-hands { width: min(100%, 300px); }
  .info { max-width: 760px; }
}

@media (min-aspect-ratio: 4/3) and (max-height: 520px) {
  .player { gap: 8px; }
  .stage { aspect-ratio: auto; height: calc(100svh - 76px); max-height: none; }
  .panel { gap: 10px; }
  .step { min-height: 0; }
  .step-title { font-size: 2rem; }
  .step-text { font-size: 1rem; }
  .readout { padding: 4px 10px; }
  .readout-hands { width: 190px; }
  .nav-btn { width: 48px; height: 48px; }
  .main-btn { height: 48px; }
}

/* Short phones: shrink the readout so the controls stay on screen. */
@media (max-height: 700px) and (max-aspect-ratio: 4/3) {
  .player { gap: 10px; }
  .stage { max-height: 41svh; }
  .readout { padding: 6px 12px 5px; }
  .readout-hands { width: min(100%, 210px); }
  .step { min-height: 6.4rem; }
  .step-title { font-size: clamp(2rem, 9.6vw, 2.6rem); }
  .step-text { font-size: 1.02rem; margin-top: 6px; }
  .nav-btn { width: 52px; height: 52px; }
  .main-btn { height: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  .readout .target { animation: none; stroke-opacity: 1; }
}
