:root {
  --bg: #0c0e0a;
  --panel: #14170f;
  --line: #2a3220;
  --ink: #d7e8b4;
  --dim: #8a9770;
  --phos: #c6ef4a;
  --warn: #ffb14a;
  --fail: #ff5a3c;
  --sys: 44px;
  --pull: 40px;
  --safe: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
html, body {
  height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Bahnschrift", "DIN Alternate", "Source Han Sans SC", "Noto Sans SC", "PingFang SC", sans-serif;
}
body {
  min-height: 100dvh;
  overflow: hidden;
  touch-action: none;
  overscroll-behavior: none;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgb(198 239 74 / .03) 3px 4px);
  mix-blend-mode: overlay;
}

.screen {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: calc(12px + env(safe-area-inset-top, 0px)) 14px calc(10px + var(--safe));
}
.screen[hidden] { display: none !important; }

.kicker {
  margin: 0 0 8px;
  font-size: 10px;
  letter-spacing: .22em;
  color: var(--phos);
}
h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 650;
  letter-spacing: .04em;
}
.lead {
  margin: 10px 0 22px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--dim);
}
#pick { overflow-y: auto; }
.choice {
  display: grid;
  gap: 6px;
  width: 100%;
  margin: 0 0 8px;
  padding: 14px 16px;
  text-align: left;
  font: inherit;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  cursor: pointer;
}
.choice b { font-size: 18px; font-weight: 700; }
.choice span { font-size: 13px; color: var(--dim); line-height: 1.4; }
.choice:active { border-color: var(--phos); }

.bar {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
}
.bar h2 {
  margin: 0;
  text-align: left;
  font-size: 16px;
  font-weight: 650;
}
.back, .ghost {
  font: inherit;
  min-height: 36px;
  padding: 0 8px;
  color: var(--dim);
  background: transparent;
  border: 1px solid var(--line);
  cursor: pointer;
}
.back { text-align: left; }
.bar-acts {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}
.bar-acts .ghost {
  min-width: 40px;
  padding: 0 8px;
  font-size: 12px;
}
#area-coach-btn[aria-pressed="true"] {
  color: var(--phos);
  border-color: var(--phos);
}

.tip {
  margin: 10px 0 8px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--dim);
}

.meters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 8px;
  background: #0a0c08;
  border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.meters div { display: grid; gap: 2px; min-width: 0; }
.meters span { font-size: 9px; letter-spacing: .08em; color: var(--dim); }
.meters b {
  font-size: 13px;
  font-weight: 650;
  color: var(--phos);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.surface {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 50% 42%, rgb(198 239 74 / .08), #10140c 58%);
  border: 1px solid var(--line);
  overflow: hidden;
  touch-action: none;
}
.blob {
  position: absolute;
  left: 50%;
  top: 48%;
  width: 72px;
  height: 72px;
  margin: -36px 0 0 -36px;
  border-radius: 50%;
  background: rgb(198 239 74 / .28);
  transform: scale(.2);
  pointer-events: none;
  z-index: 2;
}
#area.show-coach .meters,
#area.show-coach .tip,
#area.show-coach .log { display: none; }
.coach {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}
#area.show-coach .coach { display: block; }
#area.show-coach .blob { opacity: 0; }
.coach-demo {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 46%;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 4px;
  padding: 10px 12px 8px;
  background: linear-gradient(#0c0e0a, rgb(12 14 10 / .88));
  border-bottom: 1px dashed rgb(198 239 74 / .32);
}
.coach-kicker {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .22em;
  color: var(--phos);
}
.coach-copy {
  margin: 0;
  font-size: 12px;
  line-height: 1.4;
  color: var(--ink);
  text-align: center;
}
.scheme-play {
  width: 100%;
  max-width: 244px;
  margin-top: auto;
  margin-bottom: 2px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
}
.scheme-svg {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
  color: var(--phos);
}
.scheme-svg path,
.scheme-phone {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.scheme-pose {
  opacity: 0;
}
.scheme-tip { animation: scheme-tip 4.8s ease-in-out infinite; }
.scheme-rub { animation: scheme-rub 4.8s ease-in-out infinite; }
.scheme-pad { animation: scheme-pad 4.8s ease-in-out infinite; }
@keyframes scheme-tip {
  0%, 20% { opacity: 1; }
  28%, 100% { opacity: 0; }
}
@keyframes scheme-rub {
  0%, 20% { opacity: 0; }
  28%, 48% { opacity: 1; }
  56%, 100% { opacity: 0; }
}
@keyframes scheme-pad {
  0%, 48% { opacity: 0; }
  56%, 86% { opacity: 1; }
  94%, 100% { opacity: 0; }
}
.scheme-cap {
  position: relative;
  height: 16px;
  width: 100%;
  margin: 0;
}
.scheme-cap span {
  position: absolute;
  inset: 0;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  color: var(--phos);
}
.scheme-cap .scheme-pad { color: var(--phos); }
.scheme-cap .scheme-rub { color: var(--phos); }
@media (prefers-reduced-motion: reduce) {
  .scheme-pose,
  .scheme-cap span {
    animation: none !important;
  }
  .scheme-tip { opacity: 1; }
  .scheme-rub,
  .scheme-pad { opacity: 0; }
  .scheme-cap .scheme-rub,
  .scheme-cap .scheme-pad { opacity: 0; }
  .scheme-cap .scheme-tip { opacity: 1; }
}
.print {
  position: absolute;
  color: var(--phos);
  background-color: currentColor;
  border-radius: 0;
  box-shadow: none;
  box-sizing: border-box;
  -webkit-mask: url("./assets/fp-mark.svg?v=3") center / 92% 92% no-repeat;
  mask: url("./assets/fp-mark.svg?v=3") center / 92% 92% no-repeat;
  -webkit-mask-mode: alpha;
  mask-mode: alpha;
  filter: drop-shadow(0 0 6px rgb(198 239 74 / .28));
}
.print-sm {
  width: 24px;
  height: 24px;
}
.print-lg {
  width: 78px;
  height: 78px;
}
.coach-do {
  position: absolute;
  inset: 0;
  z-index: 1;
  --tap-w: 24px;
  --tap-h: 24px;
  --hold-w: 78px;
  --hold-h: 78px;
}
.coach-do.is-out { opacity: 0; transition: opacity .28s ease; }
.coach-do.is-in .tap { animation: coach-popin .38s ease-out; }
.coach-do .print,
.coach-do .coach-path {
  position: absolute;
  pointer-events: none;
}
.coach-do .tap {
  width: var(--tap-w);
  height: var(--tap-h);
  animation: coach-pulse 1.6s ease-in-out infinite;
}
.coach-path {
  height: 2px;
  transform-origin: 0 50%;
  overflow: visible;
}
.coach-path-in {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--phos);
  box-shadow: 0 0 0 3px rgb(198 239 74 / .16);
  transform: scaleX(0);
  transform-origin: 0 50%;
}
.coach-do.is-play .coach-path-in {
  animation: coach-draw .32s ease-out forwards;
}
.coach-do .hold {
  width: var(--hold-w);
  height: var(--hold-h);
  opacity: 0;
}
.coach-do.is-play .hold {
  animation: coach-hold-in .28s ease-out .18s forwards;
}
.coach-do.is-arrive .hold,
.coach-do.is-ok .hold {
  animation: none;
  opacity: 1;
  filter: brightness(1.55) drop-shadow(0 0 10px rgb(198 239 74 / .45));
}
.surface .verdict,
.surface .why {
  position: relative;
  z-index: 4;
  text-align: center;
  pointer-events: none;
}
.verdict {
  margin: auto 16px 4px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1.3;
}
.why {
  margin: 0 18px 12px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--dim);
}
#area.show-coach .why:empty { display: none; }
#area.show-coach .verdict[data-kind="track"] + .why {
  color: var(--warn);
  font-size: 13px;
}

@keyframes coach-pulse {
  0%, 100% { filter: brightness(1); transform: scale(1); }
  50% { filter: brightness(1.45); transform: scale(1.06); }
}
@keyframes coach-popin {
  from { opacity: 0; transform: scale(.55); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes coach-draw {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
@keyframes coach-hold-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .coach-do .tap, .coach-path-in, .coach-do .hold {
    animation: none !important;
  }
  .coach-do.is-play .hold {
    opacity: 1;
  }
  .coach-do.is-play .coach-path-in { transform: none; }
}
.verdict[data-kind="idle"] { color: var(--dim); }
.verdict[data-kind="track"] { color: var(--warn); }
.verdict[data-kind="ok"] { color: var(--phos); }
.verdict[data-kind="miss"] { color: var(--fail); }

.edge-board {
  background: #10140c;
}
.pull-band {
  position: absolute;
  top: 52%;
  bottom: 0;
  width: var(--pull);
  background: rgb(198 239 74 / .28);
  pointer-events: none;
}
.pull-l { left: var(--sys); }
.pull-r { right: var(--sys); }
.sys-band {
  position: absolute;
  top: 52%;
  bottom: 0;
  width: var(--sys);
  background: rgb(255 90 60 / .22);
  pointer-events: none;
}
.sys-l { left: 0; }
.sys-r { right: 0; }

.sheet {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(var(--sys) + var(--pull));
  right: calc(var(--sys) + var(--pull));
  z-index: 4;
}
.sheet-dim {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  background: rgb(0 0 0 / .38);
  cursor: pointer;
}
.sheet-card {
  position: absolute;
  inset: 10px 0 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 16px 14px;
  border: 1px solid rgb(198 239 74 / .28);
  border-radius: 16px;
  background: rgb(16 22 12 / .52);
  color: var(--ink);
  box-shadow: 0 12px 40px rgb(0 0 0 / .28);
  animation: sheet-in .22s ease;
}
@keyframes sheet-in {
  from { transform: translateX(28%); opacity: .4; }
  to { transform: none; opacity: 1; }
}
.sheet-kicker {
  margin: 0;
  font-size: 10px;
  letter-spacing: .2em;
  color: var(--phos);
}
.sheet-card h3 {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
}
.sheet-copy {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--dim);
}
.sheet-acts {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}
.sheet-acts button,
.sheet-fold {
  font: inherit;
  min-height: 44px;
  color: var(--ink);
  background: rgb(198 239 74 / .12);
  border: 1px solid rgb(198 239 74 / .35);
  cursor: pointer;
}
.sheet-fold {
  margin-top: auto;
  width: 100%;
  background: var(--phos);
  color: #0c0e0a;
  border-color: var(--phos);
  font-weight: 700;
}

.log {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  max-height: 64px;
  overflow: auto;
  font-size: 11px;
  color: var(--dim);
  font-variant-numeric: tabular-nums;
}
.log li { border-top: 1px solid var(--line); padding: 4px 0; }
.log .ok { color: var(--phos); }
.log .miss { color: var(--fail); }
