/* ═══════════════════════════════════════════════════════════
   Guitar Scale Practice Plugin — guitar-app.css  v1.2.0
   모바일 퍼스트, 터치 최적화
═══════════════════════════════════════════════════════════ */

/* ── 리셋 & 기본 ─────────────────────────────────────────── */
.gsp-wrap *, .gsp-wrap *::before, .gsp-wrap *::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
.gsp-wrap {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.4;
  color: #1a1a1a;
  max-width: 680px;
  margin: 0 auto;
  padding: 12px;
}
@media (prefers-color-scheme: dark) {
  .gsp-wrap { color: #e8e8e8; }
}

/* ── 카드 ────────────────────────────────────────────────── */
.gsp-card {
  background: #ffffff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 10px;
}
@media (prefers-color-scheme: dark) {
  .gsp-card { background: #1e1e1e; border-color: #333; }
}

/* ── 탭 네비 ─────────────────────────────────────────────── */
.gsp-nav {
  display: flex;
  border-bottom: 1px solid #e0e0e0;
  margin-bottom: 14px;
}
@media (prefers-color-scheme: dark) {
  .gsp-nav { border-color: #333; }
}
.gsp-nav-btn {
  flex: 1;
  padding: 10px 8px;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  border: none;
  background: transparent;
  cursor: pointer;
  color: #888;
  border-bottom: 3px solid transparent;
  transition: color .15s, border-color .15s;
  touch-action: manipulation;
}
.gsp-nav-btn.active { color: #378ADD; border-bottom-color: #378ADD; }
@media (prefers-color-scheme: dark) {
  .gsp-nav-btn { color: #666; }
  .gsp-nav-btn.active { color: #378ADD; }
}

/* ── 탭 패널 ─────────────────────────────────────────────── */
.gsp-tab { display: none; }
.gsp-tab.show { display: block; }

/* ── 공통 유틸 ───────────────────────────────────────────── */
.gsp-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.gsp-mb8  { margin-bottom: 8px; }
.gsp-mb10 { margin-bottom: 10px; }
.gsp-mb12 { margin-bottom: 12px; }
.gsp-row-label {
  font-size: 12px;
  color: #888;
  min-width: 40px;
  flex-shrink: 0;
}
.gsp-sec-label {
  font-size: 11px;
  font-weight: 600;
  color: #999;
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

/* ── 버튼 ────────────────────────────────────────────────── */
.gsp-btn-group { display: flex; flex-wrap: wrap; gap: 5px; }
.gsp-btn {
  padding: 7px 13px;
  font-size: 13px;
  border: 1.5px solid #bbb;
  border-radius: 8px;
  background: #f5f5f5;       /* 기본 배경: 연회색 */
  color: #222;               /* 기본 글자: 진한 색 */
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  min-height: 36px;
  font-weight: 500;
}
.gsp-btn:hover  { background: #e8e8e8; border-color: #999; }
.gsp-btn:active { background: #ddd;    border-color: #888; }

/* 선택된(active) 버튼: 파란 배경 + 흰 글씨 — 명확한 대비 */
.gsp-btn.active {
  background: #1a6fb5;
  border-color: #1a6fb5;
  color: #ffffff;
  font-weight: 600;
}
.gsp-btn.gsp-static {
  cursor: default;
  pointer-events: none;
  background: #f0f0f0;
  color: #555;
}

/* 다크모드 버튼 */
@media (prefers-color-scheme: dark) {
  .gsp-btn {
    background: #2a2a2a;
    border-color: #555;
    color: #e0e0e0;
  }
  .gsp-btn:hover  { background: #333; border-color: #777; }
  .gsp-btn:active { background: #3a3a3a; }
  .gsp-btn.active {
    background: #1a6fb5;
    border-color: #378ADD;
    color: #ffffff;
  }
  .gsp-btn.gsp-static { background: #252525; color: #aaa; border-color: #444; }
}

/* ── 프렛보드 캔버스 ─────────────────────────────────────── */
#gsp-fretboard {
  width: 100%;
  display: block;
  border-radius: 8px;
  margin-bottom: 6px;
  touch-action: pan-x;
}

/* ── 범례 ────────────────────────────────────────────────── */
.gsp-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.gsp-legend-item {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; color: #888;
}
.gsp-legend-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }

/* ── 색상 커스터마이저 ───────────────────────────────────── */
.gsp-color-card {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f0f0f0;
}
@media (prefers-color-scheme: dark) {
  .gsp-color-card { border-color: #2a2a2a; }
}
.gsp-degree-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.gsp-degree-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 6px 10px;
  border: 1.5px solid #bbb;
  border-radius: 8px;
  background: #f5f5f5;
  cursor: pointer;
  font-size: 12px;
  min-height: 36px;
  touch-action: manipulation;
  color: #222;
  font-weight: 500;
}
.gsp-degree-chip:hover { background: #e8e8e8; }
.gsp-degree-chip .gsp-swatch {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,.2); flex-shrink: 0;
}
@media (prefers-color-scheme: dark) {
  .gsp-degree-chip { border-color: #555; background: #2a2a2a; color: #e0e0e0; }
  .gsp-degree-chip:hover { background: #333; }
}
.gsp-color-picker {
  display: none;
  margin-top: 8px;
  padding: 10px;
  background: #f8f8f8;
  border-radius: 10px;
  border: 1px solid #eee;
}
.gsp-color-picker.open { display: block; }
@media (prefers-color-scheme: dark) {
  .gsp-color-picker { background: #252525; border-color: #333; }
}
.gsp-picker-title { font-size: 12px; color: #888; }
.gsp-picker-title span { font-weight: 600; color: #1a1a1a; }
@media (prefers-color-scheme: dark) {
  .gsp-picker-title span { color: #e8e8e8; }
}
.gsp-color-grid { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 8px; }
.gsp-color-swatch {
  width: 26px; height: 26px; border-radius: 50%;
  cursor: pointer; border: 2px solid transparent;
  touch-action: manipulation;
}
.gsp-color-swatch:hover { border-color: #aaa; }
.gsp-color-swatch.selected { border-color: #1a1a1a; }
@media (prefers-color-scheme: dark) {
  .gsp-color-swatch.selected { border-color: #fff; }
}

/* ── 메트로놈 섹션 ───────────────────────────────────────── */
.gsp-metro-section {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid #f0f0f0;
}
@media (prefers-color-scheme: dark) {
  .gsp-metro-section { border-color: #2a2a2a; }
}
.gsp-bpm-display {
  font-size: 42px;
  font-weight: 700;
  text-align: center;
  color: #1a1a1a;
  line-height: 1;
}
@media (prefers-color-scheme: dark) {
  .gsp-bpm-display { color: #e8e8e8; }
}
.gsp-bpm-unit {
  font-size: 11px;
  color: #999;
  text-align: center;
  margin-bottom: 4px;
}
.gsp-wrap input[type="range"] {
  flex: 1;
  min-width: 60px;
  height: 4px;
  accent-color: #1a6fb5;
  cursor: pointer;
}

/* ── 서브디비전 카드 ─────────────────────────────────────── */
.gsp-sub-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
@media (max-width: 400px) {
  .gsp-sub-grid { grid-template-columns: repeat(2, 1fr); }
}
.gsp-sub-card {
  padding: 8px 10px;
  border: 1.5px solid #bbb;
  border-radius: 10px;
  cursor: pointer;
  background: #f5f5f5;
  touch-action: manipulation;
  transition: border-color .12s, background .12s;
  min-height: 56px;
}
.gsp-sub-card:hover { border-color: #1a6fb5; background: #eef4fb; }
.gsp-sub-card.active {
  border-color: #1a6fb5;
  background: #ddeaf8;
}
@media (prefers-color-scheme: dark) {
  .gsp-sub-card { border-color: #555; background: #2a2a2a; }
  .gsp-sub-card:hover  { border-color: #378ADD; background: #1a2d3f; }
  .gsp-sub-card.active { border-color: #378ADD; background: #1a2d3f; }
}
.gsp-sub-title {
  font-size: 12px; font-weight: 600; color: #1a1a1a;
}
.gsp-sub-desc { font-size: 10px; color: #888; margin-top: 2px; }
.gsp-sub-card.active .gsp-sub-title { color: #1a6fb5; }
@media (prefers-color-scheme: dark) {
  .gsp-sub-title { color: #e8e8e8; }
  .gsp-sub-card.active .gsp-sub-title { color: #378ADD; }
}

/* ── 한 줄 비트 트랙 ─────────────────────────────────────── */
.gsp-beat-row-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0 8px;
}
.gsp-beat-track {
  display: flex;
  align-items: center;
  gap: 3px;
  flex: 1;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 4px 0;
  -webkit-overflow-scrolling: touch;
}
.gsp-beat-group { display: flex; align-items: center; gap: 2px; flex-shrink: 0; }
.gsp-beat-sep   { width: 7px; height: 1px; background: #ddd; flex-shrink: 0; }
@media (prefers-color-scheme: dark) {
  .gsp-beat-sep { background: #333; }
}
.gsp-dot {
  border-radius: 50%;
  flex-shrink: 0;
  transition: background .05s, transform .05s, box-shadow .05s;
  border: 1.5px solid #bbb;
  background: #e8e8e8;
}
@media (prefers-color-scheme: dark) {
  .gsp-dot { border-color: #555; background: #2a2a2a; }
}
.gsp-dot.main { width: 22px; height: 22px; }
.gsp-dot.sub  { width: 10px; height: 10px; }
/* 모든 박 동일 색상으로 표시 (강약 구분 없음) */
.gsp-dot.hit     { background: #1a6fb5 !important; border-color: #1a6fb5 !important; transform: scale(1.12); }
.gsp-dot.sub-hit { background: #1a6fb5 !important; border-color: #1a6fb5 !important; transform: scale(1.12); }

/* ── 메트로놈 컨트롤 버튼 ────────────────────────────────── */
.gsp-metro-ctrl { display: flex; gap: 8px; margin-top: 10px; }
.gsp-tap-btn {
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  border: 1.5px solid #bbb;
  border-radius: 10px;
  background: #f5f5f5;
  color: #222;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 44px;
  transition: background .12s;
}
.gsp-tap-btn:active { background: #ddd; }
@media (prefers-color-scheme: dark) {
  .gsp-tap-btn { border-color: #555; background: #2a2a2a; color: #e0e0e0; }
  .gsp-tap-btn:active { background: #3a3a3a; }
}
.gsp-metro-start {
  flex: 1;
  padding: 10px;
  font-size: 15px;
  font-weight: 700;
  border: 1.5px solid #bbb;
  border-radius: 10px;
  background: #f5f5f5;
  color: #222;
  cursor: pointer;
  touch-action: manipulation;
  min-height: 44px;
  transition: background .12s, color .12s, border-color .12s;
}
.gsp-metro-start.running {
  background: #1a6fb5;
  border-color: #1a6fb5;
  color: #fff;
}
@media (prefers-color-scheme: dark) {
  .gsp-metro-start { border-color: #555; background: #2a2a2a; color: #e0e0e0; }
  .gsp-metro-start.running { background: #1a6fb5; border-color: #1a6fb5; color: #fff; }
}

/* ── 튜너 ────────────────────────────────────────────────── */
.gsp-tuner-note {
  font-size: 64px;
  font-weight: 700;
  text-align: center;
  line-height: 1;
  margin-bottom: 4px;
  color: #1a1a1a;
}
@media (prefers-color-scheme: dark) {
  .gsp-tuner-note { color: #e8e8e8; }
}
.gsp-tuner-cent {
  font-size: 14px;
  text-align: center;
  color: #888;
  margin-bottom: 8px;
  min-height: 20px;
}
.gsp-tuner-bar {
  position: relative;
  height: 10px;
  background: #ebebeb;
  border-radius: 5px;
  margin: 10px 0;
}
@media (prefers-color-scheme: dark) {
  .gsp-tuner-bar { background: #2a2a2a; }
}
.gsp-tuner-center {
  position: absolute;
  left: 50%; top: -4px;
  width: 2px; height: 18px;
  background: #1D9E75;
  transform: translateX(-50%);
  border-radius: 1px;
}
.gsp-tuner-needle {
  position: absolute;
  top: -3px;
  width: 4px; height: 16px;
  background: #E24B4A;
  border-radius: 2px;
  transform: translateX(-50%);
  transition: background .15s;
}
.gsp-tuner-cents-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #aaa;
  margin-bottom: 14px;
}
.gsp-green { color: #1D9E75; font-weight: 600; }

/* ── 모바일 반응형 ───────────────────────────────────────── */
@media (max-width: 480px) {
  .gsp-wrap        { padding: 8px; }
  .gsp-card        { padding: 12px 12px; }
  .gsp-bpm-display { font-size: 36px; }
  .gsp-tuner-note  { font-size: 52px; }
  .gsp-btn         { padding: 7px 10px; font-size: 12px; }
  .gsp-nav-btn     { font-size: 13px; padding: 9px 6px; }
  .gsp-dot.main    { width: 20px; height: 20px; }
  .gsp-dot.sub     { width: 9px;  height: 9px; }
}
@media (max-width: 360px) {
  .gsp-btn { padding: 6px 8px; font-size: 11px; }
}


/* ── 튜너 개선 (v1.0.3) ─────────────────────────────────── */
/* 목표음 표시 */
.gsp-tuner-target {
  text-align: center;
  font-size: 14px;
  color: #888;
  margin-bottom: 6px;
}
.gsp-tuner-target strong {
  font-size: 18px;
  color: #1a6fb5;
  margin: 0 4px;
}
.gsp-target-freq {
  font-size: 12px;
  color: #999;
}
@media (prefers-color-scheme: dark) {
  .gsp-tuner-target strong { color: #378ADD; }
}

/* 게이지 정확 구간(±5¢) 음영 */
.gsp-tuner-bar { position: relative; }
.gsp-tuner-zone-ok {
  position: absolute;
  left: 45%;
  width: 10%;
  top: 0; bottom: 0;
  background: rgba(29,158,117,.18);
  border-radius: 2px;
}

/* note의 옥타ब 표시 */
.gsp-tuner-note sub {
  vertical-align: sub;
}

/* 줄 선택 그리드 */
.gsp-string-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
@media (max-width: 400px) {
  .gsp-string-grid { grid-template-columns: repeat(2, 1fr); }
}
.gsp-string-cell {
  display: flex;
  align-items: stretch;
  border: 1.5px solid #bbb;
  border-radius: 10px;
  overflow: hidden;
  background: #f5f5f5;
  transition: border-color .12s, background .12s;
}
.gsp-string-cell.active {
  border-color: #1a6fb5;
  background: #ddeaf8;
}
@media (prefers-color-scheme: dark) {
  .gsp-string-cell { border-color: #555; background: #2a2a2a; }
  .gsp-string-cell.active { border-color: #378ADD; background: #1a2d3f; }
}
.gsp-string-main {
  flex: 1;
  text-align: center;
  padding: 6px 2px;
  cursor: pointer;
  touch-action: manipulation;
}
.gsp-string-num {
  font-size: 10px;
  color: #999;
}
.gsp-string-note {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a1a;
}
.gsp-string-cell.active .gsp-string-note { color: #1a6fb5; }
@media (prefers-color-scheme: dark) {
  .gsp-string-note { color: #e8e8e8; }
  .gsp-string-cell.active .gsp-string-note { color: #378ADD; }
}
.gsp-string-minus, .gsp-string-plus {
  width: 28px;
  border: none;
  background: rgba(0,0,0,.04);
  color: #555;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}
.gsp-string-minus:active, .gsp-string-plus:active {
  background: rgba(0,0,0,.12);
}
@media (prefers-color-scheme: dark) {
  .gsp-string-minus, .gsp-string-plus {
    background: rgba(255,255,255,.06); color: #aaa;
  }
}

/* A4 기준 표시 */
.gsp-a4-display {
  font-size: 13px;
  font-weight: 600;
  color: #1a1a1a;
  min-width: 110px;
  text-align: center;
}
@media (prefers-color-scheme: dark) {
  .gsp-a4-display { color: #e8e8e8; }
}

/* ── 표준 튜닝 텍스트 표기 (6번줄→1번줄) ─────────────────── */
.gsp-tuning-ref {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
@media (max-width: 400px) {
  .gsp-tuning-ref { grid-template-columns: repeat(3, 1fr); }
}
.gsp-tuning-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px;
  border: 1.5px solid #ddd;
  border-radius: 8px;
  background: #f7f7f7;
}
.gsp-tuning-str  { font-size: 10px; color: #888; }
.gsp-tuning-note { font-size: 17px; font-weight: 700; color: #1a6fb5; }
.gsp-tuning-hz   { font-size: 9px; color: #aaa; }
@media (prefers-color-scheme: dark) {
  .gsp-tuning-chip { background: #252525; border-color: #444; }
  .gsp-tuning-str  { color: #999; }
  .gsp-tuning-note { color: #5DA9EE; }
  .gsp-tuning-hz   { color: #777; }
}
