/* =====================================================
   LOCAL GAME STYLES: Tune Me! Guitar Tuning Simulator
   Builds on top of ../../shared/global.css
   ===================================================== */

:root {
  --tune-correct:   #34d399;
  --tune-incorrect: #f87171;
}

/* ─── Title ─── */
.gameMainTitle {
  text-align: center; font-size: 22px; font-weight: 900;
  color: var(--text-main); margin: 0; padding: 0 12px;
}
.diffBadge {
  display: inline-block; font-size: 13px; font-weight: 800;
  padding: 2px 10px; border-radius: 20px; margin-left: 8px;
  vertical-align: middle;
}
.diffBadge--adv { background: #a78bfa; color: #fff; }

/* ─── Accessibility: ensure intro modal copy is comfortably readable ─── */
#introModal .modalBody {
  font-size: max(16px, calc((16px + var(--font-adjust)) * var(--font-scale)));
  line-height: 1.6;
}
#introModal .modalGameSubtitle {
  font-size: max(16px, calc((17px + var(--font-adjust)) * var(--font-scale)));
}

/* ─── Modal titles ─── */
.modalGameTitle {
  text-align: center; font-size: 22px; font-weight: 900;
  margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.4px;
}
.modalGameSubtitle {
  text-align: center; font-size: 16px; font-weight: 700;
  color: var(--text-muted); margin-bottom: 10px;
}

/* ─── 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 ─── */
.statusText {
  text-align: center; font-size: 14px; font-weight: 600;
  color: var(--text-muted); margin: 4px 4px 0; line-height: 1.4;
}

/* ─── Difficulty picker ─── */
.diffGrid--4 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  width: 100%;
  margin-top: 8px;
}
@media (min-width: 420px) {
  .diffGrid--4 { grid-template-columns: repeat(4, 1fr); }
}
.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, 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); }

/* ─── Game actions row (below the guitar) ─── */
.gameActionsRow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 6px 0 0;
}
.gameActionBtn {
  flex: 0 1 auto;
  height: 40px;
  padding: 0 14px;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.gameActionBtn .ib-icon { font-size: 15px; display: inline; }
.gameActionBtn:disabled { opacity: 0.4; cursor: not-allowed; }

.repeatToggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
  font-size: 12px;
  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; }
.repeatToggle:has(input:disabled) { cursor: not-allowed; opacity: 0.7; }

/* ─── Guitar image + peg clusters ─── */
.guitarWrap {
  position: relative;
  width: 100%;
  max-width: 200px;
  margin: 14px auto 12px;
}
@media (min-width: 480px) { .guitarWrap { max-width: 280px; } }
@media (min-width: 620px) { .guitarWrap { max-width: 320px; } }

.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;
  width: 62px;
}
.pegCluster--left  { left: 0;  transform: translate(-100%, -50%); padding-right: 5px; }
.pegCluster--right { right: 0; transform: translate(100%, -50%);  padding-left: 5px; }

.pegNoteBtn {
  background: var(--bg-surface);
  color: var(--text-main);
  border: 2px solid rgba(255,255,255,0.14);
  border-radius: var(--radius-sm);
  width: 53px; height: 48px;
  font-size: 22px; 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 0.45s ease-in-out; }
@keyframes pegVibrate {
  0%   { transform: translateX(0) rotate(0);        box-shadow: var(--shadow-soft), 0 0 0 0 rgba(56,131,246,0); }
  10%  { box-shadow: var(--shadow-soft), 0 0 0 5px rgba(56,131,246,0.55); }
  20%  { transform: translateX(-3px) rotate(-4deg); }
  40%  { transform: translateX(3px) rotate(4deg);   box-shadow: var(--shadow-soft), 0 0 0 7px rgba(56,131,246,0.35); }
  60%  { transform: translateX(-3px) rotate(-3deg); box-shadow: var(--shadow-soft), 0 0 0 4px rgba(56,131,246,0.2); }
  80%  { transform: translateX(3px) rotate(3deg); }
  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);
}

.pegTuneRow {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.pegAdjustBtn {
  width: 25px; height: 25px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.14);
  background: var(--bg-elevated);
  color: var(--text-main);
  font-size: 17px; font-weight: 900;
  line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  flex-shrink: 0;
}
body.light-theme .pegAdjustBtn { border-color: rgba(0,0,0,0.12); }
.pegAdjustBtn:disabled { opacity: 0.4; cursor: not-allowed; }
.pegAdjustBtn:active:not(:disabled) { background: var(--accent); color: #fff; }

.pegCents {
  font-size: 13px; font-weight: 800; color: var(--text-muted);
  width: 62px; text-align: center; line-height: 1.15;
}

.pegCluster.correct .pegNoteBtn {
  background: var(--tune-correct); color: #063b2a; border-color: var(--tune-correct);
}
.pegCluster.correct .pegCents { color: var(--tune-correct); }
.pegCluster.incorrect .pegNoteBtn {
  background: var(--tune-incorrect); color: #4c0a0a; border-color: var(--tune-incorrect);
}
.pegCluster.incorrect .pegCents { color: var(--tune-incorrect); }
