body { font-family: Inter, sans-serif; }

:root {
  --flute-silver-light: #e8ecf0;
  --flute-silver-mid: #c8cdd4;
  --flute-silver-dark: #9aa0a8;
  --flute-silver-deep: #6b7280;
  --flute-key-open: #2a2f38;
  --flute-key-pad: rgba(180, 160, 120, 0.85);
  --flute-gold: #c8a84a;
  --flute-gold-dark: #9a7830;
  --flute-accent: rgba(16, 185, 129, 0.12);
}

.tool-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 3px 12px rgba(0,0,0,.04);
}

/* ── Mode buttons ── */
.mode-btn {
  padding: 5px 14px;
  border-radius: 7px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #6b7280;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.mode-btn.active {
  background: #fff;
  color: #065f46;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}

/* ── Reverb toggle ── */
.reverb-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 1px;
  background: #f3f4f6;
  border-radius: 8px;
  padding: 3px;
}
.reverb-btn {
  padding: 5px 12px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #6b7280;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.reverb-btn.active {
  background: #fff;
  color: #065f46;
  box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}

/* ── Flute body container ── */
.flute-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 16px 0 8px;
}

/* ── Flute instrument visual ── */
.flute-instrument {
  display: flex;
  flex-direction: row;
  align-items: center;
  width: 100%;
  max-width: 560px;
  height: 56px;
  position: relative;
}

/* Crown cap */
.flute-crown {
  width: 16px;
  height: 32px;
  background: linear-gradient(180deg, var(--flute-silver-light) 0%, var(--flute-silver-mid) 50%, var(--flute-silver-dark) 100%);
  border-radius: 8px 2px 2px 8px;
  flex-shrink: 0;
  box-shadow:
    inset 0 1px 3px rgba(255,255,255,0.6),
    inset 0 -1px 3px rgba(0,0,0,0.2),
    0 2px 6px rgba(0,0,0,0.15);
}

/* Head joint */
.flute-head {
  width: 72px;
  height: 28px;
  background: linear-gradient(180deg, var(--flute-silver-light) 0%, var(--flute-silver-mid) 55%, var(--flute-silver-dark) 100%);
  position: relative;
  flex-shrink: 0;
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,0.5),
    inset 0 -2px 4px rgba(0,0,0,0.15);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Embouchure hole */
.flute-embouchure {
  width: 14px;
  height: 10px;
  background: rgba(20, 25, 35, 0.9);
  border-radius: 3px;
  box-shadow:
    inset 0 2px 4px rgba(0,0,0,0.8),
    0 0 0 2px var(--flute-gold),
    0 0 0 3px rgba(200, 168, 74, 0.3);
}

/* Main tube */
.flute-tube {
  flex: 1;
  height: 28px;
  background:
    repeating-linear-gradient(90deg, rgba(255,255,255,0.03) 0 20px, rgba(0,0,0,0.02) 20px 40px),
    linear-gradient(180deg, var(--flute-silver-light) 0%, var(--flute-silver-mid) 50%, var(--flute-silver-dark) 100%);
  border-top: 1px solid rgba(255,255,255,0.7);
  border-bottom: 1px solid rgba(0,0,0,0.2);
  position: relative;
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,0.4),
    inset 0 -2px 4px rgba(0,0,0,0.12);
}

/* Key pads on the tube */
.flute-key-display {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 100%;
  padding: 0 8px;
}

.tube-key-pad {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--flute-key-open);
  border: 1.5px solid var(--flute-gold);
  box-shadow:
    inset 0 1px 3px rgba(0,0,0,0.7),
    0 1px 1px rgba(255,255,255,0.15);
  transition: background 0.08s, box-shadow 0.08s;
  flex-shrink: 0;
}
.tube-key-pad.active {
  background: var(--flute-gold);
  box-shadow:
    inset 0 1px 2px rgba(255,200,80,0.4),
    0 0 6px rgba(200, 168, 74, 0.5);
}

/* Foot joint */
.flute-foot {
  width: 24px;
  height: 36px;
  background: linear-gradient(180deg, var(--flute-silver-mid) 0%, var(--flute-silver-dark) 60%, var(--flute-silver-deep) 100%);
  border-radius: 2px 10px 12px 2px;
  box-shadow:
    inset 0 2px 4px rgba(255,255,255,0.3),
    inset 0 -2px 4px rgba(0,0,0,0.25),
    0 2px 8px rgba(0,0,0,0.2);
  flex-shrink: 0;
}

/* ── Notes grid ── */
.notes-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  width: 100%;
  max-width: 560px;
}

/* ── Individual note button ── */
.note-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 52px;
  min-height: 64px;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  border: 1.5px solid rgba(180, 195, 210, 0.6);
  background: linear-gradient(160deg, var(--flute-silver-light) 0%, #d8dde4 60%, var(--flute-silver-mid) 100%);
  box-shadow:
    0 3px 8px rgba(0,0,0,0.10),
    inset 0 1px 2px rgba(255,255,255,0.7),
    inset 0 -1px 2px rgba(0,0,0,0.08);
  transition: transform 0.07s, box-shadow 0.07s, background 0.07s;
  position: relative;
  overflow: hidden;
}
.note-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 15%;
  width: 20%;
  height: 100%;
  background: linear-gradient(180deg, rgba(255,255,255,0.45), rgba(255,255,255,0.05));
  border-radius: 999px;
  pointer-events: none;
}
.note-btn:active,
.note-btn.struck {
  transform: translateY(2px) scale(0.97);
  background: linear-gradient(160deg, #d0e8f0 0%, #a8c8d8 60%, #88a8c0 100%);
  box-shadow:
    0 1px 3px rgba(0,0,0,0.15),
    inset 0 2px 4px rgba(0,0,0,0.10),
    0 0 14px rgba(16,185,129,0.28);
}

.note-name {
  font-size: 13px;
  font-weight: 700;
  color: #1a2535;
  line-height: 1.2;
  letter-spacing: -0.01em;
}
.note-swar {
  font-size: 9px;
  color: #4a6080;
  line-height: 1.2;
  margin-top: 1px;
}
.note-key {
  font-size: 8px;
  font-family: monospace;
  color: rgba(30, 50, 80, 0.45);
  margin-top: 3px;
  background: rgba(0,0,0,0.06);
  border-radius: 3px;
  padding: 1px 4px;
}

/* Sharp/accidental notes */
.note-btn.sharp {
  background: linear-gradient(160deg, #2a3545 0%, #1a2535 60%, #121c2a 100%);
  min-height: 56px;
  width: 32px;
  border-color: rgba(100, 130, 160, 0.4);
}
.note-btn.sharp .note-name { color: #c8dae8; }
.note-btn.sharp .note-swar { color: rgba(180, 210, 235, 0.75); }
.note-btn.sharp .note-key  { color: rgba(180, 210, 235, 0.45); background: rgba(255,255,255,0.08); }
.note-btn.sharp:active,
.note-btn.sharp.struck {
  background: linear-gradient(160deg, #1e4060 0%, #163050 60%, #102040 100%);
}

/* ── Note ripple ── */
.note-ripple {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 50;
  animation: noteRip 0.45s ease-out forwards;
  border: 2px solid rgba(16, 185, 129, 0.6);
}
@keyframes noteRip {
  from { transform: scale(0); opacity: 1; }
  to   { transform: scale(3.5); opacity: 0; }
}

/* ── Mobile ── */
@media (max-width: 639px) {
  .note-btn {
    width: 44px;
    min-height: 56px;
  }
  .note-btn.sharp {
    width: 38px;
    min-height: 50px;
  }
  .flute-instrument {
    height: 44px;
  }
  .flute-tube {
    height: 22px;
  }
  .tube-key-pad {
    width: 9px;
    height: 9px;
  }
  .flute-key-display {
    gap: 7px;
  }
  .notes-grid {
    gap: 5px;
  }
}
