* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Helvetica Neue', Arial, sans-serif;
  background: #f0f4f8;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 24px;
}
.card {
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 4px 32px rgba(0,0,0,0.10);
  padding: 36px 40px;
  max-width: 720px;
  width: 100%;
}
h1 { font-size: 1.4rem; font-weight: 700; color: #1e293b; margin-bottom: 6px; }
.subtitle { color: #64748b; font-size: 0.875rem; margin-bottom: 20px; }


/* Melody editor */
#melody-editor { margin-bottom: 20px; }
.melody-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.melody-title { font-size: 0.9rem; font-weight: 600; color: #1e293b; }
.play-btn {
  padding: 6px 14px;
  background: #10b981; color: #fff;
  border: none; border-radius: 6px;
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
.play-btn:hover { background: #059669; }
.play-btn:disabled { background: #94a3b8; cursor: default; }
.clear-btn {
  padding: 6px 14px;
  background: #e2e8f0; color: #475569;
  border: none; border-radius: 6px;
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
.clear-btn:hover { background: #cbd5e1; }
.header-actions { display: flex; gap: 8px; }
.load-btn {
  padding: 6px 14px;
  background: #3b82f6; color: #fff;
  border: none; border-radius: 6px;
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
.load-btn:hover { background: #2563eb; }
.save-btn {
  padding: 6px 14px;
  background: #0e7490; color: #fff;
  border: none; border-radius: 6px;
  font-size: 0.8rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
.save-btn:hover { background: #155e75; }
.marker-note {
  display: flex; align-items: center; gap: 8px;
  background: #eff6ff;
  border-left: 3px solid #3b82f6;
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 0.8rem; line-height: 1.4; color: #334155;
}
.marker-note__icon { color: #3b82f6; font-size: 0.7rem; flex-shrink: 0; }

/* Piano roll */
#piano-roll {
  display: grid;
  /* grid-template-columns set dynamically in JS */
  gap: 2px;
  margin-bottom: 10px;
}
.pr-beat-num {
  font-size: 0.55rem; color: #94a3b8;
  text-align: center; line-height: 1.4;
}
.pr-key {
  border-radius: 4px;
  font-size: 0.7rem; font-weight: 700; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  display: flex; align-items: center; justify-content: center;
  height: 20px; padding: 2px;
}
.pr-cell {
  height: 20px;
  border-radius: 3px;
  cursor: pointer;
  transition: opacity 0.1s, transform 0.06s;
}
.pr-cell:hover { opacity: 0.7; }
.pr-cell:active { transform: scale(0.88); }

/* Preview */
#preview-container {
  width: 100%; height: 300px;
  border-radius: 10px; overflow: hidden;
  background: #e8f0f8; border: 1px solid #dde3ec;
  margin-bottom: 6px;
}
.preview-hint { text-align: center; color: #94a3b8; font-size: 0.78rem; margin-bottom: 24px; }
/* WebGL が使えない環境で 3D プレビューの代わりに出す案内 */
.preview-fallback {
  display: flex; align-items: center; justify-content: center;
  height: 100%; margin: 0; padding: 0 24px;
  text-align: center; color: #64748b; font-size: 0.82rem; line-height: 1.6;
}

/* Download buttons */
.download-row { display: flex; gap: 10px; }
#downloadBtn, #downloadSvgBtn, #downloadPdfBtn {
  flex: 1; padding: 14px;
  background: #2563eb; color: #fff;
  border: none; border-radius: 8px;
  font-size: 0.92rem; font-weight: 600;
  cursor: pointer; transition: background 0.15s;
}
#downloadSvgBtn { background: #0e7490; }
#downloadPdfBtn { background: #b45309; }
#downloadBtn:hover  { background: #1d4ed8; }
#downloadBtn:active { background: #1e40af; }
#downloadSvgBtn:hover  { background: #155e75; }
#downloadSvgBtn:active { background: #164e63; }
#downloadPdfBtn:hover  { background: #92400e; }
#downloadPdfBtn:active { background: #78350f; }

/* GitHub ribbon */
.github-ribbon {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 1000;
  width: 80px;
  height: 80px;
  overflow: hidden;
}
.github-ribbon svg {
  width: 80px;
  height: 80px;
}
.github-ribbon .octo-arm {
  animation: none;
}
.github-ribbon:hover .octo-arm {
  animation: octocat-wave 560ms ease-in-out;
}
@keyframes octocat-wave {
  0%, 100% { transform: rotate(0); }
  20%, 60% { transform: rotate(-25deg); }
  40%, 80% { transform: rotate(10deg); }
}

/* Footer */
.site-footer {
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
  text-align: center;
  font-size: 0.78rem;
  color: #94a3b8;
}
.site-footer a { color: #64748b; text-decoration: none; font-weight: 600; }
.site-footer a:hover { color: #2563eb; text-decoration: underline; }
.site-footer__sep { margin: 0 6px; }

