body { font-family: Inter, sans-serif; }

:root {
  --kalimba-wood-light: #a96e34;
  --kalimba-wood-mid: #8d5427;
  --kalimba-wood-dark: #6e401c;
  --kalimba-wood-shadow: rgba(43, 20, 8, 0.55);
  --kalimba-metal-light: #eceff3;
  --kalimba-metal-mid: #b7c0cb;
  --kalimba-metal-dark: #7f8a98;
  --kalimba-hardware-light: #d9dde3;
  --kalimba-hardware-dark: #6d7783;
  --kalimba-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);
}

/* ── Kalimba body ── */
.kalimba-body {
  background:
    radial-gradient(circle at 50% 67%, rgba(70, 34, 12, 0.16) 0 8%, rgba(70, 34, 12, 0.05) 9%, transparent 18%),
    repeating-linear-gradient(92deg, rgba(255, 232, 184, 0.03) 0 26px, rgba(150, 90, 36, 0.04) 26px 52px, rgba(255, 232, 184, 0.018) 52px 78px),
    linear-gradient(90deg, rgba(255, 234, 190, 0.05) 0%, transparent 18%, rgba(255, 234, 190, 0.035) 38%, transparent 56%, rgba(255, 234, 190, 0.05) 76%, transparent 100%),
    linear-gradient(160deg, var(--kalimba-wood-light) 0%, var(--kalimba-wood-mid) 42%, var(--kalimba-wood-dark) 100%);
  border-radius: 1.2rem 1.2rem 2.5rem 2.5rem;
  padding: 34px 16px 38px;
  border: 1px solid rgba(150, 94, 45, 0.42);
  box-shadow:
    inset 0 2px 10px rgba(255, 239, 206, 0.18),
    inset 0 -10px 22px rgba(82, 45, 18, 0.18),
    inset 0 0 0 1px rgba(255, 240, 210, 0.06),
    0 12px 34px rgba(0,0,0,0.18);
  position: relative;
  overflow: hidden;
}
.kalimba-body::before {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(255, 238, 204, 0.16) 0%, transparent 58%),
    radial-gradient(ellipse at 50% 75%, rgba(95, 52, 20, 0.08) 0%, transparent 25%),
    linear-gradient(180deg, transparent 0%, transparent 72%, var(--kalimba-accent) 100%);
  pointer-events: none;
}
.kalimba-body::after {
  content: '';
  position: absolute;
  width: 92px;
  height: 92px;
  left: 50%;
  top: 54%;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(18, 8, 3, 0.9) 0 34%, rgba(40, 18, 8, 0.68) 35%, rgba(88, 46, 18, 0.16) 47%, transparent 61%);
  box-shadow:
    0 0 0 2px rgba(98, 54, 22, 0.18),
    0 10px 16px rgba(0, 0, 0, 0.10);
  pointer-events: none;
}

/* ── Tines container ── */
.kalimba-tines {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 5px;
  width: max-content;
  max-width: 100%;
  margin: 0 auto;
  min-height: 230px;
  position: relative;
  z-index: 1;
}
.kalimba-tines::before {
  content: '';
  position: absolute;
  top: -10px;
  left: 50%;
  width: 100%;
  height: 6px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #edf1f5 0%, #bcc4ce 45%, #6e7987 100%);
  border-radius: 999px;
  box-shadow:
    0 1px 2px rgba(0,0,0,0.20),
    inset 0 1px 1px rgba(255,255,255,0.22),
    inset 0 -1px 1px rgba(0,0,0,0.24);
  pointer-events: none;
}
.kalimba-tines::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 50%;
  width: 90%;
  height: 3px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, #7e8792 0%, #5f6874 100%);
  border-radius: 999px;
  box-shadow: 0 1px 1px rgba(0,0,0,0.18);
  pointer-events: none;
}

/* ── Individual tine — grows upward from base ── */
.tine {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  position: relative;
  transition: filter 0.08s;
}
.tine:active { filter: brightness(1.3); }

.tine-bar {
  border-radius: 0 0 6px 6px;
  position: relative;
  transition: transform 0.06s cubic-bezier(0.2, 0.8, 0.4, 1), background 0.08s;
  box-shadow:
    inset 1px 0 1px rgba(255,255,255,0.32),
    inset -1px 0 1px rgba(51,65,85,0.18),
    0 2px 5px rgba(0,0,0,0.24);
  flex-shrink: 0;
  margin-top: 3px;
  transform-origin: top center;
}
.tine-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 16%;
  width: 18%;
  height: 100%;
  background: linear-gradient(180deg, rgba(255,255,255,0.42), rgba(255,255,255,0.05));
  border-radius: 999px;
  pointer-events: none;
}
.tine-bar::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 8%;
  right: 8%;
  height: 1px;
  background: rgba(255, 255, 255, 0.38);
  border-radius: 999px;
  pointer-events: none;
}
.tine-bar.struck {
  transform: scaleY(0.96) translateY(2px);
  background: #f2f5f8 !important;
  box-shadow:
    inset 1px 0 1px rgba(255,255,255,0.5),
    0 0 14px rgba(214, 225, 236, 0.72),
    0 3px 10px rgba(0,0,0,0.3);
}

/* Tine base bridge — at bottom */
.tine-base {
  width: 110%; /* slightly wider than bar for a realistic bridge look */
  height: 10px;
  background: linear-gradient(180deg, var(--kalimba-hardware-light) 0%, #a7b0bb 48%, var(--kalimba-hardware-dark) 100%);
  border-radius: 3px;
  box-shadow:
    0 2px 4px rgba(0,0,0,0.30),
    inset 0 1px 2px rgba(255,255,255,0.28),
    inset 0 -1px 2px rgba(55,65,81,0.28);
  margin-top: 0;
  margin-bottom: 0;
  flex-shrink: 0;
  position: relative;
}

/* Dark slot line on bridge top where tine slots in */
.tine-base::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 14%;
  width: 72%;
  height: 2px;
  background: rgba(0,0,0,0.45);
  border-radius: 1px;
}
.tine-base::after {
  content: '';
  position: absolute;
  top: -5px;
  left: 50%;
  width: 34%;
  height: 3px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(247, 249, 251, 0.96), rgba(129, 139, 151, 0.92));
  border-radius: 999px;
  box-shadow:
    0 1px 1px rgba(0,0,0,0.18),
    inset 0 1px 1px rgba(255,255,255,0.20);
}

/* Tine labels — rendered above the bar (column-reverse means they appear at top) */
.tine-note-label {
  font-size: 9px;
  font-weight: 700;
  color: rgba(255,251,235,0.96);
  letter-spacing: 0.02em;
  line-height: 1.15;
  text-align: center;
  white-space: nowrap;
  margin-top: 3px;
}
.tine-swar-label {
  font-size: 7px;
  color: rgba(253, 213, 115, 0.92);
  text-align: center;
  line-height: 1.15;
  white-space: nowrap;
  margin-top: 3px;
}
.tine-key-label {
  font-size: 6.5px;
  color: rgba(226, 232, 240, 0.48);
  font-family: monospace;
  text-align: center;
  line-height: 1.15;
  white-space: nowrap;
  margin-top: 1px;
}

/* ── Reverb styled toggle (matches mode-btn pattern) ── */
.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);
}

/* ── Loop recorder ── */
.rec-active #recBtn {
  background: #7f1d1d;
  animation: recPulse 1s infinite;
}
@keyframes recPulse { 0%,100%{opacity:1} 50%{opacity:0.6} }

/* ── Ripple on tine tap ── */
.tine-ripple {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 50;
  animation: tineRip 0.5s ease-out forwards;
  border: 2px solid rgba(232,216,122,0.8);
}
@keyframes tineRip {
  from { transform: scale(0); opacity: 1; }
  to   { transform: scale(4); opacity: 0; }
}

tbody tr:nth-child(even) { background: #f9fafb; }

/* ── Landscape banner ── */
.landscape-banner {
  background: #fefce8;
  border: 1px solid #fde68a;
  border-radius: 0.5rem;
  padding: 8px 14px;
  font-size: 0.75rem;
  color: #92400e;
  text-align: center;
  margin-bottom: 10px;
}

/* ── Fullscreen button ── */
.fullscreen-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid #e5e7eb;
  border-radius: 7px;
  background: #f9fafb;
  color: #6b7280;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
  margin-left: auto;
}
.fullscreen-btn:hover {
  background: #fff;
  color: #065f46;
  border-color: #6ee7b7;
}
.fullscreen-btn svg {
  width: 15px;
  height: 15px;
  pointer-events: none;
}

/* ── Fullscreen mode ── */
.tool-card.is-fullscreen {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
  border-radius: 0 !important;
  max-width: 100vw !important;
  width: 100vw !important;
  height: 100dvh !important;
  overflow-y: auto !important;
  margin: 0 !important;
  padding: 1.5rem !important;
  box-sizing: border-box !important;
}
.tool-card.is-fullscreen .kalimba-body {
  flex: 1;
}
.tool-card.is-fullscreen .kalimba-tines {
  min-height: 300px;
}

/* ── Mobile overrides (<640px) ── */
@media (max-width: 639px) {
  .kalimba-body {
    padding: 30px 8px 34px;
  }
  .kalimba-tines {
    gap: 3px;
    min-height: 260px;
  }
  .kalimba-body::after {
    width: 74px;
    height: 74px;
    top: 60%;
  }
}
