:root {
  --bg: #141414;
  --panel: #1c1c1c;
  --line: #333;
  --fg: #fff;
  --sub: #9a9a9a;
  --accent: #3b82f6;
  --red: #ef4444;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
  margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Segoe UI", sans-serif;
  overscroll-behavior: none; -webkit-user-select: none; user-select: none;
}
button { font: inherit; color: inherit; cursor: pointer; }

#app { position: fixed; inset: 0; display: flex; flex-direction: column; }

/* ===== ヘッダー（音名表示） ===== */
.hdr {
  position: relative; flex: none;
  padding-top: calc(env(safe-area-inset-top) + 14px);
  height: calc(env(safe-area-inset-top) + 250px);
}
.readout { text-align: center; line-height: 1.15; transition: opacity .3s; }
.readout.idle { opacity: .45; }
.note-en { font-size: 21px; letter-spacing: .02em; }
.note-kara { font-size: 21px; margin-top: 10px; }
.note-big { font-size: clamp(72px, 22vw, 96px); font-weight: 500; line-height: 1.05; margin: 2px 0 4px; letter-spacing: -.02em; min-height: 1.05em; }
.hz { font-size: 22px; }
.cents { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 12px; }
.c-lab { font-size: 11px; color: var(--sub); width: 24px; }
.c-bar { position: relative; width: min(140px, 40vw); height: 12px; }
.c-bar::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: #777; }
.c-bar i { position: absolute; top: 2px; width: 1px; height: 8px; background: #777; }
.c-bar i.mid { top: 0; height: 12px; background: #aaa; }
.c-mark {
  position: absolute; top: -2px; width: 5px; height: 16px; margin-left: -2.5px; left: 50%;
  border-radius: 2px; background: #fff; border: 1px solid #555; transition: left .08s linear, background .2s;
}
.c-mark.ok { background: #4ade80; }

/* マイク感度スライダー */
.sens {
  position: absolute; left: 0; top: calc(env(safe-area-inset-top) + 0px);
  height: 236px; width: 84px; padding: 16px 0 24px 16px; touch-action: none; display: flex; z-index: 2;
}
.sens-track { position: relative; width: 30px; height: 100%; display: flex; justify-content: center; }
.sens-track::before { content: ""; position: absolute; top: 0; bottom: 0; width: 4px; border-radius: 2px; background: #3a3a3a; }
.sens-fill { position: absolute; bottom: 0; width: 4px; border-radius: 2px; background: #8a8a8a; }
.sens-thumb { position: absolute; width: 30px; height: 10px; margin-bottom: -5px; transition: transform .1s; border-radius: 4px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.6); }
.sens.active .sens-thumb { transform: scale(1.25); }
.sens-label { writing-mode: vertical-rl; font-size: 12px; color: #bbb; padding-left: 4px; padding-top: 4px; white-space: nowrap; }


/* ===== グラフ ===== */
.graph { position: relative; flex: 1; min-height: 0; touch-action: none; }
#graph { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* ===== オーバーレイ ===== */
.overlay {
  position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 16px;
  background: rgba(10,10,10,.82); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.overlay.hide { display: none; }
.start-card { text-align: center; max-width: 340px; }
.start-card h1 { font-size: 24px; margin: 12px 0 6px; }
.start-card p { color: #ccc; line-height: 1.7; margin: 0 0 22px; font-size: 15px; }
.start-card p.small { font-size: 12px; color: var(--sub); margin-top: 16px; }
.start-card p.small.err { color: #ff8a8a; }
.primary {
  background: var(--accent); border: 0; border-radius: 999px; padding: 15px 26px;
  font-size: 16px; font-weight: 600; width: 100%;
}
