/* onestroke — 一筆畫 */

.app { max-width: 560px; padding-bottom: 32px; }

/* ── HUD ───────────────────────────────────────────────── */
.hud { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0 8px; }
.hud-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 8px 6px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}
.hud-label { font-size: 11px; color: var(--text-muted); letter-spacing: 0.5px; }
.hud-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
:where(body:not(.dark)) .hud-value { color: color-mix(in srgb, var(--accent) 55%, #000); }

.level-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.level-title { flex: 1; text-align: center; font-weight: 800; color: var(--text-strong); font-size: 15px; }
.nav-btn { min-width: 44px; }

/* ── Board ─────────────────────────────────────────────── */
.board-wrap {
  --edge: #b9ad9f;
  --dot: #6b6259;
  --board-bg: #fffaf0;
  position: relative;
  width: min(100%, 440px);
  margin: 0 auto;
  background: var(--board-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg, 14px);
  box-shadow: var(--shadow-sm);
}
body.dark .board-wrap { --edge: #6d6255; --dot: #e8dccb; --board-bg: #1b1611; }
.board-wrap.is-paused .board,
.board-wrap.is-paused .clear-panel { visibility: hidden; }
.board { display: block; width: 100%; height: auto; aspect-ratio: 1; touch-action: none; user-select: none; -webkit-user-select: none; }

.edge { stroke: var(--edge); stroke-width: 2.6; stroke-linecap: round; }
.edge.is-used { stroke: transparent; }
.edge-used {
  stroke: hsl(var(--hue), 75%, 45%);
  stroke-width: 3.4;
  stroke-linecap: round;
}
body.dark .edge-used { stroke: hsl(var(--hue), 80%, 62%); }
.edge-used.fresh { animation: edge-in 0.18s ease-out; }
@keyframes edge-in { from { stroke-width: 6; } to { stroke-width: 3.4; } }
.band { stroke: hsl(200, 70%, 50%); stroke-width: 1.6; stroke-dasharray: 2 2; stroke-linecap: round; pointer-events: none; opacity: 0.8; }

.vertex { cursor: pointer; outline: none; }
.vertex .hit { fill: transparent; }
.vertex .dot { fill: var(--dot); transition: r 0.12s ease; }
.vertex .start-ring { fill: none; stroke: transparent; stroke-width: 1.2; }
.vertex.visited .dot { fill: hsl(200, 70%, 45%); }
.vertex.is-option .dot { fill: hsl(140, 60%, 40%); r: 3.8; }
.vertex.is-end .dot { fill: #e53935; r: 4.4; }
body.dark .vertex.is-end .dot { fill: #ff6f61; }
.vertex.is-start .start-ring { stroke: #e0a800; animation: start-pulse 1.4s ease-in-out infinite; }
.vertex:focus-visible .start-ring { stroke: var(--accent); stroke-width: 1.6; }
@keyframes start-pulse { 0%, 100% { stroke-opacity: 0.15; } 50% { stroke-opacity: 0.9; } }

.board.cleared .edge-used { animation: clear-wave 0.9s ease-in-out calc(var(--k) * 40ms) 2; }
@keyframes clear-wave { 0%, 100% { stroke-width: 3.4; } 50% { stroke-width: 6; stroke: #ffc107; } }

.clear-panel {
  position: relative;
  margin: 0 auto 12px;
  width: min(92%, 320px);
  box-sizing: border-box;
  background: rgba(20, 16, 12, 0.88);
  color: #fff;
  border-radius: 12px;
  padding: 12px 14px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  animation: panel-in 0.3s ease;
}
.clear-panel[hidden] { display: none; }
@keyframes panel-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.clear-title { font-size: 20px; font-weight: 900; }
.clear-detail { font-size: 13px; color: #f3e6d0; }
.clear-panel .btn.primary { background: linear-gradient(180deg, #1e88e5, #1259a3); color: #fff; }

.status-line { min-height: 20px; text-align: center; font-size: 13px; font-weight: 700; color: var(--text-strong); margin: 8px 0 2px; }
.action-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 8px 0; }
.legend { font-size: 12px; color: var(--text-muted); text-align: center; line-height: 1.6; }

@media (max-width: 420px) {
  .hud { gap: 6px; }
  .hud-value { font-size: 18px; }
}
