:root {
  --bg: #121212;
  --panel: #1e1e1e;
  --panel-2: #2a2a2a;
  --text: #f2efe9;
  --muted: #9a958c;
  --accent: #e8b931;
  --hit: #4ade80;
  --target: #ffffff;
  --radius: 16px;
  --tabs-h: 64px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}

#screen {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 18px calc(var(--tabs-h) + env(safe-area-inset-bottom) + 24px);
}

body.focus #screen { padding-bottom: calc(env(safe-area-inset-bottom) + 24px); }
body.focus .tabs { display: none; }

h1, h2, h3 { margin: 0 0 8px; line-height: 1.15; }
h1 { font-size: 30px; font-weight: 900; letter-spacing: -0.5px; text-transform: uppercase; }
h2 { font-size: 22px; font-weight: 800; }
p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.stack > * + * { margin-top: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > .grow { flex: 1; }

/* ---------- bottom tabs ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-around;
  height: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(18, 18, 18, 0.94);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid #2a2a2a;
  z-index: 10;
}
.tabs a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 700; min-height: 48px;
}
.tabs a svg { width: 26px; height: 26px; }
.tabs a.active { color: var(--accent); }

/* ---------- buttons & cards ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 56px; padding: 12px 20px;
  border: 0; border-radius: var(--radius);
  background: var(--accent); color: #121212;
  font: inherit; font-size: 19px; font-weight: 800;
  cursor: pointer; text-decoration: none;
  transition: transform 0.08s ease;
}
.btn:active { transform: scale(0.97); }
.btn.secondary { background: var(--panel-2); color: var(--text); }
.btn.ghost { background: transparent; color: var(--muted); min-height: 48px; font-size: 16px; font-weight: 700; }
.btn.small { width: auto; min-height: 48px; font-size: 16px; padding: 8px 16px; }
.btn[disabled] { opacity: 0.45; }

.card {
  background: var(--panel);
  border-radius: var(--radius);
  padding: 18px;
}

.notice {
  background: var(--panel-2);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: 12px 14px;
}

select, textarea, input[type="text"] {
  width: 100%; min-height: 48px;
  background: var(--panel-2); color: var(--text);
  border: 1px solid #3a3a3a; border-radius: 12px;
  padding: 10px 12px; font: inherit;
}
textarea { min-height: 90px; resize: vertical; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
input[type="range"] { width: 100%; accent-color: var(--accent); min-height: 36px; }
label.field { display: block; font-weight: 700; margin-bottom: 6px; }

/* ---------- level meter ---------- */
.meter { height: 10px; background: var(--panel-2); border-radius: 5px; overflow: hidden; }
.meter > div { height: 100%; width: 0; background: var(--accent); transition: width 0.08s linear; }

/* ---------- tuner ---------- */
.tuner-note {
  font-size: 112px; font-weight: 900; line-height: 1; text-align: center;
  margin: 18px 0 4px; letter-spacing: -2px; transition: color 0.15s;
}
.tuner-string { text-align: center; font-weight: 700; margin-bottom: 6px; }
.tuner-note.in-tune { color: var(--hit); }
.tuner-hint { text-align: center; font-size: 20px; font-weight: 800; min-height: 28px; }
.tuner-hint.in-tune { color: var(--hit); }

.needle {
  position: relative; height: 56px; margin: 16px 4px 8px;
  background: linear-gradient(90deg, transparent 0 calc(50% - 22px), rgba(74, 222, 128, 0.18) calc(50% - 22px) calc(50% + 22px), transparent calc(50% + 22px));
  border-bottom: 2px solid #333;
}
.needle .tick { position: absolute; bottom: 0; width: 2px; height: 14px; background: #444; transform: translateX(-1px); }
.needle .tick.zero { height: 30px; background: var(--muted); }
.needle .pointer {
  position: absolute; bottom: 0; left: 50%; width: 6px; height: 50px; margin-left: -3px;
  border-radius: 3px; background: var(--accent);
  transition: left 0.12s ease-out, background 0.15s;
}
.needle .pointer.in-tune { background: var(--hit); }
.needle .pointer.idle { background: #444; }
.needle-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; margin: 0 4px; }

.string-list { list-style: none; margin: 0; padding: 0; }
.string-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; border-radius: 12px; min-height: 48px;
}
.string-list li + li { margin-top: 2px; }
.string-list .num { width: 22px; color: var(--muted); font-weight: 700; text-align: right; }
.string-list .line { flex: 1; background: #6b665e; border-radius: 2px; }
.string-list .name { width: 54px; font-weight: 800; font-size: 20px; text-align: right; }
.string-list .check { width: 24px; color: var(--hit); font-weight: 900; text-align: center; }
.string-list li.active { background: var(--panel-2); }
.string-list li.active .name { color: var(--accent); }
.string-list li.done .name { color: var(--hit); }

details.miccheck { margin-top: 18px; }
details.miccheck summary { cursor: pointer; color: var(--muted); font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.readout { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center; font-variant-numeric: tabular-nums; }

/* ---------- overlay ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  background: rgba(0, 0, 0, 0.8);
}
.overlay .card { max-width: 420px; width: 100%; }
