* {
  box-sizing: border-box;
  font-family: 'Noto Sans TC', sans-serif;
}
a {color:black;text-decoration: none;}
body {
  background-color: #F5F5F5;
}
h1 { font-size:19px; font-size:1.17em; font-weight:normal;}
div.mHeader {
 position: fixed;top:0;width:100%;height:50px;margin:0;padding:10px;z-index:1;background-color:tan;
 font-size:16px;
}
div.mHeaderT {display:inline; margin-left:10px; text-align:left; font-size:24px;
}
div.mHeaderT span {display:inline-block; font-size:28px; margin-top:-7px;
}
div.mHeaderT2 {display:inline-block; margin-left: 10px; vertical-align:top;
}
div.mHeaderC {display:inline-block; margin-right:10px;float:right;cursor:pointer;
}

.app-container {
  width: 100%;
  max-width: 560px;
  box-sizing: border-box; /* Prevents padding from breaking width calculations */
  
  /* Centering across Block, Flex, and Grid parents */
  margin-inline: auto;
  align-self: center;
  justify-self: center;

  /* Internal layout */
  display: flex;
  flex-direction: column;
  align-items: center;

  /* Styling */
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  padding: clamp(16px, 4vw, 28px);
  box-shadow: 0 10px 25px -5px rgba(15, 23, 42, 0.06), 0 4px 10px -6px rgba(15, 23, 42, 0.04);
}
.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-bottom: 1.25rem;
}

button, select, .snap-control {
  min-height: 42px;
  padding: 8px 14px;
  font-size: 0.9rem;
  border-radius: 10px;
  border: 1px solid #cbd5e1;
  background: #f1f5f9;
  color: #0f172a;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

button:hover:not(:disabled), select:hover {
  background: #e2e8f0;
}

button.primary {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
  font-weight: 600;
}

button.primary:hover:not(:disabled) {
  background: #1d4ed8;
}

button:disabled {
  opacity: 0.65;
  cursor: default;
}

.snap-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: default;
}

.snap-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  color: #334155;
}

.snap-toggle input[type="checkbox"] {
  accent-color: #16a34a;
  width: 18px;
  height: 18px;
  cursor: pointer;
  margin: 0;
}

.snap-control input[type="range"] {
  width: clamp(72px, 18vw, 100px);
  height: 24px;
  accent-color: #16a34a;
  cursor: pointer;
  margin: 0;
}

.snap-value {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: #16a34a;
  min-width: 3.1em;
  text-align: right;
}

.hidden {
  display: none !important;
}

/* Guitar String Pill Badges */
.strings-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
  margin-bottom: 1.25rem;
}

.string-badge {
  min-width: 44px;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 8px;
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  font-weight: 700;
  font-size: 0.9rem;
  color: #64748b;
  transition: all 0.12s;
}

.string-badge.active {
  color: #0369a1;
  border-color: #0284c7;
  background: #e0f2fe;
}

.string-badge.in-tune {
  color: #ffffff;
  background: #16a34a;
  border-color: #16a34a;
}

/* Classic Linear Display (420px full width) */
.linear-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 420px;
}

.note {
  font-size: clamp(3rem, 11vw, 4.75rem);
  font-weight: 800;
  line-height: 1.05;
  color: #0f172a;
  transition: color 0.1s;
  text-align: center;
}

.in-tune-text {
  color: #16a34a;
}

.meter {
  position: relative;
  width: 100%;
  max-width: 420px;
  height: 18px;
  background: #e2e8f0;
  border-radius: 9px;
  margin-bottom: 1.5rem;
  border: 1px solid #cbd5e1;
}

.meter-sweet-spot {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 45%;
  width: 10%;
  background: rgba(22, 163, 74, 0.25);
  border-radius: 4px;
  transition: left 0.1s, width 0.1s;
}

.meter-center {
  position: absolute;
  left: 50%;
  top: -4px;
  bottom: -4px;
  width: 2.5px;
  background: #16a34a;
  transform: translateX(-50%);
}

.needle {
  position: absolute;
  top: -4px;
  left: 50%;
  width: 14px;
  height: 24px;
  background: #0f172a;
  border-radius: 4px;
  transform: translateX(-50%);
  transition: left 0.08s ease-out, background 0.1s;
}

/* Analog Speedometer Gauge (R = 210px, Diameter = 420px) */
.gauge-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 480px;
  margin-bottom: 0.75rem;
}

.gauge-svg {
  width: 100%;
  height: auto;
  aspect-ratio: 480 / 305;
  overflow: visible;
}

#analogPointer {
  transform-origin: 240px 230px;
  transform: rotate(0deg);
  transition: transform 0.09s cubic-bezier(0.22, 1, 0.36, 1);
}

canvas#scope {
  width: 100%;
  max-width: 420px;
  height: 76px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
}

@media (max-width: 480px) {
  .controls > button,
  .controls > select {
    flex: 1 1 auto;
  }
  .snap-control {
    width: 100%;
    justify-content: space-between;
  }
  .snap-control input[type="range"] {
    flex: 1;
  }
}

.tuner-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #334155;
  background-color: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}

.tuner-btn:hover {
  background-color: #f1f5f9;
  border-color: #94a3b8;
}

.tuner-btn .swap-icon {
  margin-left: 2px;
  stroke:black;
  opacity: 0.5;
}

/* Toggle SVG visibility based on data-next-view attribute */
.tuner-btn[data-current-view="linear"] .icon-needle,
.tuner-btn[data-current-view="needle"] .icon-linear {
  display: none;
}
