* { box-sizing: border-box; }
[hidden] { display: none !important; }
:root {
  color-scheme: light;
  --ink: #15395c;
  --accent: #ff8a3d;
  --sky: #76c9f2;
  font-family: system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { display: flex; justify-content: center; background: #112d48; }
.game {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  color: #fff;
  background: var(--sky);
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
@media (min-aspect-ratio: 3/4) {
  .game { max-width: 60vh; max-width: 60dvh; }
}
.scene-art, #scene, .play-area { position: absolute; inset: 0; width: 100%; height: 100%; }
.scene-art { display: block; object-fit: cover; object-position: center; pointer-events: none; }
#scene { display: block; pointer-events: none; }
.play-area {
  padding: 0;
  border: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
  touch-action: none;
}
.play-area:focus-visible { outline: 3px solid #fff; outline-offset: -4px; }
.start-btn {
  position: absolute;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 22px);
  z-index: 3;
  transform: translateX(-50%);
  min-width: 144px;
  min-height: 48px;
  padding: 10px 22px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--accent);
  box-shadow: 0 3px 0 var(--ink);
  color: var(--ink);
  font: 800 16px/1.2 system-ui, sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}
.start-btn:active { box-shadow: 0 1px 0 var(--ink); }
.start-btn:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.hud {
  position: absolute;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  left: max(12px, env(safe-area-inset-left, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  z-index: 2;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  pointer-events: none;
}
.stat {
  display: grid;
  align-content: center;
  min-width: 86px;
  min-height: 56px;
  padding: 5px 12px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: #e8f6ff;
  box-shadow: 0 3px 0 var(--ink);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.1;
  color: var(--ink);
}
.stat-score { background: var(--accent); text-align: right; }
.stat strong, .combo {
  color: #fff;
  paint-order: stroke fill;
  -webkit-text-stroke: 2.5px var(--ink);
  text-shadow: 0 2px var(--ink);
}
.stat strong { font-size: 24px; font-variant-numeric: tabular-nums; }
.combo {
  position: absolute;
  top: 23%;
  left: 53%;
  width: 44%;
  margin: 0;
  text-align: center;
  pointer-events: none;
  font-weight: 900;
  color: #ffe0a1;
  font: 900 42px/1.06 "Kaiti SC", "STKaiti", KaiTi, serif;
  -webkit-text-stroke-width: 4px;
  transform: rotate(-9deg);
}
.combo small { display: block; font: 900 18px/1.3 system-ui, sans-serif; color: #fff; -webkit-text-stroke-width: 3px; }
@media (prefers-reduced-motion: no-preference) {
  .combo.pop { animation: combo-in 170ms ease-out both; }
  @keyframes combo-in { from { transform: rotate(-9deg) scale(.72); opacity: .4; } }
}
.end {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  padding: max(16px, env(safe-area-inset-top, 0px)) 16px max(16px, env(safe-area-inset-bottom, 0px));
  overflow: auto;
  background: #102d4bbd;
}
.result {
  width: min(100%, 310px);
  margin: auto;
  padding: 18px;
  text-align: center;
  border: 2px solid var(--ink);
  border-radius: 8px;
  box-shadow: 0 4px 0 #0a263f;
  background: #f2f9ff;
  color: var(--ink);
}
.result h1 { margin: 0; font-size: 25px; }
.result p { margin: 8px 0; font-size: 14px; }
.result .summary { font-weight: 850; font-size: 18px; }
.result .blade, .result .ad-status { color: #325471; }
.action {
  display: block;
  width: 100%;
  min-height: 46px;
  margin-top: 10px;
  padding: 8px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--accent);
  color: #112f4b;
  font: 800 16px/1.2 inherit;
  cursor: pointer;
  touch-action: manipulation;
}
.action.secondary { background: #e0f2ff; }
.action:disabled { opacity: .58; cursor: default; }
.action:focus-visible { outline: 3px solid #287cc2; outline-offset: 2px; }
