/* =========================
   Base
   ========================= */

html,
body {
  height: 100%;
}

body {
  margin: 0;
  padding: 0;

  /* Woody Brown Theme (global) */
  background: #3a281c; /* 少し明るい木材色 */
  color: #f3e7d7; /* 生成り系 */

  font-family:
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;

  /* app-shell（grid）を使っているので body は block でOK */
  display: block;
  min-height: 100vh;
}

h1 {
  margin-top: 32px;
  margin-bottom: 8px;
  font-size: 1.6rem;
}

.title-row {
  width: min(90vw, 960px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  position: relative;
}

.title-row h1 {
  text-align: center;
  margin-left: 0;
}

.title-actions {
  position: absolute;
  right: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-btn {
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  border: 1px solid #c08a55;
  background: linear-gradient(180deg, #7d4a2a 0%, #4a2b18 100%);
  color: #f3e7d7;
  font-size: 1.5rem;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 180, 0.35),
    0 8px 16px rgba(0, 0, 0, 0.55);
  transition:
    transform 0.08s ease,
    filter 0.12s ease,
    box-shadow 0.12s ease;
}

#settingsBtn {
  color: #ffd54a;
  text-shadow: 0 0 8px rgba(255, 213, 74, 0.35);
}

#settingsBtn:hover {
  color: #ffe27a;
}

.keyboard-guide-btn {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 9999px;
  border-color: rgba(255, 220, 180, 0.18);
  background: rgba(0, 0, 0, 0.26);
  color: rgba(243, 231, 215, 0.7);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 180, 0.1),
    0 4px 10px rgba(0, 0, 0, 0.35);
}

.keyboard-guide-icon {
  font-size: 21px;
  line-height: 1;
}

.keyboard-guide-btn:hover {
  background: rgba(0, 0, 0, 0.18);
  border-color: rgba(255, 220, 180, 0.3);
  color: rgba(243, 231, 215, 0.84);
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 180, 0.18),
    0 6px 12px rgba(0, 0, 0, 0.38);
}

.keyboard-guide-btn.is-active {
  background: linear-gradient(180deg, #f0c08a 0%, #cf8d4d 100%);
  border-color: #f0c08a;
  color: #2a1b12;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    0 8px 16px rgba(0, 0, 0, 0.42);
}

.settings-btn:hover {
  filter: brightness(1.08);
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 180, 0.4),
    0 10px 20px rgba(0, 0, 0, 0.6);
}

.settings-btn:active {
  transform: translateY(2px) scale(0.98);
}

p {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 0.9rem;
  color: #d6c3ae; /* 木目に馴染ませた色（最終版） */
}

/* =========================
   3-column layout
   ========================= */

.app-shell {
  width: 100%;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr min(960px, 92vw) 1fr; /* 左 / 中央 / 右 */
  gap: 16px;
  padding: 20px 16px 28px;
  box-sizing: border-box;
  align-items: start;
}

.center-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.side-panel {
  min-height: 100%;
}

/* 画面が狭いときは1カラム */
@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .side-panel {
    display: none;
  }
}

/* =========================
   Main containers (wood panels)
   ========================= */

.piano,
.chord-section,
.ref-piano {
  border-radius: 8px;
  border: 1px solid rgba(255, 220, 180, 0.12);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
}

/* piano は少しだけ木目感 */
.piano {
  width: min(90vw, 960px);
  height: 260px;
  overflow: hidden;
  padding: 16px 16px 34px;
  box-sizing: border-box;
  position: relative;
  border: none;
  box-shadow: none;
  background: #2f1d14;
}

.piano-inner {
  width: 100%;
  height: 100%;
  display: flex;
}

.chord-section {
  margin-top: 16px;
  width: min(90vw, 960px);
  background: linear-gradient(180deg, #3a2418 0%, #2b1a12 100%);
  padding: 14px 16px 16px;
  box-sizing: border-box;
}

.keyboard-guide-panel {
  margin-top: 14px;
  width: min(90vw, 960px);
  padding: 0;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: transparent;
  border: none;
  box-shadow: none;
}

.keyboard-guide-panel[hidden] {
  display: none !important;
}

.ref-piano {
  margin-top: 0;
  width: min(90vw, 960px);
  padding: 0;
  box-sizing: border-box;
  background: transparent;
  border: none;
  box-shadow: none;
}

.ref-piano .key-label {
  display: none;
}

.ref-piano .ref-key span {
  display: none;
}

/* =========================
   Piano keys
   ========================= */

/* 白鍵の枠（白鍵＋黒鍵を1セットにまとめる） */
.white-key-wrap {
  flex: 1;
  position: relative;
  margin: 0 2px;
}

.key {
  width: 100%;
  height: 100%;
  border-radius: 4px 4px 12px 12px;
  border: none;
  background: #f3f4f6;
  cursor: pointer;
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 8px;
  font-size: 0.8rem;
  color: #374151;
  user-select: none;
  transition:
    transform 0.06s ease,
    background-color 0.08s ease,
    filter 0.08s ease;
}

/* 白鍵 */
.key.white {
  background: #f3f4f6;
}

/* 黒鍵 */
.key.black {
  position: absolute;
  top: 0;
  right: -20%;
  width: 60%;
  height: 60%;
  border-radius: 4px 4px 8px 8px;
  border: none;
  background: #111827;
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 4px;
  font-size: 0.7rem;
  color: #e5e7eb;
  user-select: none;
  z-index: 5;
}

/* 押下・発音中 */
.key:active,
.key.active {
  transform: translateY(3px) scale(0.98);
  filter: brightness(1.08);
}

.key.held {
  transform: translateY(2px) scale(0.99);
  filter: brightness(1.06);
}

.key.white:active,
.key.white.active {
  background: #bfdbfe;
}

.key.white.held {
  background: #fecaca;
  color: #7f1d1d;
}

.key.black:active,
.key.black.active {
  background: #374151;
}

.key.black.held {
  background: #ef4444;
}

.key.outside-range {
  opacity: 0.55;
  filter: brightness(0.85);
}

/* ラベル */
.key-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.1;
}
.key-label-note {
  font-weight: 600;
}
.key-label-name {
  font-size: 0.7rem;
  opacity: 0.7;
}

.keyboard-guide-content {
  align-items: center;
}

.keyboard-guide-layout {
  --keyboard-guide-side-width: 84px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 4px 0 0;
  width: min(680px, 100%);
  margin: 0 auto;
}

.keyboard-guide-white-row {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
  flex: 1;
}

.keyboard-guide-main-row {
  display: grid;
  grid-template-columns: var(--keyboard-guide-side-width) minmax(0, 1fr) var(
      --keyboard-guide-side-width
    );
  align-items: stretch;
  gap: 10px;
}

.keyboard-guide-side {
  width: var(--keyboard-guide-side-width);
  display: flex;
  align-items: center;
  justify-content: center;
}

.keyboard-guide-side-key {
  min-width: 72px;
  aspect-ratio: auto;
  padding: 6px 10px;
}

.keyboard-guide-side-key .kbd-key-label {
  font-size: 0.82rem;
  font-weight: 900;
}

.keyboard-guide-side-key .kbd-key-sub {
  margin-top: 4px;
  font-size: 0.58rem;
  line-height: 1.1;
  white-space: nowrap;
}

.kbd-key {
  user-select: none;
  pointer-events: none;
  text-align: center;
  box-sizing: border-box;
  aspect-ratio: 1 / 1;
  min-height: 0;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: linear-gradient(
    180deg,
    rgba(255, 248, 240, 0.78),
    rgba(220, 208, 196, 0.72)
  );
  color: #2f241d;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 4px 8px rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.kbd-key-label {
  font-size: 0.84rem;
  font-weight: 800;
  line-height: 1;
}

.kbd-key-sub {
  margin-top: 4px;
  font-size: 0.68rem;
  opacity: 0.74;
  line-height: 1;
}

.keyboard-guide-black-row {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
  width: calc(100% - (var(--keyboard-guide-side-width) * 2) - 20px);
  margin: 0 auto;
}

.keyboard-guide-chord-row {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  width: calc(100% - (var(--keyboard-guide-side-width) * 2) - 20px);
  margin: 2px auto 0;
}

.keyboard-guide-chord-row .kbd-key-sub {
  font-size: 0.6rem;
}

.keyboard-guide-black-row .kbd-key {
  background: linear-gradient(
    180deg,
    rgba(92, 84, 77, 0.42),
    rgba(58, 50, 45, 0.34)
  );
  color: rgba(255, 244, 232, 0.72);
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.kbd-spacer {
  aspect-ratio: 1 / 1;
}

.octave-dots {
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 30;
}

.octave-dot {
  width: 12px;
  height: 12px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18);
  cursor: pointer;
  transition:
    transform 0.08s ease,
    background 0.12s ease,
    border-color 0.12s ease,
    box-shadow 0.12s ease;
}

.octave-dot:hover {
  background: rgba(255, 255, 255, 0.22);
}

.octave-dot:active {
  transform: scale(0.92);
}

.octave-dot.is-active {
  background: #f0c08a;
  border-color: rgba(255, 240, 220, 0.92);
  box-shadow:
    0 0 0 3px rgba(240, 192, 138, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.28);
}

/* button.key のデフォルト見た目除去 */
button.key {
  border: none;
  background: none;
}

/* =========================
   Octave click zones + hint arrows
   ========================= */

.oct-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 5%;
  z-index: 20;
  cursor: pointer;
  user-select: none;

  background: transparent;
  border: none;
  transition: background 0.12s ease;
}

.oct-zone-left {
  left: 0;
}
.oct-zone-right {
  right: 0;
}

.oct-zone:hover {
  background: rgba(37, 99, 235, 0.18);
}

.oct-zone:active {
  background: rgba(37, 99, 235, 0.28);
}

/* 矢印（見た目だけ） */
.piano::before,
.piano::after {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 15;
  pointer-events: none;
  opacity: 0.55;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
  padding: 10px 8px;
  border-radius: 9999px;
  background: transparent;
  border: none;
  color: inherit;
}

.piano::before {
  content: "◀︎";
  left: 6px;
}

.piano::after {
  content: "▶︎";
  right: 6px;
}

.piano:hover::before,
.piano:hover::after {
  opacity: 0.8;
  filter: brightness(1.08);
}

/* =========================
   Transpose / Mode buttons (Woody Button Theme)
   ========================= */

.transpose-controls {
  margin-top: 12px;
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: 1fr;
  align-items: start;
  gap: 8px;
  font-size: 0.9rem;
  color: inherit;
}

.transpose-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  grid-column: 1;
}

.scale-mode-buttons {
  display: flex;
  gap: 4px;
  grid-column: 1 / -1;
}

.transpose-buttons .tbtn {
  min-width: 72px;
  min-height: 43px;
  padding: 0 9px;
  font-size: 1.44rem;
  line-height: 1;
}

.chord-root-controls {
  display: flex;
  align-items: start;
  gap: 10px;
  margin-bottom: 12px;
}

.chord-root-label {
  padding-top: 6px;
  opacity: 0.8;
  font-size: 0.82rem;
}

.chord-root-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.tbtn,
.root-btn,
.mode-btn,
.chord-btn,
.chord7-btn {
  padding: 4px 10px;
  border-radius: 9999px;
  border: 1px solid #a07040;
  background: linear-gradient(180deg, #6b3f23 0%, #3f2414 100%);
  color: #f3e7d7;
  cursor: pointer;
  user-select: none;
  transition:
    background 0.1s ease,
    border-color 0.1s ease,
    transform 0.06s ease,
    box-shadow 0.1s ease;
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 180, 0.25),
    0 6px 12px rgba(0, 0, 0, 0.6);
  font-size: 0.8rem;
}

.tbtn:hover,
.root-btn:hover,
.mode-btn:hover,
.chord-btn:hover,
.chord7-btn:hover {
  background: linear-gradient(180deg, #7d4a2a 0%, #4a2b18 100%);
  border-color: #c08a55;
  box-shadow:
    inset 0 1px 0 rgba(255, 220, 180, 0.35),
    0 8px 16px rgba(0, 0, 0, 0.65);
}

.tbtn:active,
.root-btn:active,
.mode-btn:active,
.chord-btn:active,
.chord7-btn:active {
  transform: translateY(2px) scale(0.97);
  filter: brightness(1.1);
}

.tbtn.active,
.root-btn.active,
.mode-btn.active {
  background: linear-gradient(180deg, #b0733c 0%, #7a4422 100%);
  border-color: #f0c08a;
  color: #2a1b12;
  box-shadow:
    inset 0 2px 4px rgba(0, 0, 0, 0.35),
    0 0 0 2px rgba(240, 192, 138, 0.5),
    0 10px 20px rgba(0, 0, 0, 0.6);
}

.root-btn {
  min-width: 44px;
}

.scale-mode-buttons {
  display: flex;
  align-items: center;
  gap: 0;
}

.scale-mode-buttons .mode-btn {
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: rgba(243, 231, 215, 0.65);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.2;
  position: relative;
}

.scale-mode-buttons .mode-btn + .mode-btn {
  margin-left: 14px;
}

.scale-mode-buttons .mode-btn + .mode-btn::before {
  content: "/";
  position: absolute;
  left: -10px;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(243, 231, 215, 0.45);
  font-weight: 600;
  pointer-events: none;
}

.scale-mode-buttons .mode-btn:hover {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: rgba(243, 231, 215, 0.85);
  text-shadow: 0 0 5px rgba(255, 255, 255, 0.18);
}

.scale-mode-buttons .mode-btn:active {
  transform: none;
  filter: none;
}

.scale-mode-buttons .mode-btn.active {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  color: #f0c08a;
  text-decoration: underline;
  text-underline-offset: 0.16em;
}

/* =========================
   Chord section
   ========================= */

.section-title {
  width: 100%;
  font-size: 1.18rem;
  font-weight: 700;
  color: #f0d9be;
  opacity: 0.95;
  margin: 0;
  text-align: center;
}

.chord-section-head {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(75, 85, 99, 0.6);
}

.chord-section-left {
  min-width: 0;
  display: flex;
  justify-content: flex-end;
}

.chord-section-toggle {
  width: 24px;
  min-width: 24px;
  justify-content: flex-start;
  gap: 0;
  padding: 0;
}

.chord-section-toggle .panel-toggle-icon {
  position: static;
}

.chord-section-title {
  width: auto;
  white-space: nowrap;
}

.chord-title-play-btn {
  border: 1px solid rgba(255, 220, 180, 0.26);
  background: linear-gradient(
    180deg,
    rgba(125, 74, 42, 0.95) 0%,
    rgba(74, 43, 24, 0.95) 100%
  );
  color: #ffe8cd;
  padding: 8px 14px;
  border-radius: 9999px;
  cursor: pointer;
  justify-self: center;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow:
    inset 0 1px 0 rgba(255, 226, 190, 0.36),
    0 8px 16px rgba(0, 0, 0, 0.38);
  transition:
    transform 0.08s ease,
    filter 0.12s ease,
    box-shadow 0.12s ease,
    background 0.12s ease;
}

.chord-title-play-btn:hover:not(:disabled) {
  filter: brightness(1.07);
  box-shadow:
    inset 0 1px 0 rgba(255, 232, 198, 0.42),
    0 10px 20px rgba(0, 0, 0, 0.44);
}

.chord-title-play-btn.active {
  background: linear-gradient(
    180deg,
    rgba(240, 192, 138, 0.98) 0%,
    rgba(207, 141, 77, 0.98) 100%
  );
  color: #2a1b12;
  border-color: rgba(255, 221, 175, 0.9);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 10px 22px rgba(240, 192, 138, 0.28);
}

.chord-title-play-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.chord-title-play-btn:active:not(:disabled) {
  transform: translateY(1px) scale(0.99);
}

.chord-title-play-icon {
  font-size: 0.76em;
  line-height: 1;
  opacity: 0.92;
}

.chord-section-tools {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  min-height: 32px;
}

.chord-current-name {
  min-width: 2.5em;
  font-size: 1.5rem;
  font-weight: 800;
  color: #f3e7d7;
  text-align: right;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.chord-tool-btn {
  width: 34px;
  height: 34px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.18);
  color: inherit;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  user-select: none;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1;
}

.chord-tool-btn:hover {
  filter: brightness(1.06);
}

.chord-tool-btn:active {
  transform: translateY(1px) scale(0.99);
}

.chord-tool-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.material-symbols-outlined {
  font-family: "Material Symbols Outlined";
  font-variation-settings:
    "FILL" 0,
    "wght" 400,
    "GRAD" 0,
    "opsz" 24;
  font-feature-settings: "liga";
  font-weight: normal;
  font-style: normal;
  font-size: 20px;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  display: inline-block;
  white-space: nowrap;
  word-wrap: normal;
  direction: ltr;
  -webkit-font-smoothing: antialiased;
}

.arp-icon-btn {
  font-size: 0.92rem;
  padding-left: 2px;
}

.chord-bpm-ctrl {
  flex: 0 0 auto;
}

.chord-section .panel-content {
  margin-top: 10px;
}

.chord-section .note-chip-row {
  margin-bottom: 12px;
}

.chord-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  width: 100%;
}

.chord-col {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

/* 幅を一致 */
.chord-btn,
.chord7-btn {
  width: 100%;
  padding: 5px 12px; /* chord系は少しだけ広め */
}

.chord-name-triad,
.chord-name-7 {
  font-size: 0.7rem;
  color: #e5e7eb;
  opacity: 0.45;
  text-align: center;
  user-select: none;
  pointer-events: none;
  line-height: 1;
}

/* =========================
   Ref piano (fixed labels)
   ========================= */

.ref-piano-title {
  font-size: 0.9rem;
  color: #f0d9be;
  opacity: 0.9;
  margin-bottom: 10px;
  text-align: left;
}

.ref-piano-inner {
  width: 100%;
  height: 96px;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 2px;
  background: #2f1d14;
}

.ref-white-key-wrap {
  flex: 1;
  min-width: 18px;
  position: relative;
  margin: 0 1px;
}

.ref-key {
  width: 100%;
  height: 100%;
  border-radius: 0 0 12px 12px;
  user-select: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 4px;
  box-sizing: border-box;

  /* 通常時はグレー */
  opacity: 0.55;
  filter: brightness(0.85);
}

.ref-key span {
  font-size: 0.56rem;
  font-weight: 600;
  opacity: 0.85;
  line-height: 1.02;
  text-align: center;
  white-space: nowrap;
}

/* 白鍵（通常） */
.ref-white {
  background: #e5e7eb;
  border: none;
  box-shadow: none;
  color: #111827;
}

/* 黒鍵（通常） */
.ref-black {
  position: absolute;
  top: 0;
  right: -20%;
  width: 60%;
  height: 60%;
  border-radius: 0 0 8px 8px;
  background: #111827;
  border: none;
  box-shadow: none;
  color: #e5e7eb;
  z-index: 5;
  padding-bottom: 3px;

  opacity: 0.65;
  filter: brightness(0.9);
}

/* 点灯・保持（共通） */
.ref-key.ref-active,
.ref-key.ref-held {
  opacity: 1;
  filter: brightness(1.25);
  transform: translateY(2px) scale(0.99);
}

/* 白鍵が赤く光る */
.ref-white.ref-active,
.ref-white.ref-held {
  background: #fecaca;
  color: #7f1d1d;
}

/* 黒鍵が赤く光る */
.ref-black.ref-active,
.ref-black.ref-held {
  background: #ef4444;
}

/* =========================
   Left side panels
   ========================= */

.instrument-panel {
  width: 100%;
  border-radius: 10px;
  padding: 12px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.instrument-panel,
.ethnic-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-toggle {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  cursor: pointer;
  text-align: left;
}

.panel-toggle:hover {
  filter: brightness(1.06);
}

.panel-toggle-icon {
  order: -1;
  font-size: 0.9rem;
  opacity: 0.78;
  transition: transform 0.16s ease;
}

.panel-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.panel-content[hidden] {
  display: none;
}

.is-collapsed .panel-toggle-icon {
  transform: rotate(-90deg);
}

.panel-title {
  font-size: 0.9rem;
  font-weight: 700;
  opacity: 0.9;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* instrument */
.instrument-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.inst-btn {
  padding: 8px 10px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.18);
  color: inherit;
  cursor: pointer;
  user-select: none;
}

.inst-btn:hover {
  filter: brightness(1.06);
}

.inst-btn.active {
  border-color: rgba(255, 255, 255, 0.32);
  background: rgba(255, 255, 255, 0.14);
}

/* duration */
.duration-panel {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.duration-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}

.duration-value {
  font-size: 0.85rem;
  opacity: 0.85;
  font-variant-numeric: tabular-nums;
}

#durationSlider {
  width: 100%;
  accent-color: rgba(240, 192, 138, 0.9);
}

/* bpm */
.bpm-ctrl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  position: relative;
}

.bpm-display {
  height: 26px;
  padding: 0 10px;
  border: none;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;

  cursor: ns-resize;
  user-select: none;
}

.bpm-num {
  font-size: 0.85rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
}

.bpm-unit {
  font-size: 0.7rem;
  opacity: 0.7;
  font-weight: 800;
}

.bpm-inline-input {
  width: 48px;
  background: transparent;
  border: none;
  color: inherit;
  font-weight: 900;
  font-size: 0.85rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
  outline: none;
  cursor: text;
}

.bpm-inline-input:focus {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 6px;
}

.chord-section-tools .bpm-display {
  height: 34px;
  padding: 0 12px;
}

/* note chips */
.last-chord-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 10px;
}

.last-chord-label {
  font-size: 0.9rem;
  font-weight: 700;
  opacity: 0.9;
}

.note-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.note-chip {
  padding: 6px 10px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
}

/* narrow */
@media (max-width: 520px) {
  .chord-section-head {
    grid-template-columns: auto 1fr;
    align-items: stretch;
    gap: 12px;
    padding-bottom: 0;
    border-bottom: 0;
  }

  .chord-section-left {
    justify-content: flex-end;
    grid-column: 2;
    grid-row: 1;
  }

  .chord-section-title {
    grid-column: 2;
    grid-row: 2;
    text-align: left;
  }

  .chord-section-toggle {
    width: 24px;
    justify-content: flex-start;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(75, 85, 99, 0.6);
    grid-column: 1;
    grid-row: 1 / span 3;
    align-self: start;
  }

  .chord-section-tools {
    justify-content: flex-start;
    flex-wrap: wrap;
    padding-bottom: 0;
    grid-column: 2;
    grid-row: 3;
  }
}

/* =========================
   UI Lock (start overlay)
   ========================= */

.ui-lock {
  position: fixed;
  inset: 0;
  background: rgba(42, 27, 18, 0.65);
  backdrop-filter: blur(2px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ui-lock-card {
  width: min(520px, 90vw);
  border-radius: 14px;
  padding: 16px 18px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.55);
  text-align: center;
}

/* 開始カード（半透明パネル風） */
.start-card {
  padding: 36px 52px;
  border-radius: 18px;
  cursor: pointer;
  user-select: none;

  background: rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(2px);
  color: #f3e7d7;
  border: 1px solid rgba(255, 255, 255, 0.12);

  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.6);

  transition:
    transform 0.08s ease,
    filter 0.08s ease,
    box-shadow 0.08s ease,
    background 0.08s ease;
}

.start-card-title {
  font-size: 2rem;
  font-weight: 900;
  letter-spacing: 0.15em;
}

.start-card-subtitle {
  margin-top: 10px;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  opacity: 0.78;
}

.start-card:hover {
  background: rgba(255, 255, 255, 0.1);
  filter: brightness(1.05);
}

.start-card:active {
  transform: translateY(3px) scale(0.98);
  background: rgba(0, 0, 0, 0.35);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.65);
}

.settings-modal[hidden] {
  display: none;
}

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 1500;
  display: grid;
  place-items: center;
}

.settings-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}

.settings-card {
  position: relative;
  width: min(520px, calc(100vw - 24px));
  border-radius: 14px;
  padding: 16px;
  box-sizing: border-box;
  background: linear-gradient(180deg, #3a2418 0%, #2b1a12 100%);
  border: 1px solid rgba(255, 220, 180, 0.15);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.62);
}

.settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 12px;
}

.settings-head-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.settings-head h2 {
  margin: 0;
  font-size: 1.05rem;
}

.settings-close {
  width: 30px;
  height: 30px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.2);
  color: inherit;
  cursor: pointer;
}

.settings-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.settings-label {
  font-size: 0.84rem;
  font-weight: 700;
  color: #f0d9be;
}

.settings-select,
#volumeSlider {
  width: 100%;
}

.settings-select {
  height: 34px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.25);
  color: inherit;
  padding: 0 10px;
}

.settings-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.settings-value {
  width: 54px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  opacity: 0.9;
}

.settings-action-btn {
  height: 34px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: inherit;
  cursor: pointer;
  font-weight: 700;
  padding: 0 12px;
}

.settings-head-action {
  height: 30px;
  font-size: 0.72rem;
  white-space: nowrap;
}

.settings-credits {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.settings-credit-line {
  font-size: 0.78rem;
  color: #d8c0aa;
}

.settings-credit-line + .settings-credit-line {
  margin-top: 6px;
}

.settings-status {
  min-height: 1.2em;
  margin-top: 4px;
  font-size: 0.8rem;
  color: #f0c08a;
}

/* =========================
   Footer
   ========================= */

footer {
  margin-top: auto;
}

.footer {
  margin-top: 4px;
  font-size: 0.75rem;
  color: rgba(243, 231, 215, 0.55);
  text-align: left;
}

footer a {
  color: rgba(243, 231, 215, 0.7) !important;
}

/* =========================
   Theory Panel (right side)
   ========================= */

.theory-panel {
  width: 100%;
  border-radius: 10px;
  padding: 12px;
  box-sizing: border-box;
  background: transparent;
  border: none;
}

.fifths-panel {
  width: 100%;
  margin-top: 0;
  border-radius: 10px;
  padding: 0;
  box-sizing: border-box;
  background: transparent;
  border: none;
}

.theory-fifths-panel {
  width: 100%;
  border-radius: 10px;
  padding: 12px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.theory-fifths-panel .panel-content {
  margin-top: 8px;
  gap: 8px;
}

.progression-panel {
  width: 100%;
  margin-top: 14px;
  border-radius: 10px;
  padding: 12px;
  box-sizing: border-box;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0.1)),
    radial-gradient(
      circle at top left,
      rgba(240, 192, 138, 0.08),
      transparent 45%
    );
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.progression-panel.is-collapsed {
  margin-top: 0;
}

.progression-subtitle {
  font-size: 0.76rem;
  line-height: 1.5;
  color: rgba(243, 231, 215, 0.72);
}

.progression-current {
  margin-top: 12px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(240, 192, 138, 0.12);
}

.progression-current-label,
.progression-block-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #f0c08a;
}

.progression-current-name {
  margin-top: 6px;
  font-size: 1.18rem;
  font-weight: 800;
  color: #fff6ea;
}

.progression-current-hint {
  margin-top: 6px;
  font-size: 0.8rem;
  line-height: 1.6;
  color: rgba(243, 231, 215, 0.78);
}

.progression-block {
  margin-top: 14px;
}

.progression-next-list,
.progression-preset-steps {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.progression-next-btn,
.progression-step-btn {
  border: 1px solid rgba(240, 192, 138, 0.18);
  color: #f3e7d7;
  cursor: pointer;
  transition:
    transform 0.08s ease,
    border-color 0.12s ease,
    filter 0.12s ease,
    box-shadow 0.12s ease;
}

.progression-next-btn:hover,
.progression-step-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(240, 192, 138, 0.45);
  filter: brightness(1.04);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.2);
}

.progression-next-btn:active,
.progression-step-btn:active {
  transform: translateY(2px) scale(0.985);
}

.progression-next-btn {
  width: 100%;
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(
    180deg,
    rgba(111, 64, 37, 0.85),
    rgba(55, 31, 18, 0.95)
  );
  text-align: left;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 10px;
  align-items: center;
}

.progression-next-degree {
  grid-row: 1 / span 2;
  font-size: 0.76rem;
  font-weight: 800;
  color: #2a1b12;
  background: linear-gradient(180deg, #f0c08a, #cf8d4d);
  padding: 6px 9px;
  border-radius: 999px;
}

.progression-next-name {
  font-size: 0.96rem;
  font-weight: 700;
  color: #fff6ea;
}

.progression-next-reason {
  font-size: 0.76rem;
  color: rgba(243, 231, 215, 0.72);
}

.progression-presets {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.progression-preset-card {
  padding: 10px 12px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.progression-preset-head {
  margin-bottom: 8px;
}

.progression-preset-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: #f7dfc2;
}

.progression-preset-hint {
  margin-top: 3px;
  font-size: 0.74rem;
  line-height: 1.5;
  color: rgba(243, 231, 215, 0.68);
}

.progression-step-btn {
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.16);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.progression-step-degree {
  font-size: 0.72rem;
  font-weight: 800;
  color: #f0c08a;
}

.progression-step-name {
  font-size: 0.8rem;
  font-weight: 600;
}

.theory-wheel {
  margin-top: 10px;
  width: 100%;
  max-width: 320px; /* 右パネル内での最大サイズ */
  aspect-ratio: 1 / 1; /* 正方形を維持 */
  margin-left: auto;
  margin-right: auto;
  cursor: default;
}

.theory-wheel svg {
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0.84;
  filter: grayscale(0.22) brightness(0.88);
  pointer-events: none;
}

.circle-of-fifths {
  margin-top: 0;
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1 / 1;
  margin-left: auto;
  margin-right: auto;
  cursor: default;
}

.circle-of-fifths svg {
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0.84;
  filter: grayscale(0.22) brightness(0.88);
  pointer-events: none;
}

.fifths-seg {
  stroke: rgba(255, 255, 255, 0.78);
  stroke-width: 3;
  transition:
    fill 0.15s ease,
    stroke 0.15s ease,
    filter 0.15s ease;
  opacity: 0.74;
}

.fifths-seg-major {
  fill: url(#fifthsSegWhite);
  opacity: 0.72;
}

.fifths-seg-minor {
  fill: url(#fifthsSegWhite);
  opacity: 0.45;
}

.fifths-text {
  letter-spacing: 0.01em;
  font-weight: 800;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
  opacity: 0.8;
}

.fifths-text-major {
  fill: #374151;
  font-size: 16px;
}

.fifths-text-minor {
  fill: #374151;
  font-size: 16px;
}

.fifths-text-major.is-long {
  font-size: 16px;
}

.fifths-text-minor.is-long {
  font-size: 16px;
}

.fifths-center {
  fill: rgba(42, 27, 18, 0.78);
  stroke: rgba(255, 255, 255, 0.24);
  stroke-width: 1.8;
}

.fifths-center-text {
  fill: rgba(243, 231, 215, 0.74);
  font-weight: 900;
  font-size: 17px;
  text-anchor: middle;
  dominant-baseline: middle;
  pointer-events: none;
}

.fifths-item.is-major-root .fifths-seg-major {
  fill: rgba(245, 158, 11, 0.58);
  stroke: rgba(245, 158, 11, 0.95);
  filter: drop-shadow(0 0 5px rgba(245, 158, 11, 0.45));
}

.fifths-item.is-minor-root .fifths-seg-minor {
  fill: rgba(56, 189, 248, 0.5);
  stroke: rgba(56, 189, 248, 0.92);
  filter: drop-shadow(0 0 5px rgba(56, 189, 248, 0.45));
}

.fifths-item.is-minor-root .fifths-text-minor {
  fill: rgba(248, 250, 252, 0.96);
  opacity: 1;
  text-shadow:
    0 0 5px rgba(56, 189, 248, 0.55),
    0 0 2px rgba(255, 255, 255, 0.45);
}

/* ドーナツの各セグメント */
.wheel-seg {
  fill: rgba(0, 0, 0, 0.22);
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 3;
}

/* 中抜きリング（外枠＆内枠っぽさを出す） */
.wheel-ring {
  fill: none;
  stroke: rgba(255, 255, 255, 0.95);
  stroke-width: 6;
}

/* ドーナツの各セグメント */
.wheel-seg {
  fill: url(#segBlack);
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 3;
  opacity: 0.72;
}

.wheel-seg.is-scale {
  fill: url(#segWhite);
}

/* ===== スケール外（黒鍵側） ===== */
.wheel-text {
  fill: rgba(229, 231, 235, 0.55); /* 少し薄く */
  font-weight: 600;
  font-size: 16px; /* 小さめ */
  letter-spacing: 0.02em;
  text-anchor: middle;
  dominant-baseline: middle;
  transition: all 0.15s ease;
  opacity: 0.76;
}

/* ===== スケール内（白鍵側） ===== */
.wheel-text.is-scale {
  fill: #374151; /* はっきり */
  font-weight: 900;
  font-size: 20px; /* 大きめ */
}

.wheel-seg.wheel-active,
.wheel-seg.wheel-held {
  fill: #ef4444;
  stroke: rgba(239, 68, 68, 0.95);
  opacity: 1;
  filter: drop-shadow(0 0 8px rgba(239, 68, 68, 0.55));
}

.wheel-text.wheel-active,
.wheel-text.wheel-held {
  fill: #fee2e2;
  font-weight: 900;
  opacity: 1;
  text-shadow:
    0 0 6px rgba(239, 68, 68, 0.65),
    0 0 2px rgba(255, 255, 255, 0.55);
}

/* 中央のコード名（背景ウォーターマーク風） */
.wheel-center-text {
  fill: rgba(243, 231, 215, 0.18); /* かなり薄く */
  font-weight: 900;
  font-size: 42px; /* 少し大きめで存在感は残す */
  letter-spacing: 0.08em;
  dominant-baseline: middle;
  text-anchor: middle;
  pointer-events: none;

  /* くっきりさせず、溶け込ませる */
  filter: blur(0.3px);

  /* 縁取りは消す（目立つ原因） */
  stroke: none;
}

/* ルート音マーク */
.wheel-root-star {
  font-size: 15px;
  font-weight: 900;
  dominant-baseline: middle;
  text-anchor: middle;
  pointer-events: none;
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.6));
}

/* =========================
   Ethnic Panel (left bottom)
   ========================= */

.side-panel.left {
  display: flex;
  flex-direction: column;
}

.ethnic-panel {
  margin-top: auto; /* 左パネル内で下に寄せる */
  width: 100%;
  border-radius: 10px;
  padding: 12px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ethnic-panel .panel-title {
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.02em;
  opacity: 0.9;
}

.ethnic-panel-body {
  margin-top: 10px;
  min-height: 80px;
}

/* =========================
   Ethnic Scale Panel (left-bottom)
   ========================= */

.ethnic-panel {
  width: 100%;
  border-radius: 10px;
  padding: 12px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ethnic-panel .panel-title {
  font-weight: 900;
  letter-spacing: 0.02em;
  font-size: 16px;
}

.panel-actions {
  display: flex;
  justify-content: flex-start;
}

.ethnic-panel .panel-sub {
  margin: 6px 0 12px;
  font-size: 12px;
  opacity: 0.75;
  line-height: 1.4;
}

.scale-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.section-icon {
  font-size: 16px;
  line-height: 1;
}

.section-title {
  font-weight: 800;
  font-size: 13px;
  opacity: 0.9;
}

.scale-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

/* ピル型ボタン */
.scale-btn {
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 8px;

  padding: 10px 10px;
  border-radius: 999px;

  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: inherit;

  cursor: pointer;
  user-select: none;

  transition:
    transform 0.08s ease,
    background 0.12s ease,
    border-color 0.12s ease,
    box-shadow 0.12s ease;
}

.scale-btn .emoji {
  font-size: 16px;
  line-height: 1;
}

.scale-btn .label {
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.scale-btn .tag {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.1);
  opacity: 0.95;
}

.scale-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.2);
}

.scale-btn:active {
  transform: translateY(1px);
}

/* いずれ「選択中」にする用（UIだけ先に用意） */
.scale-btn.is-active {
  background: rgba(240, 192, 138, 0.18);
  border-color: rgba(240, 192, 138, 0.55);
  box-shadow: 0 0 0 2px rgba(240, 192, 138, 0.15) inset;
}

.scale-btn.is-active .tag {
  background: rgba(240, 192, 138, 0.16);
  border-color: rgba(240, 192, 138, 0.3);
}

.ethnic-tooltip {
  position: fixed;
  z-index: 9999;
  pointer-events: none;
  max-width: 280px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(10, 10, 10, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.92);
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: translateY(6px);
  transition:
    opacity 0.12s ease,
    transform 0.12s ease;
}

.ethnic-tooltip.is-show {
  opacity: 1;
  transform: translateY(0);
}

.ethnic-tooltip .tt-title {
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 6px;
}

.ethnic-tooltip .tt-row {
  margin-top: 4px;
  opacity: 0.92;
}

.ethnic-tooltip .tt-muted {
  opacity: 0.75;
}

.key.is-disabled {
  opacity: 0.22; /* 透明度アップ */
  pointer-events: none; /* マウスで押せない */
  filter: grayscale(0.2);
}

.wheel-seg.is-disabled {
  opacity: 0.35;
}

.wheel-text.is-disabled {
  opacity: 0.35;
}

.ethnic-tooltip {
  max-width: min(280px, calc(100vw - 20px));
}

/* =========================
   Ethnic filter chips
   ========================= */

.scale-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 6px;
}

.filter-btn {
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  cursor: pointer;
  user-select: none;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.01em;
  transition:
    background 0.12s ease,
    border-color 0.12s ease,
    transform 0.08s ease;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
}

.filter-btn:active {
  transform: translateY(1px);
}

.filter-btn.is-active {
  background: rgba(240, 192, 138, 0.18);
  border-color: rgba(240, 192, 138, 0.55);
  box-shadow: 0 0 0 2px rgba(240, 192, 138, 0.15) inset;
}

/* =========================
   Ethnic title + reset button
   ========================= */

.scale-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.scale-title-text {
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 0.02em;
}

/* 解除ボタンは少しコンパクトに */
.scale-reset-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;

  width: auto;
  padding: 6px 10px;
}

.scale-reset-btn .label {
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}

.scale-reset-btn .tag {
  font-size: 10px;
  padding: 2px 6px;
}

/* =========================
   Flat button theme (global)
   ========================= */

button:not(.key):not(.ref-key):not(.panel-toggle),
.octave-dot {
  border: none !important;
  box-shadow: none !important;
  text-shadow: none !important;
  background: #4b2e1f !important;
  color: #f3e7d7 !important;
}

button:not(.key):not(.ref-key):not(.panel-toggle):hover,
.octave-dot:hover {
  border: none !important;
  box-shadow: none !important;
  background: #5a3624 !important;
}

button:not(.key):not(.ref-key):not(.panel-toggle):active,
button:not(.key):not(.ref-key):not(.panel-toggle).active,
button:not(.key):not(.ref-key):not(.panel-toggle).is-active,
button:not(.key):not(.ref-key):not(.panel-toggle)[aria-expanded="true"],
.octave-dot:active,
.octave-dot.is-active {
  border: none !important;
  box-shadow: none !important;
  background: #6a432d !important;
  color: #fff3e2 !important;
}

button:not(.key):not(.ref-key):not(.panel-toggle):disabled {
  border: none !important;
  box-shadow: none !important;
  background: #3a2418 !important;
  color: rgba(243, 231, 215, 0.55) !important;
}

/* =========================
   Flat panel theme (global)
   ========================= */

.instrument-panel,
.ethnic-panel,
.chord-section,
.keyboard-guide-panel,
.ref-piano,
.theory-panel,
.fifths-panel,
.theory-fifths-panel,
.progression-panel,
.settings-card {
  background: #2f1d14 !important;
  border: none !important;
  box-shadow: none !important;
}

.panel-toggle,
.panel-toggle:hover,
.panel-toggle:active,
.panel-toggle.is-active,
.panel-toggle[aria-expanded="true"] {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* octave-dots accent */
.octave-dot {
  background: #5a3624 !important;
}

.octave-dot:hover {
  background: #7a4a31 !important;
}

.octave-dot.is-active,
.octave-dot:active {
  background: #ffb000 !important;
  color: #2a1b12 !important;
}
