:root {
  --ink: #f3efe4;
  --muted: #9ca69b;
  --deep: #101410;
  --panel: #171d18;
  --line: #303b32;
  --green: #b9ef75;
  --orange: #ff7657;
  --blue: #76d7e7;
  --shadow: #0008;
}

* { box-sizing: border-box; }
html { background: var(--deep); }
body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(#ffffff08 1px, transparent 1px),
    linear-gradient(90deg, #ffffff08 1px, transparent 1px),
    var(--deep);
  background-size: 48px 48px;
  font-family: "DM Sans", sans-serif;
}

button, select { font: inherit; }
button { color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.ambient { position: fixed; z-index: -1; width: 34rem; height: 34rem; border-radius: 50%; filter: blur(100px); opacity: .11; pointer-events: none; }
.ambient-one { top: -17rem; right: -8rem; background: var(--green); }
.ambient-two { bottom: -20rem; left: -12rem; background: var(--blue); }

.page-shell { width: calc(100% - 40px); max-width: 1060px; margin: auto; }
.nav { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; padding: 30px 0; border-bottom: 1px solid var(--line); }
.wordmark { color: var(--ink); font: 600 25px/1 "Playfair Display", serif; text-decoration: none; letter-spacing: -1px; }
.wordmark span { color: var(--orange); }
.nav-label, .eyebrow, .privacy-badge, .listen-state, .input-field > span, footer { font: 500 10px/1 "DM Mono", monospace; letter-spacing: .09em; text-transform: uppercase; }
.nav-label { color: var(--muted); }
.privacy-badge { justify-self: end; display: flex; gap: 8px; align-items: center; color: var(--muted); }
.privacy-badge i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 16px var(--green); }

.hero { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, .7fr); gap: 70px; align-items: end; padding: 76px 0 48px; }
.hero > *, .tuner-card, .meter, .controls > * { min-width: 0; }
.eyebrow { margin: 0 0 15px; color: var(--green); }
h1 { margin: 0; font-size: clamp(45px, 7vw, 78px); font-weight: 500; letter-spacing: -.06em; line-height: .96; }
h1 em { color: var(--green); font-family: "Playfair Display", serif; font-weight: 600; }
.intro { margin: 0 0 5px; color: var(--muted); font-size: 15px; line-height: 1.65; }

.tuner-card { padding: 10px; border: 1px solid var(--line); border-radius: 28px; background: #111712cc; box-shadow: 0 35px 90px var(--shadow); backdrop-filter: blur(15px); }
.meter { position: relative; min-height: 470px; overflow: hidden; border-radius: 20px; background: radial-gradient(circle at 50% 64%, #273226, #171d18 48%, #111611 75%); }
.meter::before { content: ""; position: absolute; inset: 18px; border: 1px solid #ffffff0b; border-radius: 14px; pointer-events: none; }
.meter-scale { position: absolute; top: 38px; left: 7%; right: 7%; display: grid; grid-template-columns: repeat(5, 1fr); color: #748076; font: 400 9px "DM Mono", monospace; }
.meter-scale span:nth-child(n+2), .meter-scale strong { text-align: center; }
.meter-scale span:last-child { text-align: right; }
.meter-scale strong { color: var(--green); font-weight: 500; }
.meter-track { position: absolute; top: 70px; left: 8%; right: 8%; height: 88px; border-top: 1px solid var(--line); background: repeating-linear-gradient(90deg, transparent 0 calc(2% - 1px), #526054 2%); mask-image: linear-gradient(to bottom, #000 0 22px, transparent 22px); }
.meter-track::after { content: ""; position: absolute; top: -8px; left: 50%; width: 1px; height: 53px; background: var(--green); box-shadow: 0 0 14px var(--green); }
.tolerance-zone { position: absolute; top: -1px; bottom: 40px; left: 45%; width: 10%; background: linear-gradient(90deg, transparent, #b9ef7530, transparent); }
.needle { position: absolute; top: -17px; left: var(--needle-left); width: 2px; height: 70px; background: var(--orange); box-shadow: 0 0 16px var(--orange); transition: left 110ms ease-out, background .2s; }
.meter.in-tune .needle { background: var(--green); box-shadow: 0 0 18px var(--green); }
.needle i { position: absolute; bottom: 0; left: 50%; width: 10px; height: 10px; border: 2px solid currentColor; border-radius: 50%; transform: translate(-50%, 50%); }

.readout { position: absolute; inset: 145px 0 auto; display: flex; flex-direction: column; align-items: center; }
.listen-state { min-height: 1em; color: var(--muted); }
.note-row { display: flex; align-items: flex-start; min-height: 142px; margin: 5px 0 -4px; }
.note-row strong { font: 600 clamp(105px, 20vw, 155px)/.94 "Playfair Display", serif; letter-spacing: -.08em; }
.note-row sup { min-width: 20px; margin-top: 29px; color: var(--green); font: 500 20px "DM Mono", monospace; }
.cents { min-height: 1.3em; color: var(--ink); font: 500 15px "DM Mono", monospace; }
.frequency { margin-top: 7px; color: var(--muted); font: 400 11px "DM Mono", monospace; }
.signal { position: absolute; left: 34px; right: 34px; bottom: 24px; display: grid; grid-template-columns: auto 1fr 34px; gap: 12px; align-items: center; color: #778178; font: 400 9px "DM Mono", monospace; text-transform: uppercase; letter-spacing: .06em; }
.signal-track { height: 2px; background: #4c574e; }
.signal-track i { display: block; width: var(--level); height: 100%; background: var(--blue); box-shadow: 0 0 9px var(--blue); transition: width 80ms linear; }
.signal span:last-child { text-align: right; }

.controls { display: grid; grid-template-columns: 1fr auto; gap: 12px; padding: 14px 4px 4px; }
.input-field { position: relative; display: flex; align-items: center; gap: 12px; min-width: 0; padding-left: 15px; border: 1px solid var(--line); border-radius: 14px; background: #0d120e; }
.input-field > span { flex: 0 0 auto; color: #707b71; }
select { width: 100%; min-width: 0; padding: 14px 36px 14px 0; border: 0; outline: 0; color: var(--ink); background: transparent; font: 400 12px "DM Mono", monospace; }
select:disabled { color: #778078; }
.start-button { min-width: 180px; padding: 0 24px; border: 0; border-radius: 14px; background: var(--green); color: #15200e; font: 500 12px "DM Mono", monospace; cursor: pointer; transition: transform .2s, filter .2s; }
.start-button:hover { transform: translateY(-2px); filter: brightness(1.08); }
.button-dot { display: inline-block; width: 7px; height: 7px; margin-right: 9px; border-radius: 50%; background: var(--orange); }
.start-button.listening .button-dot { background: #15200e; box-shadow: 0 0 0 5px #15200e19; animation: pulse 1.4s infinite; }
.permission-note { margin: 13px 8px 6px; color: var(--muted); font-size: 11px; line-height: 1.5; }

.string-section { padding: 75px 0 45px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 21px; }
.section-heading h2 { margin: 0; font: 600 34px/1 "Playfair Display", serif; letter-spacing: -.03em; }
.auto-button { padding: 10px 14px; border: 1px solid var(--line); border-radius: 999px; background: transparent; color: var(--muted); font: 500 10px "DM Mono", monospace; cursor: pointer; }
.auto-button.active { border-color: #b9ef7560; background: #b9ef7510; color: var(--green); }
.strings { display: grid; grid-template-columns: repeat(6, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: #11161280; }
.string-note { position: relative; min-height: 138px; padding: 18px 5px; border: 0; border-right: 1px solid var(--line); background: transparent; cursor: pointer; transition: background .2s, color .2s; }
.string-note:last-child { border-right: 0; }
.string-note:hover, .string-note.active { background: #b9ef750d; }
.string-note.active::after { content: ""; position: absolute; right: 25%; bottom: 0; left: 25%; height: 2px; background: var(--green); box-shadow: 0 0 10px var(--green); }
.string-note span, .string-note small { display: block; color: var(--muted); font: 400 9px "DM Mono", monospace; }
.string-note strong { display: block; margin: 18px 0 11px; font: 600 39px/1 "Playfair Display", serif; }
.string-note sub { color: var(--green); font: 500 11px "DM Mono", monospace; }
.string-note.detected:not(.active) strong { color: var(--blue); }
.string-help { margin: 13px 0 0; color: var(--muted); font-size: 11px; }

.tips { margin-bottom: 65px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tips summary { padding: 22px 0; color: var(--ink); font: 500 12px "DM Mono", monospace; cursor: pointer; }
.tips > div { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; padding: 0 0 24px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.tips p { margin: 0; }
footer { padding: 0 20px 32px; color: #6f786f; text-align: center; font-size: 9px; }

@keyframes pulse { 50% { box-shadow: 0 0 0 7px #15200e05; } }
@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; gap: 25px; padding-top: 55px; }
  .intro { max-width: 520px; }
  .strings { grid-template-columns: repeat(3, 1fr); }
  .string-note:nth-child(3) { border-right: 0; }
  .string-note:nth-child(-n+3) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 540px) {
  .page-shell { width: calc(100% - 24px); }
  .nav { grid-template-columns: 1fr auto; }
  .nav-label { display: none; }
  .privacy-badge { font-size: 8px; }
  .hero { padding: 46px 5px 35px; }
  .meter { min-height: 430px; }
  .meter-track { left: 6%; right: 6%; }
  .note-row { min-height: 132px; }
  .controls { grid-template-columns: 1fr; }
  .input-field { min-height: 49px; }
  .start-button { min-height: 49px; }
  .strings { grid-template-columns: repeat(2, 1fr); }
  .string-note { min-height: 110px; }
  .string-note:nth-child(n) { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
  .string-note:nth-child(2n) { border-right: 0; }
  .string-note:nth-child(n+5) { border-bottom: 0; }
  .string-note strong { margin: 12px 0 8px; }
  .tips > div { grid-template-columns: 1fr; gap: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
