:root {
  --bg: #0c0e0a;
  --panel: #14170f;
  --line: #2a3220;
  --ink: #d7e8b4;
  --dim: #8a9770;
  --phos: #c6ef4a;
  --warn: #ffb14a;
  --fail: #ff5a3c;
  --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: 64px 1fr 64px;
  align-items: center;
  gap: 8px;
}
.bar h2 {
  margin: 0;
  text-align: center;
  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; }

.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;
}

.board {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 8px;
  background:
    radial-gradient(circle at 50% 36%, rgb(198 239 74 / .07), #10140c 62%);
  border: 1px solid var(--line);
  overflow: hidden;
  touch-action: none;
}
.comfort {
  position: absolute;
  left: 0;
  right: 0;
  top: 52%;
  bottom: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent, rgb(198 239 74 / .08));
  box-shadow: inset 0 1px 0 rgb(198 239 74 / .35);
}
.hint {
  position: absolute;
  left: 0;
  right: 0;
  top: 58%;
  margin: 0;
  text-align: center;
  font-size: 13px;
  letter-spacing: .12em;
  color: rgb(138 151 112 / .85);
  pointer-events: none;
}
.board.live .hint { opacity: .2; }
.board.drop {
  box-shadow: inset 0 0 0 2px var(--fail);
}

.node {
  position: absolute;
  z-index: 2;
  min-width: 44px;
  min-height: 34px;
  padding: 0 7px;
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  color: var(--ink);
  background: #1a2214;
  border: 1px solid #3a4a28;
  pointer-events: none;
}
.node.inner {
  min-width: 40px;
  background: #161c12;
  border-style: dashed;
}
.node.sm {
  min-width: 34px;
  min-height: 28px;
  padding: 0 5px;
  font-size: 11px;
}
.node.xs {
  min-width: 22px;
  min-height: 22px;
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  background: #12180e;
}
.node.ops { min-width: 28px; }
.node.map {
  width: 48px;
  height: 42px;
  min-height: 42px;
  font-size: 11px;
}
.node.task {
  min-width: 72px;
  min-height: 32px;
}
.node.task-row { min-width: 40px; }
.node.claim {
  min-width: 58px;
  background: #2a2410;
  border-color: #6a5a28;
  color: #e8d48a;
}
.node.arrow,
.node.gear {
  min-width: 22px;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 4px;
}
.node.hit {
  border-color: var(--phos);
  color: #0c0e0a;
  background: var(--phos);
}
.back-node {
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border-radius: 50%;
  font-size: 11px;
}

.cursor {
  position: absolute;
  z-index: 8;
  width: 28px;
  height: 28px;
  margin: -14px 0 0 -14px;
  border-radius: 50%;
  border: 3px solid #fff6c8;
  background: rgb(198 239 74 / .4);
  box-shadow: 0 0 0 2px rgb(0 0 0 / .45), 0 0 14px rgb(198 239 74 / .85);
  pointer-events: none;
}
.cursor::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
}
.focus {
  position: absolute;
  z-index: 7;
  border: 3px solid #fff6c8;
  border-radius: 8px;
  pointer-events: none;
  box-shadow: 0 0 0 2px rgb(0 0 0 / .4), 0 0 14px rgb(198 239 74 / .7);
}

.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); }
