:root {
  font-family:
    system-ui,
    -apple-system,
    "Noto Sans CJK SC",
    "Microsoft YaHei",
    sans-serif;
  color: #3a2340;
  background: #fff6ee;
  font-synthesis: none;
  --pink: #e34d78;
  --line: #eeddd8;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: radial-gradient(ellipse at 80% 0, #ffe2c8, transparent 50%), #fff6ee;
  min-height: 100svh;
}
button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}
button,
select {
  font: inherit;
}
button {
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffcf8;
  color: inherit;
  padding: 13px 22px;
  font-weight: 650;
  min-height: 44px;
  transition:
    background 0.2s,
    transform 0.2s;
}
button:hover {
  background: #ffe5d7;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #2f8cff;
  outline-offset: 4px;
}
button:disabled {
  opacity: 0.65;
  cursor: wait;
}
a {
  color: inherit;
  text-decoration: none;
}
header {
  max-width: 1300px;
  margin: auto;
  padding: 22px 38px;
  display: flex;
  align-items: center;
  gap: 24px;
}
header > a {
  font-size: 28px;
  font-weight: 950;
  letter-spacing: 3px;
}
header > a span {
  font-size: 12px;
  letter-spacing: 2px;
  display: block;
  font-weight: 500;
}
header .tag {
  font-size: 13px;
  color: #755967;
  border-left: 1px solid #d9bfba;
  padding-left: 24px;
}
header button {
  margin-left: auto;
  padding: 10px 20px;
}
main {
  max-width: 1180px;
  margin: auto;
  padding: 0 28px 20px;
}
.intro {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 26px;
  padding: 9px 4px 22px;
}
.eyebrow {
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 2px;
  color: #a54e65;
}
.intro > .eyebrow {
  width: 100%;
  margin-bottom: 6px;
}
h1 {
  font-size: 36px;
  letter-spacing: 1px;
  margin: 0;
}
h1 span {
  font-size: 16px;
  font-weight: 450;
  letter-spacing: 0;
  margin-left: 22px;
  color: #816373;
}
.intro p {
  font-size: 13px;
  margin-left: auto;
  color: #816373;
}
.playfield {
  height: 420px;
  border: 2px solid white;
  border-radius: 32px;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 22%, #fff5e6aa, transparent 60%),
    linear-gradient(#ffb392, #ffd8b6 70%, #ffeacf);
  box-shadow: 0 18px 55px #b2745220;
}
.playfield:after {
  content: "";
  position: absolute;
  width: 120%;
  height: 75px;
  background: #fff9ed88;
  border-radius: 50%;
  bottom: -32px;
  left: -10%;
  pointer-events: none;
}
.ambient {
  position: absolute;
  border-radius: 50%;
  border: 1px solid #fff7eabb;
}
.ambient.a {
  width: 360px;
  height: 360px;
  left: calc(50% - 180px);
  top: 28px;
  background: #ffefe344;
  box-shadow:
    0 0 0 22px #fff4e51a,
    0 0 0 45px #fff4e516;
}
.ambient.b {
  width: 80px;
  height: 80px;
  left: 6%;
  top: 43%;
  background: #ffeed960;
}
#coach {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
#coach canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.coachLabel {
  position: absolute;
  left: 50%;
  bottom: 45px;
  transform: translateX(-50%);
  border-radius: 20px;
  background: #fff8e9d9;
  padding: 7px 18px;
  font-size: 14px;
  font-weight: 750;
}
.coachLabel span {
  font-size: 11px;
  font-weight: 450;
  margin-left: 10px;
  color: #82636e;
}
.status {
  position: absolute;
  top: 20px;
  left: 24px;
  right: 24px;
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #684859;
}
.status span {
  border-radius: 20px;
  background: #fff8eea8;
  padding: 7px 12px;
}
#clock {
  font-variant-numeric: tabular-nums;
}
.instruction {
  position: absolute;
  left: 30px;
  top: 103px;
  width: 31%;
  max-width: 325px;
  z-index: 1;
}
.instruction h2 {
  font-size: 29px;
  line-height: 1.35;
  margin: 12px 0;
}
.instruction p {
  font-size: 14px;
  line-height: 1.9;
  color: #715363;
  max-width: 245px;
}
.indicator {
  position: absolute;
  right: 42px;
  top: 91px;
  width: 174px;
  text-align: center;
}
.indicator svg {
  width: 170px;
  height: 170px;
  overflow: visible;
}
.indicator svg circle {
  fill: none;
  stroke-width: 5;
}
.track {
  stroke: #fff4e6;
}
#ring {
  stroke: #de5a7e;
  stroke-dasharray: 477.53;
  stroke-dashoffset: 477.53;
  transform: rotate(-90deg);
  transform-origin: 90px 90px;
  stroke-linecap: round;
}
#targetArc {
  fill: none;
  stroke: #2f8cff;
  stroke-width: 12;
  opacity: 0.3;
  stroke-linecap: round;
}
#avatar {
  transform-origin: 90px 100px;
  fill: #fff4eacc;
  stroke: #705366;
  stroke-width: 3;
  stroke-linecap: round;
}
#avatar path {
  fill: none;
}
.indicator b,
.indicator span {
  display: block;
}
.indicator b {
  font-size: 21px;
  margin: 7px 0;
}
.indicator span {
  font-size: 11px;
  color: #805f6e;
}
#feedback {
  position: absolute;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%);
  font-size: 13px;
  background: #fff8eee0;
  padding: 7px 15px;
  border-radius: 15px;
  white-space: nowrap;
}
#feedback:empty {
  display: none;
}
.bottom {
  position: absolute;
  z-index: 1;
  bottom: 15px;
  left: 28px;
  right: 28px;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #866170;
}
.modes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 20px 0 16px;
}
.modes button {
  text-align: left;
  padding: 15px 20px;
  background: #fffcf6;
}
.modes button.selected {
  border-color: #ea8398;
  background: #ffe9e3;
  box-shadow: 0 4px 16px #d87c7020;
}
.modes b {
  font-size: 15px;
}
.modes span {
  display: block;
  font-size: 11px;
  margin-top: 6px;
  font-weight: 450;
  color: #836672;
}
.actions {
  display: flex;
  justify-content: center;
  gap: 12px;
}
.primary {
  background: linear-gradient(110deg, #eb6386, #ed9269);
  border-color: transparent;
  color: white;
  box-shadow: 0 6px 20px #d86c7230;
  padding: 15px 28px;
}
.primary:hover {
  background: #d6547c;
}
.primary span {
  margin-left: 26px;
}
.footnote {
  text-align: center;
  color: #8b6d77;
  font-size: 11px;
  margin: 14px 0 0;
  line-height: 1.7;
}
dialog {
  border: 1px solid white;
  border-radius: 28px;
  color: #3a2340;
  background: #fffaf4;
  padding: 32px;
  width: min(510px, calc(100vw - 28px));
  max-height: calc(100svh - 32px);
  overflow: auto;
  box-shadow: 0 30px 100px #66424b44;
}
dialog::backdrop {
  background: #5d384233;
  backdrop-filter: blur(8px);
}
dialog h2 {
  font-size: 25px;
  line-height: 1.4;
  margin: 14px 0 18px;
}
dialog p {
  font-size: 14px;
  line-height: 1.9;
  color: #775968;
}
dialog label {
  display: block;
  font-size: 14px;
  margin: 15px 0;
}
dialog input {
  accent-color: #d9537a;
}
dialog select {
  float: right;
  border: 1px solid #e7d4cd;
  padding: 4px 8px;
  border-radius: 7px;
  background: #fff;
}
dialog button {
  display: block;
  width: 100%;
  margin-top: 12px;
}
.healthRule {
  display: flex;
  align-items: center;
  gap: 24px;
  background: #ffe8de;
  border-radius: 17px;
  padding: 15px 22px;
  margin: 20px 0;
}
.healthRule b {
  font-size: 42px;
  color: #d95578;
}
.healthRule span {
  font-size: 13px;
  line-height: 1.8;
}
.stats {
  display: flex;
  gap: 10px;
  margin: 20px 0;
}
.stats > div {
  flex: 1;
  background: #ffeade;
  border-radius: 16px;
  padding: 16px 8px;
  text-align: center;
}
.stats b,
.stats span {
  display: block;
}
.stats b {
  font-size: 24px;
}
.stats span {
  font-size: 11px;
  margin-top: 7px;
  color: #7e5869;
}
#symmetry > div {
  padding: 12px 0;
  border-bottom: 1px solid #efddd5;
  font-size: 13px;
}
#symmetry span {
  display: block;
  font-size: 12px;
  margin-top: 7px;
  color: #826370;
}
.back {
  display: block;
  text-align: center;
  margin-top: 15px;
  font-size: 14px;
}
fieldset {
  border: 1px solid #eeddd8;
  border-radius: 12px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 8px;
  padding: 10px;
}
fieldset label {
  font-size: 12px;
  margin: 7px 0;
}
.reduced * {
  transition: none !important;
}
.playing #modes {
  display: none;
}
.playing .actions {
  margin-top: 18px;
}
[hidden] {
  display: none !important;
}
@media (max-width: 700px) {
  header {
    padding: 16px 20px;
    gap: 12px;
  }
  header > a {
    font-size: 24px;
  }
  header .tag {
    font-size: 10px;
    padding-left: 12px;
  }
  header button {
    padding: 8px 13px;
    font-size: 12px;
  }
  main {
    padding: 0 14px 16px;
  }
  .intro {
    padding: 12px 5px 15px;
  }
  .intro > .eyebrow {
    font-size: 9px;
  }
  h1 {
    font-size: 28px;
  }
  h1 span {
    display: block;
    font-size: 13px;
    margin: 5px 0 0;
  }
  .intro p {
    font-size: 11px;
    margin: 7px 0 0;
    width: 100%;
  }
  .playfield {
    height: 390px;
    border-radius: 25px;
  }
  .status {
    left: 14px;
    right: 14px;
    top: 13px;
    font-size: 9px;
  }
  .status span {
    padding: 6px 8px;
  }
  .instruction {
    left: 18px;
    top: 61px;
    width: 60%;
    max-width: none;
  }
  .instruction .eyebrow {
    font-size: 9px;
  }
  .instruction h2 {
    font-size: 22px;
    margin: 7px 0;
  }
  .instruction p {
    font-size: 11px;
    max-width: 195px;
    line-height: 1.65;
    margin-top: 6px;
  }
  .indicator {
    right: 7px;
    top: 66px;
    width: 106px;
  }
  .indicator svg {
    width: 96px;
    height: 96px;
  }
  .indicator b {
    font-size: 15px;
    margin: 0 0 5px;
  }
  .indicator span {
    font-size: 9px;
  }
  .ambient.a {
    width: 255px;
    height: 255px;
    left: calc(50% - 127px);
    top: 128px;
  }
  .coachLabel {
    bottom: 38px;
    font-size: 11px;
    padding: 6px 13px;
  }
  .coachLabel span {
    font-size: 9px;
  }
  .bottom {
    bottom: 13px;
    left: 15px;
    right: 15px;
    font-size: 9px;
  }
  #feedback {
    bottom: 73px;
    font-size: 11px;
  }
  .modes {
    gap: 8px;
    grid-template-columns: 1fr 1fr;
    margin: 12px 0;
  }
  .modes button {
    padding: 11px 14px;
    border-radius: 13px;
  }
  .modes b {
    font-size: 13px;
  }
  .modes span {
    font-size: 10px;
    margin-top: 4px;
  }
  .actions {
    gap: 8px;
    flex-wrap: wrap;
  }
  .actions button {
    font-size: 12px;
    padding: 12px 15px;
  }
  .actions .primary {
    width: 100%;
  }
  .actions #guided {
    border: none;
    background: transparent;
    padding: 7px 10px;
  }
  .footnote {
    font-size: 10px;
    margin-top: 9px;
  }
  dialog {
    padding: 24px;
  }
  dialog h2 {
    font-size: 22px;
  }
  .playing .playfield {
    height: min(490px, 65svh);
  }
  .playing .intro p {
    display: none;
  }
}
@media (max-height: 750px) and (min-width: 701px) {
  header {
    padding-top: 12px;
    padding-bottom: 12px;
  }
  .intro {
    padding-bottom: 12px;
  }
  .playfield {
    height: 355px;
  }
  .modes {
    margin: 12px 0;
  }
  .modes button {
    padding: 12px 18px;
  }
}

@media (min-width: 701px) {
  header {
    max-width: 1600px;
  }
  main {
    max-width: 1600px;
  }
  .playfield {
    height: 74vh;
    min-height: 510px;
    max-height: 860px;
  }
  .instruction {
    top: 25%;
    left: 4%;
    width: 28%;
  }
  .instruction h2 {
    font-size: clamp(29px, 2.3vw, 40px);
  }
  .instruction p {
    font-size: 16px;
    max-width: 290px;
  }
  .indicator {
    top: 23%;
    right: 5%;
    width: clamp(190px, 16vw, 270px);
  }
  .indicator svg {
    width: 100%;
    height: auto;
  }
  .indicator b {
    font-size: 27px;
  }
  .indicator span {
    font-size: 13px;
  }
  .ambient.a {
    width: 480px;
    height: 480px;
    left: calc(50% - 240px);
    top: 12%;
  }
  .coachLabel {
    bottom: 8%;
  }
  #feedback {
    bottom: 15%;
  }
}

@media (max-width: 700px) {
  .coachLabel {
    white-space: nowrap;
    padding: 6px 10px;
  }
  .coachLabel span {
    font-size: 8px;
    margin-left: 5px;
  }
}

.sideLabel {
  position: absolute;
  text-align: center;
  font-size: 11px;
  color: #715363;
  white-space: nowrap;
}
.neck-trails {
  position: absolute;
  inset: 0;
  width: 100%;
  pointer-events: none;
}
#video:not([hidden]) {
  position: absolute;
  right: 16px;
  bottom: 50px;
  width: 120px;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 16px;
  transform: scaleX(-1);
}
#video[data-size="big"] { width: 260px; }
#video[data-size="large"] { width: 260px; }
#video[data-size="medium"] { width: 190px; }
#video[data-size="small"] { width: 120px; }
.amplitude-shortcuts { display: flex; gap: 7px; flex-wrap: wrap; margin: -4px 0 10px; }
.amplitude-shortcuts button { min-height: 44px; padding: 7px 10px; border-radius: 12px; font-size: 12px; }
#amplitudeValue { float: right; font-weight: 750; color: #d9537a; }
#amplitudeNote { clear: both; margin: 5px 0 8px; font-size: 12px; }
@media (max-width: 700px) {
  body { padding-bottom: env(safe-area-inset-bottom); }
  header { padding-top: max(16px, env(safe-area-inset-top)); }
  .playfield { min-height: 390px; }
  .actions button { min-height: 48px; }
  #video:not([hidden]) { right: 10px; bottom: 48px; width: 96px; border-radius: 12px; }
  #video[data-size="big"] { width: 180px; }
  #video[data-size="medium"] { width: 132px; }
  #video[data-size="small"] { width: 96px; }
  dialog { margin: auto; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
  .playing .actions { position: relative; z-index: 3; }
}
@media (max-width: 700px) and (orientation: portrait) {
  .playfield { height: min(620px, 70svh); min-height: 500px; }
  .instruction { top: 53px; width: 68%; }
  .indicator { top: 67px; }
  #coach { inset: 110px 0 68px; }
  .coachLabel { bottom: 44px; }
  #feedback { bottom: 80px; max-width: 88%; white-space: normal; text-align: center; }
  .bottom { bottom: 14px; }
}
#guideDeviation {
  width: 100%;
  height: 10px;
  margin-top: 8px;
}
.cache-items {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 12px 0;
  font-size: 13px;
}
.cache-item {
  border: 1px solid #e3cabc;
  border-radius: 12px;
  padding: 6px 10px;
  background: #fff8ee;
}
.first-download {
  width: 100%;
  margin: 0;
  text-align: left;
}
/* Style the internal meter track too: its native track was only ~3 px tall. */
#guideDeviation { appearance:none; height:14px; border:0; border-radius:7px; overflow:hidden; background:#e2dcd2; }
#guideDeviation::-webkit-meter-bar { height:14px; border:0; border-radius:7px; background:#e2dcd2; }
#guideDeviation { --guide-color:#258675; }
#guideDeviation[data-level=low] { --guide-color:#bf841d; }
#guideDeviation[data-level=high] { --guide-color:#c45356; }
#guideDeviation::-webkit-meter-optimum-value,
#guideDeviation::-webkit-meter-suboptimum-value,
#guideDeviation::-webkit-meter-even-less-good-value { background:var(--guide-color); border-radius:7px; }
#guideDeviation::-moz-meter-bar { background:var(--guide-color); }

/* Keep the amplitude track while matching the settings' 48px touch targets. */
#amplitudeScale {
  appearance: none;
  min-height: 48px;
  min-width: 100px;
  background: transparent;
  cursor: pointer;
}
#amplitudeScale::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: #d9cdc7; }
#amplitudeScale::-moz-range-track { height: 6px; border-radius: 6px; background: #d9cdc7; }
#amplitudeScale::-webkit-slider-thumb { appearance: none; width: 24px; height: 24px; margin-top: -9px; border: 2px solid #fffaf4; border-radius: 50%; background: #d9537a; }
#amplitudeScale::-moz-range-thumb { width: 20px; height: 20px; border: 2px solid #fffaf4; border-radius: 50%; background: #d9537a; }
#amplitudeScale:focus-visible { outline: 3px solid #bf8b28; outline-offset: 2px; border-radius: 8px; }

/* 2026-10-18 readability pass: keep the safety copy legible on phones. */
@media (max-width: 700px) {
  header .tag { font-size: 12px; }
  .intro > .eyebrow { font-size: 12px; }
  .intro p { font-size: 13px; }
  .status { font-size: 12px; }
  .instruction .eyebrow { font-size: 12px; }
  .instruction p { font-size: 13px; }
  .indicator span { font-size: 11px; }
  .coachLabel { font-size: 12px; }
  .coachLabel span { font-size: 11px; }
  .bottom { font-size: 11px; }
  #feedback { font-size: 12px; }
  .footnote { font-size: 12px; }
  dialog p { font-size: 14px; }
  .healthRule span { font-size: 14px; }
}

header > a { min-height: 44px; display: inline-flex; align-items: center; }
.back { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }

@media (max-width: 700px) {
  header .tag { font-size: 12px; }
  .modes span { font-size: 12px; line-height: 1.4; }
  .footnote { font-size: 12px; }
  .coachLabel span { font-size: 12px; }
  dialog .eyebrow, .intro > .eyebrow { font-size: 12px; }
}

@media (max-width: 700px) {
  .bottom { font-size: 12px; }
  body:has(#coach):not(.playing) #footnote { font-size: 12px; }
}

@media (max-width: 700px) {
  body:has(#coach):not(.playing) #footnote { font-size: 12px !important; }
}
