* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: #fff;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

header {
  text-align: center;
  padding: 2rem 1rem 1rem;
}

header h1 {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(90deg, #e94560, #f5a623);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

header p {
  color: #aaa;
  font-size: 1.05rem;
}

main {
  flex: 1;
  width: 100%;
  max-width: 960px;
  padding: 1rem;
}

.controls {
  display: flex;
  justify-content: center;
  gap: 2rem;
  margin-bottom: 2rem;
  align-items: center;
  flex-wrap: wrap;
}

.controls label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: #ccc;
}

.controls select,
.controls input[type="range"] {
  cursor: pointer;
}

.controls select {
  padding: 0.3rem 0.5rem;
  border-radius: 6px;
  border: none;
  background: #2a2a4a;
  color: #fff;
  font-size: 0.9rem;
}

.piano-container {
  display: flex;
  justify-content: center;
  margin-bottom: 3rem;
  overflow-x: auto;
  padding: 1rem 0;
}

.piano {
  display: flex;
  position: relative;
  user-select: none;
  border-radius: 0 0 8px 8px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
}

.key {
  cursor: pointer;
  transition: background 0.05s, transform 0.05s;
  position: relative;
}

.key.white {
  width: 52px;
  height: 200px;
  background: linear-gradient(180deg, #f8f8f8 0%, #fff 5%, #e8e8e8 100%);
  border: 1px solid #ccc;
  border-radius: 0 0 6px 6px;
  z-index: 1;
  color: #555;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.key.white.active {
  background: linear-gradient(180deg, #e0e0e0 0%, #f0f0f0 5%, #d0d0d0 100%);
  transform: scaleY(0.98);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.15);
}

.key.black {
  width: 34px;
  height: 130px;
  background: linear-gradient(180deg, #333 0%, #1a1a1a 100%);
  border: 1px solid #111;
  border-radius: 0 0 4px 4px;
  z-index: 2;
  margin-left: -17px;
  margin-right: -17px;
  color: #999;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 8px;
  font-size: 0.6rem;
}

.key.black.active {
  background: linear-gradient(180deg, #555 0%, #2a2a2a 100%);
  transform: scaleY(0.96);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.4);
}

.key .key-label {
  pointer-events: none;
}

.key.white .key-label {
  color: #888;
  font-size: 0.65rem;
}

.key.black .key-label {
  color: #666;
  font-size: 0.55rem;
}

.song-guide {
  margin-bottom: 2rem;
}

.song-guide h2 {
  text-align: center;
  font-size: 1.8rem;
  margin-bottom: 1rem;
  color: #f5a623;
}

.song-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.song-controls select {
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: none;
  background: #2a2a4a;
  color: #fff;
  font-size: 0.95rem;
  cursor: pointer;
  min-width: 200px;
}

.song-controls button {
  padding: 0.5rem 1.2rem;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
}

.song-controls button:active {
  transform: scale(0.96);
}

#play-btn {
  background: #2ecc71;
  color: #fff;
}

#play-btn:hover {
  background: #27ae60;
}

#stop-btn {
  background: #e74c3c;
  color: #fff;
}

#stop-btn:hover {
  background: #c0392b;
}

.tempo-label {
  color: #ccc;
  font-size: 0.9rem;
}

.song-controls input[type="range"] {
  width: 100px;
  cursor: pointer;
}

#tempo-val {
  color: #f5a623;
  font-weight: 600;
  min-width: 2rem;
  text-align: center;
}

.song-display {
  display: flex;
  justify-content: center;
}

.note-indicator {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0.6rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.note-label {
  color: #aaa;
  font-size: 0.9rem;
}

.note-value {
  color: #e94560;
  font-size: 1.3rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  min-width: 3rem;
  text-align: center;
}

.how-to-play {
  margin-bottom: 2rem;
}

.how-to-play h2 {
  text-align: center;
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  color: #f5a623;
}

.tips {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
}

.tip-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 1.2rem;
  transition: transform 0.2s, border-color 0.2s;
}

.tip-card:hover {
  transform: translateY(-3px);
  border-color: #e94560;
}

.tip-card h3 {
  font-size: 1.05rem;
  margin-bottom: 0.5rem;
  color: #e94560;
}

.tip-card p {
  font-size: 0.9rem;
  color: #bbb;
  line-height: 1.5;
}

footer {
  padding: 1.5rem;
  color: #666;
  font-size: 0.85rem;
  text-align: center;
}

@media (max-width: 700px) {
  header h1 { font-size: 1.8rem; }
  .key.white { width: 40px; height: 150px; font-size: 0.65rem; }
  .key.black { width: 26px; height: 100px; margin-left: -13px; margin-right: -13px; font-size: 0.5rem; }
  .tips { grid-template-columns: 1fr; }
}
