.fullscreen-control {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
}

/* Reference-style open strings: one continuous maple end, then the nut. */
.headstock {
  overflow: hidden;
  background:
    repeating-linear-gradient(3deg, transparent 0 13px, rgba(116, 69, 31, 0.08) 14px, transparent 15px 28px),
    linear-gradient(90deg, #c88d4e 0%, #e6bd7d 48%, #d39a57 100%);
  border-radius: 0;
  clip-path: polygon(0 8%, 32% 8%, 47% 0, 100% 0, 100% 100%, 47% 100%, 32% 92%, 0 92%);
  box-shadow: inset -14px 0 20px rgba(103, 57, 25, 0.2);
}

.headstock::after,
.headstock-logo,
.tuner-peg {
  display: none;
}

.headstock i {
  left: 0;
  right: -2px;
  width: auto;
  height: 2px;
  background: linear-gradient(#fffdf5, #8f8d86 62%, #eee8dc);
  box-shadow: 0 1px 1px rgba(35, 25, 18, 0.48);
  transform: translateY(-50%);
}

.headstock i:nth-of-type(1) { top: 8.333% !important; height: 1px; }
.headstock i:nth-of-type(2) { top: 25% !important; height: 1px; }
.headstock i:nth-of-type(3) { top: 41.667% !important; height: 1.5px; }
.headstock i:nth-of-type(4) { top: 58.333% !important; height: 2px; }
.headstock i:nth-of-type(5) { top: 75% !important; height: 2.5px; }
.headstock i:nth-of-type(6) { top: 91.667% !important; height: 3px; }

.note.fret-0 {
  background:
    repeating-linear-gradient(3deg, transparent 0 13px, rgba(62, 31, 14, 0.1) 14px, transparent 15px 28px),
    linear-gradient(90deg, #9d602d, #b97536 52%, #8c4f24);
  border-right: 6px solid #e6dfca;
  box-shadow: inset 1px 0 rgba(255, 228, 184, 0.2), inset -5px 0 9px rgba(55, 27, 12, 0.28);
}

.note.fret-0 > span {
  display: none;
}

.note:focus {
  outline: none;
}

.string-row::before {
  position: absolute;
  z-index: 8;
  left: 2.14%;
  top: 50%;
  color: #fffdf7;
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(14px, 1.35vw, 21px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 1px rgba(45, 20, 8, 0.9);
  transform: translate(-50%, -50%);
  pointer-events: none;
  content: "";
}

.string-row:nth-child(1)::before { content: "E"; }
.string-row:nth-child(2)::before { content: "B"; }
.string-row:nth-child(3)::before { content: "G"; }
.string-row:nth-child(4)::before { content: "D"; }
.string-row:nth-child(5)::before { content: "A"; }
.string-row:nth-child(6)::before { content: "E"; }

.string-row:has(.note.fret-0.marked)::before {
  color: #ffe09b;
}

.string-row:has(.note.fret-0.sounding)::before,
.string-row:has(.note.fret-0:focus-visible)::before {
  color: #9ce3ba;
  text-shadow: 0 0 8px rgba(91, 194, 141, 0.78);
}

.left-handed .string-row::before {
  left: auto;
  right: 2.14%;
  transform: translate(50%, -50%);
}

/* Fret inlays are centered independently of the fret-number baseline. */
.fret-markers {
  z-index: 2;
}

.fret-markers span {
  align-self: stretch;
  padding-top: 0;
  color: transparent;
  font-size: 0;
}

.fret-markers .dot::before,
.fret-markers .dot-12::after {
  width: clamp(13px, 1.35vw, 20px);
  height: clamp(13px, 1.35vw, 20px);
  border: 1px solid rgba(231, 225, 211, 0.3);
  background: #827b72;
  box-shadow: inset 0 2px 4px rgba(34, 28, 23, 0.45), 0 1px 2px rgba(20, 12, 8, 0.24);
}

.fret-markers .dot-12::before {
  top: 16.667%;
  background: #827b72;
  box-shadow: inset 0 2px 4px rgba(34, 28, 23, 0.45), 0 1px 2px rgba(20, 12, 8, 0.24);
}

.fret-markers .dot-12::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 83.333%;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.fullscreen-control svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fullscreen-control span {
  margin: 0 !important;
  color: inherit !important;
  font-size: inherit !important;
}

.toolbar > button.fullscreen-control {
  height: 41px;
  min-height: 41px;
  padding: 0 13px;
  border-color: #bad8c7;
  border-radius: 8px;
  background: #edf5f0;
  color: var(--green);
  font-weight: 600;
  box-shadow: none;
  transition: background 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.toolbar > button.fullscreen-control:hover,
.toolbar > button.fullscreen-control.active {
  border-color: #8ebea3;
  background: var(--mint);
  color: #245f47;
  box-shadow: 0 4px 12px rgba(46, 118, 87, .1);
  transform: none;
}

.toolbar > button.fullscreen-control:focus-visible {
  outline: 3px solid rgba(46, 118, 87, 0.28);
  outline-offset: 2px;
}

.guitar-app:fullscreen,
.guitar-app:-webkit-full-screen {
  width: 100vw;
  max-width: none;
  height: 100vh;
  height: 100dvh;
  margin: 0;
  display: flex;
  flex-direction: column;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: #fff;
}

.guitar-app:fullscreen > :not(.fretboard-scroll),
.guitar-app:-webkit-full-screen > :not(.fretboard-scroll) {
  flex: 0 0 auto;
}

.guitar-app:fullscreen .fretboard-scroll,
.guitar-app:-webkit-full-screen .fretboard-scroll {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
}

.guitar-app:fullscreen .fretboard,
.guitar-app:-webkit-full-screen .fretboard {
  height: clamp(300px, min(46vh, 28vw), 520px);
}

@media (min-width: 1400px) {
  .instrument-section {
    padding-left: clamp(32px, 3vw, 64px);
    padding-right: clamp(32px, 3vw, 64px);
  }

  .title-row,
  .guitar-app {
    max-width: 1760px;
  }

  .fretboard {
    height: 330px;
    padding-top: 15px;
    padding-bottom: 35px;
  }

  .headstock {
    width: 170px;
    flex-basis: 170px;
  }

  .headstock-logo {
    left: 56px;
    top: 116px;
    font-size: 41px;
  }

  .headstock i {
    left: 0;
    right: -2px;
    width: auto;
  }

  .headstock i:nth-of-type(1) { top: 8.333% !important; }
  .headstock i:nth-of-type(2) { top: 25% !important; }
  .headstock i:nth-of-type(3) { top: 41.667% !important; }
  .headstock i:nth-of-type(4) { top: 58.333% !important; }
  .headstock i:nth-of-type(5) { top: 75% !important; }
  .headstock i:nth-of-type(6) { top: 91.667% !important; }

  .string-row {
    height: auto;
    flex: 1 1 0;
  }

  .note > span {
    width: 31px;
    height: 31px;
    font-size: 11px;
  }

  .fret-markers span {
    padding-top: 0;
  }

  .guitar-app:fullscreen .headstock-logo,
  .guitar-app:-webkit-full-screen .headstock-logo {
    top: 164px;
  }

  .guitar-app:fullscreen .headstock i:nth-of-type(1),
  .guitar-app:-webkit-full-screen .headstock i:nth-of-type(1) { top: 8.333% !important; }
  .guitar-app:fullscreen .headstock i:nth-of-type(2),
  .guitar-app:-webkit-full-screen .headstock i:nth-of-type(2) { top: 25% !important; }
  .guitar-app:fullscreen .headstock i:nth-of-type(3),
  .guitar-app:-webkit-full-screen .headstock i:nth-of-type(3) { top: 41.667% !important; }
  .guitar-app:fullscreen .headstock i:nth-of-type(4),
  .guitar-app:-webkit-full-screen .headstock i:nth-of-type(4) { top: 58.333% !important; }
  .guitar-app:fullscreen .headstock i:nth-of-type(5),
  .guitar-app:-webkit-full-screen .headstock i:nth-of-type(5) { top: 75% !important; }
  .guitar-app:fullscreen .headstock i:nth-of-type(6),
  .guitar-app:-webkit-full-screen .headstock i:nth-of-type(6) { top: 91.667% !important; }

  .guitar-app:fullscreen .fret-markers span,
  .guitar-app:-webkit-full-screen .fret-markers span {
    padding-top: 0;
  }
}

@media (max-width: 820px) {
  .fullscreen-control {
    gap: 0;
  }

  .fullscreen-control span {
    display: none;
  }
}

/* Six equal rows fill the whole neck, so no empty band appears underneath. */
.neck {
  height: 100%;
  min-height: 0;
}

.string-row {
  height: auto;
  min-height: 0;
  flex: 1 1 0;
}

.string-row,
.fret-markers {
  grid-template-columns: 0.58fr repeat(13, minmax(0, 1fr));
}

.note {
  min-height: 0;
}

.guitar-app:has(.toolbar > .dropdown-control:first-of-type > button.active)
  .note:not(.marked):not(.sounding):hover > span:not(.visible) {
  opacity: 0;
  transform: scale(0.7);
}

.fret-markers {
  inset: 0;
  height: auto;
}

.headstock i:nth-of-type(1) { top: 8.333% !important; }
.headstock i:nth-of-type(2) { top: 25% !important; }
.headstock i:nth-of-type(3) { top: 41.667% !important; }
.headstock i:nth-of-type(4) { top: 58.333% !important; }
.headstock i:nth-of-type(5) { top: 75% !important; }
.headstock i:nth-of-type(6) { top: 91.667% !important; }

@media (max-width: 620px) {
  .string-row::before {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0;
    text-shadow: 0 1px 1px rgba(45, 20, 8, 0.72);
  }

  .note {
    border-right: 1px solid #aaa89f;
  }

  .note.fret-0 {
    border-right: 3px solid #e6dfca;
  }

  .fret-markers .dot::before,
  .fret-markers .dot-12::after {
    width: 11px;
    height: 11px;
  }
}

.orientation-lock {
  display: none;
}

@media (max-width: 700px) and (orientation: portrait) {
  html,
  body {
    width: 100%;
    height: 100%;
    overflow: hidden;
  }

  #root {
    display: none;
  }

  .orientation-lock {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    padding: 28px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
    background: radial-gradient(circle at 50% 36%, #fffdf8, #eee8dc 72%);
    color: #292b25;
  }

  .orientation-phone {
    position: relative;
    width: 48px;
    height: 76px;
    margin-bottom: 28px;
    border: 3px solid #2e7657;
    border-radius: 10px;
    box-shadow: 0 9px 24px rgba(46, 118, 87, 0.2);
    animation: turn-phone 1.8s ease-in-out infinite;
  }

  .orientation-phone::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 6px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #2e7657;
    transform: translateX(-50%);
  }

  .orientation-lock strong {
    font: 700 23px/1.2 Arial, Helvetica, sans-serif;
  }

  .orientation-lock p {
    max-width: 300px;
    margin: 10px 0 0;
    color: #6e7168;
    font: 14px/1.55 Arial, Helvetica, sans-serif;
  }
}

@keyframes turn-phone {
  0%, 20% { transform: rotate(0deg); }
  55%, 80% { transform: rotate(90deg); }
  100% { transform: rotate(0deg); }
}

@media (prefers-reduced-motion: reduce) {
  .orientation-phone {
    animation: none;
    transform: rotate(90deg);
  }
}
