/* =====================================================
   LOCAL TOOL STYLES: Guitar Tune-By-Ear
   Builds on top of ../../shared/global.css
   ===================================================== */

/* ─── Title ─── */
.gameMainTitle {
  text-align: center; font-size: 22px; font-weight: 900;
  color: var(--text-main); margin: 0; padding: 0 12px;
}

/* ─── Modal titles ─── */
.modalTitle {
  text-align: center; font-size: 22px; font-weight: 900;
  margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.4px;
}

/* ─── Panels ─── */
.controlsPanel {
  background: var(--bg-surface); border: 2px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md); padding: 12px 12px; box-shadow: var(--shadow-soft);
  display: flex; flex-direction: column; gap: 8px;
}
body.light-theme .controlsPanel { border-color: rgba(0,0,0,0.06); }

/* ─── Nav actions rows (each collapses to icons individually) ─── */
.navActionsRow {
  display: flex;
  flex-wrap: nowrap;
  gap: 6px;
  width: 100%;
}
.navBtn {
  flex: 1 1 0;
  min-width: 0;
  height: 52px;
  padding: 0 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  overflow: hidden;
}
.navBtn .ib-icon  { font-size: 19px; flex-shrink: 0; line-height: 1; display: none; }
.navBtn .ib-label {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  min-width: 0;
}
.navBtn.icon-only {
  flex: 0 0 auto;
  width: 52px;
  padding: 0;
}
.navBtn.icon-only .ib-label { display: none; }
.navBtn.icon-only .ib-icon  { display: inline; }
.navBtn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ─── Status text (shows the current tuning) ─── */
.statusText {
  text-align: center; font-size: 14px; font-weight: 700;
  color: var(--text-muted); margin: 4px 4px 0; line-height: 1.4;
}

/* ─── Persistent-choice option tiles (tuning / audio source) ─── */
.diffOption {
  min-height: 64px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--bg-elevated);
  background: var(--bg-elevated);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  padding: 8px 6px;
  line-height: 1.35;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.diffOption:active { transform: scale(0.97); }
.diffOptionSub {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-top: 3px;
}
.diffOption:hover { background: var(--accent); border-color: var(--accent-shadow); color: #fff; }
.diffOption:hover .diffOptionSub { color: rgba(255,255,255,0.85); }
body.light-theme .diffOption { border-color: rgba(0,0,0,0.08); }

.diffOption.selected {
  background: var(--accent);
  border-color: var(--accent-shadow);
  color: #fff;
}
.diffOption.selected .diffOptionSub { color: rgba(255,255,255,0.85); }

/* ─── Settings modal sections ─── */
.settingsSectionTitle {
  font-size: 15px; font-weight: 800; color: var(--text-main);
  margin: 4px 0 8px;
  text-align: left;
}
.settingsSectionTitle:first-child { margin-top: 0; }

.tuningGrid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  width: 100%;
  margin-bottom: 18px;
}
@media (min-width: 420px) {
  .tuningGrid { grid-template-columns: repeat(2, 1fr); }
}
.tuningGrid .diffOption { min-height: 54px; text-align: left; padding: 8px 10px; }

.audioSourceGrid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 100%;
}
.audioSourceGrid .diffOption { min-height: 54px; }

/* ─── Toggle row: Repeat Notes / Let Notes Ring ─── */
.gameActionsRow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  margin: 0 0 4px;
}

.toggleRow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}
.toggleSwitch { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.toggleSwitch input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0;
  opacity: 0; cursor: pointer; z-index: 1;
}
.toggleTrack {
  position: absolute; inset: 0;
  background: var(--bg-elevated);
  border: 2px solid rgba(255,255,255,0.14);
  border-radius: 999px;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
body.light-theme .toggleTrack { border-color: rgba(0,0,0,0.12); }
.toggleThumb {
  position: absolute; top: 1px; left: 1px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--text-muted);
  transition: transform 0.18s ease, background-color 0.15s ease;
}
.toggleSwitch input:checked + .toggleTrack { background: var(--accent); border-color: var(--accent); }
.toggleSwitch input:checked + .toggleTrack .toggleThumb { transform: translateX(18px); background: #fff; }
.toggleSwitch input:disabled + .toggleTrack { opacity: 0.4; }
.toggleRow:has(input:disabled) { cursor: not-allowed; opacity: 0.7; }

/* ─── Guitar image + peg clusters ─────────────────────────────── */
.guitarWrap {
  position: relative;
  width: 100%;
  min-width: 245px;
  max-width: 260px;
  margin: 8px auto 12px;
}
@media (min-width: 480px) { .guitarWrap { max-width: 300px; } }
@media (min-width: 620px) { .guitarWrap { max-width: 360px; } }

.guitarImg { display: block; width: 100%; height: auto; }

.guitarImgFallback { display: none; }
.guitarWrap.img-missing .guitarImg { display: none; }
.guitarWrap.img-missing { aspect-ratio: 480 / 970; }
.guitarWrap.img-missing .guitarImgFallback {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: absolute; inset: 0;
  background: var(--bg-surface);
  border: 2px dashed rgba(255,255,255,0.15);
  border-radius: var(--radius-md);
  font-size: 26px; font-weight: 700; color: var(--text-muted);
  text-align: center; gap: 6px; line-height: 1.5;
}
.guitarWrap.img-missing .guitarImgFallback br + br { display: none; }
body.light-theme .guitarWrap.img-missing .guitarImgFallback { border-color: rgba(0,0,0,0.12); }

.pegCluster {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 44px;
}
.pegCluster--left  { left: 0;  transform: translate(-100%, -50%); padding-right: 6px; }
.pegCluster--right { right: 0; transform: translate(100%, -50%);  padding-left: 6px; }

.pegNoteBtn {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 2px solid rgba(255,255,255,0.14);
  border-radius: var(--radius-sm);
  width: 40px; height: 38px;
  font-size: 18px; font-weight: 900;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
body.light-theme .pegNoteBtn { border-color: rgba(0,0,0,0.12); }

.pegNoteBtn.vibrating { animation: pegVibrate 4s linear; }
@keyframes pegVibrate {
  /* Quick, tight wobbles at the start, gradually slowing and settling
     down (like a damped oscillation) over the full 4 seconds. */
  0%   { transform: translateX(0) rotate(0);            box-shadow: var(--shadow-soft), 0 0 0 0 rgba(56,131,246,0); }
  3%   { transform: translateX(-4px) rotate(-5deg);     box-shadow: var(--shadow-soft), 0 0 0 6px rgba(56,131,246,0.6); }
  6%   { transform: translateX(4px) rotate(5deg); }
  9%   { transform: translateX(-4px) rotate(-5deg);     box-shadow: var(--shadow-soft), 0 0 0 6px rgba(56,131,246,0.55); }
  12%  { transform: translateX(4px) rotate(5deg); }
  16%  { transform: translateX(-3.5px) rotate(-4deg);   box-shadow: var(--shadow-soft), 0 0 0 5px rgba(56,131,246,0.5); }
  20%  { transform: translateX(3.5px) rotate(4deg); }
  26%  { transform: translateX(-3px) rotate(-3.5deg);   box-shadow: var(--shadow-soft), 0 0 0 5px rgba(56,131,246,0.4); }
  32%  { transform: translateX(3px) rotate(3.5deg); }
  40%  { transform: translateX(-2.5px) rotate(-3deg);   box-shadow: var(--shadow-soft), 0 0 0 4px rgba(56,131,246,0.3); }
  48%  { transform: translateX(2.5px) rotate(3deg); }
  58%  { transform: translateX(-2px) rotate(-2deg);     box-shadow: var(--shadow-soft), 0 0 0 3px rgba(56,131,246,0.2); }
  68%  { transform: translateX(2px) rotate(2deg); }
  80%  { transform: translateX(-1px) rotate(-1deg);     box-shadow: var(--shadow-soft), 0 0 0 2px rgba(56,131,246,0.1); }
  90%  { transform: translateX(1px) rotate(1deg); }
  100% { transform: translateX(0) rotate(0);            box-shadow: var(--shadow-soft), 0 0 0 0 rgba(56,131,246,0); }
}

.pegCluster.selected .pegNoteBtn {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent);
}

/* Wider viewports: bigger note buttons to use the extra room the
   wider guitarWrap now has available either side of it. */
@media (min-width: 480px) {
  .pegNoteBtn { width: 46px; height: 44px; font-size: 20px; }
  .pegCluster { min-width: 48px; }
}
@media (min-width: 620px) {
  .pegNoteBtn { width: 54px; height: 50px; font-size: 23px; }
  .pegCluster { min-width: 54px; gap: 5px; }
}

/* ─── Note picker menu (hold-click on mobile / double-click on
   desktop) — pops out sideways, away from the guitar image, so it
   never overlaps the other peg clusters above or below it. ───── */
.noteMenu {
  display: none;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  background: var(--bg-surface);
  border: 2px solid rgba(255,255,255,0.16);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-soft);
  padding: 8px;
  min-width: 110px;
}
.noteMenu.open { display: flex; flex-direction: column; gap: 4px; }
body.light-theme .noteMenu { border-color: rgba(0,0,0,0.12); }

.pegCluster--left  .noteMenu { right: 100%; margin-right: 8px; }
.pegCluster--right .noteMenu { left: 100%;  margin-left: 8px; }

.noteMenuHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 2px;
}
.noteMenuTitle {
  font-size: 11px; font-weight: 800; color: var(--text-muted);
  white-space: nowrap;
}
.noteMenuClose {
  border: none; background: none; color: var(--text-muted);
  font-size: 16px; font-weight: 900; line-height: 1; cursor: pointer;
  padding: 0 2px;
}
.noteMenuClose:hover { color: var(--text-main); }

.noteMenuOption {
  min-width: 90px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--bg-elevated);
  background: var(--bg-elevated);
  color: var(--text-main);
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease;
}
.noteMenuOption:hover { background: var(--accent); border-color: var(--accent-shadow); color: #fff; }
.noteMenuOption.selected { background: var(--accent); border-color: var(--accent-shadow); color: #fff; }
body.light-theme .noteMenuOption { border-color: rgba(0,0,0,0.08); }
