/* [KÓÐI] Grunnútlit. Gamlar reglur fyrir fjarlægð viðmót hafa verið teknar út. */
/* [ÚTSKÝRING] box-sizing lætur padding og border teljast með uppgefinni breidd. */
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: #f5f7fb;
  color: #182b43;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
main {
  max-width: 1000px;
  margin: auto;
  padding: 12px 20px 14px;
}
p {
  line-height: 1.65;
}
h1 {
  letter-spacing: -1.5px;
  margin: 0 0 6px;
}
h2 {
  font-size: 15px;
  margin: 0;
}

/* [ÚTSKÝRING] Flex með column raðar vörumerki og bakatengli lóðrétt, fyrir miðju. */
.site-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  text-align: center;
  border-bottom: 1px solid #dce3ee;
  padding: 0 0 5px;
}
.site-brand a {
  color: #005ac8;
  font-weight: 850;
  text-decoration: none;
}
.site-brand .brand-home {
  font-size: clamp(32px, 5.5vw, 44px);
  line-height: 1.12;
  letter-spacing: .045em;
}
.site-brand .home-link {
  font-size: 12px;
  letter-spacing: 0;
  font-weight: 600;
  padding: 3px 10px;
  border: 1px solid #d5e3f5;
  border-radius: 20px;
}
.site-brand .home-link:hover {
  background: #eaf2ff;
}
.intro {
  text-align: center;
  margin: 6px 0;
}
.intro h1 {
  font-size: 28px;
  margin-bottom: 2px;
}
.intro p {
  color: #64748b;
  font-size: 12px;
  margin: 0;
  line-height: 1.3;
}

/* [KÓÐI] Aðalstýringar. Sami hnappur virkjar og stöðvar hljóðnemann. */
.tuner-controls {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  margin: 0 auto 9px;
}
.settings {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
}
.settings label {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12px;
  font-weight: 650;
  color: #52647a;
  min-width: 190px;
}
select {
  font: inherit;
  font-size: 14px;
  color: #182b43;
  height: 44px;
  padding: 8px 30px 8px 12px;
  border: 1px solid #cbd6e4;
  border-radius: 9px;
  background: white;
  max-width: 100%;
}
button {
  font: inherit;
  cursor: pointer;
  border: 0;
  border-radius: 10px;
  padding: 12px 18px;
  font-size: 14px;
  font-weight: 650;
}
button:disabled {
  opacity: .45;
  cursor: default;
}
/* [ÚTSKÝRING] focus-visible sýnir ramma við lyklaborðsnotkun. */
button:focus-visible, a:focus-visible, select:focus-visible, summary:focus-visible {
  outline: 3px solid #6faafa;
  outline-offset: 3px;
}
.microphone-start {
  text-align: center;
}
.primary {
  background: #005ac8;
  color: white;
}
.microphone-start #start {
  min-width: 210px;
  max-width: 100%;
  min-height: 44px;
  padding: 9px 18px;
  font-size: 16px;
  font-weight: 750;
  border-radius: 9px;
}
.live .microphone-start #start {
  background: #e5f5eb;
  color: #18734c;
}
.status {
  font-size: 12px;
  color: #52647a;
  min-height: 18px;
  margin: 0 0 5px;
  text-align: center;
  line-height: 1.4;
}
.live .status::before {
  content: '';
  display: inline-block;
  margin-right: 8px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #005ac8;
}

/* [KÓÐI] Hálsmynd: stærðir og röðun haldast í anda fyrri útgáfu. */
.tuner-panel {
  background: white;
  border: 1px solid #dfe6ef;
  border-radius: 16px;
  padding: 12px 20px 10px;
  box-shadow: 0 14px 45px #1d365609;
}
.tuner-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  justify-items: center;
  align-items: center;
  gap: 0;
  margin-bottom: 8px;
}
.neck-reference {
  width: 100%;
  max-width: 440px;
  margin-inline: auto;
  text-align: center;
  min-width: 0;
}
.neck-reference h2 {
  font-size: 20px;
}
.neck-hint {
  color: #64748b;
  margin: 3px 0 8px;
  font-size: 14px;
  line-height: 1.4;
}
/* [ÚTSKÝRING] JS setur --neck-strings;
repeat býr til þann fjölda jafnbreiðra dálka. */
.neck-diagram {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: repeat(var(--neck-strings, 6), minmax(0, 1fr));
  width: 100%;
  max-width: 340px;
  margin: auto;
}
.neck-board {
  position: absolute;
  z-index: -1;
  top: 76px;
  bottom: 0;
  left: 3%;
  right: 3%;
  border: 2px solid #49515c;
  border-top: 6px solid #333;
  border-radius: 3px 3px 9px 9px;
  background: repeating-linear-gradient(to bottom, #f5f5f5 0, #f5f5f5 23px, #9a9fa6 23px, #9a9fa6 25px);
}
.neck-string {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  background: transparent;
  border-radius: 7px;
  color: #182b43;
  min-width: 0;
  position: relative;
}
.neck-number {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #111;
  color: white;
  font-size: 25px;
  font-weight: 800;
  line-height: 1;
}
.neck-note {
  display: block;
  height: 34px;
  padding-top: 3px;
  font-size: 23px;
  font-weight: 750;
  line-height: 1.4;
}
.neck-note sub {
  font-size: 14px;
  vertical-align: baseline;
  margin-left: 1px;
}
.neck-wire {
  display: block;
  width: var(--wire-width);
  height: 58px;
  background: #454545;
  box-shadow: 1px 0 2px #0003;
  border-radius: 2px;
}
.neck-string:hover .neck-number, .neck-string:focus-visible .neck-number, .neck-string:active .neck-number {
  background: #005ac8;
}
/* [ÚTSKÝRING] Gradient teiknar efni strengsins;
þetta eru CSS-litir, ekki myndaskrár. */
.neck-wire.wound {
  background: repeating-linear-gradient(165deg, #646c75 0, #dce1e6 1px, #a0a7b0 2px, #f4f5f7 3px);
  border-inline: 1px solid #727b86;
}
.neck-wire.plain {
  background: linear-gradient(90deg, #747e8b, #f1f4f7 55%, #9aa4af);
}
.neck-wire.nylon {
  background: linear-gradient(90deg, #b5ad9b, #fff9e8 45%, #e0d8c4);
  border-inline: 1px solid #b7af9f;
}
.neck-wire.wound.bronze {
  background: repeating-linear-gradient(165deg, #62391f 0, #ba8555 1px, #81502d 2px, #cca075 3px);
  border-inline-color: #714426;
}
.neck-string:hover .neck-wire, .neck-string:focus-visible .neck-wire {
  filter: brightness(1.1);
  box-shadow: 0 0 0 2px #005ac830;
}
#stringFeedback {
  color: #147d54;
  margin: 8px 0 0;
  min-height: 18px;
  font-size: 11px;
  line-height: 1.4;
}

/* [KÓÐI] Nál og fínstilling. Græna svæðið samsvarar ±8 cent innan ±50 cent mælis. */
.meter {
  text-align: center;
  padding: 0;
}
.meter .fine-tuning {
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
}
#meterReference {
  font-size: 12px;
  color: #52647a;
  margin: 0 0 5px;
  text-align: center;
}
.gauge {
  position: relative;
  height: 36px;
  overflow: hidden;
  border-radius: 8px;
  background: #f3f6fa;
}
.ticks {
  position: absolute;
  inset: 9px 0 0;
  height: 18px;
  background: repeating-linear-gradient(90deg, transparent 0, transparent calc(10% - 1px), #b6c5d8 calc(10% - 1px), #b6c5d8 10%);
}
.greenZone {
  position: absolute;
  left: 42%;
  width: 16%;
  top: 0;
  bottom: 0;
  background: #e1f6ed;
  border-left: 1px solid #a5d8c2;
  border-right: 1px solid #a5d8c2;
}
#needle {
  position: absolute;
  left: 50%;
  width: 3px;
  top: 4px;
  bottom: 4px;
  border-radius: 3px;
  background: #005ac8;
  transform: translateX(-50%);
  transition: left .1s linear;
  opacity: .25;
}
.tuned #needle {
  background: #16815e;
}
.scale {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #64748b;
  margin-top: 3px;
}
.scale span:nth-child(2) {
  color: #18835f;
}

/* [KÓÐI] Lárétt tónaröð. Hún má skruna sjálfstætt án þess að breikka alla síðuna. */
.meter #alphabet {
  text-align: left;
  border: 0;
  margin: 6px 0 0;
  padding: 0;
  min-width: 0;
}
.alphabet-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 20px;
}
.alphabet-range {
  font-size: 12px;
  color: #53667e;
  background: #f0f4f9;
  padding: 2px 8px;
  border-radius: 20px;
  font-variant-numeric: tabular-nums;
}
.alphabet-directions {
  display: flex;
  flex: 1;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  font-size: 11px;
  color: #64748b;
}
.alphabet-viewport {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: #c2d0e1 transparent;
  padding: 0 0 4px;
}
.alphabet-viewport:focus-visible {
  outline: 2px solid #6faafa;
  outline-offset: 3px;
  border-radius: 6px;
}
.alphabet-track {
  position: relative;
  min-width: 0;
  padding-top: 58px;
}
.alphabet-notes {
  display: grid;
  gap: 0;
}
.alphabet-cell {
  margin: 0 1.5px;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 66px;
  padding: 5px 2px;
  background: #f3f6fa;
  color: #263e59;
  border: 1px solid #dce4ef;
  border-radius: 7px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
.alphabet-cell sub {
  font-size: 15px;
  margin-left: 1px;
  vertical-align: baseline;
  font-weight: 700;
}
.alphabet-cell.accidental {
  font-size: 16px;
}
.alphabet-cell.accidental sub {
  font-size: 11px;
}
.flat-name {
  font-size: 13px;
  font-weight: 500;
  opacity: .8;
}
.alphabet-cell.octave-start::before {
  content: '';
  position: absolute;
  left: -3px;
  top: -7px;
  bottom: -6px;
  width: 1px;
  background: #a8b8cd;
}
.alphabet-cell.open-string {
  color: #182b43;
}
.alphabet-cell.open-string > span:first-child {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #111;
  color: white;
  font-size: 23px;
  flex-shrink: 0;
}
.alphabet-cell.open-string > span:first-child sub {
  font-size: 14px;
}
.alphabet-cell.active, .alphabet-cell.open-string.active {
  background: #ddebff;
  color: #005ac8;
  border-color: #005ac8;
  box-shadow: 0 0 0 2px #005ac825;
}
.alphabet-cell.open-string:hover {
  border-color: #111;
}
.string-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: absolute;
  top: -42px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  font-size: 23px;
  font-weight: 800;
  white-space: nowrap;
  background: #111;
  color: #fff;
  line-height: 1;
}
.alphabet-marker {
  position: absolute;
  top: 0;
  height: 7px;
  width: 3px;
  background: #005ac8;
  transform: translateX(-50%);
  border-radius: 2px;
  z-index: 1;
}
.alphabet-marker::after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: -4px;
  border-left: 5.5px solid transparent;
  border-right: 5.5px solid transparent;
  border-top: 6px solid #005ac8;
}
.alphabet-help {
  font-size: 11px;
  color: #005ac8;
  margin: 4px 0 0;
  line-height: 1.4;
}
/* [ÚTSKÝRING] Hak ásamt lit merkir staðfestingu;
ástandið er líka í aria-label. */
.neck-string.string-tuned .neck-number, .alphabet-cell.string-tuned .string-tag {
  background: #147d54;
  color: #fff;
  box-shadow: 0 0 0 4px #d8f2e5, 0 0 16px #16815e40;
}
.neck-string.string-tuned .neck-number::after, .alphabet-cell.string-tuned .string-tag::after {
  content: '✓';
  position: absolute;
  top: -4px;
  right: -5px;
  width: 17px;
  height: 17px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: #147d54;
  font-size: 12px;
  line-height: 1;
  border: 1px solid #147d54;
}

/* [KÓÐI] Leiðbeiningar, villur og fótur. */
#guidance {
  margin: 7px 0 0;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}
.microphone-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 7px;
}
.level {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #64748b;
}
.level > div {
  width: 100px;
  height: 5px;
  background: #e8eef5;
  border-radius: 5px;
  overflow: hidden;
}
#level {
  display: block;
  height: 100%;
  width: 0;
  background: #005ac8;
}
#error {
  color: #a13427;
  background: #fff1ee;
  text-align: left;
  padding: 13px;
  border-radius: 8px;
  font-size: 13px;
}
#openAlone {
  color: #005ac8;
  font-size: 13px;
}
details {
  padding: 10px 12px;
  font-size: 14px;
  color: #182b43;
  line-height: 1.7;
  background: #fff;
  border: 1px solid #dce3ee;
  border-radius: 10px;
  margin: 8px 0;
}
summary {
  cursor: pointer;
  font-weight: 650;
  color: #182b43;
}
details a {
  color: #005ac8;
  text-decoration: underline;
}
.audio-credit {
  font-size: 11px;
}
.audio-credit a {
  color: inherit;
}
footer {
  display: flex;
  justify-content: space-between;
  border-top: 1px solid #dce3ee;
  padding-top: 8px;
  font-size: 11px;
  color: #718096;
}
footer a {
  color: #005ac8;
  text-decoration: none;
}

/* [ÚTSKÝRING] @media keyrir reglur aðeins þegar skjástærð passar. Breidd í CSS-pixlum. */
@media (max-width: 700px) {
  footer {
    font-size: 10px;
    gap: 10px;
  }
  .level {
    font-size: 10px;
  }
  .microphone-controls {
    flex-wrap: wrap;
    gap: 10px;
  }
}
@media (max-width: 600px) {
  main {
    padding: 8px 10px 12px;
  }
  .intro h1 {
    font-size: 26px;
  }
  .tuner-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
  }
  .settings {
    gap: 8px;
  }
  .settings label {
    min-width: 0;
    width: 100%;
    font-size: 11px;
  }
  .settings select {
    width: 100%;
    font-size: 13px;
    padding-left: 8px;
    padding-right: 22px;
  }
  .microphone-start #start {
    min-width: 0;
    width: 100%;
    padding: 8px 6px;
    font-size: 14px;
  }
  .tuner-panel {
    padding: 12px 10px 10px;
    border-radius: 13px;
  }
  .tuner-top {
    margin-bottom: 6px;
  }
  .neck-reference h2 {
    font-size: 18px;
  }
  .neck-hint {
    margin: 2px 0 5px;
  }
  .neck-number {
    width: 40px;
    height: 40px;
    font-size: 24px;
  }
  .neck-note {
    height: 33px;
    font-size: 22px;
  }
  .neck-board {
    top: 73px;
  }
  .neck-wire {
    height: 36px;
  }
  #stringFeedback {
    margin-top: 5px;
  }
  .gauge {
    height: 30px;
  }
  .ticks {
    top: 7px;
    height: 16px;
  }
  .alphabet-directions {
    font-size: 10px;
    gap: 6px;
  }
  .alphabet-range {
    font-size: 10px;
    padding: 2px 5px;
  }
  footer {
    flex-wrap: wrap;
    gap: 4px 12px;
  }
}
@media (max-width: 550px) {
  #alphabet {
    margin-left: -4px;
    margin-right: -4px;
  }
}
/* [ÚTSKÝRING] Lágir skjáir, t.d. sími í landscape, fá minna lóðrétt bil. */
@media (max-height: 700px) {
  main {
    padding-top: 6px;
    padding-bottom: 8px;
  }
  .site-brand {
    padding-bottom: 3px;
  }
  .intro {
    margin: 4px 0;
  }
  .tuner-controls {
    margin-bottom: 7px;
  }
  .tuner-panel {
    padding-top: 9px;
    padding-bottom: 8px;
  }
  .neck-wire {
    height: 32px;
  }
  .neck-hint {
    margin-bottom: 5px;
  }
  #stringFeedback {
    margin-top: 5px;
  }
}
/* [KÓÐI] Virðum ósk notanda um minni hreyfingu. */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
