:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-soft: #1f2630;
  --text: #f0f6fc;
  --muted: #8b949e;
  --green: #2ea043;
  --yellow: #d29922;
  --blue: #58a6ff;
  --red: #f85149;
  --border: rgba(255,255,255,.12);
  --shadow: 0 22px 60px rgba(0,0,0,.35);
  --radius: 28px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  min-height: 100svh;
  background:
    radial-gradient(circle at top, rgba(88,166,255,.18), transparent 34rem),
    linear-gradient(180deg, #0d1117 0%, #070a0f 100%);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}
a { color: var(--blue); }
.site-header {
  width: min(100%, 1000px);
  margin: 0 auto;
  padding: 18px 16px 0;
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.logo {
  color: var(--text);
  text-decoration: none;
  font-weight: 950;
  letter-spacing: -0.04em;
  font-size: 1.2rem;
}
.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}
.nav-links a {
  color: var(--muted);
  text-decoration: none;
  font-weight: 800;
  font-size: .92rem;
}
.nav-links a:hover { color: var(--text); }
.page {
  width: min(100%, 1000px);
  margin: 0 auto;
  padding: 18px 16px max(24px, env(safe-area-inset-bottom));
}
.hero {
  text-align: center;
  margin: 14px auto 22px;
  max-width: 760px;
}
h1, h2, h3 { line-height: 1.08; letter-spacing: -.04em; }
h1 { font-size: clamp(2.1rem, 8vw, 4rem); margin: 24px 0 10px; }
h2 { font-size: clamp(1.45rem, 4.8vw, 2.15rem); margin: 34px 0 12px; }
h3 { font-size: 1.2rem; margin: 24px 0 8px; }
.lede {
  color: var(--muted);
  font-size: clamp(1.05rem, 3vw, 1.25rem);
  margin: 0 auto;
}
.app-layout {
  display: grid;
  grid-template-columns: minmax(0, 560px) minmax(260px, 1fr);
  gap: 20px;
  align-items: start;
}
.tuner-card, .content-card {
  background: rgba(22,27,34,.92);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(20px, 4vw, 32px);
  backdrop-filter: blur(14px);
}
.content-card {
  box-shadow: 0 14px 34px rgba(0,0,0,.22);
}
.content-card p, .content-card li { color: #c9d1d9; }
.content-card .muted { color: var(--muted); }
.tuning-control { margin: 0 0 18px; }
.tuning-control label {
  display: block;
  color: var(--muted);
  font-size: .86rem;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 8px;
}
select {
  width: 100%;
  min-height: 54px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 850;
  padding: 0 44px 0 16px;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text) 50%),
    linear-gradient(135deg, var(--text) 50%, transparent 50%);
  background-position: calc(100% - 23px) 23px, calc(100% - 16px) 23px;
  background-size: 7px 7px;
  background-repeat: no-repeat;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 13px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-weight: 750;
  font-size: .9rem;
  margin-bottom: 14px;
}
.dot {
  width: 10px; height: 10px; border-radius: 999px;
  background: var(--muted);
  box-shadow: 0 0 0 5px rgba(139,148,158,.12);
}
.status-pill.listening .dot { background: var(--green); box-shadow: 0 0 0 5px rgba(46,160,67,.16); }
.status-pill.error .dot { background: var(--red); box-shadow: 0 0 0 5px rgba(248,81,73,.16); }
.readout {
  display: grid;
  gap: 10px;
  justify-items: center;
  text-align: center;
  margin: 4px 0 20px;
}
.note {
  font-size: clamp(5.3rem, 22vw, 8.7rem);
  line-height: .9;
  font-weight: 950;
  letter-spacing: -.09em;
  color: var(--red);
  font-variant-numeric: tabular-nums;
  transition: color 160ms ease, transform 160ms ease;
}
.note.in-tune { color: var(--green); transform: scale(1.02); }
.note.flat { color: var(--blue); }
.note.sharp { color: var(--yellow); }
.note-idle { color: var(--red); opacity: .72; }
.helper {
  min-height: 32px;
  font-size: clamp(1.12rem, 4.6vw, 1.45rem);
  font-weight: 850;
  letter-spacing: -.02em;
}
.details {
  color: var(--muted);
  min-height: 24px;
  font-variant-numeric: tabular-nums;
}
.meter-wrap { margin: 24px 0 22px; }
.meter-labels {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 900;
  padding: 0 4px 8px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.meter {
  position: relative;
  height: 72px;
  border-radius: 22px;
  background:
    linear-gradient(90deg,
      rgba(88,166,255,.26) 0%,
      rgba(88,166,255,.12) 38%,
      rgba(46,160,67,.32) 46%,
      rgba(46,160,67,.32) 54%,
      rgba(210,153,34,.12) 62%,
      rgba(210,153,34,.26) 100%);
  border: 1px solid var(--border);
  overflow: hidden;
}
.meter::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 50%;
  width: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,.65);
  transform: translateX(-50%);
}
.meter::after {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 18px;
  left: 46%;
  width: 8%;
  border-radius: 999px;
  border: 2px solid rgba(46,160,67,.86);
  background: rgba(46,160,67,.12);
}
.needle {
  position: absolute;
  top: 9px;
  left: 50%;
  width: 8px;
  height: 54px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 0 22px rgba(255,255,255,.4);
  transform: translateX(-50%);
  transition: background 160ms ease, opacity 160ms ease, left 120ms ease;
}
.needle::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -7px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: inherit;
  transform: translateX(-50%);
}
.tick {
  position: absolute;
  bottom: 9px;
  width: 1px;
  height: 9px;
  background: rgba(255,255,255,.28);
  left: var(--x);
}
.strings {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  margin: 18px 0 20px;
}
.string {
  border: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--muted);
  border-radius: 16px;
  padding: 11px 4px;
  text-align: center;
  font-weight: 950;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}
.string.active {
  color: var(--text);
  border-color: rgba(255,255,255,.35);
  background: rgba(88,166,255,.18);
}
.string.active.in-tune {
  background: rgba(46,160,67,.24);
  border-color: rgba(46,160,67,.72);
}
button {
  appearance: none;
  border: 0;
  width: 100%;
  min-height: 62px;
  border-radius: 20px;
  background: var(--blue);
  color: #07111f;
  font-size: 1.15rem;
  font-weight: 950;
  cursor: pointer;
  box-shadow: 0 12px 34px rgba(88,166,255,.25);
  touch-action: manipulation;
}
button.stop {
  background: var(--red);
  color: #fff;
  box-shadow: 0 12px 34px rgba(248,81,73,.22);
}
button:active { transform: scale(.985); }
.small-note {
  color: var(--muted);
  text-align: center;
  font-size: .88rem;
  line-height: 1.35;
  margin-top: 12px;
}
.level {
  height: 10px;
  background: rgba(255,255,255,.08);
  border-radius: 999px;
  overflow: hidden;
  margin: 0 0 16px;
}
.level-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: rgba(255,255,255,.55);
  transition: width 80ms linear;
}
.grid-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
  margin-top: 14px;
}
.grid-links a {
  display: block;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--panel-soft);
  color: var(--text);
  text-decoration: none;
  font-weight: 850;
}
.notice {
  border-left: 4px solid var(--blue);
  background: rgba(88,166,255,.1);
  padding: 12px 14px;
  border-radius: 14px;
  color: #c9d1d9;
}
.footer {
  width: min(100%, 1000px);
  margin: 0 auto;
  padding: 20px 16px 28px;
  color: var(--muted);
  text-align: center;
  font-size: .9rem;
}
.footer a { color: var(--muted); }
@media (max-width: 850px) {
  .app-layout { grid-template-columns: 1fr; }
}
@media (max-width: 460px) {
  .nav { align-items: flex-start; flex-direction: column; }
  .nav-links { justify-content: flex-start; }
  .tuner-card, .content-card { border-radius: 24px; }
  .strings { gap: 6px; }
  .string { border-radius: 13px; font-size: .9rem; padding: 10px 2px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
