:root {
  --bg-deep: #120e0b;
  --bg-mid: #1c1510;
  --wood: #8b5a2b;
  --amber: #e8a04a;
  --amber-hot: #ffc06a;
  --cream: #f3e6d4;
  --mute: #a8947e;
  --in-tune: #6fbf73;
  --sharp: #e8a04a;
  --flat: #d4785a;
  --line: rgba(243, 230, 212, 0.12);
  --font-display: "Syne", sans-serif;
  --font-body: "Figtree", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

@font-face {
  font-family: "Great Vibes";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/great-vibes.woff2") format("woff2");
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-body);
  color: var(--cream);
  background: var(--bg-deep);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 90% 55% at 50% -10%, rgba(232, 160, 74, 0.28), transparent 55%),
    radial-gradient(ellipse 60% 40% at 85% 70%, rgba(139, 90, 43, 0.22), transparent 50%),
    radial-gradient(ellipse 50% 35% at 10% 80%, rgba(80, 45, 20, 0.35), transparent 45%),
    linear-gradient(165deg, #1a120c 0%, #0f0c09 55%, #16100c 100%);
  pointer-events: none;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  opacity: 0.07;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

.app {
  position: relative;
  z-index: 2;
  flex: 1;
  width: min(560px, 100%);
  margin: 0 auto;
  padding: clamp(0.75rem, 3vw, 1.5rem) 1.1rem 0.75rem;
  display: flex;
  flex-direction: column;
}

.inst-switch {
  position: relative;
  z-index: 20;
  margin-bottom: 0.75rem;
  padding: 0.7rem 0.7rem 0.75rem;
  border: 1px solid rgba(232, 160, 74, 0.28);
  background: linear-gradient(180deg, rgba(42, 28, 18, 0.85), rgba(18, 14, 11, 0.72));
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  pointer-events: auto;
}

.inst-switch__label {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--amber);
}

.inst-switch__row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.35rem;
}

@media (min-width: 520px) {
  .inst-switch__row {
    grid-template-columns: repeat(7, 1fr);
  }
}

.inst-chip {
  appearance: none;
  border: 1px solid rgba(243, 230, 212, 0.16);
  background: rgba(243, 230, 212, 0.06);
  color: var(--cream);
  font-family: var(--font-display);
  padding: 0.7rem 0.4rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s, transform 0.15s;
  min-height: 3.1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.15rem;
  -webkit-tap-highlight-color: rgba(232, 160, 74, 0.25);
  touch-action: manipulation;
  pointer-events: auto;
  position: relative;
  z-index: 1;
}

.inst-chip__name {
  font-weight: 800;
  font-size: 0.82rem;
  letter-spacing: -0.01em;
  line-height: 1.1;
}

.inst-chip__meta {
  font-family: var(--font-body);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--mute);
}

.inst-chip:hover,
.inst-chip:focus-visible {
  border-color: rgba(232, 160, 74, 0.65);
  background: rgba(232, 160, 74, 0.12);
  outline: none;
  transform: translateY(-1px);
}

.inst-chip:active {
  transform: scale(0.98);
}

.inst-chip.is-active {
  border-color: var(--amber);
  background: linear-gradient(160deg, rgba(232, 160, 74, 0.28), rgba(232, 160, 74, 0.1));
  box-shadow: inset 0 0 0 1px rgba(232, 160, 74, 0.25);
}

.inst-chip.is-active .inst-chip__name {
  color: var(--amber-hot);
}

.inst-chip.is-active .inst-chip__meta {
  color: var(--amber);
}

body.on-tuner .app {
  padding-top: 0.55rem;
}

body.on-tuner .inst-switch {
  margin-bottom: 0.5rem;
  padding: 0.55rem 0.55rem 0.6rem;
}

body.on-tuner .inst-chip {
  min-height: 2.75rem;
  padding: 0.55rem 0.3rem;
}

body.on-tuner .inst-chip__name {
  font-size: 0.78rem;
}

body.on-tuner .inst-chip__meta {
  font-size: 0.58rem;
}

.screen {
  display: none;
  flex-direction: column;
  gap: 1.1rem;
  animation: rise 0.55s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.screen--active {
  display: flex;
}

.screen[hidden] {
  display: none !important;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.brand-block {
  text-align: center;
  padding-top: 1.25rem;
  overflow: visible;
}

.brand-block--compact {
  padding-top: 0.25rem;
}

.brand-icon {
  display: block;
  width: 56px;
  height: 56px;
  margin: 0 auto 0.65rem;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
  animation: brand-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.brand-icon--hero {
  width: clamp(96px, 28vw, 128px);
  height: clamp(96px, 28vw, 128px);
  border-radius: 28px;
  margin-bottom: 1rem;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
}

.brand-mark {
  display: inline-block;
  max-width: 100%;
  margin: 0 0 0.45rem;
  padding: 0.08em 0.12em 0.32em;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.5rem, 10vw, 3.85rem);
  letter-spacing: -0.02em;
  line-height: 1.3;
  overflow: visible;
  background: linear-gradient(180deg, var(--cream) 20%, var(--amber) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
  animation: brand-in 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.brand-mark--sm {
  font-size: clamp(1.65rem, 6.5vw, 2.2rem);
  margin-bottom: 0.3rem;
  padding: 0.06em 0.1em 0.28em;
  line-height: 1.32;
}

.brand-slogan {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1rem, 3.5vw, 1.2rem);
  letter-spacing: 0.04em;
  color: var(--amber);
  animation: rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both;
}

.brand-block--compact .brand-slogan {
  margin-bottom: 0.65rem;
  font-size: 0.92rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.android-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  text-align: center;
}

.section-label {
  margin: 0 0 0.15rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mute);
}

.install-hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--mute);
  line-height: 1.4;
  max-width: 32ch;
}

.install-hint strong {
  color: var(--cream);
  font-weight: 600;
}

.status-pill {
  margin: 0.25rem auto 0;
  padding: 0.4rem 0.85rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--amber);
  border: 1px solid rgba(232, 160, 74, 0.28);
  border-radius: 999px;
  background: rgba(232, 160, 74, 0.08);
  width: fit-content;
}

body.is-android-app #android-actions,
body.is-android-app #pwa-status {
  display: none;
}

@media (display-mode: standalone) {
  .brand-block {
    padding-top: 0.5rem;
  }
}

@keyframes brand-in {
  from {
    opacity: 0;
    letter-spacing: 0.04em;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    letter-spacing: -0.02em;
    transform: scale(1);
  }
}

.headline {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.35rem, 4.5vw, 1.75rem);
  letter-spacing: -0.02em;
  color: var(--cream);
}

.lede {
  margin: 0 auto;
  max-width: 28ch;
  font-size: 1rem;
  line-height: 1.45;
  color: var(--mute);
  font-weight: 500;
}

.choice-row {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.choice {
  appearance: none;
  border: 1px solid var(--line);
  background: linear-gradient(135deg, rgba(243, 230, 212, 0.06), rgba(232, 160, 74, 0.04));
  color: inherit;
  text-align: left;
  padding: 1.2rem 1.35rem;
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
  position: relative;
  overflow: hidden;
}

.choice::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--amber);
  transform: scaleY(0);
  transform-origin: bottom;
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
}

.choice:hover,
.choice:focus-visible {
  border-color: rgba(232, 160, 74, 0.45);
  background: linear-gradient(135deg, rgba(232, 160, 74, 0.12), rgba(243, 230, 212, 0.05));
  outline: none;
  transform: translateX(4px);
}

.choice:hover::before,
.choice:focus-visible::before {
  transform: scaleY(1);
}

.choice:active {
  transform: translateX(2px) scale(0.99);
}

.choice__label {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  margin-bottom: 0.2rem;
}

.choice__hint {
  display: block;
  font-size: 0.88rem;
  color: var(--mute);
}

.cta-strip {
  margin-top: 0.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  align-items: center;
}

.btn {
  appearance: none;
  border: none;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.95rem 1.5rem;
  border-radius: 2px;
  transition: transform 0.15s, filter 0.15s, background 0.2s;
}

.btn--install {
  width: 100%;
  max-width: 320px;
  background: var(--amber);
  color: #1a120c;
}

.btn--install:hover,
.btn--install:focus-visible {
  filter: brightness(1.08);
  outline: none;
}

.btn--download {
  width: 100%;
  max-width: 320px;
  background: transparent;
  color: var(--cream);
  border: 1px solid rgba(232, 160, 74, 0.45);
}

.btn--download:hover,
.btn--download:focus-visible {
  background: rgba(232, 160, 74, 0.12);
  outline: none;
}

.btn--install:active,
.btn--download:active {
  transform: scale(0.98);
}

.btn--mic {
  width: 100%;
  background: transparent;
  color: var(--cream);
  border: 1px solid rgba(232, 160, 74, 0.55);
}

.btn--mic:hover,
.btn--mic:focus-visible {
  background: rgba(232, 160, 74, 0.15);
  outline: none;
}

.btn--mic.is-live {
  background: rgba(111, 191, 115, 0.18);
  border-color: var(--in-tune);
  color: var(--in-tune);
  animation: pulse-live 2s ease-in-out infinite;
}

@keyframes pulse-live {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(111, 191, 115, 0);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(111, 191, 115, 0.12);
  }
}

.cta-note {
  margin: 0;
  font-size: 0.82rem;
  color: var(--mute);
}

.cta-note a {
  color: var(--amber);
  text-decoration: none;
  font-weight: 600;
}

.cta-note a:hover {
  text-decoration: underline;
}

.back {
  appearance: none;
  align-self: flex-start;
  border: none;
  background: transparent;
  color: var(--mute);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.25rem 0;
  transition: color 0.15s;
}

.back:hover,
.back:focus-visible {
  color: var(--cream);
  outline: none;
}

.meter {
  text-align: center;
  padding: 0.5rem 0 0.25rem;
}

.meter__needle-wrap {
  position: relative;
  height: 110px;
  max-width: 280px;
  margin: 0 auto 0.75rem;
}

.meter__scale {
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 240px;
  height: 120px;
  margin-left: -120px;
  border: 2px solid var(--line);
  border-bottom: none;
  border-radius: 120px 120px 0 0;
}

.meter__scale::before,
.meter__scale::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 2px;
  height: 12px;
  background: var(--mute);
}

.meter__scale::before {
  left: 18%;
  transform: rotate(-35deg);
}

.meter__scale::after {
  right: 18%;
  transform: rotate(35deg);
}

.meter__needle {
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 3px;
  height: 100px;
  margin-left: -1.5px;
  background: linear-gradient(to top, var(--amber), var(--amber-hot));
  transform-origin: bottom center;
  transform: rotate(0deg);
  transition: transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
  border-radius: 2px 2px 0 0;
  z-index: 2;
  will-change: transform;
}

.meter__center {
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: 14px;
  height: 14px;
  margin-left: -7px;
  border-radius: 50%;
  background: var(--amber);
  z-index: 3;
}

.meter__note {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(3rem, 12vw, 4rem);
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--cream);
  transition: color 0.2s;
}

.meter__note.is-in-tune {
  color: var(--in-tune);
}

.meter__cents {
  margin: 0.35rem 0 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--mute);
  min-height: 1.4em;
  letter-spacing: 0.01em;
  transition: color 0.2s;
}

.meter__cents.is-in-tune {
  color: var(--in-tune);
}

.meter__cents.is-tighten {
  color: var(--flat);
}

.meter__cents.is-loosen {
  color: var(--sharp);
}

.meter__hz {
  margin: 0.15rem 0 0;
  font-size: 0.85rem;
  color: var(--mute);
  opacity: 0.8;
  min-height: 1.2em;
}

.brand-block--tuner .brand-icon {
  display: none;
}

/* Compact tuner layout — dial + headstock first */
body.on-tuner .site-footer {
  display: none;
}

.screen--tuner {
  gap: 0.55rem !important;
}

.screen--tuner.screen--active {
  padding-bottom: 0.5rem;
}

.tuner-bar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 2.25rem;
}

.tuner-bar .back {
  flex: 0 0 auto;
  font-size: 1.15rem;
  padding: 0.2rem 0.35rem;
}

.tuner-bar__meta {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.tuner-bar__brand {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  color: var(--amber);
  line-height: 1.1;
}

.tuner-bar__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--cream);
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tuner-bar__active {
  margin: 0;
  flex: 0 0 auto;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  color: var(--amber-hot);
  border: 1px solid rgba(232, 160, 74, 0.45);
  background: rgba(232, 160, 74, 0.12);
  padding: 0.35rem 0.55rem;
  border-radius: 2px;
  min-width: 3.5rem;
  text-align: center;
}

.tuner-bar__sub {
  margin: -0.15rem 0 0.15rem;
  font-size: 0.78rem;
  color: var(--mute);
  text-align: left;
}

.meter--compact {
  padding: 0;
}

.meter--compact .meter__needle-wrap {
  height: 78px;
  max-width: 220px;
  margin-bottom: 0.35rem;
}

.meter--compact .meter__scale {
  width: 190px;
  height: 95px;
  margin-left: -95px;
}

.meter--compact .meter__needle {
  height: 72px;
}

.meter--compact .meter__note {
  font-size: clamp(2.1rem, 9vw, 2.75rem);
}

.meter--compact .meter__cents {
  font-size: 0.95rem;
}

.meter--compact .meter__hz {
  font-size: 0.75rem;
  min-height: 1em;
}

.btn--mic-compact {
  padding: 0.7rem 1rem;
  font-size: 0.92rem;
}

.tuner-controls {
  display: flex;
  gap: 0.55rem;
  width: 100%;
  align-items: stretch;
}

.tuner-controls .btn--mic {
  flex: 1;
}

.btn--tone-stop {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 7.5rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid rgba(232, 160, 74, 0.55);
  border-radius: 2px;
  background:
    linear-gradient(135deg, rgba(232, 160, 74, 0.22), rgba(229, 57, 53, 0.14));
  color: var(--cream);
  box-shadow: 0 0 0 0 rgba(232, 160, 74, 0);
  animation: tone-pulse 1.6s ease-in-out infinite;
  transition: transform 0.15s, filter 0.15s, border-color 0.15s, background 0.15s;
}

.btn--tone-stop[hidden] {
  display: none !important;
}

.btn--tone-stop__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 1.55rem;
  height: 1.55rem;
  border-radius: 50%;
  background: rgba(18, 14, 11, 0.35);
  border: 1px solid rgba(243, 230, 212, 0.2);
  flex-shrink: 0;
}

.btn--tone-stop__bar {
  display: block;
  width: 3px;
  height: 11px;
  border-radius: 1px;
  background: var(--amber-hot);
}

.btn--tone-stop__text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
  text-align: left;
}

.btn--tone-stop__label {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.88rem;
  letter-spacing: 0.02em;
  color: var(--cream);
}

.btn--tone-stop__sub {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--amber);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 0.12rem;
}

.btn--tone-stop:hover,
.btn--tone-stop:focus-visible {
  filter: brightness(1.08);
  border-color: var(--amber-hot);
  outline: none;
  transform: translateY(-1px);
}

.btn--tone-stop:active {
  transform: translateY(0) scale(0.98);
}

@keyframes tone-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(232, 160, 74, 0);
  }
  50% {
    box-shadow: 0 0 0 5px rgba(232, 160, 74, 0.14);
  }
}

.screen--tuner .headstock {
  width: min(260px, 78vw);
  margin-top: 0.15rem;
}

.screen--tuner .headstock[data-layout="6+6"] {
  width: min(320px, 92vw);
  aspect-ratio: 340 / 560;
}

.screen--tuner .headstock[data-layout="harp"] {
  width: min(420px, 96vw);
  aspect-ratio: auto;
  height: auto;
}

.headstock[data-layout="harp"] {
  width: min(420px, 96vw);
  aspect-ratio: auto;
  margin-bottom: 0.25rem;
}

.headstock[data-layout="harp"] .harp-svg {
  aspect-ratio: 420 / 520;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 22px 36px rgba(0, 0, 0, 0.5));
}

.headstock[data-layout="harp"] .headstock-logo__pater {
  font-size: 26px;
  fill: #f8ecd8;
}

.headstock[data-layout="harp"] .headstock-logo__brand {
  font-size: 15px;
  fill: #ffc06a;
}

.harp-string-rail {
  display: flex;
  gap: 0.1rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.35rem 0.1rem 0.45rem;
  margin-top: 0.15rem;
  scrollbar-width: thin;
}

.harp-string-btn {
  appearance: none;
  border: 1px solid rgba(243, 230, 212, 0.14);
  background: rgba(243, 230, 212, 0.05);
  color: var(--cream);
  flex: 0 0 auto;
  width: 1.55rem;
  min-height: 2.6rem;
  padding: 0.32rem 0.05rem;
  border-radius: 2px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  font-family: var(--font-display);
  transition: border-color 0.15s, background 0.15s, transform 0.12s ease;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  user-select: none;
}

.harp-string-btn:active {
  transform: scale(0.93);
  border-color: rgba(232, 160, 74, 0.85);
  background: rgba(232, 160, 74, 0.2);
}

.harp-string-btn__note {
  font-weight: 800;
  font-size: 0.58rem;
  line-height: 1;
}

.harp-string-btn__pos {
  font-family: var(--font-body);
  font-size: 0.48rem;
  font-weight: 600;
  color: var(--mute);
  line-height: 1;
}

.harp-string-btn--c {
  border-color: rgba(229, 57, 53, 0.45);
  background: rgba(229, 57, 53, 0.1);
}

.harp-string-btn--f {
  border-color: rgba(66, 133, 244, 0.45);
  background: rgba(66, 133, 244, 0.1);
}

.harp-string-btn.is-target {
  border-color: rgba(232, 160, 74, 0.85);
  background: rgba(232, 160, 74, 0.16);
}

.harp-string-btn.is-target .harp-string-btn__note {
  color: var(--amber-hot);
}

.harp-string-btn.is-in-tune {
  border-color: rgba(111, 191, 115, 0.9);
  background: rgba(111, 191, 115, 0.14);
}

.harp-string-btn.is-in-tune .harp-string-btn__note {
  color: var(--in-tune);
}

.neck-string.is-active .neck-string__wire {
  stroke: #ff1744 !important;
}

.neck-string.is-active.is-in-tune .neck-string__wire {
  stroke: #43a047 !important;
}

.string-pointer {
  transition: transform 0.2s ease;
  pointer-events: none;
}

.tuning-drawer {
  border: 1px solid var(--line);
  border-radius: 2px;
  background: rgba(243, 230, 212, 0.04);
  margin-top: 0.15rem;
}

.tuning-drawer__summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.65rem 0.8rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--mute);
}

.tuning-drawer__summary::-webkit-details-marker {
  display: none;
}

.tuning-drawer[open] .tuning-drawer__summary {
  border-bottom: 1px solid var(--line);
  color: var(--cream);
}

.tuning-drawer .tuning-picker {
  padding: 0.55rem 0.65rem 0.7rem;
}

.tuning-drawer .tuning-chips {
  max-height: 160px;
}

.headstock-hint {
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.28em;
  color: var(--amber);
}

.headstock-hint--inline {
  letter-spacing: 0.18em;
  font-size: 0.9rem;
}

.tuning-picker {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  width: 100%;
}

.tuning-picker__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0 0.15rem;
}

.tuning-picker__label {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--mute);
}

.tuning-chips {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 148px;
  overflow-y: auto;
  padding-bottom: 0.15rem;
  -webkit-overflow-scrolling: touch;
}

.tuning-chips__group {
  margin: 0.15rem 0 0;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
}

.tuning-chips__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.tuning-chip {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(243, 230, 212, 0.05);
  color: var(--cream);
  border-radius: 2px;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  text-align: left;
  min-width: calc(50% - 0.25rem);
  flex: 1 1 calc(50% - 0.25rem);
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.tuning-chip__name {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.88rem;
  line-height: 1.15;
}

.tuning-chip__code {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--mute);
}

.tuning-chip:hover,
.tuning-chip:focus-visible {
  border-color: rgba(232, 160, 74, 0.55);
  outline: none;
}

.tuning-chip.is-active {
  border-color: var(--amber);
  background: rgba(232, 160, 74, 0.16);
}

.tuning-chip.is-active .tuning-chip__code {
  color: var(--amber);
}

.tuning-select {
  appearance: none;
  width: 100%;
  padding: 0.75rem 2.25rem 0.75rem 0.9rem;
  border: 1px solid rgba(232, 160, 74, 0.4);
  border-radius: 2px;
  background: rgba(243, 230, 212, 0.08);
  color: var(--cream);
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.headstock {
  position: relative;
  width: min(300px, 92vw);
  margin: 0 auto 0.5rem;
  aspect-ratio: 280 / 420;
  user-select: none;
}

.headstock__svg {
  display: block;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 18px 28px rgba(0, 0, 0, 0.45));
}

.headstock-logo__pater,
.headstock-logo__brand {
  font-family: "Great Vibes", "Segoe Script", "Snell Roundhand", "Brush Script MT", cursive;
  fill: #f3e6d4;
  paint-order: stroke fill;
  stroke: rgba(42, 26, 14, 0.35);
  stroke-width: 0.6px;
}

.headstock-logo__pater {
  font-size: 22px;
  fill: #f8ecd8;
  opacity: 0.92;
}

.headstock-logo__brand {
  font-size: 15px;
  fill: #ffc06a;
  opacity: 0.88;
}

.headstock[data-layout="6+6"] .headstock-logo__pater {
  font-size: 24px;
}

.headstock[data-layout="6+6"] .headstock-logo__brand {
  font-size: 16px;
}

.headstock__pegs {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.peg {
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  position: absolute;
  width: 52px;
  height: 52px;
  pointer-events: auto;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  transform: translate(-50%, -50%);
  transition: transform 0.15s ease;
  z-index: 2;
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  touch-action: manipulation;
  user-select: none;
}

.peg:focus {
  outline: none;
}

.peg:hover,
.peg:focus-visible {
  transform: translate(-50%, -50%) scale(1.08);
  outline: none;
}

.peg:active {
  transform: translate(-50%, -50%) scale(0.94);
}

.peg__knob {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #f0e2c8 0%, #c4a574 45%, #6e5434 100%);
  border: 2px solid #3a2816;
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.35),
    0 4px 10px rgba(0, 0, 0, 0.4);
  position: relative;
}

/* Circular press feedback replaces the platform tap rectangle */
.peg__knob::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(
    circle,
    rgba(255, 192, 106, 0.55) 0%,
    rgba(232, 160, 74, 0.28) 45%,
    rgba(232, 160, 74, 0) 72%
  );
  opacity: 0;
  transform: scale(0.55);
  pointer-events: none;
}

.peg:active .peg__knob::before {
  opacity: 0.9;
  transform: scale(1);
  transition: opacity 0.08s ease, transform 0.12s ease;
}

.peg.is-pressed .peg__knob::before {
  animation: peg-ping 0.5s ease-out;
}

@keyframes peg-ping {
  0% {
    opacity: 0.9;
    transform: scale(0.55);
  }
  60% {
    opacity: 0.35;
    transform: scale(1.2);
  }
  100% {
    opacity: 0;
    transform: scale(1.5);
  }
}

@media (prefers-reduced-motion: reduce) {
  .peg.is-pressed .peg__knob::before {
    animation: none;
  }
}

.peg__knob::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  border: 1px solid rgba(42, 26, 14, 0.35);
}

.peg__note {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--cream);
  line-height: 1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
  margin-top: -2px;
}

.peg__pos {
  font-family: var(--font-body);
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--mute);
  line-height: 1;
}

.peg.is-target .peg__knob {
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.35),
    0 0 0 3px rgba(232, 160, 74, 0.75),
    0 4px 14px rgba(232, 160, 74, 0.35);
}

.peg.is-target .peg__note {
  color: var(--amber-hot);
}

.peg.is-in-tune .peg__knob {
  box-shadow:
    inset 0 2px 3px rgba(255, 255, 255, 0.35),
    0 0 0 3px rgba(111, 191, 115, 0.9),
    0 4px 14px rgba(111, 191, 115, 0.4);
}

.peg.is-in-tune .peg__note {
  color: var(--in-tune);
}

/* 3+3 guitar peg positions (percent of headstock) */
.headstock[data-layout="3+3"] .peg--L0 { left: 14%; top: 16%; }
.headstock[data-layout="3+3"] .peg--L1 { left: 12%; top: 32%; }
.headstock[data-layout="3+3"] .peg--L2 { left: 14%; top: 48%; }
.headstock[data-layout="3+3"] .peg--R0 { left: 86%; top: 16%; }
.headstock[data-layout="3+3"] .peg--R1 { left: 88%; top: 32%; }
.headstock[data-layout="3+3"] .peg--R2 { left: 86%; top: 48%; }

/* 2+2 bass / ukulele */
.headstock[data-layout="2+2"] .peg--L0 { left: 14%; top: 22%; }
.headstock[data-layout="2+2"] .peg--L1 { left: 13%; top: 42%; }
.headstock[data-layout="2+2"] .peg--R0 { left: 86%; top: 22%; }
.headstock[data-layout="2+2"] .peg--R1 { left: 87%; top: 42%; }

.headstock[data-layout="2+2-uke"] .peg--L0 { left: 14%; top: 22%; }
.headstock[data-layout="2+2-uke"] .peg--L1 { left: 13%; top: 42%; }
.headstock[data-layout="2+2-uke"] .peg--R0 { left: 86%; top: 22%; }
.headstock[data-layout="2+2-uke"] .peg--R1 { left: 87%; top: 42%; }

/* 6+6 twelve-string — taller stock, denser pegs */
.headstock[data-layout="6+6"] {
  width: min(340px, 94vw);
  aspect-ratio: 340 / 560;
}

.headstock[data-layout="6+6"] .peg {
  width: 42px;
  height: 42px;
}

.headstock[data-layout="6+6"] .peg__knob {
  width: 26px;
  height: 26px;
}

.headstock[data-layout="6+6"] .peg__knob::after {
  inset: 6px;
}

.headstock[data-layout="6+6"] .peg__note {
  font-size: 0.78rem;
}

.headstock[data-layout="6+6"] .peg__pos {
  font-size: 0.55rem;
}

.headstock[data-layout="6+6"] .peg--L0 { left: 12.5%; top: 8.5%; }
.headstock[data-layout="6+6"] .peg--L1 { left: 10.5%; top: 15.5%; }
.headstock[data-layout="6+6"] .peg--L2 { left: 10%; top: 22.5%; }
.headstock[data-layout="6+6"] .peg--L3 { left: 10.5%; top: 30%; }
.headstock[data-layout="6+6"] .peg--L4 { left: 11.5%; top: 37%; }
.headstock[data-layout="6+6"] .peg--L5 { left: 13.5%; top: 44%; }
.headstock[data-layout="6+6"] .peg--R0 { left: 87.5%; top: 8.5%; }
.headstock[data-layout="6+6"] .peg--R1 { left: 89.5%; top: 15.5%; }
.headstock[data-layout="6+6"] .peg--R2 { left: 90%; top: 22.5%; }
.headstock[data-layout="6+6"] .peg--R3 { left: 89.5%; top: 30%; }
.headstock[data-layout="6+6"] .peg--R4 { left: 88.5%; top: 37%; }
.headstock[data-layout="6+6"] .peg--R5 { left: 86.5%; top: 44%; }

.string-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.string-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(243, 230, 212, 0.04);
  color: var(--cream);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  padding: 0.75rem 0.9rem;
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-align: left;
  width: 100%;
}

.string-btn__pos {
  flex: 0 0 2rem;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(232, 160, 74, 0.35);
  color: var(--amber);
  font-size: 0.95rem;
  font-weight: 800;
  border-radius: 2px;
}

.string-btn__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.string-btn__note {
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.string-btn small {
  display: block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 0.75rem;
  color: var(--mute);
  margin-top: 0.15rem;
}

.string-btn.is-target {
  border-color: var(--amber);
  background: rgba(232, 160, 74, 0.14);
}

.string-btn.is-target .string-btn__pos {
  background: rgba(232, 160, 74, 0.2);
}

.string-btn.is-in-tune {
  border-color: var(--in-tune);
  color: var(--in-tune);
}

.string-btn.is-in-tune .string-btn__pos {
  border-color: var(--in-tune);
  color: var(--in-tune);
}

.string-btn:hover,
.string-btn:focus-visible {
  border-color: rgba(232, 160, 74, 0.5);
  outline: none;
}

.site-footer {
  position: relative;
  z-index: 2;
  text-align: center;
  padding: 1rem 1.25rem calc(1.25rem + var(--safe-b));
  border-top: 1px solid var(--line);
  background: rgba(12, 9, 7, 0.55);
  backdrop-filter: blur(8px);
}

.footer-system {
  margin: 0 0 0.35rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  color: var(--cream);
}

.footer-donate {
  margin: 0;
  font-size: 0.82rem;
  color: var(--mute);
  line-height: 1.4;
}

.footer-donate a {
  color: var(--amber);
  text-decoration: none;
  font-weight: 600;
}

.footer-donate a:hover {
  text-decoration: underline;
}

.footer-legal {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
}

.footer-legal a {
  color: var(--mute);
  text-decoration: none;
}

.footer-legal a:hover {
  color: var(--amber);
  text-decoration: underline;
}

@media (min-width: 480px) {
  .choice-row {
    gap: 1rem;
  }
}
