@font-face {
  font-family: Smiley;
  src: url("../assets/fonts/games.woff2") format("woff2");
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

body {
  font-family:
    system-ui,
    -apple-system,
    "Microsoft YaHei",
    sans-serif;
  color: #293653;
  background: #fff4e7;
}

button,
a,
input,
select {
  font: inherit;
}

button,
.button {
  border: 0;
  border-radius: 18px;
  padding: 14px 25px;
  background: #fff;
  color: #293653;
  cursor: pointer;
  font-weight: 750;
  text-decoration: none;
  display: inline-block;
  box-shadow: 0 6px 22px #66537513;
}

button:hover,
.button:hover {
  transform: translateY(-2px);
  outline: 3px solid #ffce57;
}

button:focus-visible,
a:focus-visible {
  outline: 4px solid #2f8cff;
}

.primary {
  color: white;
  background: linear-gradient(115deg, #ff5e7e, #ff8a4c);
}

[hidden] {
  display: none !important;
}

#world {
  position: fixed;
  inset: 0;
  background: linear-gradient(#ffc6a3 0%, #fff0bf 25%, #bbf2df 48%, #24cfc4 65%);
}

#world canvas,
#world > svg {
  width: 100%;
  height: 100%;
  display: block;
}

.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(ellipse at 15% 15%, #ffe7b4 0, transparent 50%),
    linear-gradient(130deg, #fff8edee, #fff0f7ee);
}

.sheet {
  width: min(830px, 95vw);
  max-height: 95vh;
  overflow: auto;
  background: #ffffffed;
  border-radius: 32px;
  padding: 36px 48px;
  box-shadow: 0 25px 100px #9c687d25;
  border: 2px solid white;
}

.eyebrow {
  color: #c74564;
  font-weight: 800;
  letter-spacing: 0.13em;
  font-size: 15px;
}

h1,
h2,
.display {
  font-family: Smiley, system-ui, sans-serif;
  font-weight: 400;
}

h1 {
  font-size: clamp(32px, 4vw, 58px);
  margin: 12px 0;
}

h2 {
  font-size: 32px;
}

.muted {
  color: #64718a;
}

.sheet p {
  line-height: 1.65;
}

.load-number {
  font: 100px/1 Smiley;
  color: #f26478;
}

.load-number small {
  font-size: 30px;
}

progress {
  width: 100%;
  height: 12px;
  border: 0;
  border-radius: 9px;
  overflow: hidden;
  background: #f4e7ed;
  accent-color: #ff7083;
}

progress::-webkit-progress-bar {
  background: #f4e7ed;
}

progress::-webkit-progress-value {
  background: linear-gradient(90deg, #ff6f96, #ffc15d);
}

.load-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 15px;
  margin: 11px 0;
  font-size: 17px;
}

.load-row[data-state="完成"] {
  color: #168870;
}

.load-row[data-state="进行"] {
  color: #bd4569;
  font-weight: 700;
}

.mode-note {
  padding: 10px 16px;
  background: #fff2cc;
  border-radius: 12px;
  font-size: 14px;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.stat {
  position: absolute;
  top: 24px;
  background: #fffffff0;
  box-shadow: 0 8px 30px #29596c14;
  border: 2px solid white;
  border-radius: 22px;
  padding: 12px 24px;
  min-width: 150px;
}

.stat small {
  display: block;
  color: #63738a;
  font-size: 15px;
}

.stat strong {
  font: 36px Smiley;
}

.stat-left {
  left: 28px;
}

.stat-right {
  right: 28px;
  text-align: right;
}

.phase {
  position: absolute;
  left: 32%;
  width: 36%;
  top: 27px;
  text-align: center;
  font-size: 20px;
  font-weight: 800;
}

.segments {
  display: flex;
  gap: 5px;
  margin-top: 10px;
}

.segments i {
  height: 7px;
  background: #ffffffb0;
  border-radius: 5px;
  flex: 1;
  overflow: hidden;
}

.segments b {
  display: block;
  height: 100%;
  background: #ff658b;
}

.command-box {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  width: max-content;
  max-width: 94vw;
}

.command {
  font-family: Smiley, system-ui;
  font-size: 8.2vh;
  line-height: 1.18;
  background: #fffffff5;
  border: 3px solid white;
  border-radius: 24px;
  padding: 12px 35px;
  box-shadow: 0 10px 35px #415e7020;
  color: #976500;
  white-space: nowrap;
}

.command.urgent {
  outline: 5px solid #ffd352;
  transform: scale(1.025);
}

.next {
  font-size: 18px;
  margin: 12px auto 0;
  background: #ffffffdf;
  border-radius: 30px;
  padding: 6px 20px;
  width: max-content;
  max-width: 90vw;
}

.feedback {
  position: absolute;
  top: 43%;
  width: 100%;
  text-align: center;
  font: italic 7vh Smiley;
  color: #ffc929;
  -webkit-text-stroke: 1.5px #fff;
  filter: drop-shadow(0 4px 0 #c68048);
  pointer-events: none;
}

.feedback.fail {
  font-size: 4vh;
  color: #fff;
  -webkit-text-stroke: 0;
  filter: drop-shadow(0 2px 2px #607c98);
}

.combo {
  position: absolute;
  left: 30px;
  bottom: 110px;
  color: #fff;
  font: 34px Smiley;
  text-shadow: 0 3px 6px #547486;
}

.meter {
  position: absolute;
  left: 28px;
  bottom: 65px;
  background: #ffffffe8;
  border-radius: 18px;
  padding: 10px 19px;
  font-size: 20px;
}

.footer-note {
  position: absolute;
  bottom: 22px;
  left: 28px;
  font-size: 15px;
  background: #ffffffbd;
  padding: 5px 12px;
  border-radius: 12px;
}

.camera {
  position: fixed;
  right: 28px;
  bottom: 24px;
  width: 185px;
  height: 145px;
  border: 3px solid white;
  border-radius: 20px;
  background: #244b66ba;
  overflow: hidden;
  z-index: 12;
}

.camera video,
.camera canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.camera canvas {
  z-index: 1;
}

.camera button {
  position: absolute;
  right: 4px;
  top: 4px;
  z-index: 2;
  padding: 3px 9px;
  font-size: 11px;
  border-radius: 9px;
}

.camera::after {
  content: "镜像 · 你的动作";
  position: absolute;
  bottom: 4px;
  left: 12px;
  font-size: 11px;
  color: white;
}

.camera.expanded {
  right: calc(50% - 145px);
  bottom: 14%;
  width: 290px;
  height: 225px;
}

.camera.minimized {
  width: 75px;
  height: 34px;
}

.camera.minimized canvas,
.camera.minimized video,
.camera.minimized::after {
  display: none;
}

.toolbar {
  position: fixed;
  right: 28px;
  top: 130px;
  z-index: 5;
  display: flex;
  gap: 5px;
}

.toolbar button {
  padding: 8px 12px;
  font-size: 13px;
}

.far {
  position: absolute;
  left: 28px;
  top: 133px;
  font-size: 13px;
  background: #ffffffc9;
  padding: 5px 10px;
  border-radius: 12px;
}

.debug {
  position: fixed;
  top: 38%;
  left: 10px;
  z-index: 15;
  background: #ffffffec;
  white-space: pre;
  font: 12px monospace;
  padding: 12px;
  pointer-events: none;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 25px 0;
}

.result-grid div {
  border-radius: 18px;
  background: #fff0e6;
  padding: 15px;
}

.result-grid strong {
  display: block;
  font: 38px Smiley;
  color: #e9657c;
}

.result-grid small {
  color: #67758b;
}

.stars {
  font: 50px Smiley;
  color: #f1b315;
  letter-spacing: 0.12em;
}

.result-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.result-counts span {
  padding: 9px 13px;
  background: #edf8f5;
  border-radius: 10px;
  font-size: 15px;
}

#calibration-ring {
  height: 10px;
  margin: 20px 0;
  background: #fbe6ef;
  border-radius: 8px;
  overflow: hidden;
}

#calibration-ring i {
  display: block;
  background: #2ed9a3;
  height: 100%;
}

.position-sheet {
  padding-bottom: 275px;
  text-align: center;
}

#countdown-number {
  font: 150px Smiley;
  color: #ff7585;
  text-align: center;
}

#hand-cursor {
  position: fixed;
  width: 36px;
  height: 36px;
  border: 4px solid white;
  border-radius: 50%;
  background: conic-gradient(#ff6986 var(--dwell, 0deg), #2ed9a366 0);
  transform: translate(-50%, -50%);
  z-index: 99;
  pointer-events: none;
  box-shadow: 0 2px 8px #4566;
}

.settings-row {
  display: flex;
  gap: 16px;
  align-items: center;
  margin: 16px 0;
}

.settings-row input {
  width: 130px;
}

.settings-row select {
  padding: 10px;
  border: 1px solid #eadbe0;
  border-radius: 10px;
  background: white;
}

.sim-label {
  font-size: 13px;
  color: #728395;
}

.reduced * {
  animation: none !important;
  transition: none !important;
}

@media (orientation: portrait) {
  .stat {
    top: 14px;
    padding: 10px 14px;
    min-width: 0;
    border-radius: 17px;
  }

  .stat-left {
    left: 12px;
  }

  .stat-right {
    right: 12px;
  }

  .stat strong {
    font-size: 27px;
  }

  .stat small {
    font-size: 11px;
  }

  .phase {
    top: 101px;
    left: 15%;
    width: 70%;
    font-size: 16px;
  }

  .command-box {
    top: 22%;
    max-width: 96vw;
  }

  .command {
    font-size: max(34px, 5.1vh);
    padding: 12px 15px;
    border-radius: 20px;
  }

  .next {
    font-size: 14px;
    margin-top: 10px;
    padding: 6px 12px;
  }

  .feedback {
    top: 40%;
    font-size: 6vh;
  }

  .feedback.fail {
    font-size: 3.2vh;
  }

  .toolbar {
    right: 12px;
    top: auto;
    bottom: 190px;
  }

  .toolbar button {
    font-size: 11px;
    padding: 7px;
  }

  .camera {
    width: 120px;
    height: 105px;
    bottom: 65px;
    right: 12px;
  }

  .meter {
    left: 12px;
    bottom: 76px;
    font-size: 15px;
    padding: 10px;
  }

  .combo {
    left: 16px;
    bottom: 128px;
    font-size: 25px;
  }

  .footer-note {
    left: 12px;
    bottom: 21px;
    font-size: 11px;
    padding: 5px 8px;
  }

  .far {
    top: 148px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 11px;
  }

  .sheet {
    padding: 24px 22px;
    border-radius: 24px;
  }

  .sheet h1 {
    font-size: 34px;
  }

  .sheet .eyebrow {
    font-size: 12px;
  }

  .load-number {
    font-size: 76px;
  }

  .load-row {
    font-size: 13px;
    margin: 14px 0;
    gap: 4px;
  }

  .mode-note {
    font-size: 12px;
  }

  .screen {
    padding: 12px;
  }

  .sheet p {
    font-size: 14px;
  }

  .result-grid {
    gap: 7px;
    margin: 16px 0;
  }

  .result-grid div {
    padding: 12px 7px;
  }

  .result-grid strong {
    font-size: 29px;
  }

  .result-grid small {
    font-size: 11px;
  }

  .result-counts span {
    font-size: 12px;
    padding: 6px 9px;
  }

  .actions {
    gap: 8px;
    margin-top: 18px;
  }

  .actions button,
  .actions a {
    padding: 12px 16px;
    font-size: 14px;
  }

  .stars {
    font-size: 38px;
  }

  .position-sheet {
    padding-bottom: 265px;
  }

  .camera.expanded {
    bottom: 14%;
  }

  .debug {
    font-size: 9px;
    top: 44%;
  }
}

@media (max-height: 420px) and (orientation: landscape) {
  .stat {
    top: 8px;
    padding: 7px 14px;
  }

  .stat strong {
    font-size: 23px;
  }

  .stat small {
    font-size: 10px;
  }

  .phase {
    top: 12px;
    font-size: 14px;
  }

  .command-box {
    top: 24%;
  }

  .command {
    font-size: 8vh;
    padding: 6px 20px;
  }

  .next {
    font-size: 12px;
    margin-top: 5px;
  }

  .toolbar {
    top: auto;
    bottom: 12px;
    right: 160px;
  }

  .camera {
    width: 120px;
    height: 95px;
    bottom: 12px;
  }

  .footer-note {
    bottom: 7px;
    font-size: 10px;
  }

  .meter {
    bottom: 36px;
    font-size: 14px;
  }

  .combo {
    bottom: 77px;
    font-size: 22px;
  }

  .far {
    top: 80px;
    font-size: 10px;
  }

  .sheet {
    padding: 18px;
    max-height: 96vh;
  }

  .sheet h1 {
    font-size: 27px;
  }

  .result-grid {
    margin: 8px 0;
  }

  .result-grid strong {
    font-size: 27px;
  }
}

.stat strong + strong {
  margin-left: 15px;
  padding-left: 14px;
  border-left: 2px solid #e9e3e6;
}

.stat small {
  margin-bottom: 5px;
}

@media (orientation: portrait) {
  .stat strong + strong {
    margin-left: 7px;
    padding-left: 7px;
  }
}

.hud.miss-flash::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 12px solid #ff82976b;
  pointer-events: none;
  border-radius: 24px;
}

/* Feedback stays near the player and remains readable over bright water/snow. */
.feedback {
  top: 61%;
  font-size: 10vh;
  background: linear-gradient(#fff29b, #ffbd18 65%, #f49622);
  background-clip: text;
  -webkit-text-fill-color: transparent;
  -webkit-text-stroke: 2px white;
  filter: drop-shadow(0 5px 0 #b87731);
  animation: reward-pop 0.45s ease-out;
}

.feedback.fail {
  font-size: 5.2vh;
  -webkit-text-fill-color: #a33851;
  -webkit-text-stroke: 1px white;
  background: none;
}

@keyframes reward-pop {
  from {
    transform: scale(0.65);
  }

  60% {
    transform: scale(1.12);
  }

  to {
    transform: scale(1);
  }
}

.combo {
  color: #b85332;
  background: #fffffff0;
  border: 2px solid white;
  border-radius: 24px;
  padding: 8px 20px;
  text-shadow: none;
  font-size: 36px;
  bottom: 120px;
}

.camera {
  background: #ffffffd9;
}

.camera::after {
  color: #344b69;
}

.position-sheet {
  width: min(1150px, 96vw);
  height: 88vh;
  padding: 26px;
  text-align: left;
  position: relative;
}

.position-sheet h1 {
  font-size: 40px;
}

.station-checks {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.station-checks span {
  padding: 8px 12px;
  background: #fff1e5;
  border-radius: 12px;
}

.station-checks .checked {
  background: #d8f9ec;
  color: #087459;
}

.camera.expanded {
  width: min(72vh, 65vw);
  height: 55vh;
  left: calc(50% - min(550px, 44vw));
  right: auto;
  bottom: 10vh;
  border-radius: 28px;
}

#calibration-ring {
  position: absolute;
  right: 5%;
  bottom: 24%;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: conic-gradient(#2ed9a3 var(--progress, 0deg), #e8f2f0 0);
  padding: 10px;
}

#calibration-ring i {
  border-radius: 50%;
  background: white;
  display: grid;
  place-content: center;
  text-align: center;
  font: 28px Smiley;
  color: #087459;
}

.position-sheet #start-button {
  position: absolute;
  right: 3%;
  bottom: 12%;
}

.position-sheet .sim-label {
  position: absolute;
  right: 3%;
  bottom: 5%;
}

#loading {
  isolation: isolate;
}

#loading::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.7;
  background: linear-gradient(165deg, transparent 48%, #60d5ce 49%, #bdf4df 70%);
}

#loading::after {
  content: "☀";
  position: absolute;
  left: 7%;
  top: 12%;
  font-size: 24vw;
  color: #ffc956;
  z-index: -1;
}

body[data-scene="glide"] #loading::before {
  background: linear-gradient(140deg, transparent 45%, #82cecd 46%, #ecffff 65%, #9cdedc 66%, #fff 85%);
}

@media (orientation: portrait) {
  .feedback {
    top: 57%;
    font-size: 9vh;
  }

  .feedback.fail {
    font-size: 4.3vh;
  }

  .combo {
    font-size: 22px;
    padding: 7px 12px;
    bottom: 130px;
  }

  .position-sheet {
    height: 94vh;
    padding: 20px;
  }

  .position-sheet h1 {
    font-size: 29px;
  }

  .station-checks {
    gap: 5px;
    font-size: 12px;
  }

  .station-checks span {
    padding: 6px;
  }

  .camera.expanded {
    width: 86vw;
    height: 45vh;
    left: 7vw;
    bottom: 22vh;
  }

  #calibration-ring {
    width: 86px;
    height: 86px;
    right: auto;
    left: 8%;
    bottom: 3%;
    margin: 0;
  }

  #calibration-ring i {
    font-size: 19px;
  }

  .position-sheet #start-button {
    bottom: 8%;
    right: 4%;
    font-size: 14px;
  }

  .position-sheet .sim-label {
    bottom: 1%;
    right: 5%;
    font-size: 11px;
  }
}

.loading-cover {
  position: absolute;
  inset: 0;
  z-index: -1;
  opacity: 0.7;
  overflow: hidden;
}

.loading-cover svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.screen#loading {
  background: #fff4e770;
}

#loading::before,
#loading::after {
  display: none;
}

.hud.speeding::before {
  content: "";
  position: absolute;
  inset: 32% 0 8%;
  pointer-events: none;
  background: repeating-conic-gradient(
    from 50deg at 50% 40%,
    transparent 0 13deg,
    #ffffff80 13.1deg 13.3deg,
    transparent 13.4deg 25deg
  );
  mask-image: linear-gradient(90deg, #000, transparent 18%, transparent 82%, #000);
  opacity: 0.6;
}

.reduced .hud.speeding::before {
  display: none;
}

/* V2: independent display layers, bounded editing, and height-driven results. */
.camera:not(.expanded),
.skeleton-window {
  left: var(--layout-left);
  top: var(--layout-top);
  width: var(--layout-width);
  height: var(--layout-height);
  right: auto;
  bottom: auto;
}

.skeleton-window {
  position: fixed;
  z-index: 4;
  background: #ffffffb0;
  border: 2px solid white;
  border-radius: 16px;
  overflow: hidden;
  pointer-events: none;
}

.skeleton-window canvas {
  width: 100%;
  height: 100%;
  transform: scaleX(-1);
}

.camera {
  z-index: 4;
}

body[data-state="position"] .camera,
body[data-state="position"] .skeleton-window {
  z-index: 12;
}

body[data-state="position"] .skeleton-window {
  left: calc(50% - min(550px, 44vw));
  top: auto;
  bottom: 10vh;
  width: min(72vh, 65vw);
  height: 55vh;
  background: transparent;
  border: 0;
}

body:not([data-state="position"])[data-camera="off"] .camera,
body:not([data-state="position"])[data-skeleton="off"] .skeleton-window {
  display: none;
}

body:not([data-state="position"])[data-camera="background"] .camera {
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: transparent;
  border: 0;
  pointer-events: none;
  z-index: 2;
}

body[data-camera="background"] .camera::after,
body[data-camera="background"] #hide-camera {
  display: none;
}

body:not([data-state="position"])[data-skeleton="center"] .skeleton-window {
  left: 25vw;
  top: 26vh;
  width: 50vw;
  height: 65vh;
  background: transparent;
  border: 0;
  z-index: 2;
}

body[data-state="result"] .camera,
body[data-state="result"] .skeleton-window {
  display: none;
}

.display-settings {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 24px;
  margin: 15px 0;
}

.display-settings label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 15px;
}

.display-settings select {
  max-width: 130px;
  padding: 8px;
  border: 1px solid #d9dce4;
  border-radius: 10px;
}

.display-settings input[type="range"] {
  width: 110px;
}

.display-settings button {
  padding: 10px;
  font-size: 14px;
  background: #edf8f5;
}

#settings .sheet {
  width: min(940px, 95vw);
}

#settings h1 {
  font-size: clamp(24px, 4vh, 42px);
}

#settings .settings-row {
  margin: 8px 0;
}

#layout-guide {
  position: fixed;
  z-index: 30;
  bottom: 1vh;
  left: 2vw;
  right: 2vw;
  padding: 10px;
  background: #fffffff2;
  border-radius: 14px;
  text-align: center;
  font-size: 14px;
}

#layout-guide button {
  margin-left: 12px;
  padding: 9px 12px;
}

#protected-preview {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 19;
}

#protected-preview i {
  position: absolute;
  border: 2px dashed #eeaf47;
  background: #ffda5720;
  color: #916500;
  font-size: 12px;
}

.layout-editing #settings,
.layout-editing #position {
  visibility: hidden;
}

.layout-editing .camera,
.layout-editing .skeleton-window {
  display: block !important;
  position: fixed;
  z-index: 25 !important;
  pointer-events: auto;
  touch-action: none;
  visibility: visible;
  outline: 3px dashed #2ed9a3;
  overflow: visible;
  cursor: move;
  background: #ffffffb0;
  left: var(--layout-left) !important;
  top: var(--layout-top) !important;
  width: var(--layout-width) !important;
  height: var(--layout-height) !important;
  bottom: auto !important;
}

.layout-editing [data-layout]::after {
  content: attr(data-label);
  position: absolute;
  top: 0;
  bottom: auto;
  left: 0;
  padding: 4px;
  color: #13554d;
  background: #e0fff6;
  white-space: nowrap;
  font-size: 12px;
}

.layout-editing [data-layout].blocked {
  outline-color: #f14c68;
}

.layout-editing [data-layout].blocked::after {
  background: #ffced6;
  color: #a01835;
}

[data-corner] {
  display: none;
}

.layout-editing [data-corner] {
  display: block;
  position: absolute;
  width: 18px;
  height: 18px;
  background: #2ed9a3;
  z-index: 3;
}

[data-corner="nw"] {
  left: -7px;
  top: -7px;
  cursor: nwse-resize;
}

[data-corner="ne"] {
  right: -7px;
  top: -7px;
  cursor: nesw-resize;
}

[data-corner="sw"] {
  left: -7px;
  bottom: -7px;
  cursor: nesw-resize;
}

[data-corner="se"] {
  right: -7px;
  bottom: -7px;
  cursor: nwse-resize;
}

#position-layout {
  position: absolute;
  right: 3%;
  bottom: 19%;
  padding: 9px 12px;
}

#skip-range {
  position: absolute;
  right: 3%;
  bottom: 10%;
  background: #ffda76;
}

#range-list {
  position: absolute;
  right: 3%;
  top: 30%;
  width: 26%;
  display: grid;
  gap: 8px;
  font-size: 16px;
}

#range-list span {
  background: #f4f2f0;
  padding: 8px;
  border-radius: 9px;
}

#range-list .checked {
  background: #dcfbed;
  color: #13745e;
}

#calibration-ring {
  bottom: 23%;
  width: 85px;
  height: 85px;
  right: 12%;
}

#calibration-ring i {
  font-size: 19px;
}

#range-risk,
#voice-warning {
  position: fixed;
  left: 2vw;
  bottom: 2vh;
  z-index: 6;
  font-size: 12px;
  color: #853f23;
  background: #fff9db;
}

#range-risk:empty,
#voice-warning:empty {
  display: none;
}

.target-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.action-badge {
  position: absolute;
  transform: translate(-50%, -50%);
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 4px solid white;
  background: #fff7da;
  font-family: system-ui, sans-serif;
  font-weight: 900;
  line-height: 1;
  box-shadow:
    0 5px 0 #664c4238,
    0 0 20px #ffffff80;
}

.action-badge.bubble {
  background: radial-gradient(circle at 30% 22%, white, #cfeaff 28%, currentColor 100%);
}

.punch-ring {
  position: absolute;
  top: 51%;
  transform: translate(-50%, -50%);
  box-sizing: content-box;
  border: 5px solid #ffffffb0;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #2f8cff;
  transition: box-shadow 0.2s;
}

.punch-ring[data-side="1"] {
  box-shadow: 0 0 0 2px #ff4d5e;
}

.punch-ring.now {
  box-shadow:
    0 0 0 3px #ffd052,
    0 0 26px #fff7c9;
  animation: ring-ready 0.5s ease-out;
}

@keyframes ring-ready {
  from {
    transform: translate(-50%, -50%) scale(1.12);
  }

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

.command-icon {
  font-family: system-ui, sans-serif;
  font-weight: 900;
  display: inline-block;
}

.feedback small {
  display: block;
  font: 600 clamp(13px, 2vh, 22px) system-ui;
  -webkit-text-stroke: 0;
  -webkit-text-fill-color: #32435a;
}

.feedback[data-tier="great"] {
  background: none;
  -webkit-text-fill-color: #29d9ae;
  filter: drop-shadow(0 4px 0 #126b61);
}

.feedback[data-tier="good"] {
  background: none;
  -webkit-text-fill-color: white;
  -webkit-text-stroke: 2px #34465c;
}

.feedback[data-tier="miss"] {
  background: none;
  -webkit-text-fill-color: #9099a7;
  -webkit-text-stroke: 1px white;
  font-size: 8vh;
}

.hud.combo-burst:not(:has(.feedback[hidden]))::after {
  content: "";
  position: absolute;
  inset: 18%;
  border: 6px solid #ffe5a8;
  border-radius: 50%;
  animation: shockwave 0.8s ease-out infinite;
  pointer-events: none;
}

@keyframes shockwave {
  from {
    transform: scale(0.2);
    opacity: 0.8;
  }

  to {
    transform: scale(2);
    opacity: 0;
  }
}

body[data-impact="off"] .hud::after,
body[data-impact="weak"] .hud::after,
.reduced .hud::after {
  display: none;
}

#world.sunset::before {
  content: "";
  position: absolute;
  top: 34%;
  left: 70%;
  width: 12vh;
  height: 12vh;
  border-radius: 50%;
  background: #ffda99;
  box-shadow: 0 0 50px 25px #ffa87488;
  z-index: 0;
}

#result .sheet {
  height: auto;
  max-height: 94vh;
  width: min(920px, 96vw);
  overflow: hidden;
  display: grid;
  grid-auto-rows: max-content;
  align-content: center;
  gap: clamp(5px, 1.1vh, 13px);
  padding: clamp(15px, 3vh, 36px) clamp(18px, 3vw, 42px);
}

#result h1 {
  font-size: clamp(26px, 4.8vh, 56px);
  margin: 0;
}

#result p {
  margin: 0;
  line-height: 1.35;
  font-size: clamp(12px, 1.8vh, 17px);
}

#result .stars {
  font-size: clamp(25px, 5vh, 52px);
  line-height: 1;
}

#result .result-grid {
  margin: 0;
  gap: 9px;
}

#result .result-grid div {
  padding: clamp(8px, 1.5vh, 16px);
}

#result .result-grid strong {
  font-size: clamp(24px, 4.5vh, 46px);
}

#result .result-counts {
  gap: 6px;
}

#result .result-counts span {
  font-size: clamp(11px, 1.7vh, 16px);
  padding: 6px 9px;
}

#result .actions {
  margin: 0;
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  gap: 8px;
}

#result .actions > * {
  text-align: center;
  font-size: clamp(12px, 1.9vh, 18px);
  padding: 12px 8px;
  white-space: nowrap;
}

.tier-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  color: #187568;
  font-size: clamp(12px, 1.9vh, 19px);
}

.rhythm {
  background: #fff5d9;
  padding: 10px;
  border-radius: 12px;
  color: #805a30;
}

@media (orientation: portrait) {
  body[data-state="position"] .skeleton-window {
    left: 7vw;
    bottom: 28vh;
    top: auto;
    width: 86vw;
    height: 35vh;
  }

  .camera.expanded {
    bottom: 28vh;
    height: 35vh;
  }

  #range-list {
    top: auto;
    bottom: 14%;
    left: 4%;
    width: 92%;
    grid-template-columns: 1fr 1fr;
    gap: 3px;
    font-size: 11px;
  }

  #range-list span {
    padding: 4px;
  }

  #position-layout {
    bottom: 6%;
    right: 4%;
    font-size: 12px;
  }

  #skip-range {
    bottom: 1%;
    right: 4%;
    font-size: 12px;
    padding: 8px;
  }

  .position-sheet #start-button {
    bottom: 9%;
  }

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

  .camera:not(.expanded) {
    border-radius: 12px;
  }

  .camera::after {
    display: none;
  }

  .toolbar {
    bottom: 62px;
  }

  .combo {
    bottom: 18px;
    left: auto;
    right: 12px;
    font-size: 17px;
    padding: 8px;
  }

  .meter {
    bottom: 18px;
    font-size: 13px;
    padding: 10px;
  }

  .footer-note {
    display: none;
  }

  #result .sheet {
    height: 93vh;
    gap: 12px;
  }

  #result .eyebrow {
    letter-spacing: 0.06em;
  }

  #result .actions {
    grid-template-columns: 1fr 1fr;
  }

  #result .pulse-home {
    grid-column: 1 / -1;
  }

  #result h1 {
    font-size: 31px;
  }

  #result .result-grid strong {
    font-size: 28px;
  }

  #result .result-counts span {
    font-size: 12px;
  }

  #result p {
    font-size: 13px;
  }

  #layout-guide {
    font-size: 11px;
  }
}

@media (max-height: 450px) and (orientation: landscape) {
  #result .sheet {
    width: 94vw;
    gap: 4px;
    padding: 10px 20px;
  }

  #result h1 {
    font-size: 25px;
  }

  #result .stars {
    font-size: 23px;
  }

  #result .result-grid div {
    padding: 5px;
  }

  #result .result-grid strong {
    font-size: 24px;
  }

  #result .result-counts span {
    padding: 3px 6px;
  }

  #result .actions > * {
    padding: 7px;
  }

  #result .eyebrow {
    font-size: 11px;
  }

  #result .rhythm {
    padding: 5px;
  }
}

.hud[data-fx="good"] .feedback:not([hidden])::before,
.hud[data-fx="great"] .feedback:not([hidden])::before {
  content: "";
  position: absolute;
  left: 40%;
  top: -15%;
  width: 20%;
  height: 130%;
  border: 4px solid #b0ffe8;
  border-radius: 50%;
  opacity: 0.55;
  animation: reward-pop 0.5s ease-out;
  z-index: -1;
}

body[data-impact="off"] .feedback::before {
  display: none !important;
}

.layout-presets {
  display: flex;
  gap: 8px;
  margin-top: 18px;
}

body[data-state="position"] .sim-label {
  display: none;
}

.punch-ring.now::after {
  content: "现在出拳";
  position: absolute;
  top: 106%;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 3px 8px;
  border-radius: 10px;
  background: #fff7c9;
  color: #835200;
  font: 700 clamp(11px, 1.6vh, 19px) system-ui;
}

.camera.minimized:not(.expanded) {
  width: 75px;
  height: 34px;
}

#calibration-ring {
  bottom: 19%;
}

@media (orientation: portrait) {
  #calibration-ring {
    bottom: 3%;
    left: 7%;
    right: auto;
  }
}

/* Shared label/control columns for every settings group. */
.display-settings h2 {
  grid-column: 1 / -1;
  margin: 2px 0 0;
  padding-bottom: 5px;
  border-bottom: 1px solid #d9e5e0;
  font-size: 16px;
  text-align: left;
}
.display-settings label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  min-width: 0;
  text-align: left;
}
.display-settings label > input,
.display-settings label > select,
.display-settings .timing-control {
  justify-self: end;
  max-width: 100%;
}
.display-settings .timing-control {
  display: grid;
  justify-items: end;
  font-size: 12px;
}
.display-settings input[type="range"] {
  width: 130px;
  min-width: 0;
}
.display-settings input {
  margin: 0;
}

/* Keep the drag surface accessible even in the compact portrait camera window. */
.layout-editing #hide-camera {
  display: none;
}

.pair-dialog {
  border: 0;
  border-radius: 26px;
  padding: 32px;
  max-width: min(560px, 90vw);
  color: #243e3b;
  background: #fffdf5;
  box-shadow: 0 20px 80px #1236;
}
.pair-dialog::backdrop {
  background: #122a37b8;
}
.pair-dialog p {
  line-height: 1.7;
}
.pair-code {
  display: block;
  font-size: 38px;
  letter-spacing: 8px;
  margin: 20px 0;
}
.pair-link {
  display: block;
  overflow-wrap: anywhere;
  color: #14695f;
}
.pair-status {
  font-weight: 700;
}
.pair-qr:empty {
  display: none;
}
.pair-dialog {
  background: var(--paper);
  color: var(--ink);
  max-height: 92vh;
  overflow: auto;
  padding: 24px;
}
.pair-dialog h2 {
  font-family: Smiley, system-ui;
}
.pair-dialog p {
  margin: 10px 0;
  font-size: 15px;
}
.pair-code {
  text-align: center;
  margin: 12px 0;
  font-size: 40px;
}
.pair-qr {
  display: flex;
  justify-content: center;
}
.pair-qr svg {
  display: block;
  width: 256px;
  height: 256px;
  flex-shrink: 0;
  background: white;
}
.pair-link {
  font-size: 13px;
}
.pair-dialog .actions {
  margin-top: 16px;
}
.pair-dialog .pair-retry {
  background: var(--cta);
}
#games-input-status {
  position: fixed;
  bottom: 8px;
  left: 16px;
  font-size: 12px;
  padding: 5px 10px;
  background: #fffdf0e8;
  border-radius: 12px;
  z-index: 8;
  pointer-events: none;
}

.pair-dialog {
  background: #fffdf5;
  color: #243e3b;
}
.pair-dialog .pair-retry {
  background: #ffe2b5;
}
.pair-dialog .actions {
  display: flex;
  gap: 12px;
}
.display-settings > p {
  grid-column: 1/-1;
}
#games-input-kind {
  max-width: none;
  width: 235px;
}

.pair-dialog h2 {
  margin: 8px 0;
  font-size: 25px;
}
.pair-dialog p {
  margin: 8px 0;
  line-height: 1.45;
}
.pair-dialog .eyebrow {
  margin: 0;
}
.pair-dialog .actions button {
  min-height: 40px;
  padding: 8px 16px;
}
.pair-dialog .actions {
  margin-top: 10px;
}

#games-input-status {
  top: 132px;
  bottom: auto;
  left: 28px;
  max-width: 220px;
}
body:not([data-state="playing"]):not([data-state="paused"]) #games-input-status {
  display: none;
}
@media (max-width: 600px) {
  #games-input-status {
    top: 100px;
    left: 12px;
    max-width: 170px;
    font-size: 10px;
  }
}
#games-pair-open:disabled {
  opacity: 0.5;
  cursor: default;
}

.display-settings .input-kind-setting {
  grid-template-columns: minmax(60px, 1fr) minmax(0, 235px);
}
#games-input-kind {
  width: 100%;
  max-width: 100%;
}
body[data-camera="off"] .camera {
  display: none !important;
}
.cache-items {
  position: absolute;
  bottom: 18px;
  left: 5%;
  right: 5%;
  font-size: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.cache-items .first-download {
  width: 100%;
  margin: 0;
}
.cache-item {
  padding: 3px 8px;
  border-radius: 8px;
  background: #ffffffb0;
  color: #24465a;
}
body.layout-editing[data-camera="off"] .camera {
  display: block !important;
  background: #e4eef0;
}
body.layout-editing[data-camera="off"] .camera video {
  visibility: hidden;
}
body.layout-editing[data-camera="off"] .camera::after {
  content: "真人画面已关闭";
  position: absolute;
  left: 12px;
  top: 35%;
  color: #42676f;
}
