:root {
  --ink: #183f35;
  --ink-soft: #41635e;
  --paper: #f7f5ef;
  --brand: #205148;
  --accent: #cf7356;
  --safe-top: var(--safe-area-inset-top, 0px);
  --safe-bottom: var(--safe-area-inset-bottom, 0px);
}

html {
  touch-action: manipulation;
}

body {
  color: var(--ink);
  background: var(--paper);
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
}

.visually-hidden {
  clip: rect(0 0 0 0);
  white-space: nowrap;
  width: 1px;
  height: 1px;
  margin: -1px;
  position: absolute;
  overflow: hidden;
}

#shell, .shell-view {
  height: 100%;
}

.shell-view[hidden] {
  display: none;
}

#app-nav {
  top: calc(var(--safe-top, 0px) + 8px);
  z-index: 100;
  grid-gap: 8px;
  pointer-events: none;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: calc(100% - 16px);
  max-width: 744px;
  display: flex;
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
}

.no-flex-gap #app-nav > * + * {
  margin-left: 8px;
}

.mode-choice, .view-choice {
  grid-gap: 2px;
  pointer-events: auto;
  background: #f7f5ef;
  border: 1px solid rgba(32, 81, 72, .16);
  border-radius: 14px;
  align-items: center;
  gap: 2px;
  padding: 3px;
  display: flex;
  box-shadow: 0 2px 8px rgba(20, 46, 46, .05);
}

.no-flex-gap .view-choice > * + *, .no-flex-gap .mode-choice > * + * {
  margin-left: 2px;
}

.mode-choice {
  width: auto;
  margin: 0;
}

#app-nav button {
  color: #41635e;
  cursor: pointer;
  touch-action: manipulation;
  background: none;
  border: 0;
  border-radius: 10px;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  display: grid;
}

#app-nav [data-mode-nav] {
  letter-spacing: .04em;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
}

#app-nav button[aria-pressed="true"] {
  color: #fff;
  background: #205148;
}

#app-nav button:active {
  opacity: .75;
}

#app-nav button:focus-visible {
  outline-offset: 2px;
  outline: 3px solid #cf7356;
}

.view-choice svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6px;
  stroke-linecap: round;
  stroke-linejoin: round;
  width: 23px;
  height: 23px;
}

body {
  font-family: Helvetica Neue, PingFang SC, Hiragino Sans GB, Microsoft YaHei, sans-serif;
  font-weight: 400;
}

button {
  -webkit-tap-highlight-color: transparent;
}

#app-nav .view-choice {
  grid-gap: 4px;
  gap: 4px;
}

.no-flex-gap #app-nav .view-choice > * + * {
  margin-left: 4px;
}

#app-nav .view-choice button[aria-pressed="true"] {
  color: #205148;
  background: #e2e9dd;
}

#app-nav button {
  transition: background-color .15s, color .15s;
}

@media (prefers-reduced-motion: reduce) {
  #app-nav button {
    transition: none;
  }
}

#app-nav #view-toggle {
  padding: 0 12px;
  font-size: 13px;
  font-weight: 600;
  display: flex;
}

#view-toggle span {
  margin-left: 7px;
}

#view-toggle[data-view-nav="rules"] .nav-back, #view-toggle[data-view-nav="play"] .nav-book {
  display: none;
}

#app-nav button:focus {
  outline-offset: 2px;
  outline: 2px solid #cf7356;
}

.mode-switch[hidden] {
  display: none;
}

.mode-switch {
  z-index: 300;
  background: rgba(13, 38, 31, .45);
  justify-content: center;
  align-items: center;
  padding: 20px;
  display: flex;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}

.mode-switch-card {
  background: var(--paper);
  border-radius: 22px;
  width: 100%;
  max-width: 380px;
  max-height: 88%;
  padding: 26px 22px 20px;
  line-height: 1.6;
  overflow-y: auto;
  box-shadow: 0 18px 60px rgba(13, 38, 31, .18);
}

.mode-switch-kicker {
  color: var(--ink-soft);
  letter-spacing: .12em;
  font-size: 12px;
}

.mode-switch-card h2 {
  margin: 6px 0 12px;
  font-size: 25px;
  line-height: 1.35;
}

#mode-switch-detail {
  font-size: 15px;
}

.mode-switch-warning {
  color: #80573f;
  margin-top: 14px;
  font-size: 13px;
}

.mode-switch-actions {
  margin-top: 22px;
  display: flex;
}

.mode-switch-actions button {
  cursor: pointer;
  background: none;
  border: 1px solid #cbd7cd;
  border-radius: 12px;
  flex: 1;
  min-width: 0;
  min-height: 48px;
  padding: 10px 8px;
  font-size: 14px;
  font-weight: 600;
}

.mode-switch-actions button + button {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
  margin-left: 10px;
}

.mode-switch-actions button:focus {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

#app-nav {
  pointer-events: none;
  width: 100%;
  max-width: none;
  height: 100%;
  display: block;
  top: 0;
  left: 0;
  transform: none;
}

#app-nav [hidden] {
  display: none !important;
}

#app-nav button {
  pointer-events: auto;
}

#app-nav #mode-menu-toggle {
  bottom: 20px;
  right: 12px;
  right: calc(var(--safe-area-inset-right, var(--safe-right, 0px)) + 12px);
  bottom: calc(var(--safe-area-inset-bottom, var(--safe-bottom, 0px)) + 20px);
  background: var(--paper);
  border: 1px solid #cbd7cd;
  min-width: 64px;
  min-height: 48px;
  padding: 6px 10px;
  font-size: 20px;
  position: absolute;
  box-shadow: 0 2px 10px rgba(20, 46, 46, .094);
}

#app-nav #mode-menu-backdrop {
  touch-action: none;
  background: rgba(9, 45, 59, .4);
  border-radius: 0;
  width: 100%;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}

#mode-menu-panel {
  width: 268px;
  max-width: calc(100% - 24px);
  max-height: calc(100% - 100px);
  bottom: 78px;
  right: 12px;
  right: calc(var(--safe-area-inset-right, var(--safe-right, 0px)) + 12px);
  bottom: calc(var(--safe-area-inset-bottom, var(--safe-bottom, 0px)) + 78px);
  background: var(--paper);
  pointer-events: auto;
  border: 1px solid #cbd7cd;
  border-radius: 16px;
  padding: 12px;
  position: absolute;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(20, 46, 46, .2);
}

.menu-heading {
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  display: flex;
}

.menu-heading b {
  font-size: 14px;
}

#app-nav .mode-choice, #app-nav .view-choice {
  box-shadow: none;
  background: none;
  border: 0;
  padding: 0;
  display: flex;
}

#app-nav .mode-choice button {
  flex: 1;
}

#app-nav .view-choice {
  margin-top: 8px;
}

#app-nav #view-toggle {
  background: #e2e9dd;
  justify-content: center;
  width: 100%;
  min-height: 48px;
}

#app-nav[data-open="true"] #mode-menu-toggle {
  visibility: hidden;
}

#controls .court-tools {
  bottom: 80px;
  bottom: calc(var(--safe-area-inset-bottom, var(--safe-bottom, 0px)) + 80px);
}

#app-nav[data-open="true"] ~ #view-play #overlay article {
  visibility: hidden;
}

#view-play #overlay {
  padding-bottom: 92px;
  padding-bottom: calc(var(--safe-area-inset-bottom, var(--safe-bottom, 0px)) + 92px);
}

#app-nav #mode-menu-toggle {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  box-shadow: none;
  background: rgba(247, 245, 239, .35);
  border-color: rgba(255, 255, 255, .3);
  padding: 2px;
  font-size: 18px;
}

#mode-menu-toggle small {
  font-size: 9px;
}

#app-nav .menu-tools {
  border-top: 1px solid #d5dfd6;
  margin-top: 8px;
  padding-top: 8px;
  display: flex;
}

#app-nav .menu-tools button {
  flex-direction: column;
  flex: 1;
  justify-content: center;
  align-items: center;
  min-width: 44px;
  min-height: 54px;
  font-size: 11px;
  display: flex;
}

#app-nav .menu-tools svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6px;
  width: 20px;
  height: 20px;
}

#app-nav #camera:after {
  content: "视角";
}

#app-nav #score-help-toggle:after {
  content: "比分";
}

#app-nav #help:after {
  content: "帮助";
}

#app-nav #sound {
  font-size: 0;
}

#app-nav #sound:after {
  content: "声音";
  font-size: 11px;
}

#view-play #hud {
  top: 8px;
  top: calc(var(--safe-area-inset-top, var(--safe-top, 0px)) + 8px);
  flex-wrap: nowrap;
  align-items: flex-start;
  min-height: 44px;
  padding: 0 8px;
}

#view-play #scoreboard {
  max-width: 170px;
  box-shadow: none;
  -webkit-backdrop-filter: none;
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(255, 255, 255, .55);
  background: rgba(247, 245, 239, .22);
  border-radius: 7px;
  flex: 0 170px;
  grid-template-rows: 11px 18px 11px 11px;
  padding: 5px 7px;
}

#view-play #scoreboard strong {
  font-size: 15px;
}

#view-play .hud-actions button {
  box-shadow: none;
  -webkit-backdrop-filter: none;
  background: rgba(247, 245, 239, .18);
}

#view-play #move {
  background: none;
  width: 60px;
  height: 60px;
}

#view-play .move-ring {
  width: 44px;
  height: 44px;
  box-shadow: none;
  border-color: rgba(255, 255, 255, .4);
}

#view-play #stick {
  width: 16px;
  height: 16px;
  box-shadow: none;
  background: rgba(246, 252, 249, .65);
}

#view-play #swipe {
  top: calc(var(--safe-top) + 76px);
}

#view-play #hud {
  top: 44px;
  top: calc(var(--safe-area-inset-top, var(--safe-top, 0px)) + 44px);
}

.menu-follow {
  border-top: 1px solid #d5dfd6;
  margin-top: 8px;
  padding-top: 8px;
}

#app-nav #follow-author {
  background: #e2e9dd;
  width: 100%;
  min-height: 44px;
  font-size: 13px;
}

#app-nav #follow-author:disabled {
  opacity: .6;
  cursor: default;
}

#follow-author-status {
  color: #637971;
  margin-top: 4px;
  font-size: 11px;
  line-height: 1.5;
}

#follow-author-status:empty {
  display: none;
}

:root {
  color: #173b3c;
  font-synthesis: none;
  --safe-top: var(--safe-area-inset-top, 0px);
  --safe-right: var(--safe-area-inset-right, 0px);
  --safe-bottom: var(--safe-area-inset-bottom, 0px);
  --safe-left: var(--safe-area-inset-left, 0px);
  background: #162b2b;
  font-family: Helvetica Neue, PingFang SC, Hiragino Sans GB, Microsoft YaHei, sans-serif;
}

:root[data-safe-area="simulated"] {
  --safe-top: 20px;
  --safe-bottom: 34px;
}

* {
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
}

#view-play {
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  overscroll-behavior: none;
  touch-action: none;
  background: #162b2b;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  overflow: hidden;
}

button {
  min-width: 44px;
  min-height: 44px;
  color: inherit;
  font: inherit;
  cursor: pointer;
  background: none;
  border: 0;
  border-radius: 999px;
}

button:focus {
  outline-offset: 2px;
  outline: 3px solid #fff;
}

button:focus-visible {
  outline-offset: 2px;
  outline: 3px solid #fff;
}

#app {
  width: 100%;
  height: 100vh;
  isolation: isolate;
  background: #dbe8e9;
  max-width: 760px;
  height: 100dvh;
  min-height: 0;
  margin: auto;
  position: relative;
  overflow: hidden;
}

#view {
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  min-height: 0;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}

#court {
  width: 100%;
  height: 100%;
  display: block;
}

#swipe {
  z-index: 2;
  top: calc(var(--safe-top) + 120px);
  bottom: 0;
  left: 0;
  right: 0;
  inset: calc(var(--safe-top) + 120px) 0 0;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  position: absolute;
  overflow: hidden;
  background: none !important;
}

#swipe > b, .swipe-arrow {
  left: 50%;
  bottom: calc(var(--safe-bottom) + 42px);
  color: rgba(255, 255, 255, .92);
  text-shadow: 0 1px 8px rgba(12, 38, 38, .55);
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s;
  position: absolute;
  transform: translateX(-50%);
}

#swipe > b {
  bottom: calc(var(--safe-bottom) + 22px);
  font-size: 12px;
  font-weight: 650;
}

.swipe-arrow {
  font-size: 27px;
  line-height: 1;
}

#swipe[data-hint="visible"] > b, #swipe[data-hint="visible"] .swipe-arrow {
  opacity: .88;
}

#swipe-canvas {
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  pointer-events: none;
  opacity: 1;
  width: 100%;
  height: 100%;
  transition: opacity .3s;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}

#swipe-canvas.fading {
  opacity: 0;
}

#hud {
  z-index: 6;
  top: calc(var(--safe-top) + 62px);
  left: var(--safe-left);
  right: var(--safe-right);
  grid-gap: 6px;
  pointer-events: none;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  min-height: 58px;
  padding: 7px 8px;
  display: flex;
  position: absolute;
}

.no-flex-gap #hud > * + * {
  margin-left: 6px;
}

#scoreboard, .hud-actions {
  pointer-events: auto;
}

#scoreboard {
  grid-column-gap: 2px;
  -webkit-backdrop-filter: blur(10px);
  background: #f7f5ef;
  border-radius: 12px;
  flex: 192px;
  grid-template-rows: 13px 22px 13px 13px;
  grid-template-columns: 14px minmax(0, 1fr) minmax(0, 1fr) 24px;
  align-content: center;
  align-items: center;
  column-gap: 2px;
  min-width: 0;
  max-width: 186px;
  padding: 8px 10px;
  display: grid;
  box-shadow: 0 2px 14px rgba(20, 48, 46, .14);
}

#scoreboard small {
  color: #5a7471;
  white-space: nowrap;
  font-size: 9px;
  line-height: 1;
}

#scoreboard strong {
  font-variant-numeric: tabular-nums;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  font-size: 17px;
  font-weight: 600;
  line-height: 1;
  overflow: hidden;
}

.score-spacer {
  grid-area: 1 / 1;
}

.team-heading {
  color: #41635e;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  line-height: 1;
  overflow: hidden;
}

#your-role {
  grid-area: 1 / 2;
}

#ai-role {
  grid-area: 1 / 3;
}

.score-label {
  text-align: center;
  grid-column: 1;
}

#your-score {
  grid-area: 2 / 2;
}

#ai-score {
  grid-area: 2 / 3;
}

#your-games {
  grid-area: 3 / 2;
}

#ai-games {
  grid-area: 3 / 3;
}

#your-sets {
  grid-area: 4 / 2;
}

#ai-sets {
  grid-area: 4 / 3;
}

#your-games, #ai-games, #your-sets, #ai-sets {
  color: #173b3c;
  text-align: center;
  font-size: 10px;
  line-height: 1;
}

#match-score {
  color: #41635e;
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: normal;
  grid-area: 1 / 4 / 5;
  align-self: center;
  font-size: 9px;
  line-height: 1.2;
}

.hud-actions {
  grid-gap: 2px;
  flex: none;
  gap: 2px;
  display: flex;
}

.hud-actions button {
  -webkit-backdrop-filter: blur(10px);
  background: #f7f5ef;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  box-shadow: 0 2px 14px rgba(20, 48, 46, .12);
}

#sound {
  font-size: 0;
}

#sound:before {
  content: "♪";
  font-size: 20px;
  font-weight: 700;
}

#sound[aria-pressed="false"]:before {
  content: "♩";
  opacity: .55;
}

#pause span, #help span {
  pointer-events: none;
  font-size: 17px;
  font-weight: 750;
}

#camera span {
  pointer-events: none;
  font-size: 20px;
}

#controls {
  z-index: 5;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  pointer-events: none;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}

#move {
  left: calc(var(--safe-left) + 12px);
  bottom: calc(var(--safe-bottom) + 12px);
  touch-action: none;
  pointer-events: auto;
  -webkit-user-select: none;
  user-select: none;
  background: rgba(231, 243, 238, .34);
  border-radius: 50%;
  place-items: center;
  width: 76px;
  height: 76px;
  display: grid;
  position: absolute;
}

.move-ring {
  pointer-events: none;
  border: 1.5px solid rgba(255, 255, 255, .72);
  border-radius: 50%;
  place-items: center;
  width: 52px;
  height: 52px;
  display: grid;
  box-shadow: 0 2px 10px rgba(18, 49, 46, .2);
}

#stick {
  pointer-events: none;
  background: rgba(246, 252, 249, .9);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: block;
  box-shadow: 0 2px 8px rgba(13, 43, 40, .32);
}

#callout, #shot-label {
  z-index: 4;
  color: #fff;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  background: rgba(17, 47, 46, .68);
  border-radius: 12px;
  padding: 7px 11px;
  transition: opacity .16s, transform .16s;
  position: absolute;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  box-shadow: 0 2px 12px rgba(9, 31, 30, .16);
}

#callout {
  top: calc(var(--safe-top) + 150px);
  white-space: nowrap;
}

#status {
  font-size: 13px;
  font-weight: 650;
  display: block;
}

#detail {
  color: rgba(255, 255, 255, .78);
  margin-top: 2px;
  font-size: 10px;
  display: block;
}

#shot-label {
  bottom: calc(var(--safe-bottom) + 116px);
  font-size: 12px;
  font-weight: 650;
}

#callout[data-visible="true"], #shot-label[data-visible="true"] {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#serve-guide {
  z-index: 4;
  top: calc(var(--safe-top) + 192px);
  width: calc(100% - 32px);
  max-width: 226px;
  grid-gap: 12px;
  color: #fff;
  pointer-events: none;
  background: rgba(17, 47, 46, .74);
  border: 1px solid rgba(255, 255, 255, .58);
  border-radius: 16px;
  align-items: center;
  gap: 12px;
  width: min(226px, 100% - 32px);
  min-height: 92px;
  padding: 9px 12px;
  display: flex;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 6px 20px rgba(9, 31, 30, .18);
}

.no-flex-gap #serve-guide > * + * {
  margin-left: 12px;
}

#serve-guide[hidden] {
  display: none;
}

.serve-gesture-guide {
  z-index: 5;
  text-align: center;
  color: #fffaf0;
  pointer-events: none;
  text-shadow: 0 1px 5px #173f3c;
  width: 220px;
  max-width: calc(100% - 40px);
  position: absolute;
  bottom: 23%;
  left: 50%;
  transform: translateX(-50%);
}

.serve-gesture-guide[hidden] {
  display: none;
}

.serve-gesture-guide svg {
  width: 220px;
  max-width: 100%;
  height: 100px;
  display: block;
  overflow: visible;
}

.serve-gesture-path {
  fill: none;
  stroke: #fff7cf;
  stroke-width: 3px;
  stroke-dasharray: 5 6;
  stroke-linecap: round;
}

.serve-gesture-arrow {
  fill: none;
  stroke: #fff7cf;
  stroke-width: 3px;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.serve-gesture-hand {
  animation: 2.8s ease-in-out infinite serve-hand;
}

.serve-gesture-hand path {
  fill: #fff4dc;
  stroke: #205148;
  stroke-width: 1.5px;
  stroke-linejoin: round;
}

.serve-gesture-guide b, .serve-gesture-guide span, .serve-gesture-guide small {
  line-height: 1.6;
  display: block;
}

.serve-gesture-guide b {
  font-size: 15px;
}

.serve-gesture-guide span {
  font-size: 13px;
}

.serve-gesture-guide small {
  opacity: .9;
  font-size: 11px;
}

@keyframes serve-hand {
  0%, 12% {
    opacity: 0;
    transform: translate(133px, 80px);
  }

  20% {
    opacity: 1;
    transform: translate(133px, 80px);
  }

  48% {
    opacity: 1;
    transform: translate(128px, 49px);
  }

  68%, 78% {
    opacity: 1;
    transform: translate(101px, 20px);
  }

  90%, 100% {
    opacity: 0;
    transform: translate(101px, 20px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .serve-gesture-hand {
    animation: none;
    transform: translate(101px, 20px);
  }
}

.serve-mini-court {
  background: rgba(57, 155, 151, .72);
  border: 2px solid rgba(255, 255, 255, .86);
  flex: 0 0 58px;
  width: 58px;
  height: 72px;
  position: relative;
}

.serve-mini-court:before, .serve-mini-court:after, .serve-net, .serve-centre {
  content: "";
  background: rgba(255, 255, 255, .82);
  position: absolute;
}

.serve-mini-court:before {
  height: 1px;
  top: 25%;
  left: 0;
  right: 0;
}

.serve-mini-court:after {
  height: 1px;
  bottom: 25%;
  left: 0;
  right: 0;
}

.serve-net {
  background: rgba(255, 255, 255, .96);
  height: 2px;
  top: 50%;
  left: -3px;
  right: -3px;
}

.serve-centre {
  width: 1px;
  top: 25%;
  bottom: 25%;
  left: 50%;
}

.serve-target {
  background: rgba(248, 220, 84, .82);
  border-radius: 2px;
  width: calc(50% - 4px);
  height: calc(25% - 4px);
  position: absolute;
  top: calc(25% + 3px);
}

.serve-player {
  background: #cf7356;
  border: 2px solid #fff;
  border-radius: 50%;
  width: 8px;
  height: 8px;
  position: absolute;
  bottom: -7px;
}

.serve-arrow {
  transform-origin: bottom;
  background: rgba(248, 220, 84, .9);
  width: 2px;
  height: 46px;
  position: absolute;
  bottom: 2px;
}

.serve-arrow:after {
  content: "";
  border-top: 2px solid #f8dc54;
  border-right: 2px solid #f8dc54;
  width: 6px;
  height: 6px;
  position: absolute;
  top: -1px;
  left: -3px;
  transform: rotate(-45deg);
}

#serve-guide[data-court="deuce"] .serve-player {
  right: 8px;
}

#serve-guide[data-court="deuce"] .serve-target {
  left: 3px;
}

#serve-guide[data-court="deuce"] .serve-arrow {
  right: 12px;
  transform: rotate(-25deg);
}

#serve-guide[data-court="ad"] .serve-player {
  left: 8px;
}

#serve-guide[data-court="ad"] .serve-target {
  right: 3px;
}

#serve-guide[data-court="ad"] .serve-arrow {
  left: 12px;
  transform: rotate(25deg);
}

.serve-copy {
  grid-gap: 5px;
  gap: 5px;
  min-width: 0;
  display: grid;
}

.serve-copy b {
  font-size: 12px;
  line-height: 1.25;
}

.serve-copy span {
  color: rgba(255, 255, 255, .78);
  font-size: 10px;
  line-height: 1.35;
}

#load-error {
  z-index: 8;
  top: 18%;
  bottom: auto;
  left: 20px;
  right: 20px;
  color: #752b23;
  background: #fff4ef;
  border-radius: 12px;
  padding: 16px;
  font-size: 13px;
  position: absolute;
  top: 18%;
  bottom: auto;
  left: 20px;
  right: 20px;
}

#load-error[hidden] {
  display: none;
}

#hawkeye {
  z-index: 9;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 92px);
  width: calc(100% - 32px);
  max-width: 310px;
  grid-gap: 10px;
  color: #fff;
  -webkit-backdrop-filter: blur(10px);
  background: rgba(10, 31, 31, .91);
  border: 1px solid rgba(255, 255, 255, .65);
  border-radius: 18px;
  grid-template-columns: 112px 1fr auto;
  align-items: center;
  gap: 10px;
  width: min(310px, 100% - 32px);
  min-height: 118px;
  padding: 10px;
  display: grid;
  position: absolute;
  transform: translateX(-50%);
  box-shadow: 0 12px 36px rgba(3, 20, 19, .34);
}

#hawkeye[hidden] {
  display: none;
}

.hawkeye-closeup {
  background: #87b56c;
  border-radius: 12px;
  width: 112px;
  height: 92px;
  position: relative;
  overflow: hidden;
}

.hawkeye-line {
  background: #fff;
  position: absolute;
  box-shadow: 0 0 0 1px rgba(19, 55, 42, .12);
}

.hawkeye-closeup[data-axis="vertical"] .hawkeye-line {
  width: 7px;
  top: 0;
  bottom: 0;
  left: 48%;
}

.hawkeye-closeup[data-axis="horizontal"] .hawkeye-line {
  height: 7px;
  top: 48%;
  left: 0;
  right: 0;
}

.hawkeye-mark {
  background: rgba(205, 106, 66, .82);
  border: 2px solid #f8dc54;
  border-radius: 50%;
  width: 13px;
  height: 18px;
  position: absolute;
  transform: translate(-50%, -50%) rotate(-12deg);
  box-shadow: 0 0 0 2px rgba(20, 48, 43, .35);
}

.hawkeye-copy {
  grid-gap: 5px;
  gap: 5px;
  min-width: 0;
  display: grid;
}

#hawkeye-outcome {
  color: #2d2510;
  letter-spacing: .06em;
  background: #f8dc54;
  border-radius: 6px;
  width: min-content;
  padding: 2px 7px;
  font-size: 16px;
}

#hawkeye-outcome[data-outcome="IN"] {
  color: #123a31;
  background: #8be0b5;
}

#hawkeye-reason {
  color: rgba(255, 255, 255, .82);
  font-size: 10px;
  line-height: 1.35;
}

#hawkeye-skip {
  color: rgba(255, 255, 255, .76);
  background: rgba(255, 255, 255, .1);
  align-self: start;
  min-width: 44px;
  min-height: 36px;
  padding: 0 8px;
  font-size: 11px;
}

footer {
  display: none;
}

.capture-mode footer {
  z-index: 20;
  right: calc(var(--safe-right) + 8px);
  bottom: calc(var(--safe-bottom) + 8px);
  grid-gap: 6px;
  gap: 6px;
  display: flex;
  position: absolute;
}

.no-flex-gap .capture-mode footer > * + * {
  margin-left: 6px;
}

.capture-mode footer button {
  background: #fff;
  padding: 0 12px;
  font-size: 11px;
}

#overlay {
  z-index: 10;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 138px calc(var(--safe-right) + 20px) calc(var(--safe-bottom) + 30px) calc(var(--safe-left) + 20px);
  background: rgba(16, 38, 31, .14);
  justify-content: center;
  align-items: flex-end;
  display: flex;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}

#overlay[hidden] {
  display: none;
}

#overlay article {
  width: 100%;
  max-width: 360px;
  text-align: left;
  background: #f7f5ef;
  border-top: 3px solid #205148;
  border-radius: 5px 5px 18px 18px;
  width: min(100%, 360px);
  padding: 22px 24px 24px;
  box-shadow: 0 12px 32px rgba(11, 36, 28, .15);
}

.entry-kicker {
  grid-gap: 8px;
  color: #61736a;
  letter-spacing: .16em;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 9px;
  line-height: 1.4;
  display: flex;
}

.no-flex-gap .entry-kicker > * + * {
  margin-left: 8px;
}

.entry-mode {
  letter-spacing: .1em;
  font-size: 10px;
  font-style: normal;
}

.entry-mode:before {
  content: "单人练习";
}

#app[data-mode="doubles"] .entry-mode:before {
  content: "双人配合";
}

#overlay h1 {
  color: #183f35;
  font-family: inherit;
  font-size: 32px;
  letter-spacing: -.05em;
  margin: 0 0 9px;
  font-size: max(28px, min(8vw, 36px));
  font-weight: 600;
  line-height: 1.2;
}

#intro {
  color: #627168;
  letter-spacing: .01em;
  min-height: 0;
  margin: 0 0 22px;
  font-size: 13px;
  line-height: 1.8;
}

#start {
  color: #f7f5ef;
  text-align: left;
  letter-spacing: .05em;
  background: #205148;
  border-radius: 8px;
  width: 100%;
  min-height: 50px;
  padding: 10px 32px 10px 16px;
  font-size: 14px;
  font-weight: 500;
  position: relative;
}

#start:after {
  content: "↗";
  font-size: 20px;
  font-weight: 400;
  position: absolute;
  top: 50%;
  right: 17px;
  transform: translateY(-50%);
}

#start:disabled {
  opacity: .48;
}

#app[data-overlay="visible"] #hud, #app[data-overlay="visible"] #callout, #app[data-overlay="visible"] #controls {
  visibility: hidden;
}

.court-tools {
  right: calc(var(--safe-right) + 12px);
  bottom: calc(var(--safe-bottom) + 20px);
  grid-gap: 4px;
  pointer-events: auto;
  background: #f7f5ef;
  border-radius: 14px;
  gap: 4px;
  padding: 3px;
  display: flex;
  position: absolute;
  box-shadow: 0 2px 10px rgba(20, 46, 46, .094);
}

.no-flex-gap .court-tools > * + * {
  margin-left: 4px;
}

.court-tools button {
  color: #205148;
  border-radius: 10px;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
}

.court-tools svg, .hud-actions svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6px;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
  width: 21px;
  height: 21px;
}

.hud-actions {
  grid-gap: 5px;
  gap: 5px;
}

.no-flex-gap .hud-actions > * + * {
  margin-left: 5px;
}

.hud-actions button {
  border-radius: 12px;
}

#sound:before {
  font-size: 22px;
  font-weight: 400;
}

#camera[aria-pressed="true"] {
  color: #205148;
  background: #e2e9dd;
}

@media (max-height: 570px) {
  #overlay {
    padding-bottom: calc(var(--safe-bottom) + 16px);
  }

  #overlay article {
    padding: 16px 20px 18px;
  }

  .entry-kicker {
    margin-bottom: 10px;
  }

  #intro {
    margin-bottom: 15px;
  }
}

.visually-hidden {
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  position: absolute !important;
  overflow: hidden !important;
}

@media (max-width: 379px) {
  #hud {
    grid-gap: 4px;
    padding-left: 8px;
    padding-right: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .no-flex-gap #hud > * + * {
    margin-left: 4px;
  }

  #scoreboard {
    flex: 180px;
    max-width: 186px;
    margin-right: auto;
  }

  .hud-actions {
    flex-basis: auto;
  }

  #swipe {
    top: calc(var(--safe-top) + 146px);
  }

  #callout, #score-help {
    top: calc(var(--safe-top) + 178px);
  }
}

@media (min-width: 761px) {
  #app {
    border-left: 1px solid rgba(255, 255, 255, .15);
    border-right: 1px solid rgba(255, 255, 255, .15);
  }
}

@media (prefers-reduced-motion: reduce) {
  #swipe > b, .swipe-arrow, #callout, #shot-label {
    transition: none;
  }
}

#rule-tip-scrim {
  z-index: 8;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(9, 31, 30, .28);
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}

#rule-tip-scrim[hidden] {
  display: none;
}

#rule-tip {
  z-index: 9;
  left: 50%;
  bottom: calc(var(--safe-bottom) + 148px);
  width: calc(100% - 32px);
  max-width: 320px;
  color: #173b3c;
  opacity: 0;
  background: rgba(253, 251, 245, .98);
  border: 1px solid rgba(23, 59, 60, .14);
  border-radius: 16px;
  width: min(320px, 100% - 32px);
  padding: 12px 14px 10px;
  transition: opacity .24s, transform .24s;
  position: absolute;
  transform: translateX(-50%) translateY(8px);
  box-shadow: 0 10px 28px rgba(9, 31, 30, .3);
}

#rule-tip.is-open {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#rule-tip[hidden] {
  display: none;
}

#rule-tip .rule-tip-title {
  font-size: 13px;
  line-height: 1.3;
  display: block;
}

#rule-tip .rule-tip-title:before {
  content: "规则";
  background: #f8dc54;
  border-radius: 6px;
  margin-right: 6px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 700;
  display: inline-block;
}

#rule-tip .rule-tip-excerpt {
  color: rgba(23, 59, 60, .78);
  margin: 6px 0 8px;
  font-size: 12px;
  line-height: 1.5;
}

#rule-tip .rule-tip-actions {
  grid-gap: 8px 12px;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  display: flex;
}

#rule-tip .rule-tip-continue {
  color: #fdfbf5;
  background: #173b3c;
  border: none;
  border-radius: 10px;
  min-width: 0;
  min-height: 44px;
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 700;
}

#rule-tip .rule-tip-link {
  color: #214a64;
  border-bottom: 1px solid #f8dc54;
  align-items: center;
  min-height: 44px;
  font-size: 12px;
  text-decoration: none;
  display: inline-flex;
}

#score-help {
  z-index: 7;
  top: calc(var(--safe-top) + 150px);
  width: calc(100% - 20px);
  max-width: 300px;
  color: #173b3c;
  background: rgba(253, 251, 245, .97);
  border: 1px solid rgba(23, 59, 60, .14);
  border-radius: 16px;
  width: min(300px, 100% - 20px);
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.55;
  position: absolute;
  right: 10px;
  box-shadow: 0 10px 28px rgba(9, 31, 30, .22);
}

#score-help[hidden] {
  display: none;
}

#score-help {
  max-height: calc(100% - var(--safe-top) - 170px);
  -webkit-overflow-scrolling: touch;
  overflow-y: auto;
}

#app[data-mode="singles"] .score-help-mode[data-for="doubles"], #app[data-mode="doubles"] .score-help-mode[data-for="singles"] {
  display: none;
}

#score-help > b {
  margin-bottom: 4px;
  font-size: 13px;
  display: block;
}

#score-help p {
  color: rgba(23, 59, 60, .82);
  margin: 6px 0;
}

#score-help p b {
  color: #173b3c;
}

#score-help-close {
  color: #fdfbf5;
  background: #173b3c;
  border: none;
  border-radius: 10px;
  min-width: 72px;
  min-height: 44px;
  margin-top: 4px;
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 700;
}

#score-help-toggle span {
  pointer-events: none;
  font-size: 11px;
  font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  #rule-tip {
    transition: none;
  }
}

#app[data-mode="doubles"] #scoreboard {
  grid-template-rows: 13px 22px 13px;
}

#app[data-mode="doubles"] #scoreboard .sets-row {
  display: none;
}

#app[data-mode="doubles"] #match-score {
  grid-row: 1 / 4;
}

#app[data-mode="doubles"] #callout {
  top: calc(var(--safe-top) + 144px);
}

#app[data-mode="doubles"] #serve-guide {
  top: calc(var(--safe-top) + 182px);
}

#rule-tip-scrim {
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  backdrop-filter: blur(2px);
  background: rgba(14, 34, 34, .45);
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
}

#rule-tip {
  z-index: 21;
  width: calc(100vw - 48px);
  max-width: 320px;
  color: #173b3c;
  opacity: 0;
  background: #fffdf7;
  border-radius: 18px;
  width: min(320px, 100vw - 48px);
  padding: 18px;
  transition: opacity .22s;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 14px 44px rgba(10, 30, 30, .35);
}

#rule-tip.is-open {
  opacity: 1;
}

#rule-tip .rule-tip-title {
  font-size: 16px;
  font-weight: 800;
  display: block;
}

#rule-tip .rule-tip-excerpt {
  color: #41635e;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.65;
}

#rule-tip .rule-tip-actions {
  grid-gap: 8px;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
  display: flex;
}

.no-flex-gap #rule-tip .rule-tip-actions > * + * {
  margin-left: 8px;
}

#rule-tip .rule-tip-continue {
  color: #fff;
  background: #205148;
  border-radius: 999px;
  min-height: 40px;
  padding: 0 16px;
  font-size: 13px;
  font-weight: 700;
}

#rule-tip .rule-tip-link {
  color: #205148;
  background: rgba(32, 81, 72, .1);
  border-radius: 999px;
  min-height: 40px;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 650;
}

#entry-countdown {
  z-index: 11;
  color: #f7f5ef;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  background: rgba(24, 63, 53, .9);
  border-radius: 50%;
  place-items: center;
  width: 84px;
  height: 84px;
  font-size: 54px;
  font-weight: 500;
  display: grid;
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
}

#entry-countdown[hidden] {
  display: none;
}

#app[data-entry-pending="true"] #hud, #app[data-entry-pending="true"] #controls, #app[data-entry-pending="true"] #callout {
  visibility: hidden;
}

#shot-label[hidden] {
  display: none;
}

#camera {
  position: relative;
}

#camera[data-hint="true"] {
  animation: 1.5s ease-in-out 4 camera-invite;
}

#camera[data-hint="true"]:after {
  content: "试试第一视角";
  white-space: nowrap;
  color: #254b42;
  pointer-events: none;
  background: #fff8df;
  border-radius: 9px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 500;
  position: absolute;
  bottom: 53px;
  right: 0;
  box-shadow: 0 3px 12px rgba(24, 63, 52, .15);
}

@keyframes camera-invite {
  0%, 100% {
    background: #f4f2e9;
    box-shadow: 0 0 rgba(221, 167, 64, 0);
  }

  50% {
    background: #ffe2a0;
    box-shadow: 0 0 0 6px rgba(221, 167, 64, .25);
  }
}

@media (prefers-reduced-motion: reduce) {
  #camera[data-hint="true"] {
    background: #ffe2a0;
    animation: none;
  }
}

#view-rules {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
  line-height: 1.7;
  overflow-y: auto;
}

#view-rules button, #view-rules summary, #view-rules select, #view-rules input {
  font: inherit;
  color: inherit;
}

#view-rules button {
  cursor: pointer;
  touch-action: manipulation;
}

#view-rules button:focus, #view-rules summary:focus, #view-rules select:focus, #view-rules input:focus {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

#view-rules button:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

#view-rules summary:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

#view-rules select:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

#view-rules input:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
}

.rules-head {
  grid-gap: 10px;
  padding: calc(var(--safe-top, 0px) + 72px) 4% 10px;
  align-items: center;
  gap: 10px;
  display: flex;
}

.no-flex-gap .rules-head > * + * {
  margin-left: 10px;
}

.rules-back {
  color: var(--brand);
  background: none;
  border: 0;
  min-height: 44px;
  padding: 0 8px 0 0;
  font-size: 14px;
  font-weight: 650;
}

.rules-head h1 {
  color: var(--brand);
  letter-spacing: -.02em;
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}

.chapter-nav {
  top: calc(var(--safe-top, 0px) + 62px);
  z-index: 30;
  grid-gap: 2px;
  scrollbar-width: none;
  background: var(--paper);
  border-bottom: 1px solid #d8e4dc;
  justify-content: space-between;
  gap: 2px;
  padding: 0 3%;
  display: flex;
  position: sticky;
  overflow-x: auto;
}

.no-flex-gap .chapter-nav > * + * {
  margin-left: 2px;
}

.chapter-nav::-webkit-scrollbar {
  display: none;
}

.chapter-nav button {
  min-width: 44px;
  min-height: 44px;
  color: var(--ink-soft);
  white-space: nowrap;
  background: none;
  border: 0;
  border-bottom: 3px solid rgba(0, 0, 0, 0);
  flex: 1;
  justify-content: center;
  align-items: center;
  padding: 0 8px;
  font-size: 15px;
  display: flex;
}

.chapter-nav button[aria-pressed="true"] {
  color: var(--ink);
  border-color: var(--brand);
  font-weight: 750;
}

.content-section {
  max-width: 720px;
  scroll-margin-top: calc(var(--safe-top, 0px) + 112px);
  border-bottom: 1px solid #d8e4dc;
  margin: 0 auto;
  padding: 24px 5% 30px;
}

.section-heading {
  grid-gap: 10px;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 16px;
  display: flex;
}

.no-flex-gap .section-heading > * + * {
  margin-left: 10px;
}

.section-heading h2 {
  color: var(--ink);
  margin: 0;
  font-size: 24px;
  font-weight: 750;
  line-height: 1.3;
}

.rule-encountered {
  color: #3d7a5c;
  font-size: 12px;
}

.rule-experience-link {
  min-height: 44px;
  color: var(--brand);
  text-decoration: underline;
  -webkit-text-decoration-color: var(--accent);
  text-decoration-color: var(--accent);
  text-underline-offset: 4px;
  background: none;
  border: 0;
  padding: 8px 0;
  font-size: 13px;
}

.rule-heading {
  color: var(--ink);
  margin: 24px 0 8px;
  font-size: 19px;
  font-weight: 700;
}

.rule-document > .rule-heading:first-child {
  margin-top: 0;
}

.rule-paragraph {
  color: var(--ink-soft);
  margin: 12px 0;
  font-size: 16px;
  line-height: 1.85;
}

.rule-paragraph strong, .rule-list strong, .rule-emphasis {
  color: var(--ink);
}

.rule-list {
  grid-gap: 10px;
  color: var(--ink-soft);
  gap: 10px;
  margin: 12px 0;
  padding-left: 22px;
  font-size: 16px;
  line-height: 1.8;
  display: grid;
}

.rule-list li {
  padding-left: 2px;
}

.rule-list li::marker {
  color: var(--brand);
}

.rule-callout {
  border-left: 3px solid var(--brand);
  color: var(--ink-soft);
  background: #eef6f1;
  border-radius: 0 8px 8px 0;
  margin: 12px 0;
  padding: 10px 14px;
}

.rule-callout p {
  margin: 4px 0;
}

.rule-code {
  color: #f6fcf9;
  background: #173b3c;
  border-radius: 8px;
  margin: 12px 0;
  padding: 10px 12px;
  font-size: 13px;
  overflow-x: auto;
}

.rule-details {
  background: rgba(255, 255, 255, .4);
  border: 1px solid #d8e4dc;
  border-radius: 10px;
  margin-top: 16px;
  padding: 0 14px;
}

.rule-details-summary {
  min-height: 48px;
  color: var(--ink);
  cursor: pointer;
  padding: 11px 0;
  font-size: 15px;
  font-weight: 650;
  list-style: none;
}

.rule-details-summary::-webkit-details-marker {
  display: none;
}

.rule-details-summary:after {
  content: " ▸";
  color: var(--ink-soft);
}

.rule-details[open] .rule-details-summary:after {
  content: " ▾";
}

.rule-details[open] {
  padding-bottom: 8px;
}

.rule-details-body .rule-paragraph {
  font-size: 15px;
}

.rule-tier-tag {
  color: #48633e;
  background: #e4e9d9;
  border-radius: 4px;
  margin-right: 8px;
  padding: 0 6px;
  font-size: 12px;
  display: inline-block;
}

.manual-figure {
  margin: 0 0 20px;
}

.figure-tabs {
  grid-gap: 4px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin-bottom: 8px;
  display: grid;
}

.figure-tabs button {
  min-height: 44px;
  color: var(--ink);
  background: none;
  border: 1px solid #d8e4dc;
  border-radius: 8px;
  padding: 6px 2px;
  font-size: 14px;
}

.figure-tabs button[aria-pressed="true"] {
  background: var(--brand);
  color: var(--paper);
  border-color: var(--brand);
}

.figure-stage {
  background: #dce5ea;
  border-radius: 12px;
  padding: 8px;
  position: relative;
}

.court-shell {
  justify-content: center;
  display: flex;
}

.court-shell .tennis-court {
  height: 58vh;
  max-height: 460px;
  width: auto;
  max-width: 100%;
  height: min(58vh, 460px);
}

.figure-caption {
  color: var(--ink-soft);
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.65;
}

.term-select {
  grid-gap: 12px;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
  font-size: 15px;
  display: flex;
}

.no-flex-gap .term-select > * + * {
  margin-left: 12px;
}

.term-select select {
  min-width: 0;
  height: 46px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid #d8e4dc;
  border-radius: 8px;
  flex: 1;
  padding: 6px 10px;
  font-size: 15px;
}

.ends-toggle {
  min-height: 46px;
  color: var(--ink);
  background: #d7ee79;
  border: 1px solid #99ac73;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
  position: absolute;
  bottom: 10px;
  right: 10px;
}

.tennis-court {
  --court-apron: #dce5ea;
  --court-line: #faf9f4;
  --court-net: #dfe3dc;
  --court-muted: #7893a5;
  --court-highlight: #c8db3c;
  --court-target: #d8eb45;
  --court-error: #f26052;
  --court-player: #faf9f4;
  --court-receiver: #c4dceb;
  shape-rendering: geometricprecision;
  touch-action: pan-y;
  display: block;
  overflow: visible;
}

.court-apron {
  fill: var(--court-apron);
}

.court-model {
  pointer-events: none;
}

.court-model__shadow {
  fill: #173a55;
  opacity: .26;
}

.court-model__texture {
  opacity: .16;
}

.court-model__grain {
  fill: none;
  stroke: #a8cbe3;
  stroke-width: .018px;
  stroke-linecap: round;
  opacity: .24;
}

.court-model__upper-band {
  fill: #fff;
  opacity: .025;
}

.court-model__inner-light {
  fill: none;
  stroke: #fff;
  stroke-width: .045px;
  opacity: .15;
}

.court-highlight {
  fill: var(--court-highlight);
  fill-opacity: .23;
  stroke: none;
}

.court-highlight--area {
  fill-opacity: .2;
}

.court-highlight--hatched {
  fill-opacity: .3;
}

.court-highlight--target {
  fill: var(--court-target);
  fill-opacity: .42;
}

.court-lines line {
  stroke: var(--court-line);
  stroke-width: 1.35px;
  stroke-linecap: square;
}

.court-lines .court-net {
  stroke: var(--court-net);
  stroke-width: 2.6px;
  stroke-linecap: round;
  filter: drop-shadow(0 1px rgba(0, 0, 0, .28));
}

.court-hotspot {
  cursor: pointer;
  outline: none;
}

.court-hotspot--area {
  fill: rgba(0, 0, 0, 0);
  stroke: rgba(0, 0, 0, 0);
  pointer-events: all;
}

.court-hotspot--line {
  fill: none;
  stroke: rgba(0, 0, 0, 0);
  stroke-width: 18px;
  stroke-linecap: round;
  pointer-events: stroke;
}

.court-hotspot--area.is-active {
  fill: var(--court-target);
  fill-opacity: .16;
  stroke: var(--court-target);
  stroke-opacity: .56;
  stroke-width: .05px;
}

.court-hotspot--line.is-active {
  stroke: var(--court-target);
  stroke-width: 5px;
  stroke-opacity: .84;
}

@media (hover: hover) {
  .court-hotspot--area:hover {
    fill: rgba(255, 218, 87, .1);
  }

  .court-hotspot--line:hover {
    stroke: rgba(255, 218, 87, .55);
    stroke-width: 5px;
  }
}

.court-player__halo {
  fill: var(--court-apron);
  stroke: var(--court-player);
  stroke-width: .05px;
}

.court-player__head {
  fill: var(--court-player);
}

.court-player__body {
  fill: none;
  stroke: var(--court-player);
  stroke-width: .1px;
  stroke-linecap: round;
}

.court-player--receiver .court-player__halo {
  stroke: var(--court-receiver);
}

.court-player--receiver .court-player__head {
  fill: var(--court-receiver);
}

.court-player--receiver .court-player__body {
  stroke: var(--court-receiver);
}

.court-player__letter {
  fill: var(--court-player);
  text-anchor: middle;
  font-size: .4px;
  font-weight: 800;
}

.court-ball-path {
  fill: none;
  stroke: var(--court-target);
  stroke-width: 2.2px;
  stroke-linecap: round;
  stroke-dasharray: 7 5;
}

.court-moving-ball {
  fill: var(--court-target);
  stroke: #234735;
  stroke-width: .05px;
}

.court-bounce__ring {
  fill: none;
  stroke: var(--court-target);
  stroke-width: 1.8px;
}

.court-bounce__dot {
  fill: var(--court-target);
}

.court-foot ellipse {
  fill: var(--court-player);
}

.court-foot text {
  text-anchor: middle;
  paint-order: stroke;
  stroke: var(--court-apron);
  stroke-width: .13px;
  stroke-linejoin: round;
  font-size: .66px;
  font-weight: 800;
}

.court-foot--correct text {
  fill: #174f40;
}

.court-foot--error ellipse {
  fill: var(--court-error);
}

.court-foot--error path {
  fill: none;
  stroke: var(--court-error);
  stroke-width: 2px;
}

.court-foot--error text {
  fill: #a33922;
}

.court-change-player circle {
  stroke-width: .06px;
}

.court-change-player text {
  fill: #172a24;
  text-anchor: middle;
  font-size: .42px;
  font-weight: 900;
}

.court-change-player--a circle {
  fill: var(--court-target);
}

.court-change-player--b circle {
  fill: var(--court-receiver);
}

.court-change-arrow {
  fill: none;
  stroke: var(--court-muted);
  stroke-width: 1.6px;
  stroke-dasharray: 4 4;
}

.court-state-label {
  fill: #172a24;
  letter-spacing: .06em;
  text-anchor: middle;
  paint-order: stroke;
  stroke: #eef4f2;
  stroke-width: .08px;
  font-size: .72px;
  font-weight: 800;
}

.court-label {
  fill: var(--court-player);
  paint-order: stroke;
  stroke: var(--court-apron);
  stroke-linejoin: round;
  stroke-width: .045px;
  font-size: .82px;
  font-weight: 750;
}

.court-label--secondary {
  font-size: .68px;
}

.court-label__en {
  opacity: .84;
  font-size: .78em;
  font-weight: 620;
}

.court-label--role {
  text-anchor: middle;
}

.court-term-callout {
  pointer-events: none;
}

.court-term-callout path {
  fill: none;
  stroke: var(--court-target);
  stroke-width: 1.4px;
  stroke-dasharray: 2.4 2.4;
}

.court-term-callout circle {
  fill: var(--court-target);
  stroke: var(--court-apron);
  stroke-width: 1.2px;
}

.court-term-callout rect {
  fill: #f5f4f0;
  stroke: var(--court-target);
  stroke-width: 1.2px;
  filter: drop-shadow(0 3px 4px rgba(0, 0, 0, .28));
}

.court-term-callout text {
  fill: #1c1d1a;
  text-anchor: middle;
  font-size: .6px;
  font-weight: 850;
}

.tennis-court marker path {
  fill: var(--court-target);
}

@media (prefers-reduced-motion: no-preference) {
  .court-bounce__ring {
    transform-box: fill-box;
    transform-origin: center;
    animation: 1.8s ease-out infinite rules-court-pulse;
  }

  @keyframes rules-court-pulse {
    0%, 28% {
      opacity: .95;
      transform: scale(.72);
    }

    72%, 100% {
      opacity: .15;
      transform: scale(1.26);
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .court-moving-ball {
    display: none;
  }
}

.court-lab {
  --lab-paper: #f8f5ed;
  --lab-ink: #16231e;
  --lab-muted: #58665e;
  --lab-green: #174f40;
  --lab-green-dark: #0e382d;
  --lab-line: #e7eadf;
  --lab-lime: #d4f04d;
  --lab-out: #f27b62;
  width: 100%;
  color: var(--lab-ink);
  background: var(--lab-paper);
  border: 1px solid #d4d9ce;
  border-radius: 12px;
  font-size: 15px;
  overflow: hidden;
}

.court-lab__header {
  padding: 8px 12px;
}

.court-lab__header p {
  color: var(--lab-muted);
  margin: 0;
  font-size: 14px;
}

.court-lab__modes {
  grid-gap: 1px;
  background: #d4d9ce;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  display: grid;
}

.court-lab__modes button {
  background: var(--lab-paper);
  min-height: 46px;
  color: var(--lab-ink);
  border: 0;
  padding: 6px 2px;
  font-size: 14px;
  font-weight: 700;
}

.court-lab__modes button[aria-pressed="true"] {
  background: var(--lab-lime);
}

.court-lab__presets {
  padding: 6px;
}

.court-lab__presets > div {
  grid-gap: 5px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 5px;
  display: grid;
}

.court-lab__presets button {
  min-height: 44px;
  color: var(--lab-ink);
  background: none;
  border: 1px solid #c7cebe;
  border-radius: 6px;
  padding: 4px 2px;
  font-size: 14px;
}

.court-lab__presets button:active {
  background: #dce7b5;
}

.court-lab__workspace {
  background: #eeeee5;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  display: grid;
}

.court-lab__court-wrap {
  background: var(--lab-green-dark);
  min-width: 0;
  padding: 7px;
  position: relative;
}

.court-lab__court {
  height: 52vh;
  max-height: 440px;
  touch-action: pan-y;
  -webkit-user-select: none;
  user-select: none;
  width: auto;
  max-width: 100%;
  height: min(52vh, 440px);
  margin: auto;
  display: block;
  overflow: visible;
}

.court-lab__gesture-hint {
  top: 6px;
  bottom: auto;
  left: 8px;
  right: 8px;
  color: #fff;
  pointer-events: none;
  background: rgba(23, 58, 47, .94);
  border-radius: 4px;
  margin: 0;
  padding: 3px 6px;
  font-size: 13px;
  line-height: 1.5;
  position: absolute;
  top: 6px;
  bottom: auto;
  left: 8px;
  right: 8px;
}

.court-lab__panel {
  grid-gap: 14px;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  min-width: 0;
  padding: 14px;
  display: flex;
}

.no-flex-gap .court-lab__panel > * + * {
  margin-top: 14px;
}

.court-lab__verdict {
  grid-gap: 10px;
  align-items: start;
  gap: 10px;
  display: flex;
}

.no-flex-gap .court-lab__verdict > * + * {
  margin-left: 10px;
}

.court-lab__verdict > span {
  background: var(--lab-lime);
  border-radius: 4px;
  flex-shrink: 0;
  padding: 2px 6px;
  font-size: 13px;
  font-weight: 800;
}

.court-lab__verdict.is-out > span {
  color: #732715;
  background: #ffd0b8;
}

.court-lab__verdict strong {
  font-size: 16px;
}

.court-lab__verdict p {
  color: var(--lab-muted);
  margin: 3px 0 0;
  font-size: 14px;
  line-height: 1.5;
}

.court-lab__timeline {
  grid-gap: 10px;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  display: grid;
}

.court-lab__timeline > span {
  font-size: 13px;
  line-height: 1.3;
  display: grid;
}

.court-lab__timeline output {
  color: var(--lab-muted);
  font-size: 12px;
}

.court-lab__timeline input {
  width: 100%;
  height: 44px;
  accent-color: var(--lab-green);
  margin: 0;
}

.court-lab__more {
  border-top: 1px solid #d4d9ce;
  padding: 0 12px;
}

.court-lab__more summary {
  cursor: pointer;
  min-height: 44px;
  padding: 9px 0;
  font-size: 14px;
}

.court-lab__haptics {
  grid-gap: 10px;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  margin: 8px 0;
  font-size: 14px;
  display: flex;
}

.no-flex-gap .court-lab__haptics > * + * {
  margin-left: 10px;
}

.court-lab__haptics input {
  width: 22px;
  height: 22px;
  accent-color: var(--lab-green);
}

.court-lab__disclaimer {
  color: var(--lab-muted);
  margin: 8px 0 12px;
  font-size: 13px;
}

.court-lab [role="button"]:focus {
  outline: 3px solid var(--lab-lime);
  outline-offset: 3px;
}

.court-lab [role="button"]:focus-visible {
  outline: 3px solid var(--lab-lime);
  outline-offset: 3px;
}

.court-lab__apron {
  fill: #123f34;
}

.court-lab__surface {
  fill: var(--lab-green);
}

.court-lab__valid-zone {
  fill: var(--lab-lime);
  fill-opacity: .2;
}

.court-lab__inactive-alley {
  color: var(--lab-out);
  opacity: .52;
}

.court-lab__court pattern line {
  stroke: var(--lab-out);
  stroke-width: .09px;
}

.court-lab__lines {
  fill: none;
  stroke: var(--lab-line);
  stroke-width: .075px;
  vector-effect: non-scaling-stroke;
}

.court-lab__lines .court-lab__net {
  stroke: #f8f7f1;
  stroke-width: .15px;
  stroke-dasharray: .12 .09;
  filter: drop-shadow(0 .08px .06px rgba(0, 0, 0, .5));
}

.court-lab__trajectory {
  fill: none;
  stroke: var(--lab-lime);
  stroke-width: .13px;
  stroke-linecap: round;
  stroke-dasharray: 1.15 .38;
}

.court-lab__preview text {
  fill: #f7f8ef;
  text-anchor: middle;
  paint-order: stroke;
  stroke: var(--lab-green-dark);
  stroke-width: .1px;
  font-size: .6px;
  font-weight: 760;
}

.court-lab__flight-ball, .court-lab__drag-ball {
  fill: var(--lab-lime);
  stroke: var(--lab-green-dark);
  stroke-width: .08px;
}

.court-lab__origin-ring {
  fill: var(--lab-lime);
  fill-opacity: .13;
  stroke: var(--lab-lime);
  stroke-width: .08px;
  stroke-dasharray: .16 .12;
}

.court-lab__drag-ball {
  cursor: grab;
  fill: rgba(0, 0, 0, 0);
  stroke: none;
  touch-action: none;
  outline: none;
}

.court-lab__ball-visible {
  fill: var(--lab-lime);
  pointer-events: none;
}

.court-lab__court.is-dragging .court-lab__drag-ball {
  cursor: grabbing;
}

.court-lab__bounce circle {
  fill: var(--lab-lime);
}

.court-lab__bounce.is-out circle {
  fill: var(--lab-out);
}

.court-lab__bounce-ring {
  stroke: var(--lab-lime);
  stroke-width: .1px;
  fill: none !important;
}

.court-lab__bounce.is-out .court-lab__bounce-ring {
  stroke: var(--lab-out);
}

.court-lab__preview line {
  stroke: #fff;
  stroke-width: .09px;
  stroke-dasharray: .25 .2;
}

.court-lab__preview circle {
  fill: none;
  stroke: var(--lab-lime);
  stroke-width: .1px;
}

.court-lab__preview.is-out circle {
  stroke: var(--lab-out);
}

.court-lab__magnifier {
  background: rgba(255, 255, 255, .46);
  border: 1px solid rgba(22, 35, 30, .12);
  border-radius: 14px;
  margin: 10px 0 4px;
  padding: 14px;
}

.court-lab__magnifier-heading {
  grid-gap: 10px;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  display: flex;
}

.no-flex-gap .court-lab__magnifier-heading > * + * {
  margin-left: 10px;
}

.court-lab__magnifier-heading span {
  font-size: 14px;
  font-weight: 780;
}

.court-lab__magnifier svg {
  border-radius: 10px;
  width: 100%;
  height: auto;
  margin-top: 8px;
  display: block;
  overflow: hidden;
}

.court-lab__magnifier-in {
  fill: #dce8d2;
}

.court-lab__magnifier-out {
  fill: #e8e4db;
}

.court-lab__magnifier-ball {
  fill: var(--lab-lime);
  stroke: var(--lab-green-dark);
  stroke-width: 2px;
}

.court-lab__magnifier-ball.is-touching {
  filter: drop-shadow(0 0 5px rgba(212, 240, 77, .9));
}

.court-lab__magnifier text {
  fill: var(--lab-muted);
  font-size: 13px;
  font-weight: 720;
}

.court-lab__magnifier p {
  grid-gap: 4px;
  gap: 4px;
  margin: 10px 0 0;
  font-size: 13px;
  display: grid;
}

.court-lab__magnifier p span {
  color: var(--lab-muted);
  text-align: left;
}

@media (prefers-reduced-motion: no-preference) {
  .court-lab__bounce-ring {
    transform-box: fill-box;
    transform-origin: center;
    animation: .9s ease-out rules-lab-bounce;
  }

  @keyframes rules-lab-bounce {
    from {
      opacity: 1;
      transform: scale(.35);
    }

    to {
      opacity: .18;
      transform: scale(1.28);
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  .court-lab * {
    transition: none !important;
    animation: none !important;
  }
}

.site-footer {
  grid-gap: 10px;
  max-width: 720px;
  padding: 20px 5% calc(var(--safe-bottom, 0px) + 24px);
  color: var(--ink-soft);
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: start;
  gap: 10px;
  margin: 0 auto;
  font-size: 13px;
  display: flex;
}

.no-flex-gap .site-footer > * + * {
  margin-left: 10px;
}

.site-footer > details {
  flex: 1;
  min-width: 60%;
}

.site-footer summary {
  cursor: pointer;
  min-height: 44px;
  padding-top: 8px;
  font-size: 14px;
}

.site-footer .rule-document .rule-paragraph {
  font-size: 13px;
}

.footer-sources {
  margin: 6px 0 10px;
  line-height: 1.6;
}

.footer-version {
  padding-top: 8px;
}

.reset-learning {
  min-height: 44px;
  color: var(--ink-soft);
  text-underline-offset: 4px;
  background: none;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  text-decoration: underline;
}

.reset-learning:active {
  background: #d7ee79;
  text-decoration: none;
}

.footer-top {
  min-height: 44px;
  color: var(--brand);
  background: none;
  border: 0;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
}

@media (max-width: 600px) {
  .content-section {
    padding: 20px 4% 26px;
  }

  .section-heading h2 {
    font-size: 21px;
  }

  .rule-heading {
    font-size: 18px;
  }

  .court-lab__workspace {
    grid-template-columns: 1fr;
  }

  .court-lab__court {
    height: 38vh;
    min-height: 240px;
    max-height: 320px;
    height: max(240px, min(38vh, 320px));
  }

  .court-lab__panel {
    grid-gap: 6px;
    gap: 6px;
    padding: 10px 12px;
  }

  .no-flex-gap .court-lab__panel > * + * {
    margin-top: 6px;
  }

  .court-shell .tennis-court {
    height: 52vh;
    min-height: 280px;
    max-height: 380px;
    height: max(280px, min(52vh, 380px));
  }

  .figure-caption {
    font-size: 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  #view-rules * {
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
  }
}

.rules-head {
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: 20px;
}

.rules-head h1 {
  letter-spacing: -.04em;
  font-family: inherit;
  font-size: 30px;
  font-weight: 600;
}

.chapter-nav {
  max-width: 720px;
  margin: 0 auto;
}

.chapter-nav button {
  border-radius: 0;
  font-size: 13px;
}

.chapter-nav button[aria-pressed="true"] {
  border-bottom-width: 2px;
  font-weight: 600;
}

.section-heading h2 {
  letter-spacing: -.025em;
  font-size: 23px;
  font-weight: 600;
}

.rule-heading {
  font-size: 18px;
  font-weight: 600;
}

.rule-paragraph, .rule-list {
  font-size: 15px;
  line-height: 1.9;
}

.rule-callout {
  background: #eceee5;
  border-radius: 0;
}

@supports (padding: env(safe-area-inset-top)) {
  :root {
    --safe-top: var(--safe-area-inset-top, env(safe-area-inset-top, 0px));
    --safe-right: var(--safe-area-inset-right, env(safe-area-inset-right, 0px));
    --safe-bottom: var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px));
    --safe-left: var(--safe-area-inset-left, env(safe-area-inset-left, 0px));
  }
}

#court[hidden] {
  display: none !important;
}

.renderer-notice {
  color: #fff;
  pointer-events: none;
  z-index: 8;
  background: #183f35;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
}
