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

.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);
}

/* ── Virtual Koto Styles ── */

.koto-board {
  position: relative;
  width: 100%;
  height: 380px; /* accommodate 13 horizontal strings */
  background: 
    linear-gradient(90deg, #965a38 0%, #aa6c39 30%, #b37340 50%, #aa6c39 70%, #965a38 100%);
  border-radius: 8px;
  box-shadow: 
    inset 0 10px 20px rgba(0,0,0,0.5), 
    inset 0 2px 5px rgba(255,255,255,0.2),
    0 4px 15px rgba(0,0,0,0.2);
  border: 4px solid #4a2c14;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-evenly;
  padding: 15px 30px; /* room for the ends */
  touch-action: none;
}

/* Wood grain texture applied over the board */
.koto-board::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background-image: 
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(0,0,0,0.03) 2px,
      rgba(0,0,0,0.03) 4px
    );
  pointer-events: none;
  z-index: 1;
}

/* ── Koto Bridge (Ji) mapping points ── */
/* Real koto bridges form a distinct diagonal curve. We'll set the positions in JS, 
   but style the bridge here as a pseudo element on the string wrap. */

.koto-string-wrap {
  position: relative;
  width: 100%;
  height: 20px;
  display: flex;
  align-items: center;
  z-index: 2;
  cursor: crosshair;
}

/* The actual string */
.koto-string {
  position: absolute;
  left: 0; 
  right: 0;
  height: 2px;
  background: linear-gradient(to bottom, #fde047, #fef08a, #eab308); /* silk/nylon look */
  box-shadow: 0 4px 5px rgba(0,0,0,0.4);
  pointer-events: none; /* Let the wrap handle hit events */
  transition: transform 0.05s ease-out;
}

/* Pluck animation class */
.koto-string.plucked {
  animation: string-vibrate 0.4s ease-out;
  background: #ffffff; /* flash bright when plucked */
  box-shadow: 0 0 10px #fef08a, 0 4px 5px rgba(0,0,0,0.4);
}

@keyframes string-vibrate {
  0%   { transform: translateY(0); }
  20%  { transform: translateY(-3px); }
  40%  { transform: translateY(2px); }
  60%  { transform: translateY(-1px); }
  80%  { transform: translateY(1px); }
  100% { transform: translateY(0); }
}

/* The Movable Bridge (Ji) */
.koto-bridge {
  position: absolute;
  width: 14px;
  height: 24px;
  background: linear-gradient(to bottom, #f8fafc, #94a3b8); /* white ivory look */
  border: 1px solid #475569;
  border-radius: 2px 2px 1px 1px;
  top: -2px;
  box-shadow: -3px 5px 6px rgba(0,0,0,0.5);
  pointer-events: none;
}
/* Tiny groove on top of bridge */
.koto-bridge::after {
  content: "";
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 2px; height: 4px;
  background: #000;
}

/* The Number / Label assigned to the string (Right edge) */
.koto-label {
  position: absolute;
  right: 4px;
  color: #fcd34d;
  font-weight: bold;
  font-size: 11px;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
  pointer-events: none;
}

/* Ripple effect on pluck */
.koto-ripple {
  position: absolute;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid rgba(253, 224, 71, 0.8);
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.1);
  opacity: 1;
  animation: kotoRipple 0.4s ease-out forwards;
}

@keyframes kotoRipple {
  to {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 0;
  }
}

/* Responsive Scaling */
@media (max-width: 600px) {
  .koto-board { height: 320px; padding: 10px 25px; }
  .koto-string-wrap { height: 16px; }
  .koto-bridge { width: 10px; height: 18px; top: -1px; }
}
