header {
  background: #1e1e2f;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0;
  height: 56px; /* 👈 ヘッダー縦幅を小さめに */
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
  width: 100vw;
  position: fixed;
  z-index: 100;
}

header h1 {
  font-size: 1.5rem; /* 少し小さく */
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0rem 1rem;
}

.settings-icon {
  background: none;
  border: none;
  cursor: pointer;
  color: #fff;
  padding: 0.3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 2vw;
}

.settings-icon svg {
  width: 28px;   /* 👈 大きくする */
  height: 28px;  /* 👈 大きくする */
}

.modal {
  position: fixed;
  top: 60px;
  right: 20px;
  background: #fff;
  border: 1px solid #ccc;
  padding: 0 1.2em;
  border-radius: 8px;
  width: 320px;
  max-height: 80vh;         /* 高さを画面の80%に制限 */
  overflow-y: auto;         /* 内容がはみ出たら縦スクロール */
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
  z-index: 1000;
}
@media (max-height: 500px) {
  .modal {
    max-height: 90vh;
  }
}

.modal.hidden {
  display: none;
}

.modal-content {
  position: relative;
}

.close-button {
  position: absolute;
  top: 8px;
  right: 8px;
  background-color: #eee;
  border: 1px solid #ccc;
  border-radius: 4px;
  cursor: pointer;
  padding: 4px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.close-button:hover {
  background-color: #ddd;
}

#keyboard {
  position: relative;
  margin-top: 1rem;
}

.key {
  position: absolute;
  display: flex; /* ← 追加 */
  align-items: center; /* 垂直中央揃え */
  justify-content: center; /* 水平中央揃え */
  width: 60px;
  height: 40px;
  background: white;
  border: 1px solid #999;
  border-radius: 6px;
  box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
  user-select: none;
  font-size: 0.8rem;
}

.key .label {
  pointer-events: none;
  font-size: inherit;
  font-family: 'Segoe UI', sans-serif;
}

.key.black {
  background: black;
  color: white;
}

.key.pressed {
  background-color: #3399ff !important;
  color: white;
}

#notation {
  width: 640px; /* 例: 60px * 10 + padding調整 */
  margin: 0rem auto;
  background: white;
  padding: 1rem;
  border-radius: 8px;
  overflow-x: auto;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#notation-wrapper {
  overflow-x: auto;
  padding: 0 20px;
}

#chord-chart {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.5rem;
}

.chord-chart-row {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.chord-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 90px;
}

.chord-title {
  font-weight: bold;
  margin-bottom: 0.4rem;
}

.mini-keyboard {
  display: flex;
  justify-content: center; /* 横中央に整列 */
  height: 20px;
  margin-bottom: 4px;
  width: fit-content; /* 鍵数に合わせる */
}

.mini-keyboard-3row {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 0.5rem;
}

.mini-keyboard-janko {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 0.5rem;
}

.mini-keyboard-row {
  display: flex;
  justify-content: center;
}

.mini-keyboard-row.offset {
  margin-left: 18px; /* 半キー分のシフト */
}

.mini-key {
  width: 16px;
  height: 12px;
  margin: 1px;
  background: #eee;
  border: 1px solid #aaa;
  box-sizing: border-box;
  display: inline-block;
}

.mini-key.black {
  background: #333;
}

.mini-key.active {
  background: #3399ff;
}

.mini-key.active.root {
  background-color: #3721df !important;
}

#keyboard-slide-control {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0.5rem 0;
}

#keyboard-slide-control button {
  padding: 4px 8px;
  font-size: 1.1rem; /* または 1.2rem に統一 */
}

#keyboard-range-control {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

#keyboard-range-control button {
  padding: 4px 8px;
  font-size: 1.2rem;
}

body {
  font-family: 'Segoe UI', sans-serif;
  background: #f4f4f8;
  color: #333;
  margin: 0;
  padding: 0;
}

.main-container {
  padding-top: 56px; /* ← ヘッダー高さと同じ */
  padding-left: 2rem;
  padding-right: 2rem;
  max-width: 1200px;
  margin: auto;
}

.control-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin: 1rem 0;
  background: #fff;
  border-radius: 8px;
  padding: 1rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.control-block {
  flex: 1;
  min-width: 250px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.control-group {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.control-block label {
  font-weight: bold;
  margin-bottom: 0.3rem;
}

input[type="range"] {
  flex: 1;
}

button {
  padding: 0.4rem 0.8rem;
  font-size: 1rem;
  background: #1e88e5;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s ease;
}

button:hover {
  background: #1565c0;
}

#explanation-container {
  text-align: center;
  margin-bottom: 1rem;
}

#toggle-explanation {
  background: #444;
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  cursor: pointer;
}
#explanation {
  margin-top: 0.5rem;
  background: #f4f4f4;
  border-radius: 8px;
  padding: 1rem;
  text-align: left;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.centered {
  display: flex;
  justify-content: center;
}
.control-block.vertical {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.version-badge {
  position: fixed;
  bottom: 10px;
  right: 10px;
  background: #f2f2f2;
  border: 1px solid #ccc;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.75em;
  color: #555;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  z-index: 999;
  opacity: 1;
  transition: opacity 1s ease; /* フェードアウト用 */
}

.version-badge.hidden {
  opacity: 0;
  pointer-events: none;
}

.key-hint {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 0.8em;
  color: #555;
  pointer-events: none;
}
.key.black .key-hint {
  color: #ccc;
}

.hide-key-hint .key-hint {
  display: none;
}

.memo-button {
  position: fixed;
  top: 10%;
  right: 16px;
  z-index: 50;
  padding: 8px 12px;
  background-color: #444;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.memo-button.active {
  background-color: #1e88e5;
  color: white;
  box-shadow: 0 0 10px rgba(30, 136, 229, 0.6);
  transform: scale(1.05);
}

#memo-modal {
  display: none;
  position: fixed;
  top: 20%;
  right: 16px; 
  z-index: 50;
  background: white;
  border: 1px solid #ccc;
  border-radius: 8px;
  width: 180px;
  max-width: 90vw; /* 画面幅を超えないように */
  padding: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}

@media (max-width: 500px) {
  #memo-modal {
    width: 90vw;
    right: 5vw;
  }
}