* {
  box-sizing: border-box;
}
html,
body,
#app,
#home,
#arena {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
}
html {
  background: #102d2c;
  color-scheme: dark;
  font-family: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans CJK SC', system-ui, sans-serif;
}
body {
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button,
input {
  font: inherit;
}
button {
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
button:focus-visible,
input:focus-visible {
  outline: 3px solid #ffdc8c;
  outline-offset: 4px;
}
button:disabled {
  cursor: default;
  opacity: 0.65;
}
[hidden] {
  display: none !important;
}
.symbols,
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
}
svg {
  width: 1.35em;
  height: 1.35em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
#app {
  position: relative;
  color: #fff0d3;
  background: #193d3b;
}
#home,
#arena {
  position: absolute;
  inset: 0;
}
.home-art,
.home-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.home-art {
  background: #264a45 url('assets/home.webp') 53% 50% / cover no-repeat;
}
.home-shade {
  background:
    linear-gradient(90deg, rgba(7, 35, 33, 0.62), rgba(9, 38, 35, 0.18) 38%, transparent 64%),
    linear-gradient(0deg, rgba(13, 29, 23, 0.36), transparent 27%);
}
.home-top {
  position: absolute;
  inset: max(22px, env(safe-area-inset-top)) max(30px, env(safe-area-inset-right)) auto
    max(5.8%, env(safe-area-inset-left));
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.track,
.tools,
.home-actions,
.button,
.icon-btn,
.arena-tools,
.bell-row,
.score-unit,
.notice-row {
  display: flex;
  align-items: center;
}
.track {
  gap: 9px;
  font-size: 14px;
  letter-spacing: 0.14em;
  color: #fff0c4;
  text-shadow: 0 1px 4px #063537;
}
.track svg {
  width: 29px;
  height: 26px;
  stroke-width: 1.35;
}
.tools,
.arena-tools {
  gap: 8px;
}
.icon-btn {
  width: 42px;
  height: 42px;
  border: 1px solid #f4d59569;
  border-radius: 50%;
  background: #112e2cd9;
  justify-content: center;
  color: #fce6b1;
}
.icon-btn:hover,
.secondary:hover {
  background: #27504a;
}
.home-copy {
  position: absolute;
  left: max(7.25%, env(safe-area-inset-left));
  top: 50%;
  transform: translateY(-42%);
  width: min(480px, 45vw);
}
h1,
h2,
h3,
p {
  margin: 0;
}
.home-copy h1,
.sheet h2,
.score-big,
.countdown {
  font-family: STXingkai, '华文行楷', STKaiti, KaiTi, 'Songti SC', 'Noto Serif CJK SC', serif;
}
.home-copy h1 {
  font-weight: 800;
  letter-spacing: -0.06em;
  line-height: 0.95;
  font-size: clamp(78px, min(9.5vw, 15.3vh), 155px);
  text-shadow: 0 4px 14px #0b29266e;
  transform: rotate(-3deg);
  transform-origin: 0 50%;
  color: #ffefc6;
}
.home-copy h1 span {
  display: block;
}
.home-copy h1 span:last-child {
  margin-left: 0.15em;
}
.home-copy p {
  margin: clamp(16px, 3.8vh, 38px) 0 clamp(18px, 4.5vh, 44px);
  color: #fff0d0;
  font-size: clamp(14px, 1.2vw, 19px);
  line-height: 1.8;
  letter-spacing: 0.08em;
  font-weight: 500;
  text-shadow: 0 1px 5px #14302e;
}
.home-actions {
  gap: 12px;
  flex-wrap: wrap;
}
.button {
  min-height: 49px;
  padding: 0 21px;
  border: 1px solid transparent;
  border-radius: 5px;
  justify-content: center;
  gap: 9px;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: 0.03em;
  transition:
    transform 0.14s,
    background 0.14s;
}
.button:active,
.icon-btn:active {
  transform: translateY(1px);
}
.primary {
  background: #efc775;
  color: #25332b;
  border-color: #ffdda0;
  box-shadow:
    inset 0 -3px 0 #c0924f44,
    0 3px 12px #152a2330;
}
.primary:hover {
  background: #ffdb93;
}
.secondary {
  background: #183e39ed;
  color: #f8e7bf;
  border-color: #c3a775;
}
.text-btn {
  background: transparent;
  border: 0;
  color: #e8cd93;
  text-decoration: underline;
  text-underline-offset: 4px;
  padding: 8px;
}
#stage {
  width: 100%;
  height: 100%;
  position: absolute;
  inset: 0;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  outline: 0;
  overflow: hidden;
}
#stage canvas {
  pointer-events: none;
}
.hud {
  position: absolute;
  inset: max(14px, env(safe-area-inset-top)) auto auto 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  pointer-events: none;
  min-width: min(472px, 70%);
}
.score-unit,
.timer {
  border: 1px solid #e1b76b9e;
  background: linear-gradient(110deg, #102d2bf2, #183733e6);
  color: #ffe8b9;
  box-shadow: 0 2px 7px #112b292e;
}
.score-unit {
  padding: 8px 13px;
  gap: 9px;
  border-radius: 5px;
  justify-content: space-around;
  font-size: 12px;
  white-space: nowrap;
}
.score-unit.opposing {
  flex-direction: row-reverse;
}
.bell-row {
  gap: 3px;
}
.bell-row svg {
  width: 18px;
  height: 22px;
  stroke: #f3c771;
  fill: #c39859;
  stroke-width: 1.45;
}
.bell-row .rung {
  fill: #e88b69;
  stroke: #ffc9a1;
  opacity: 0.62;
  transform: rotate(-20deg);
}
.timer {
  font:
    600 22px/1.1 Georgia,
    serif;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
  border-radius: 4px;
  padding: 7px 10px;
}
.arena-tools {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: max(14px, env(safe-area-inset-left));
}
.arena-tools .icon-btn {
  width: 35px;
  height: 35px;
}
.countdown,
.callout,
.match-hint {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  pointer-events: none;
  text-align: center;
}
.countdown {
  top: 31%;
  font-size: clamp(42px, 8vh, 92px);
  font-weight: 800;
  color: #fff0cc;
  text-shadow:
    0 2px 4px #243b36,
    0 0 25px #213a2c;
}
.callout {
  top: 17%;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #fff1cb;
  background: #163531db;
  border: 1px solid #e3c286a1;
  padding: 6px 17px;
  border-radius: 30px;
  white-space: nowrap;
}
.match-hint {
  bottom: max(16px, env(safe-area-inset-bottom));
  font-size: 13px;
  line-height: 1.5;
  padding: 6px 14px;
  border-radius: 20px;
  background: #122e2bd4;
  color: #ffedc6;
  white-space: nowrap;
}
.bow-control {
  --power: 0deg;
  position: absolute;
  right: max(5%, env(safe-area-inset-right));
  bottom: max(7%, env(safe-area-inset-bottom));
  width: clamp(74px, 10.5vmin, 106px);
  height: clamp(74px, 10.5vmin, 106px);
  border: 2px solid #f8d78c;
  border-radius: 50%;
  background:
    radial-gradient(circle, #1c403ad9 65%, transparent 66%),
    conic-gradient(#ffdc8b var(--power), #183b34c9 0);
  color: #ffdf9e;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  box-shadow: 0 3px 12px #1e302951;
}
.bow-control svg {
  width: 34px;
  height: 34px;
}
.bow-control span {
  font-size: 13px;
  letter-spacing: 0.08em;
}
.bow-control.active {
  border-color: #fff3cd;
  color: #fff3cd;
}
.scrim {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  background: #081d1bc2;
  z-index: 5;
}
.sheet {
  width: min(427px, 100%);
  max-height: 100%;
  overflow: auto;
  padding: 33px 32px 27px;
  position: relative;
  background: linear-gradient(145deg, #204a43, #122e2c 75%);
  border: 1px solid #a98d5e;
  border-radius: 9px;
  box-shadow: 0 14px 50px #081a16aa;
  outline: 0;
  scrollbar-width: thin;
}
.sheet h2 {
  margin: 0 38px 14px 0;
  font-size: 39px;
  font-weight: 700;
  color: #ffdfa0;
  letter-spacing: 0.03em;
}
.sheet h3 {
  font-size: 17px;
}
.sheet p,
.sheet label {
  font-size: 14px;
  color: #f1e4c7;
  line-height: 1.7;
}
.dismiss {
  position: absolute;
  right: 15px;
  top: 15px;
  width: 32px;
  height: 32px;
}
.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 21px;
}
.actions .button {
  min-height: 44px;
}
.room-input {
  display: block;
  width: 100%;
  background: #0d2928;
  border: 1px solid #ba9a66;
  border-radius: 4px;
  color: #ffdfa0;
  margin: 6px 0 4px;
  padding: 10px 13px;
  font:
    600 27px/1.2 Georgia,
    serif;
  letter-spacing: 0.35em;
  font-variant-numeric: tabular-nums;
}
.room-input::placeholder {
  color: #8e947d;
}
.sheet label {
  display: block;
  margin-top: 15px;
}
.small-note {
  margin-top: 10px;
  min-height: 1em;
}
.error {
  color: #ffbf98 !important;
}
.copy-code {
  font-family: Georgia, serif;
  font-size: 36px;
  letter-spacing: 0.17em;
  color: #ffdfa0;
  font-variant-numeric: tabular-nums;
}
.notice-row {
  gap: 10px;
  margin: 12px 0;
}
.instructions {
  padding: 0;
  margin: 4px 0;
  list-style: none;
}
.instructions li {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 8px;
  margin: 10px 0;
  line-height: 1.65;
  font-size: 14px;
  color: #eee0c0;
}
.instructions svg {
  margin-top: 2px;
  color: #f2ca81;
  width: 21px;
  height: 21px;
}
.score-big {
  font-size: 62px;
  line-height: 1.15;
  letter-spacing: 0.06em;
  color: #f7d791;
}
.stats {
  display: flex;
  justify-content: space-between;
  margin: 14px 0;
  padding: 12px 0;
  border-block: 1px solid #d6b0714f;
  font-size: 13px;
  color: #eddfc0;
}
.stats strong {
  color: #ffdf9e;
  font-size: 20px;
  margin-right: 3px;
}
@media (max-aspect-ratio: 4/5) {
  .home-art {
    background-position: 65% 8%;
    background-size: auto 70%;
    background-color: #1a3932;
  }
  .home-shade {
    background: linear-gradient(0deg, #112f2c 3%, #173a32f5 24%, #183a32aa 42%, transparent 68%);
  }
  .home-top {
    left: 21px;
    right: 17px;
    top: max(17px, env(safe-area-inset-top));
  }
  .home-copy {
    left: 7%;
    right: 6%;
    width: auto;
    top: auto;
    bottom: max(6.2%, env(safe-area-inset-bottom));
    transform: none;
  }
  .home-copy h1 {
    font-size: clamp(56px, 12vw, 87px);
    line-height: 1.05;
    letter-spacing: -0.08em;
  }
  .home-copy h1 span {
    display: inline;
  }
  .home-copy h1 span:last-child {
    margin: 0;
  }
  .home-copy p {
    margin: 14px 0 18px;
    font-size: 15px;
  }
  .home-actions {
    gap: 10px;
  }
  .home-actions .button {
    padding: 0 16px;
    min-height: 46px;
  }
  .arena-tools {
    top: auto;
    bottom: max(20px, env(safe-area-inset-bottom));
    left: 14px;
    flex-direction: column;
  }
  .hud {
    width: 92%;
    min-width: 0;
    gap: 5px;
  }
  .score-unit {
    padding: 5px 6px;
    gap: 3px;
    font-size: 11px;
  }
  .bell-row {
    gap: 1px;
  }
  .bell-row svg {
    width: 14px;
    height: 18px;
  }
  .timer {
    font-size: 19px;
    padding: 6px;
  }
  .bow-control {
    bottom: max(8%, env(safe-area-inset-bottom));
    right: 6%;
  }
  .match-hint {
    font-size: 11px;
    max-width: 77%;
    white-space: normal;
    bottom: max(12px, env(safe-area-inset-bottom));
  }
  .countdown {
    top: 24%;
  }
  .sheet {
    padding: 27px 23px 22px;
  }
  .sheet h2 {
    font-size: 34px;
  }
}
@media (max-height: 520px) and (min-aspect-ratio: 4/5) {
  .home-top {
    top: max(10px, env(safe-area-inset-top));
    right: max(16px, env(safe-area-inset-right));
  }
  .icon-btn {
    width: 34px;
    height: 34px;
  }
  .home-copy {
    transform: translateY(-41%);
    width: 50%;
  }
  .home-copy h1 {
    font-size: clamp(55px, 15vh, 79px);
  }
  .home-copy p {
    margin: 9px 0 13px;
    font-size: 13px;
    line-height: 1.55;
  }
  .home-actions .button {
    min-height: 38px;
    font-size: 14px;
    padding: 0 14px;
  }
  .sheet {
    padding: 20px 24px;
    max-width: 490px;
  }
  .sheet h2 {
    font-size: 31px;
    margin-bottom: 8px;
  }
  .sheet .actions {
    margin-top: 12px;
  }
  .instructions li {
    margin: 6px 0;
  }
  .hud {
    min-width: 0;
    gap: 7px;
  }
  .score-unit {
    padding: 4px 8px;
  }
  .timer {
    font-size: 18px;
    padding: 4px 7px;
  }
  .arena-tools .icon-btn {
    width: 31px;
    height: 31px;
  }
  .callout {
    top: 18%;
    font-size: 13px;
  }
  .bow-control {
    width: 67px;
    height: 67px;
  }
  .bow-control svg {
    width: 25px;
    height: 25px;
  }
  .match-hint {
    bottom: 8px;
    font-size: 11px;
  }
  .stats {
    margin: 7px 0;
  }
  .score-big {
    font-size: 43px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }
}
@media (max-aspect-ratio: 4/5) {
  .home-art {
    bottom: 24%;
    background-size: auto 100%;
    background-position: right top;
    background-color: #24483c;
    -webkit-mask-image: linear-gradient(to bottom, #000 72%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 72%, transparent 100%);
  }
  #home {
    background: linear-gradient(#527569 15%, #1a4037 65%, #112f2c);
  }
  .home-shade {
    background: linear-gradient(0deg, #112f2c 0%, rgba(17, 47, 44, 0.34) 32%, transparent 61%);
  }
  .home-copy h1 {
    letter-spacing: -0.055em;
  }
}
