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

.musicbox-body {
  background: linear-gradient(145deg, #8B4513 0%, #A0522D 40%, #8B4513 100%);
  border-radius: 16px;
  padding: 24px 20px 20px;
  box-shadow: inset 0 1px 2px rgba(255,255,255,0.15), 0 8px 32px rgba(0,0,0,0.35);
  max-width: 560px;
  margin: 0 auto;
  user-select: none;
  border: 2px solid #6B3410;
  position: relative;
}

.musicbox-lid {
  position: absolute;
  top: -8px;
  left: 10%;
  right: 10%;
  height: 12px;
  background: linear-gradient(to bottom, #A0522D, #7A3B10);
  border-radius: 6px 6px 0 0;
  box-shadow: 0 -2px 6px rgba(0,0,0,0.3);
}

.musicbox-inner {
  background: linear-gradient(180deg, #2a1a0a 0%, #1a0f05 100%);
  border-radius: 10px;
  padding: 16px;
  box-shadow: inset 0 2px 8px rgba(0,0,0,0.6);
  border: 1px solid #5a3a1a;
}

.musicbox-label {
  text-align: center;
  color: #d4a76a;
  font-family: 'Georgia', serif;
  font-size: 14px;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 12px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
}

.musicbox-cylinder-area {
  position: relative;
  height: 90px;
  background: linear-gradient(180deg, #1a0f05 0%, #2a1a0a 50%, #1a0f05 100%);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid #3a2a1a;
  margin-bottom: 12px;
}

.cylinder-wrapper {
  position: absolute;
  left: 10%;
  right: 10%;
  top: 10px;
  bottom: 10px;
  overflow: hidden;
}

.cylinder {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background: linear-gradient(180deg, #c9a96e 0%, #a8884e 30%, #7a6630 60%, #a8884e 100%);
  border-radius: 50% / 12px;
  box-shadow: inset 0 -4px 12px rgba(0,0,0,0.5), inset 0 4px 12px rgba(255,255,255,0.15);
  transform: rotateX(20deg);
}

.cylinder-spinning {
  animation: cylinderSpin 4s linear infinite;
}

@keyframes cylinderSpin {
  from { transform: rotateX(20deg) rotate(0deg); }
  to { transform: rotateX(20deg) rotate(360deg); }
}

.cylinder-pins {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  border-radius: 50% / 12px;
}

.cylinder-pin {
  position: absolute;
  width: 4px;
  height: 6px;
  background: #f0d080;
  border-radius: 2px;
  box-shadow: 0 0 3px rgba(240,208,128,0.5);
  transform: translateX(-50%);
}

.comb-area {
  display: flex;
  justify-content: center;
  gap: 3px;
  padding: 8px 12px;
  background: linear-gradient(180deg, #d4a76a, #b8894a);
  border-radius: 4px;
  margin-bottom: 12px;
  border: 1px solid #9a7a3a;
}

.comb-tooth {
  width: 6px;
  height: 28px;
  background: linear-gradient(180deg, #f0e0c0 0%, #d4c09a 100%);
  border-radius: 0 0 3px 3px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
  transition: background 0.08s, box-shadow 0.08s;
  transform-origin: top center;
}

.comb-tooth.plucked {
  background: linear-gradient(180deg, #fff8e0 0%, #f0d090 100%);
  box-shadow: 0 0 8px rgba(255,220,100,0.6);
}

.musicbox-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  justify-content: center;
}

.musicbox-controls select {
  background: #3a2a1a;
  color: #d4a76a;
  border: 1px solid #5a3a1a;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}

.musicbox-controls select option {
  background: #2a1a0a;
  color: #d4a76a;
}

.musicbox-btn {
  background: #5a3a1a;
  color: #d4a76a;
  border: 1px solid #7a5a2a;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.musicbox-btn:hover {
  background: #7a5a2a;
  color: #f0d090;
}

.musicbox-btn.playing {
  background: #8B4513;
  color: #fff;
  box-shadow: 0 0 8px rgba(139,69,19,0.4);
}

.musicbox-slider-group {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #d4a76a;
  font-size: 11px;
  font-weight: 600;
}

.musicbox-slider-group input[type="range"] {
  width: 64px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: #5a3a1a;
  border-radius: 2px;
  outline: none;
}

.musicbox-slider-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: #d4a76a;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 4px rgba(0,0,0,0.3);
}

.crank-area {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 8px;
  background: rgba(0,0,0,0.2);
  border-radius: 6px;
}

.crank-handle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #d4a76a, #8B6914);
  border: 2px solid #6B4E1A;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  transition: transform 0.15s;
  font-size: 16px;
  color: #5a3a1a;
}

.crank-handle:active {
  transform: scale(0.9);
}

.crank-handle.winding {
  animation: crankWind 0.3s linear infinite;
}

@keyframes crankWind {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.crank-status {
  color: #d4a76a;
  font-size: 12px;
  font-weight: 600;
  font-family: Georgia, serif;
  font-style: italic;
}

.note-indicator {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  margin-top: 10px;
  min-height: 24px;
}

.note-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #5a3a1a;
  transition: all 0.08s;
  border: 1px solid #3a2a1a;
}

.note-dot.active {
  background: #f0d080;
  box-shadow: 0 0 8px rgba(240,208,128,0.6);
  border-color: #f0d080;
}

.musicbox-output {
  margin-top: 10px;
}

/* Song info display */
.song-info {
  text-align: center;
  color: #a8884e;
  font-size: 11px;
  font-style: italic;
  margin-top: 6px;
  min-height: 16px;
  font-family: Georgia, serif;
}

.manual-tines-wrap {
  margin-top: 12px;
  padding: 10px 8px;
  background: rgba(0,0,0,0.15);
  border-radius: 8px;
  border: 1px solid #3a2a1a;
}

.manual-tines-label {
  text-align: center;
  color: #c9a96e;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.manual-tines {
  display: flex;
  justify-content: center;
  gap: 3px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 4px 2px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.manual-tine {
  flex: 0 0 auto;
  width: 28px;
  height: 52px;
  background: linear-gradient(180deg, #f0e0c0 0%, #d4c09a 50%, #b8a07a 100%);
  border-radius: 3px 3px 6px 6px;
  border: 1px solid #8a7a5a;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 4px;
  font-size: 8px;
  font-weight: 700;
  color: #6a5a3a;
  transition: all 0.06s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}

.manual-tine:active,
.manual-tine.plucked {
  background: linear-gradient(180deg, #fff8e0 0%, #f0d090 50%, #d4b070 100%);
  box-shadow: 0 0 10px rgba(255,220,100,0.5);
  transform: scaleY(0.95);
}

.manual-tine .tine-note {
  font-size: 9px;
  font-weight: 800;
  color: #5a4a2a;
  pointer-events: none;
}

.manual-tine .tine-key {
  font-size: 7px;
  color: #8a7a5a;
  margin-top: 1px;
  pointer-events: none;
}

.manual-tines-hint {
  text-align: center;
  color: #8a7a5a;
  font-size: 9px;
  margin-top: 6px;
}

.manual-tines-hint span {
  color: #c9a96e;
}

@media (max-width: 600px) {
  .tool-card { padding: 1rem 0.5rem; }
  .musicbox-body { padding: 16px 10px 14px; }
  .musicbox-cylinder-area { height: 70px; }
  .musicbox-controls { gap: 6px; }
  .musicbox-controls select { font-size: 11px; padding: 4px 8px; }
  .musicbox-btn { font-size: 11px; padding: 4px 10px; }
  .musicbox-slider-group input[type="range"] { width: 56px; }
  .crank-handle { width: 30px; height: 30px; font-size: 14px; }
  .comb-tooth { width: 4px; height: 20px; }
  .manual-tine { width: 22px; height: 40px; font-size: 7px; }
  .manual-tine .tine-note { font-size: 7px; }
  .manual-tine .tine-key { font-size: 6px; }
}

@media (max-width: 400px) {
  .musicbox-body { padding: 12px 6px 10px; }
  .musicbox-cylinder-area { height: 56px; }
  .musicbox-controls select { font-size: 10px; padding: 3px 6px; }
  .musicbox-btn { font-size: 10px; padding: 3px 8px; }
  .musicbox-slider-group input[type="range"] { width: 44px; }
  .crank-handle { width: 26px; height: 26px; font-size: 12px; }
  .comb-tooth { width: 3px; height: 16px; }
  .manual-tine { width: 18px; height: 34px; border-radius: 2px 2px 4px 4px; }
  .manual-tine .tine-note { font-size: 6px; }
  .manual-tine .tine-key { display: none; }
  .manual-tines-hint { font-size: 8px; }
  .song-info { font-size: 10px; }
  .musicbox-label { font-size: 12px; letter-spacing: 2px; }
}
